Don't clutter disk when debug mode is not set
This commit is contained in:
parent
46f212f1d9
commit
765f34f3f4
@ -30,7 +30,11 @@ ${SOURCE_DIR}/seeddms.sh
|
|||||||
${SOURCE_DIR}/sigmah.sh
|
${SOURCE_DIR}/sigmah.sh
|
||||||
${SOURCE_DIR}/ushahidi.sh
|
${SOURCE_DIR}/ushahidi.sh
|
||||||
|
|
||||||
# Perform cleanup only if DEBUG environment variable is not set
|
# Perform cleanup only if DEBUG mode is not set
|
||||||
if [ ${DEBUG:-0} -eq 0 ]; then
|
[ ${DEBUG:-0} -eq 1 ] && exit 0
|
||||||
${SOURCE_DIR}/zz-cleanup.sh
|
# Clean package cache
|
||||||
fi
|
rm -rf /var/cache/apk/*
|
||||||
|
# Remove root settings
|
||||||
|
find /root -mindepth 1 -maxdepth 1 | xargs rm -rf
|
||||||
|
# Change root password
|
||||||
|
passwd
|
||||||
|
11
basic.sh
11
basic.sh
@ -4,14 +4,19 @@ set -e
|
|||||||
SOURCE_DIR=$(realpath $(dirname "${0}"))/basic
|
SOURCE_DIR=$(realpath $(dirname "${0}"))/basic
|
||||||
|
|
||||||
# Install packages
|
# 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
|
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
|
# Copy root profile files and settings for DEBUG mode
|
||||||
|
if [ ${DEBUG:-0} -eq 1 ]; then
|
||||||
mkdir -p /root/.config/htop /root/.ssh
|
mkdir -p /root/.config/htop /root/.ssh
|
||||||
cp ${SOURCE_DIR}/root/.profile /root/.profile
|
cp ${SOURCE_DIR}/root/.profile /root/.profile
|
||||||
cp ${SOURCE_DIR}/root/.ssh/authorized_keys /root/.ssh/authorized_keys
|
cp ${SOURCE_DIR}/root/.ssh/authorized_keys /root/.ssh/authorized_keys
|
||||||
cp ${SOURCE_DIR}/root/.config/htop/htoprc /root/.config/htop/htoprc
|
cp ${SOURCE_DIR}/root/.config/htop/htoprc /root/.config/htop/htoprc
|
||||||
|
fi
|
||||||
|
|
||||||
# Copy boot configuration
|
# Copy boot configuration
|
||||||
cp ${SOURCE_DIR}/boot/extlinux.conf /boot/extlinux.conf
|
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
|
# Create a self-signed certificate
|
||||||
mkdir /etc/ssl/private
|
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
|
chmod 640 /etc/ssl/private/services.key
|
||||||
|
|
||||||
# Configure nginx
|
# Configure nginx
|
||||||
|
@ -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/.*
|
|
Loading…
Reference in New Issue
Block a user