diff --git a/00-install.sh b/00-install.sh index 4119f6e..6d62547 100755 --- a/00-install.sh +++ b/00-install.sh @@ -30,7 +30,11 @@ ${SOURCE_DIR}/seeddms.sh ${SOURCE_DIR}/sigmah.sh ${SOURCE_DIR}/ushahidi.sh -# Perform cleanup only if DEBUG environment variable is not set -if [ ${DEBUG:-0} -eq 0 ]; then - ${SOURCE_DIR}/zz-cleanup.sh -fi +# Perform cleanup only if DEBUG mode is not set +[ ${DEBUG:-0} -eq 1 ] && exit 0 +# Clean package cache +rm -rf /var/cache/apk/* +# Remove root settings +find /root -mindepth 1 -maxdepth 1 | xargs rm -rf +# Change root password +passwd diff --git a/basic.sh b/basic.sh index 8b15758..5abc349 100755 --- a/basic.sh +++ b/basic.sh @@ -4,14 +4,19 @@ set -e SOURCE_DIR=$(realpath $(dirname "${0}"))/basic # Install packages -apk --no-cache add --virtual .useful git file htop less openssh-server openssh-sftp-server apk --no-cache add curl docker e2fsprogs-extra gettext kbd-misc libressl python3 py3-bcrypt py3-cffi py3-dnspython py3-jinja2 py3-requests py3-six py3-werkzeug nginx util-linux +if [ ${DEBUG:-0} -eq 1 ]; then + # Install some utilities for DEBUG mode + apk --no-cache add git file htop less openssh-server openssh-sftp-server +fi -# Copy profile files and settings -mkdir -p /root/.config/htop /root/.ssh -cp ${SOURCE_DIR}/root/.profile /root/.profile -cp ${SOURCE_DIR}/root/.ssh/authorized_keys /root/.ssh/authorized_keys -cp ${SOURCE_DIR}/root/.config/htop/htoprc /root/.config/htop/htoprc +# Copy root profile files and settings for DEBUG mode +if [ ${DEBUG:-0} -eq 1 ]; then + mkdir -p /root/.config/htop /root/.ssh + cp ${SOURCE_DIR}/root/.profile /root/.profile + cp ${SOURCE_DIR}/root/.ssh/authorized_keys /root/.ssh/authorized_keys + cp ${SOURCE_DIR}/root/.config/htop/htoprc /root/.config/htop/htoprc +fi # Copy boot configuration cp ${SOURCE_DIR}/boot/extlinux.conf /boot/extlinux.conf @@ -30,7 +35,7 @@ cp ${SOURCE_DIR}/etc/conf.d/ntpd /etc/conf.d/ntpd # Create a self-signed certificate mkdir /etc/ssl/private -openssl req -x509 -new -out /etc/ssl/certs/services.pem -keyout /etc/ssl/private/services.key -nodes -days 7305 -subj "/CN=$(hostname)" +openssl req -x509 -new -out /etc/ssl/certs/services.pem -keyout /etc/ssl/private/services.key -nodes -days 7305 -subj "/CN=spotter.vm" chmod 640 /etc/ssl/private/services.key # Configure nginx diff --git a/zz-cleanup.sh b/zz-cleanup.sh deleted file mode 100755 index e87dc09..0000000 --- a/zz-cleanup.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh -set -e - -# Remove packages not necessary for release -apk --no-cache del .useful - -# Clean package cache -rm -rf /var/cache/apk/* - -# Remove user settings -rm -rf /root/* /root/.*