Skip to content

Commit af73c67

Browse files
committed
Cleanup uneeded directories on startup
1 parent b963234 commit af73c67

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

scripts/nm-start-ku.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,24 @@ KU_UPDATE_MD=${KU_DIR}/updated-md.sql
1414
# Inport logmsg function
1515
. ${KU_DIR}/scripts/ku-lib.sh
1616

17+
delete_dir() {
18+
del_dir="$1"
19+
# Protect against deleting anything outside of the ku directory
20+
case "$del_dir" in
21+
"/mnt/onboard/.adds/kobo-uncaged/"*)
22+
if [ -d "$del_dir" ] ; then
23+
logmsg "I" "Directory ${del_dir} exists. Deleting..."
24+
rm -rf "$del_dir"
25+
fi
26+
;;
27+
*) logmsg "W" "${del_dir} not in ${KU_DIR}. Not deleting" ;;
28+
esac
29+
}
30+
31+
# Cleanup 'static' and 'template' directories from older versions
32+
delete_dir "${KU_DIR}/static"
33+
delete_dir "${KU_DIR}/templates"
34+
1735
call_sqlite() {
1836
sql_file="$1"
1937
sqlite_err=$($SQLITE_BIN $NICKEL_DB 2>&1 >/dev/null <<EOF

0 commit comments

Comments
 (0)