Combine with files from virtual working directory
This commit is contained in:
39
images/btsync/build/scripts/00_prepare.sh
Normal file
39
images/btsync/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
images/btsync/build/scripts/01_boot.sh
Normal file
8
images/btsync/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
images/btsync/build/scripts/01_cron.sh
Normal file
13
images/btsync/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
images/btsync/build/scripts/01_init.sh
Normal file
12
images/btsync/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
images/btsync/build/scripts/01_logrotate.sh
Normal file
7
images/btsync/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
images/btsync/build/scripts/01_runit.sh
Normal file
7
images/btsync/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
images/btsync/build/scripts/01_sshd.sh
Normal file
28
images/btsync/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
images/btsync/build/scripts/01_syslog.sh
Normal file
11
images/btsync/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
images/btsync/build/scripts/02_hosts.sh
Normal file
13
images/btsync/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
|
||||
10
images/btsync/build/scripts/02_utilities.sh
Normal file
10
images/btsync/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
images/btsync/build/scripts/03_btsync.sh
Normal file
21
images/btsync/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
|
||||
10
images/btsync/build/scripts/99_cleanup.sh
Normal file
10
images/btsync/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