aboutsummaryrefslogtreecommitdiffstats
path: root/INSTALL/common.d
diff options
context:
space:
mode:
Diffstat (limited to 'INSTALL/common.d')
-rw-r--r--INSTALL/common.d/10_base67
-rw-r--r--INSTALL/common.d/20_worker_base31
-rw-r--r--INSTALL/common.d/99_cleanup18
3 files changed, 116 insertions, 0 deletions
diff --git a/INSTALL/common.d/10_base b/INSTALL/common.d/10_base
new file mode 100644
index 0000000..e429e65
--- /dev/null
+++ b/INSTALL/common.d/10_base
@@ -0,0 +1,67 @@
+#!/bin/bash
+
+# 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
+
+
+
diff --git a/INSTALL/common.d/20_worker_base b/INSTALL/common.d/20_worker_base
new file mode 100644
index 0000000..b262afb
--- /dev/null
+++ b/INSTALL/common.d/20_worker_base
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+# add some cool base tools
+apt-get install -y man tree curl screen
+
+# add the build user
+useradd -c "Builder" -d $DEVUSER_HOME -G sudo -m -U -s /bin/bash -u $DEVUSER_UID $DEVUSER
+echo $DEVUSER:$DEVUSER_PASSWORD | chpasswd
+
+# generate an extra environment file sourced by bashrc
+for k in DEVUSER DEVUSER_UID DEVUSER_HOME \
+ XDT_DIR \
+ XDT_META XDT_DOWNLOADCACHE XDT_SSTATECACHE XDT_CCACHE XDT_BUILD XDT_WORKSPACE XDT_SOURCES XDT_SDK \
+ ; do
+ v=${!k} # get value
+ [[ "${v:0:1}" == "/" ]] && mkdir -p $v # create dir only if value starts with "/"
+ echo "export $k=$v" >>/etc/xdtrc
+done
+
+mkdir -p $DEVUSER_HOME/bin
+cat <<'EOF' >>$DEVUSER_HOME/.bashrc
+
+# added by worker image creation script (docker-image-builder)
+export PATH=~/bin:$PATH
+[[ -f /etc/xdtrc ]] && . /etc/xdtrc
+
+EOF
+
+chown -R $DEVUSER:$DEVUSER $XDT_DIR
+chown -R $DEVUSER:$DEVUSER $DEVUSER_HOME
+
diff --git a/INSTALL/common.d/99_cleanup b/INSTALL/common.d/99_cleanup
new file mode 100644
index 0000000..3cea352
--- /dev/null
+++ b/INSTALL/common.d/99_cleanup
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+apt-get autoremove -y
+
+# remove big useless files
+rm -rf /usr/lib/x86_64-linux-gnu/dri/*.so
+rm -rf /usr/lib/perl/5.*/auto/Encode/JP/JP.so
+rm -rf /usr/lib/perl/5.*/auto/Encode/KR/KR.so
+rm -rf /usr/lib/perl/5.*/auto/Encode/CN/CN.so
+rm -rf /usr/lib/perl/5.*/auto/Encode/TW/TW.so
+
+# keep doc ?
+#rm -rf /usr/share/doc
+#rm -rf /usr/share/man
+#rm -rf /usr/share/locale
+
+
+