Preliminary commit of new files
This commit is contained in:
39
build/scripts/00_prepare.sh
Normal file
39
build/scripts/00_prepare.sh
Normal 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
|
||||
8
build/scripts/01_boot.sh
Normal file
8
build/scripts/01_boot.sh
Normal 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/
|
||||
13
build/scripts/01_cron.sh
Normal file
13
build/scripts/01_cron.sh
Normal 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
|
||||
12
build/scripts/01_init.sh
Normal file
12
build/scripts/01_init.sh
Normal 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
|
||||
7
build/scripts/01_logrotate.sh
Normal file
7
build/scripts/01_logrotate.sh
Normal file
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
source /build/config
|
||||
set -x
|
||||
|
||||
## Install logrotate
|
||||
$minimal_apt_get_install logrotate
|
||||
7
build/scripts/01_runit.sh
Normal file
7
build/scripts/01_runit.sh
Normal file
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
source /build/config
|
||||
set -x
|
||||
|
||||
## Install runit
|
||||
$minimal_apt_get_install runit
|
||||
28
build/scripts/01_sshd.sh
Normal file
28
build/scripts/01_sshd.sh
Normal 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
|
||||
11
build/scripts/01_syslog.sh
Normal file
11
build/scripts/01_syslog.sh
Normal 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
|
||||
13
build/scripts/02_hosts.sh
Normal file
13
build/scripts/02_hosts.sh
Normal 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
|
||||
7
build/scripts/02_user.sh
Normal file
7
build/scripts/02_user.sh
Normal file
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
source /build/config
|
||||
set -x
|
||||
|
||||
## User
|
||||
adduser --disabled-password --gecos "" user
|
||||
10
build/scripts/02_utilities.sh
Normal file
10
build/scripts/02_utilities.sh
Normal 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
|
||||
21
build/scripts/03_btsync.sh
Normal file
21
build/scripts/03_btsync.sh
Normal file
@@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
source /build/config
|
||||
set -x
|
||||
|
||||
## Redis
|
||||
cd opt
|
||||
wget -O btsync.tar.gz http://download-lb.utorrent.com/endpoint/btsync/os/linux-x64/track/stable
|
||||
tar xzf btsync.tar.gz
|
||||
rm btsync.tar.gz
|
||||
|
||||
export BTSYNC_CONFIG=/host/etc/btsync.conf
|
||||
export BTSYNC_DATA=/host/var/btsync
|
||||
|
||||
## Runit script
|
||||
mkdir /etc/service/btsync
|
||||
mv /build/runit/btsync /etc/service/btsync/run
|
||||
|
||||
## Environment variables
|
||||
echo -n $BTSYNC_CONFIG > /etc/container_environment/BTSYNC_CONFIG
|
||||
echo -n $BTSYNC_DATA > /etc/container_environment/BTSYNC_DATA
|
||||
14
build/scripts/03_chrome.sh
Normal file
14
build/scripts/03_chrome.sh
Normal file
@@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
source /build/config
|
||||
set -x
|
||||
|
||||
## Chrome dependencies
|
||||
$minimal_apt_get_install gconf-service libasound2 libatk1.0-0 libcairo2 libcap2 libcups2 libcurl3 libfontconfig1 libgdk-pixbuf2.0-0 libgtk2.0-0 libnspr4 libnss3 libpango1.0-0 librtmp0 libxss1 libxtst6 xdg-utils
|
||||
|
||||
## Chrome
|
||||
mkdir -p /usr/share/icons/hicolor
|
||||
cd /opt
|
||||
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
|
||||
dpkg -i google-chrome-stable_current_amd64.deb
|
||||
rm google-chrome-stable_current_amd64.deb
|
||||
11
build/scripts/03_firefox.sh
Normal file
11
build/scripts/03_firefox.sh
Normal file
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
source /build/config
|
||||
set -x
|
||||
|
||||
## Chrome dependencies
|
||||
$minimal_apt_get_install firefox
|
||||
|
||||
## Pulseaudio script
|
||||
echo "PULSE_SERVER=host firefox" > /opt/firefox
|
||||
chmod +x /opt/firefox
|
||||
18
build/scripts/03_hamachi.sh
Normal file
18
build/scripts/03_hamachi.sh
Normal file
@@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
source /build/config
|
||||
set -x
|
||||
|
||||
## Hamachi dependency
|
||||
$minimal_apt_get_install lsb-core net-tools socat strace
|
||||
|
||||
## Hamachi
|
||||
cd /opt
|
||||
export HAMACHI_DATA=/host/var/lib/logmein-hamachi
|
||||
export HAMACHI_VERSION=2.1.0.119
|
||||
wget -O hamachi.deb https://secure.logmein.com/labs/logmein-hamachi_$HAMACHI_VERSION-1_amd64.deb
|
||||
mkdir -p /etc/service/hamachi
|
||||
cp /build/runit/hamachi /etc/service/hamachi/run
|
||||
|
||||
## Environment variables
|
||||
echo -n $HAMACHI_DATA > /etc/container_environment/HAMACHI_DATA
|
||||
10
build/scripts/03_pulseaudio.sh
Normal file
10
build/scripts/03_pulseaudio.sh
Normal 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
|
||||
24
build/scripts/03_redis.sh
Normal file
24
build/scripts/03_redis.sh
Normal file
@@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
source /build/config
|
||||
set -x
|
||||
|
||||
## Redis
|
||||
$minimal_apt_get_install redis-server
|
||||
|
||||
export REDIS_CONFIG=/etc/redis/redis.conf
|
||||
export REDIS_LOG=/host/var/log/redis/redis.log
|
||||
export REDIS_DATA=/host/var/lib/redis
|
||||
|
||||
sed -i "s,^\(daemonize\s*\).*$,\1no," $REDIS_CONFIG
|
||||
sed -i "s,^\(logfile\s*\).*$,\1$REDIS_LOG," $REDIS_CONFIG
|
||||
sed -i "s,^\(dir\s*\).*$,\1$REDIS_DATA," $REDIS_CONFIG
|
||||
|
||||
## Runit script
|
||||
mkdir /etc/service/redis
|
||||
mv /build/runit/redis /etc/service/redis/run
|
||||
|
||||
## Environment variables
|
||||
echo -n $REDIS_CONFIG > /etc/container_environment/REDIS_CONFIG
|
||||
echo -n $REDIS_LOG > /etc/container_environment/REDIS_LOG
|
||||
echo -n $REDIS_DATA > /etc/container_environment/REDIS_DATA
|
||||
10
build/scripts/99_cleanup.sh
Normal file
10
build/scripts/99_cleanup.sh
Normal 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
|
||||
Reference in New Issue
Block a user