60-config 1.43 KiB
#!/usr/bin/with-contenv bash
echo "[cont-init.d] Checking for lock.file"
# check for lock file to only run git operations once
if [ ! -e /lock.file ]; then
# Give abc a sudo shell for development
echo "Lock does not exist, cloning repository"
chsh abc -s /bin/bash
sed -e 's/# %wheel ALL=(ALL) NOPASSWD: ALL/%wheel ALL=(ALL) NOPASSWD: ALL/g' \
-i /etc/sudoers
sed -e 's/^wheel:\(.*\)/wheel:\1,abc/g' -i /etc/group
# create directory for project
mkdir -p /data/code
# make sure URL is set and folder is empty to clone code
if [ ${GITURL+x} ] && [ ! "$(/bin/ls -A /data/code 2>/dev/null)" ] ; then \
# clone the url the user passed to this directory
git clone "${GITURL}" /data/code
fi
else
# lock exists not importing project this is a restart
echo "Lock exists just starting ICEcoder"
fi
# make our folders
mkdir -p \
/config/{log/ICEcoder,php,sess}
# create lock file after first run
touch /lock.file
# copy php ini for user editing
[[ ! -e "/config/php/php.ini" ]] && \
cp /etc/php7/php.ini /config/php/php.ini
cp /config/php/php.ini /etc/php7/php.ini
# Link data, code and plugins
sudo -u abc ln -sf /data /app/ICEcoder/data
sudo -u abc ln -sf /plugins /app/ICEcoder/plugins
# permissions
mkdir -p /config/sessions
echo "[cont-init.d] Setting permissions this may take some time"
chown -R abc:abc \
/app/ICEcoder \
/data \
/config \
/plugins
chmod -R 775 \
/app/ICEcoder \
/data \
/config \
/plugins