source: pkg/viola/main/base-files/trunk/debian/postinst @ 4203

Revision 4203, 4.0 KB checked in by alanbach-guest, 6 years ago (diff)
  • Merged updates from Debian 4.0.5
    • Prepare for Viola r2
Line 
1#!/bin/sh
2set -e
3
4install_local_dir() {
5  if [ ! -d $1 ]; then
6    mkdir -p $1
7  fi
8  chown root:staff $1 2> /dev/null || true
9  chmod 2775 $1 2> /dev/null || true
10}
11
12install_from_default() {
13  if [ ! -f $2 ]; then
14    cp -p $1 $2
15  fi
16}
17
18install_directory() {
19  if [ ! -d /$1 ]; then
20    mkdir /$1
21    chown root:$3 /$1
22    chmod $2 /$1
23  fi
24}
25
26preserve_directory() {
27  if [ -f /etc/base-files.create-$1 ]; then
28    install_directory $1 755 root
29    rm -f /etc/base-files.create-$1
30  fi
31}
32
33if [ "$1" = "configure" ] && [ "$2" = "" ]; then
34  install_from_default /usr/share/base-files/nsswitch.conf /etc/nsswitch.conf
35  install_from_default /usr/share/base-files/dot.profile   /root/.profile
36  install_from_default /usr/share/base-files/dot.bashrc    /root/.bashrc
37  install_from_default /usr/share/base-files/profile       /etc/profile
38  install_from_default /usr/share/base-files/motd          /etc/motd
39  install_directory srv       755 root
40  install_directory opt       755 root
41  install_directory etc/opt   755 root
42  install_directory var/opt   755 root
43  install_directory media     755 root
44  install_directory var/mail 2775 mail
45  if [ ! -L /var/spool/mail ]; then
46    ln -s ../mail /var/spool/mail
47  fi
48
49  install_local_dir /usr/local
50  install_local_dir /usr/local/share
51  install_local_dir /usr/local/share/man
52  install_local_dir /usr/local/bin
53  install_local_dir /usr/local/games
54  install_local_dir /usr/local/lib
55  install_local_dir /usr/local/include
56  install_local_dir /usr/local/sbin
57  install_local_dir /usr/local/src
58  install_local_dir /usr/local/etc
59  ln -sf share/man /usr/local/man
60fi
61
62if [ "$1" = "configure" ] && [ "$2" != "" ]; then
63  if [ ! -d /var/spool/mail ] && [ ! -L /var/spool/mail ]; then
64    if [ -f /etc/base-files.mailsymlink ]; then
65      ln -sf `cat /etc/base-files.mailsymlink` /var/spool/mail
66    else
67      install_directory var/spool/mail 2775 mail
68    fi
69  fi
70  if [ ! -L /var/mail ] && [ ! -d /var/mail ]; then
71    ln -sf spool/mail /var/mail
72  fi
73fi
74
75preserve_directory floppy
76preserve_directory cdrom
77preserve_directory initrd
78
79if [ ! -f /etc/adjtime ]; then
80  echo "0.000000 1217000000 0.000000" > /etc/adjtime
81  echo "1217000000" >> /etc/adjtime
82  echo "UTC" >> /etc/adjtime
83  chmod 644 /etc/adjtime
84fi
85
86if [ ! -f /var/run/utmp ]; then
87  echo -n>/var/run/utmp
88fi
89if [ ! -f /var/log/wtmp ]; then
90  echo -n>/var/log/wtmp
91fi
92if [ ! -f /var/log/btmp ]; then
93  echo -n>/var/log/btmp
94fi
95if [ ! -f /var/log/lastlog ]; then
96  echo -n>/var/log/lastlog
97fi
98chown root:utmp /var/run/utmp /var/log/wtmp /var/log/btmp /var/log/lastlog
99chmod 664 /var/run/utmp /var/log/wtmp /var/log/btmp /var/log/lastlog
100
101if [ ! -d /var/lib/dpkg ]; then
102  mkdir -m 755 -p /var/lib/dpkg
103  chown root:root /var/lib/dpkg
104fi
105if [ ! -f /var/lib/dpkg/status ]; then
106  echo > /var/lib/dpkg/status
107  chmod 644 /var/lib/dpkg/status
108  chown root:root /var/lib/dpkg/status
109fi
110
111if [ ! -f /usr/info/dir ] && [ ! -f /usr/share/info/dir ]; then
112  install_from_default /usr/share/base-files/info.dir /usr/share/info/dir
113  chmod 644 /usr/share/info/dir
114  chown root:root /usr/share/info/dir
115fi
116rm -f /etc/base-files.mailsymlink
117
118if [ "$1" = "configure" ] && [ "$2" != "" ]; then
119  if [ -f /etc/motd ]; then
120    oldmd=`awk 'NR > 2' /etc/motd | md5sum | awk '{print $1}'`
121    newmd=`awk 'NR > 2' /usr/share/base-files/motd | md5sum | awk '{print $1}'`
122    if [ "$oldmd" != "$newmd" ]; then
123      if grep -q "$oldmd" /usr/share/base-files/motd.md5sums; then
124        awk 'NR <= 2' /etc/motd > /etc/motd.new
125        awk 'NR > 2' /usr/share/base-files/motd >> /etc/motd.new
126        mv /etc/motd /etc/motd.old
127        mv /etc/motd.new /etc/motd
128      fi
129    fi
130  fi
131fi
132
133if [ -f /var/lib/dpkg/info/base.list ]; then
134  :> /var/lib/dpkg/info/base.list
135  rm -f /var/lib/dpkg/info/base.conffiles
136  echo
137  echo "Note: You have the old \`base' package installed"
138  echo "It is very important that you do not try to remove this package"
139  echo "using dpkg. Please read /usr/share/doc/base-files/README.base to"
140  echo "get rid of the \`base' package completely in a safe way."
141  echo
142  echo -n "Press <Return> to continue "
143  read dummy
144fi
Note: See TracBrowser for help on using the repository browser.