File size: 5,664 Bytes
b0d8e8c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 |
#!/bin/sh
set -e
install_local_dir() {
if [ ! -d $1 ]; then
mkdir -p $1
fi
}
install_from_default() {
if [ ! -f $2 ]; then
cp -p /usr/share/base-files/$1 $2
fi
}
install_directory() {
if [ ! -d /$1 ]; then
mkdir /$1
chown root:$3 /$1
chmod $2 /$1
fi
}
migrate_directory() {
if [ ! -L $1 ]; then
rmdir $1
ln -s $2 $1
fi
}
update_to_current_default() {
if [ -f $2 ]; then
md5=`md5sum $2 | cut -f 1 -d " "`
if grep -q "$md5" /usr/share/base-files/$1.md5sums; then
if ! cmp -s /usr/share/base-files/$1 $2; then
cp -p /usr/share/base-files/$1 $2
echo Updating $2 to current default.
fi
fi
fi
}
if [ ! -e /etc/dpkg/origins/default ]; then
if [ -e /etc/dpkg/origins/ubuntu ]; then
ln -sf ubuntu /etc/dpkg/origins/default
fi
fi
if [ "$1" = "configure" ] && [ "$2" = "" ]; then
install_from_default dot.profile /root/.profile
install_from_default dot.bashrc /root/.bashrc
install_from_default profile /etc/profile
install_from_default networks /etc/networks
install_directory mnt 755 root
install_directory srv 755 root
install_directory opt 755 root
install_directory etc/opt 755 root
install_directory var/opt 755 root
install_directory media 755 root
install_directory var/mail 2775 mail
if [ ! -L /var/spool/mail ]; then
ln -s ../mail /var/spool/mail
fi
install_directory run/lock 1777 root
migrate_directory /var/run /run
migrate_directory /var/lock /run/lock
install_local_dir /usr/local
install_local_dir /usr/local/share
install_local_dir /usr/local/share/man
install_local_dir /usr/local/bin
install_local_dir /usr/local/games
install_local_dir /usr/local/lib
install_local_dir /usr/local/include
install_local_dir /usr/local/sbin
install_local_dir /usr/local/src
install_local_dir /usr/local/etc
ln -sf share/man /usr/local/man
if [ ! -f /var/log/wtmp ]; then
echo -n>/var/log/wtmp
fi
if [ ! -f /var/log/btmp ]; then
echo -n>/var/log/btmp
fi
if [ ! -f /var/log/lastlog ]; then
echo -n>/var/log/lastlog
fi
chown root:utmp /var/log/wtmp /var/log/btmp /var/log/lastlog
chmod 664 /var/log/wtmp /var/log/lastlog
chmod 660 /var/log/btmp
if [ ! -f /var/run/utmp ]; then
echo -n>/var/run/utmp
fi
chown root:utmp /var/run/utmp
chmod 664 /var/run/utmp
fi
if [ ! -d /var/lib/dpkg ]; then
mkdir -m 755 -p /var/lib/dpkg
fi
if [ ! -f /var/lib/dpkg/status ]; then
echo > /var/lib/dpkg/status
chmod 644 /var/lib/dpkg/status
fi
if [ ! -f /usr/info/dir ] && [ ! -f /usr/share/info/dir ]; then
install_from_default info.dir /usr/share/info/dir
chmod 644 /usr/share/info/dir
fi
if [ "$1" = "configure" ] && [ "$2" != "" ]; then
# If we're upgrading base-files, remove the upgrade-available flag
# maintained by update-manager, and rerun the release-upgrade check
# immediately (in the background) to update the flag.
rm -f /var/lib/update-notifier/release-upgrade-available
if [ -x /usr/lib/update-manager/check-new-release ]; then
/usr/lib/update-manager/check-new-release -q > /var/lib/update-notifier/release-upgrade-available &
fi
update_to_current_default profile /etc/profile
update_to_current_default dot.profile /root/.profile
if dpkg --compare-versions "$2" lt-nl "7.7"; then
install_directory mnt 755 root
fi
fi
# special case of having /etc/default/motd-news removed by hand
# signal the motd-news-config package that this happened, so that
# it does not put back the file with default contents which would
# re-enable motd-news
motd_news_config="/etc/default/motd-news"
if [ ! -e ${motd_news_config} ]; then
if [ ! -e ${motd_news_config}.dpkg-remove ]; then
if [ ! -e ${motd_news_config}.dpkg-backup ]; then
touch ${motd_news_config}.wasremoved
fi
fi
fi
# Automatically added by dh_systemd_enable/12.10ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
# This will only remove masks created by d-s-h on package removal.
deb-systemd-helper unmask 'motd-news.timer' >/dev/null || true
# was-enabled defaults to true, so new installations run enable.
if deb-systemd-helper --quiet was-enabled 'motd-news.timer'; then
# Enables the unit on first installation, creates new
# symlinks on upgrades if the unit file has changed.
deb-systemd-helper enable 'motd-news.timer' >/dev/null || true
else
# Update the statefile to add new symlinks (if any), which need to be
# cleaned up on purge. Also remove old symlinks.
deb-systemd-helper update-state 'motd-news.timer' >/dev/null || true
fi
fi
# End automatically added section
# Automatically added by dh_systemd_start/12.10ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
if [ -d /run/systemd/system ]; then
systemctl --system daemon-reload >/dev/null || true
deb-systemd-invoke start 'motd-news.timer' >/dev/null || true
fi
fi
# End automatically added section
# Automatically added by dh_systemd_start/12.10ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
if [ -d /run/systemd/system ]; then
systemctl --system daemon-reload >/dev/null || true
deb-systemd-invoke start 'motd-news.service' >/dev/null || true
fi
fi
# End automatically added section
# Automatically added by dh_installdeb/12.10ubuntu1
dpkg-maintscript-helper rm_conffile /etc/default/motd-news 11ubuntu5.2~ base-files -- "$@"
# End automatically added section
|