Permalink
Browse files

reset config on opkg remove

  • Loading branch information...
1 parent 7090202 commit 2681986a5c44c8d3f199ef53b54a24adfe59b463 @cr committed Feb 2, 2011
Showing with 23 additions and 1 deletion.
  1. BIN piratebox_0.2-4_all.ipk
  2. +7 −1 src/control/prerm
  3. +16 −0 src/data/etc/piratebox.common
View
Binary file not shown.
View
@@ -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."
+
@@ -181,6 +181,22 @@ 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/
+ [ -d "$pb_usbmount" ] && rmdir "$pb_usbmount"
+ [ -d "$pb_extmount" ] && rmdir "$pb_extmount"
+}
+
pb_needswap() {
[ ! -e "$pb_swapimg" ]
}

0 comments on commit 2681986

Please sign in to comment.