Skip to content

Commit

Permalink
Persistent home directory rework
Browse files Browse the repository at this point in the history
  • Loading branch information
stefaang committed Aug 29, 2019
1 parent 50b1f65 commit b6a4172
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
8 changes: 4 additions & 4 deletions wdpk/entware/clean.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ echo "APKG_DEBUG: $0 $@" >> $LOG

rm /etc/profile

# backup home dir
APPDIR=$1
rm -rf "${APPDIR}/home"
rsync -a /home/root/ "${APPDIR}/home"
# remove symlink to home dir
rm /home/root
mkdir /home/root
chown root:root /home/root

# umount, the original /opt mount becomes visible again
umount /opt
Expand Down
19 changes: 14 additions & 5 deletions wdpk/entware/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ echo "Entware init.sh linking files from path: $APPDIR" >> $LOG
OPKG=/opt/bin/opkg
OPTROOT=/shares/Volume_1/entware
if [ ! -f $OPKG ]; then
[ ! -d $OPTROOT ] && echo "Entware root dir not found!" >> $LOG && exit 1
mount --bind $OPTROOT /opt
echo "Mounted Entware root to /opt" >> $LOG
[ ! -d $OPTROOT ] && echo "Entware root dir not found!" >> $LOG && exit 1
mount --bind $OPTROOT /opt
echo "Mounted Entware root to /opt" >> $LOG
fi

# add wd opt dir again
Expand All @@ -25,8 +25,17 @@ PROFILE=/etc/profile
[ ! -f $PROFILE ] && cp $APPDIR/profile $PROFILE

# restore home dir
mkdir -p /home/root
rsync -a ${APPDIR}/home/ /home/root
HOME=/home/root
NEWHOME=${APPDIR}/home
if [ ! -L ${HOME} ]
then
echo "Setup persistent home directory"
rm -rf ${HOME}
mkdir -p ${NEWHOME}
ln -sf ${NEWHOME} /home/root
chown -R root:root ${HOME}
chown -R root:root ${NEWHOME}
fi

# link web to /var/www just for the app icon
WEBPATH=/var/www/entware/
Expand Down

0 comments on commit b6a4172

Please sign in to comment.