add simple scripts for backup/restore
[openwrt.git] / openwrt / target / default / target_skeleton / sbin / backup
1 #!/bin/sh
2 for param in $*; do
3 case "$param" in
4 -n)
5 SAVE_NVRAM=y
6 ;;
7 *)
8 OUTPUT_FILE="$param"
9 esac
10 done
11
12 if [ "$OUTPUT_FILE" = "-" ]; then
13 echo "Writing backup to stdout.." >&2
14 elif [ "$OUTPUT_FILE" = "" ]; then
15 echo "No output file."
16 else
17 echo "Writing backup to $OUTPUT_FILE" >&2
18 exec > "$OUTPUT_FILE"
19 fi
20
21 echo __FILELIST__
22 find /etc -type f > /tmp/.wlbackup_files
23 cat /tmp/.wlbackup_files
24
25 echo __IPKG__
26 cat /etc/ipkg.conf
27
28 if [ "$1" = "-n" ]; then
29 echo __NVRAM__
30 nvram show 2>/dev/null
31 fi
32
33 echo __PACKAGES__
34 grep '^Package:' /usr/lib/ipkg/status | cut -d' ' -f2
35
36 echo __FILES__
37 tar -T /tmp/.wlbackup_files -cz 2>/dev/null
38 rm -f /tmp/.wlbackup_files
This page took 0.049516 seconds and 5 git commands to generate.