12345678910111213141516171819202122232425262728293031323334353637383940 |
- #!/bin/sh
-
- set -e
-
- DISTRIB_NAME=`lsb_release -is`
- DISTRIB_CODENAME=`lsb_release -cs`
-
- if [ $DISTRIB_NAME = "Ubuntu" ]; then
- echo "deb http://HOSTIP:3142/archive.ubuntu.com/ubuntu $DISTRIB_CODENAME main universe" > $1/etc/apt/sources.list
- echo "deb http://HOSTIP:3142/security.ubuntu.com/ubuntu $DISTRIB_CODENAME-security main universe" >> $1/etc/apt/sources.list
- echo "deb http://HOSTIP:3142/archive.ubuntu.com/ubuntu $DISTRIB_CODENAME-updates main universe" >> $1/etc/apt/sources.list
- elif [ $DISTRIB_NAME = "Debian" ]; then
- echo "deb http://HOSTIP:3142/ftp.debian.org/debian $DISTRIB_CODENAME main" > $1/etc/apt/sources.list
- echo "deb http://HOSTIP:3142/security.debian.org/ $DISTRIB_CODENAME/updates main" >> $1/etc/apt/sources.list
- echo "deb http://HOSTIP:3142/ftp.debian.org/debian $DISTRIB_CODENAME-updates main" >> $1/etc/apt/sources.list
- # grub-legacy conflicts grub-pc dependencies
- # No grub-legacy on Ubuntu, just on Debian
- # Work around bcron-run conflict due to cron being removed
- # Needed for KVM, but apparently errors out for LXC, so the true ignores the error
- apt-get purge -y grub-legacy bcron-run &> /dev/null || true
- fi
- echo '127.0.1.1 gitian' >> /etc/hosts
-
- # If LXC
- if grep /lxc/gitian /proc/1/cgroup > /dev/null; then
- adduser --disabled-password --gecos ${DISTRIB_NAME,,} --quiet ${DISTRIB_NAME,,} || true
- apt-get remove -y rsyslog || true
- dpkg-divert --local --rename --add /sbin/initctl
- ln -sf /bin/true /sbin/initctl
- dpkg-divert --local --rename --add /usr/bin/ischroot
- ln -sf /bin/true /usr/bin/ischroot
- # Prevent interaction with init during upgrades
- dpkg-divert --local --rename --add /usr/sbin/policy-rc.d
- echo 'exit 101' > /usr/sbin/policy-rc.d
- chmod +x /usr/sbin/policy-rc.d
- ## These are superceded by the policy-rc.d fix above
- # for pkg in lxc cgmanager udev plymouth dmsetup upstart; do
- # echo $pkg hold | dpkg --set-selections || true
- # done
- fi
|