Skip to content
Browse files

reset config on opkg remove, minor swap fix

  • Loading branch information...
1 parent 7090202 commit 2dd364f44fd85a72b8d75a1071e652dc425f9b1d @cr committed Feb 2, 2011
Showing with 25 additions and 2 deletions.
  1. BIN piratebox_0.2-4_all.ipk
  2. +7 −1 src/control/prerm
  3. +18 −1 src/data/etc/piratebox.common
View
BIN piratebox_0.2-4_all.ipk
Binary file not shown.
View
8 src/control/prerm
@@ -1,6 +1,6 @@
#!/bin/ash
-# TODO: undo UCI changes, undo dnsmasq patch
+. /etc/piratebox.common
/etc/init.d/luci_fixtime enable
/etc/init.d/luci_dhcp_migrate enable
@@ -9,3 +9,9 @@
/etc/init.d/piratebox stop
/etc/init.d/piratebox nodns
+
+# undo configuration
+echo "Resetting OpenWRT config to factory state..."
+pb_undoconfig
+echo "Please reboot for changes to take effect."
+
View
19 src/data/etc/piratebox.common
@@ -181,6 +181,23 @@ pb_usbconfig() {
}
+pb_undoconfig() {
+ # undo config changes
+ uci delete dhcp.piratebox
+ uci delete firewall.piratebox
+ uci delete fstab.piratebox
+ uci delete fstab.pirateswap
+ uci set "system.@system[0].hostname=OpenWRT"
+ uci set "network.lan.ipaddr=192.168.1.1"
+ uci commit
+ cp /rom/etc/opkg.conf /etc/
+ cp /rom/etc/hosts /etc/
+ cp /rom/etc/init.d/dnsmasq /etc/init.d/
+ rm /usr/local
+ [ -d "$pb_usbmount" ] && rmdir "$pb_usbmount"
+ [ -d "$pb_extmount" ] && rmdir "$pb_extmount"
+}
+
pb_needswap() {
[ ! -e "$pb_swapimg" ]
}
@@ -192,7 +209,7 @@ pb_mkswap() {
# create a swap file
dd if=/dev/zero of="$pb_swapimg" bs=1M count=32
mkswap "$pb_swapimg"
- pb_uciset fstab pirateswap swap \
+ pb_uciset fstab swap pirateswap \
device=$pb_swapimg \
enabled=1
}

0 comments on commit 2dd364f

Please sign in to comment.
Something went wrong with that request. Please try again.