@@ 232,6 232,51 @@ if [ "$1" = "uninstall" ]; then
exit
fi
+# --------------------------------------------------------------
+# Backup
+# --------------------------------------------------------------
+
+if [ "$1" = "backup" ]; then
+ cd ~/.konilo || exit
+ D=$(date '+%Y%m%d-%H%M')
+ tar cf $D.tar ilo.rom ilo.blocks
+ gzip -9 $D.tar
+ exit
+fi
+
+if [ "$1" = "cleanup" ]; then
+ cd ~/.konilo || exit
+ echo "Removing old backups:"
+ find ~/.konilo/*.gz -mtime +30 -type f
+ find ~/.konilo/*.gz -mtime +30 -type f -delete
+ exit
+fi
+
+if [ "$1" = "restore" ]; then
+ cd ~/.konilo || exit
+ D=$(stat -f "%m%t%N" *.gz | sort -rn | head -1 | cut -f2-)
+ echo "Restoring from: $D"
+ tar xzvf $D
+ exit
+fi
+
+if [ "$1" = "restore-from" ]; then
+ cd ~/.konilo || exit
+ echo "Restoring from: $2"
+ tar xzvf $2
+ exit
+fi
+
+if [ "$1" = "list-backups" ]; then
+ cd ~/.konilo || exit
+ ls -l *.tar.gz
+ exit
+fi
+
+# --------------------------------------------------------------
+# Help
+# --------------------------------------------------------------
+
if [ "$1" = "help" ]; then
echo "$0 help"
echo " Display this help text"
@@ 268,6 313,21 @@ if [ "$1" = "help" ]; then
echo "$0 update"
echo " Update the Konilo image & system blocks"
echo
+ echo "$0 backup"
+ echo " Make a backup of ilo.rom and ilo.blocks"
+ echo
+ echo "$0 restore"
+ echo " Restore from the the latest backup"
+ echo
+ echo "$0 restore-from filename"
+ echo " Restore from a specific backup"
+ echo
+ echo "$0 cleanup"
+ echo " Remove backups older than 30 days"
+ echo
+ echo "$0 list-backups"
+ echo " Display a list of backups"
+ echo
echo "$0"
echo " Start Konilo"
echo