X-Git-Url: https://piware.de/gitweb/?a=blobdiff_plain;f=postinst-setup;h=780407750ca8d08a15e4578ccc5ddbb59477b0eb;hb=1df0cd5fcb955d051c2ad35510e18bc60897c7fd;hp=82de451b5b9e76a2129512cf71f8085e0056d76f;hpb=82165e1a1c024e48214423800c7bb822f817fb38;p=bin.git diff --git a/postinst-setup b/postinst-setup index 82de451..7804077 100755 --- a/postinst-setup +++ b/postinst-setup @@ -1,88 +1,99 @@ #!/bin/sh -e -# install already shipped debs -[ -e /mirror ] || ln -s /home/ubuntu-mirror /mirror -mount -o loop /home/martin/download/ubuntu/gutsy-alternate-amd64.iso /cdrom -apt-cdrom -m add -DEBIAN_FRONTEND=noninteractive apt-get -y install build-essential fakeroot devscripts mutt postfix openssh-server +# move backup to /var +if [ -d /home/martin/backup ] && [ ! -d /var/backups/martin ]; then + cp -a /home/martin/backup /var/backups/martin + rm -rf /home/martin/backup +fi -dpkg -i ~martin/download/afio*.deb || exit 1 +# install already shipped debs +UBUNTU_CD="/home/martin/download/ubuntu/`lsb_release -c`-alternate-`dpkg --print-architecture`.iso" +if [ -r "$UBUNTU_CD" ]; then + mount -o loop "$UBUNTU_CD" /cdrom + apt-cdrom -m add +fi +DEBIAN_FRONTEND=noninteractive apt-get -y install build-essential fakeroot devscripts postfix openssh-server bzr -# configuration files -mkdir -p /var/backups/pibackup/ -[ -e /home/full*.cpio ] && mv /home/full*.cpio /var/backups/pibackup/ || true +# root's ssh stuff +if [ ! -d /root/.ssh ] && [ -d /home/martin/.ssh ]; then + mkdir -p /root/.ssh + chmod 700 /root/.ssh + cp /home/martin/.ssh/id_dsa* /home/martin/.ssh/known_hosts /home/martin/.ssh/config /root/.ssh/ +fi -CURBACKUP=`ls -t /var/backups/pibackup/full* | head -n 1` -[ -e "$CURBACKUP" ] || { - echo no current full backup in /var/backups/pibackup - exit 1 -} -cd / -afio -iZ -y '/etc/*' -Y /etc/passwd -Y /etc/group -Y /etc/shadow -Y /etc/fstab $CURBACKUP +# restore /etc bzr branch, rescue the files we do not want to restore +# completely +cd /etc +if [ ! -d /etc/.bzr ]; then + for i in passwd group shadow fstab; do + [ -e $i.originst] || cp $i $i.originst + done + bzr get bzr+ssh://martin@piware.de/home/martin/backup/`hostname`-etc /backup-etc + cp -av /backup-etc/* /etc/ + cp -av /backup-etc/.bzr/ /etc/ + rm -rf /backup-etc + chmod 600 /etc/ssh/ssh_*_key +fi # only restore dchroot part into fstab -cd /tmp -afio -iZ -y /etc/fstab $CURBACKUP -grep -A 200 "^# dchroots" /tmp/etc/fstab >> /etc/fstab -rm -rf /tmp/etc - -newaliases -/etc/init.d/postfix restart - -# install users -cat <> /etc/passwd -joe:x:1001:1001:Joe User,,,:/home/joe:/bin/bash -netti:x:1002:1002:Annett Kittel,,,:/home/netti:/bin/bash -EOF -cat <> /etc/shadow -joe:$1$7t1pZTyL$lI7.B/9DtPa6y2BD8wTNZ/:13060:0:99999:7::: -netti:$1$5uq6X7u0$92yOfMH2Nh89Ui.hbaEDp/:12930:0:99999:7::: -EOF -cat <> /etc/group -joe:x:1001: -netti:x:1002: -EOF +grep -A 200 "^# dchroots" fstab >> fstab.originst || true +mv fstab.originst fstab -for g in cdrom audio video plugdev scanner; do - for u in joe netti; do - adduser $u $g - done +# only restore the human users from passwd/group +for i in passwd group; do + perl -naF: -e 'print if $F[2] > 1000 && $F[2] < 60000' $i >> $i.originst + mv $i.originst $i done -# root's ssh stuff -mkdir -p /root/.ssh -chmod 700 /root/.ssh -cp /home/martin/.ssh/id_dsa* /home/martin/.ssh/known_hosts /home/martin/.ssh/config /root/.ssh/ +# only restore some passwords from shadow +egrep 'martin|netti|joe' shadow >> shadow.originst +mv shadow.originst shadow + +# update postfix for new configuration +newaliases +/etc/init.d/postfix restart # copy apt cache if [ -d /home/aptcache ]; then find /home/aptcache/ -name "*.deb" -exec cp '{}' /var/cache/apt/archives/ \; + rm -rf /home/aptcache fi # other setup dpkg -i /home/martin/download/libdvdcss2_*deb || true locale-gen ru_RU ru_RU.UTF-8 -# cronjob goo -killall apt-get || true - # remove packages that we do not need -apt-get remove --purge -y --auto-remove network-manager hplip brltty bluez-cups gnome-accessibility-themes gnome-mag gnome-orca onboard tomboy ttf-arabeyes ttf-arphic-ukai ttf-arphic-uming ttf-baekmuk ttf-gentium ttf-indic-fonts ttf-kochi-gothic ttf-kochi-mincho ttf-lao ttf-malayalam-fonts ttf-mgopen ttf-thai-tlwg +killall apt-get || true # cronjob goo +apt-get purge -y --auto-remove hplip brltty bluez-cups gnome-accessibility-themes gnome-mag gnome-orca onboard tomboy ttf-arabeyes ttf-arphic-uming ttf-baekmuk ttf-gentium ttf-kochi-gothic ttf-kochi-mincho ttf-lao ttf-malayalam-fonts ttf-mgopen ttf-thai-tlwg || true rm /etc/rcS.d/*pcmcia* /etc/rcS.d/*ppp* -# restore our network -ifdown eth0 || true -ifup eth0 - # install packages from network sources +killall apt-get || true apt-get update -o Acquire::Http::No-Cache=true -DEBIAN_FRONTEND=noninteractive apt-get install -y --force-yes vim bzr bzrtools python-paramiko patchutils offlineimap wipe gnome-gpg diffstat dchroot gtimelog pibackup jigdo-file libtool devhelp python-doc manpages-dev gstreamer0.10-plugins-ugly gstreamer0.10-plugins-bad gstreamer0.10-plugins-bad-multiverse gstreamer0.10-plugins-ugly-multiverse gstreamer0.10-ffmpeg xchat debmirror dpatch wdiff dhcp3-server grep-dctrl ccache subversion listadmin quilt apache2 python-dev cryptsetup -apt-get -y build-dep postgresql-8.2 gnome-volume-manager hal cupsys apport +DEBIAN_FRONTEND=noninteractive apt-get install -y --force-yes vim bzrtools bzr-svn python-paramiko patchutils offlineimap wipe diffstat gtimelog jigdo-file libtool devhelp python-doc manpages-dev gstreamer0.10-plugins-ugly gstreamer0.10-plugins-bad gstreamer0.10-plugins-bad-multiverse gstreamer0.10-plugins-ugly-multiverse gstreamer0.10-ffmpeg weechat weechat-plugins weechat-scripts dpatch wdiff grep-dctrl ccache subversion listadmin quilt python-dev cryptsetup mutt editmoin lintian python-gtk2-doc fakechroot ubuntu-dev-tools dput gnome-blog +apt-get -y build-dep postgresql-8.3 gnome-volume-manager hal cupsys apport jockey + +if [ `hostname` = donald ]; then + DEBIAN_FRONTEND=noninteractive apt-get install -y --force-yes dchroot rsnapshot dhcp3-server apache2 ia32-libs easytag latex-beamer texlive-lang-german fakechroot +fi + +umount /cdrom || true # other setup -ln -s /mirror /var/www/mirror -ifdown eth1 -ifup eth1 -/etc/init.d/dhcp3-server restart +if [ `hostname` = "donald" ]; then + [ -e /mirror ] || ln -s /home/ubuntu-mirror /mirror + ln -s /mirror /var/www/mirror + ifdown eth1 + ifup eth1 + /etc/init.d/dhcp3-server restart + patch /usr/bin/gtimelog ~martin/archiv/gtimelog.wednesday.patch + + # crontabs + crontab -u martin - </dev/null +EOF +fi