Remove most obsolete files before migrating to maestro

This commit is contained in:
2014-12-26 15:12:43 +01:00
parent 53c00e7df8
commit 801c56bd35
58 changed files with 1098 additions and 231 deletions

View File

@@ -0,0 +1,39 @@
#!/bin/bash
set -e
source /build/config
set -x
## Temporarily disable dpkg fsync to make building faster.
echo force-unsafe-io > /etc/dpkg/dpkg.cfg.d/02apt-speedup
## Prevent initramfs updates from trying to run grub and lilo.
## https://journal.paul.querna.org/articles/2013/10/15/docker-ubuntu-on-rackspace/
## http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=594189
export INITRD=no
mkdir -p /etc/container_environment
echo -n no > /etc/container_environment/INITRD
## Update package list
apt-get update
## Fix some issues with APT packages
## See https://github.com/dotcloud/docker/issues/1024
dpkg-divert --local --rename --add /sbin/initctl
ln -sf /bin/true /sbin/initctl
## Replace the 'ischroot' tool to make it always return true
## Prevent initscripts updates from breaking /dev/shm
## https://journal.paul.querna.org/articles/2013/10/15/docker-ubuntu-on-rackspace/
## https://bugs.launchpad.net/launchpad/+bug/974584
dpkg-divert --local --rename --add /usr/bin/ischroot
ln -sf /bin/true /usr/bin/ischroot
## Install HTTPS support for APT
$minimal_apt_get_install apt-transport-https
## Upgrade all packages
apt-get dist-upgrade -y --no-install-recommends
## Fix locale
$minimal_apt_get_install language-pack-en
locale-gen en_US

View File

@@ -0,0 +1,8 @@
#!/bin/bash
set -e
source /build/config
set -x
## Boot entries
mkdir /opt/init.d/
mv /build/boot/*.sh /opt/init.d/

View File

@@ -0,0 +1,13 @@
#!/bin/bash
set -e
source /build/config
set -x
## Install cron daemon
$minimal_apt_get_install cron
mkdir -p /etc/service/cron
mv /build/runit/cron /etc/service/cron/run
## Remove useless cron entries
# Checks for lost+found and scans for mtab
rm -f /etc/cron.daily/standard

View File

@@ -0,0 +1,12 @@
#!/bin/bash
set -e
source /build/config
set -x
## Install init process
mv /build/init /opt/
mkdir -p /etc/container_environment
touch /etc/container_environment.sh
touch /etc/container_environment.json
chmod 700 /etc/container_environment
chmod 600 /etc/container_environment.sh /etc/container_environment.json

View File

@@ -0,0 +1,7 @@
#!/bin/bash
set -e
source /build/config
set -x
## Install logrotate
$minimal_apt_get_install logrotate

View File

@@ -0,0 +1,7 @@
#!/bin/bash
set -e
source /build/config
set -x
## Install runit
$minimal_apt_get_install runit

View File

@@ -0,0 +1,28 @@
#!/bin/bash
set -e
source /build/config
set -x
## Install the SSH server
$minimal_apt_get_install openssh-server
mkdir /var/run/sshd
mkdir -p /etc/service/sshd
cp /build/runit/sshd /etc/service/sshd/run
## Install root key
cd /opt
AUTHORIZED_KEYS=/root/.ssh/authorized_keys
DIR=`dirname "$AUTHORIZED_KEYS"`
mkdir -p "$DIR"
chmod 700 "$DIR"
chown root:root "$DIR"
pwd
ssh-keygen -t rsa -N "" -f id_rsa
cat /opt/id_rsa.pub >> "$AUTHORIZED_KEYS"
## X11 forwarding
$minimal_apt_get_install xauth
## Setup environment
sed -i "1iexport HOME=/root" /root/.profile
sed -i "1isource /etc/container_environment.sh" /root/.profile

View File

@@ -0,0 +1,11 @@
#!/bin/bash
set -e
source /build/config
set -x
## Install a syslog daemon
$minimal_apt_get_install syslog-ng-core
mkdir /etc/service/syslog-ng
mv /build/runit/syslog-ng /etc/service/syslog-ng/run
mkdir -p /var/lib/syslog-ng
sed -i "s/^\(#SYSLOGNG_OPTS=\).*$/\1\"--no-caps --default-modules=affile,afprog,afsocket,afuser,basicfuncs,csvparser,dbparser,syslogformat\"/" /etc/default/syslog-ng

View File

@@ -0,0 +1,13 @@
#!/bin/bash
set -e
source /build/config
set -x
## Hosts file hack
LD_LIBRARY_PATH=/root/lib
mkdir -p $LD_LIBRARY_PATH
cp /lib/x86_64-linux-gnu/libnss_files.so.2 $LD_LIBRARY_PATH
sed -i 's,/etc/hosts,/tmp/hosts,' $LD_LIBRARY_PATH/libnss_files.so.2
## Environment variable
echo -n $LD_LIBRARY_PATH > /etc/container_environment/LD_LIBRARY_PATH

View File

@@ -0,0 +1,10 @@
#!/bin/bash
set -e
source /build/config
set -x
## Often used tools
$minimal_apt_get_install wget curl python-pip inetutils-ping telnet sox
## Often used python modules
pip install argparse

View File

@@ -0,0 +1,9 @@
#!/bin/bash
set -e
source /build/config
set -x
## Mpd
$minimal_apt_get_install mpd
mkdir -p /etc/service/mpd
cp /build/runit/mpd /etc/service/mpd/run

View File

@@ -0,0 +1,10 @@
#!/bin/bash
set -e
source /build/config
set -x
## Pulseaudio
$minimal_apt_get_install pulseaudio
## Setup environment
sed -i "1iexport PULSE_SERVER=host" /root/.profile

View File

@@ -0,0 +1,10 @@
#!/bin/bash
set -e
source /build/config
set -x
apt-get clean
#rm -rf /build
rm -rf /tmp/* /var/tmp/*
rm -rf /var/lib/apt/lists/*
rm -f /etc/dpkg/dpkg.cfg.d/02apt-speedup