Skip to content

Commit

Permalink
reset config on opkg remove, minor swap fix
Browse files Browse the repository at this point in the history
  • Loading branch information
cr committed Feb 2, 2011
1 parent 7090202 commit 2dd364f
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
Binary file modified piratebox_0.2-4_all.ipk
Binary file not shown.
8 changes: 7 additions & 1 deletion 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
Expand All @@ -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."

19 changes: 18 additions & 1 deletion src/data/etc/piratebox.common
Expand Up @@ -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" ]
}
Expand All @@ -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
}
Expand Down

0 comments on commit 2dd364f

Please sign in to comment.