blob: feb2ec9e1cb37460b649ed7c481738766e343bbd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
#!/bin/bash
# set bash as default shell for /bin/sh
diverter=$(dpkg-divert --listpackage /bin/sh)
[[ "$diverter" == "dash" ]] && {
# inspired by dash postinstall
dpkg-divert --package dash --remove /bin/sh
dpkg-divert --package bash --divert /bin/sh.distrib --add /bin/sh
[[ -e /bin/sh ]] && cp -dp /bin/sh /bin/sh.distrib
ln -sf bash /bin/sh.tmp
mv -f /bin/sh.tmp /bin/sh
}
# add backports and testing repositories
echo "deb http://http.debian.net/debian jessie-backports main contrib" >>/etc/apt/sources.list
# setup network retries for apt
echo "Acquire::Retries 5;" >/etc/apt/apt.conf.d/99NetRetries
# upgrade distro
apt-get update -y
apt-get dist-upgrade -y
apt-get install -y passwd sudo openssh-server openssh-client vim systemd logrotate ifupdown locales
apt-get remove -y exim4 exim4-base exim4-config exim4-daemon-light
apt-get autoremove -y
# remove some useless systemd services
for sysdir in /lib/systemd /etc/systemd; do
for pattern in tty udev; do
find $sysdir -name "*${pattern}*" -exec rm -rf {} \; || :
done
done
rm -f /lib/systemd/system/sysinit.target.wants/proc-sys-fs-binfmt_misc.automount
cp $INSTDIR/config/bashrc /etc/skel/.bash_aliases # sourced by .bashrc for new users
cp $INSTDIR/config/sudo_devel /etc/sudoers.d/sudo_devel # Allow sudo without password
# copy files for root account (already created)
find /etc/skel -type f -exec cp -av {} /root \;
# workaround bug on dbus if host runs selinux
mkdir -p /etc/selinux/targeted/contexts/
echo '<busconfig><selinux></selinux></busconfig>' >/etc/selinux/targeted/contexts/dbus_contexts
# remount selinux ro to workaround bug in apt-get
cat <<EOF >/etc/rc.local
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
if [ -d /sys/fs/selinux ]; then
mount -o remount,ro /sys/fs/selinux
fi
exit 0
EOF
# generate locale and set to default
echo "en_US.UTF-8 UTF-8" >>/etc/locale.gen
/usr/sbin/locale-gen
echo "LANG=en_US.UTF-8" >>/etc/default/locale
# by default, /tmp is not mounted in tmpfs: solve this
echo "tmpfs /tmp tmpfs noatime,size=50% 0 0" >>/etc/fstab
# fix sshd issues with X11 forwarding (may happen if IPv6 is in use)
cat <<EOF >>/etc/ssh/sshd_config
# configuration options added from docker-worker-generator (script $BASH_SOURCE)
AddressFamily inet
EOF
|