diff options
Diffstat (limited to 'INSTALL/setup.d')
-rw-r--r-- | INSTALL/setup.d/10_base | 64 | ||||
-rw-r--r-- | INSTALL/setup.d/20_worker_base | 63 | ||||
-rwxr-xr-x | INSTALL/setup.d/30_tools | 12 | ||||
-rw-r--r-- | INSTALL/setup.d/99_cleanup | 18 |
4 files changed, 157 insertions, 0 deletions
diff --git a/INSTALL/setup.d/10_base b/INSTALL/setup.d/10_base new file mode 100644 index 0000000..59dab07 --- /dev/null +++ b/INSTALL/setup.d/10_base @@ -0,0 +1,64 @@ +#!/bin/bash + +# add backports and testing repositories +echo "deb http://http.debian.net/debian jessie-backports main contrib" >>/etc/apt/sources.list +echo "deb http://http.debian.net/debian testing 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 + +# 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 + + + + diff --git a/INSTALL/setup.d/20_worker_base b/INSTALL/setup.d/20_worker_base new file mode 100644 index 0000000..eef5639 --- /dev/null +++ b/INSTALL/setup.d/20_worker_base @@ -0,0 +1,63 @@ +#!/bin/bash + +# install prereqs for bitbake plus other pkgs +apt-get install -y gawk wget git git-core diffstat unzip texinfo gcc-multilib build-essential chrpath socat libsdl1.2-dev cpio libzip2 lsb-release python3 + +# add some cool base tools +apt-get install -y vim-gtk man tree xz-utils tar + +# for gerrit +apt-get install -y git-review gitg + +# screen, xterm for bitbake devshell +# libncurses5-dev for kernel 'make menuconfig' +apt-get install -y ccache curl screen xterm libncurses5-dev + +# for toaster +apt-get install -y python-pip +pip install "Django==1.6" "South==0.8.4" "argparse==1.2.1" "wsgiref==0.1.2" "beautifulsoup4>=4.4.0" + +# for network boot through tftp+nbd +apt-get install -y tftpd-hpa xnbd-server +# adjust config file to have the server point to bitbake images deployment dir +sed -i -e "s#^\(TFTP_DIRECTORY=\).*\$#\1\"$XDT_BUILD/tmp/deploy/images\"#" /etc/default/tftpd-hpa + +# update xterm resources to have truetype fonts and utf-8 +cat <<EOF >>/etc/X11/app-defaults/XTerm + +!iotbzh: enable truetype fonts and UTF-8 encoding +*VT100*faceName: mono +*VT100*faceSize: 13 +*VT100*locale: true +EOF + +# 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 + +# copy meta init script in ~devel/bin: +wget -O $DEVUSER_HOME/bin/prepare_meta https://raw.githubusercontent.com/iotbzh/agl-manifest/master/prepare_meta +chmod +x $DEVUSER_HOME/bin/* + +chown -R $DEVUSER:$DEVUSER $XDT_DIR +chown -R $DEVUSER:$DEVUSER $DEVUSER_HOME + diff --git a/INSTALL/setup.d/30_tools b/INSTALL/setup.d/30_tools new file mode 100755 index 0000000..486daba --- /dev/null +++ b/INSTALL/setup.d/30_tools @@ -0,0 +1,12 @@ +#!/bin/bash + +apt-get install -y python-lzma python-gpgme pbzip2 pigz lzop + +dpkg -i \ + $INSTDIR/tools/bmaptools/bmap-tools*.deb + +mkdir -p /usr/local/bin +for x in $INSTDIR/tools/scripts/*; do + install --mode=755 $x /usr/local/bin/ +done + diff --git a/INSTALL/setup.d/99_cleanup b/INSTALL/setup.d/99_cleanup new file mode 100644 index 0000000..3cea352 --- /dev/null +++ b/INSTALL/setup.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 + + + |