Created
April 2, 2018 05:04
-
-
Save obatiuk/1a0efb6c5ac0dfed8349ca96c0cf647c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
[ -n "$(echo $@ | grep "\-debug")" ] && set -x | |
date=$(date +%Y-%m-%d-T%H-%M-%S) | |
host=$(cat /proc/sys/kernel/hostname) | |
backup_dir="/tmp/${host}-${date}" | |
mkdir -p ${backup_dir} | |
# backup installed package list to backup dir | |
# to restore packages do: | |
# cat backup-packages* | cut -f 1 -d ' ' | while read PACKAGE; do echo $PACKAGE; done; | |
opkg list-installed > ${backup_dir}/backup-packages-${host}-${date}; | |
# create config files backup using sysupgrade tool | |
sysupgrade --create-backup ${backup_dir}/backup-sysupgrade-${host}-${date}.tar.gz; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment