#!/bin/sh # Evan Widloski - 2019-03-21 # Modified Entware installer from http://bin.entware.net/armv7sf-k3.2/installer/generic.sh set -e cleanup() { echo "Encountered error. Cleaning up and quitting..." # get out of /opt so it can be unmounted cd /home/root if [ -d /opt ] then umount /opt rm /opt -rf fi if [ -d /home/root/.entware ] then rm /home/root/.entware -rf fi if [ -f /etc/systemd/system/opt.mount ] then rm /etc/systemd/system/opt.mount fi } trap cleanup ERR unset LD_LIBRARY_PATH unset LD_PRELOAD echo "Info: Checking for prerequisites and creating folders..." if [ -d /opt ] then echo "Error: Folder /opt exists! Quitting..." exit 1 else if [ -d /home/root/.entware ] then echo "Error: Folder /home/root/.entware exists! Quitting..." exit 1 else mkdir /opt # mount /opt in /home for more storage space mkdir -p /home/root/.entware mount --bind /home/root/.entware /opt fi fi # create systemd mount unit to mount over /opt on reboot cat >/etc/systemd/system/opt.mount <> ~/.bashrc'\'