correct wl-500gd
[openwrt.git] / openwrt / target / default / target_skeleton / sbin / restore
1 #!/bin/sh
2 for param in $*; do
3 case "$param" in
4 *)
5 INPUT_FILE="$param"
6 esac
7 done
8
9 if [ "$INPUT_FILE" = "-" ]; then
10 echo "Reading backup from stdin..." >&2
11 elif [ "$INPUT_FILE" = "" ]; then
12 echo "No input file."
13 else
14 echo "Reading backup from $INPUT_FILE" >&2
15 exec < "$INPUT_FILE"
16 fi
17
18 process_line () {
19 case "$SECTION" in
20 ipkg)
21 echo "$line" >> /etc/ipkg.conf
22 ;;
23 nvram)
24 echo nvram set "$line"
25 ;;
26 package)
27 if grep "^Package: $line" /usr/lib/ipkg/status 2>&1 > /dev/null; then
28 echo Package "$line" already installed.
29 else
30 ipkg install "$line"
31 fi
32 ;;
33 file)
34 rm -f "$line"
35 ;;
36 esac
37 }
38
39 while true; do
40 read line
41 case "$line" in
42 __IPKG__)
43 SECTION=ipkg
44 echo "Restoring /etc/ipkg.conf"
45 rm -f /etc/ipkg.conf
46 ;;
47 __NVRAM__)
48 SECTION=nvram
49 echo "Restoring nvram"
50 ;;
51 __PACKAGES__)
52 SECTION=package
53 echo "Restoring packages"
54 ipkg update
55 ;;
56 __FILELIST__)
57 SECTION=file
58 echo "Deleting old files"
59 ;;
60 __FILES__)
61 echo "Restoring /etc"
62 tar -C / -xvz
63 echo "Restore complete."
64 exit 0
65 ;;
66 *)
67 process_line;
68 ;;
69 esac
70 done
71
This page took 0.054065 seconds and 5 git commands to generate.