#!/bin/bash
# Cleanup Old Before Install New
rm -rf $INSTALL_DIR/builder
rm -rf $INSTALL_DIR/configs
rm -rf $INSTALL_DIR/images
rm -rf $INSTALL_DIR/scripts
#rm -rf $INSTALL_DIR/gui.py
rm -rf $INSTALL_DIR/README.md
# save ENTIRE configs folder
#mkdir -p "$TMPDIR/preserve"
#cp -a \
#    "$INSTALL_DIR/configs" \
#    "$TMPDIR/preserve/" 2>/dev/null
#sleep 5
#echo "::STATUS::Installing Update ..."
#cp -a "$TMPDIR"/extracted/. "$INSTALL_DIR"/
# restore ENTIRE configs folder
#if [ -f "$TMPDIR/preserve/configs" ]; then
#    cp -a \
#        "$TMPDIR/preserve/configs" \
#        "$INSTALL_DIR"
#fi
#sleep 5
# Save SPECIFIC files in configs folder
#mkdir -p "$TMPDIR/preserve"
#cp -a \
#    "$INSTALL_DIR/configs/hosts.conf" \
#    "$TMPDIR/preserve/" 2>/dev/null
#sleep 5
echo "::STATUS::Installing Update ..."
cp -a "$TMPDIR"/extracted/. "$INSTALL_DIR"/
# Restore SPECIFIC files in configs folder
#if [ -f "$TMPDIR/preserve/hosts.conf" ]; then
#    cp -a \
#        "$TMPDIR/preserve/hosts.conf" \
#        "$INSTALL_DIR/configs/"
#fi
#sleep 5
echo "::STATUS::Cleaning Up ..."
rm -rf "$TMPDIR"
sleep 5
exit 0
