Skip to content

Commit

Permalink
script support for last commit
Browse files Browse the repository at this point in the history
git-svn-id: http://firmware-mod-kit.googlecode.com/svn/trunk@445 5c1471b0-2a1b-0410-b4f4-f33460ac40b9
  • Loading branch information
jeremy.collake@gmail.com committed Apr 14, 2013
1 parent 30a7cbb commit 5bd03e2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
11 changes: 10 additions & 1 deletion ddwrt-gui-extract.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,15 @@ then
OUT="www"
fi

if [ $UID -ne 0 ]
then
SUDO="sudo"
fi

eval $(cat shared-ng.inc)
HTTPD="$DIR/usr/sbin/httpd"
WWW="$DIR/etc/www"
KEYFILE="$DIR/webcomp.key"

echo -e "Firmware Mod Kit (ddwrt-gui-extract) $VERSION, (c)2013 Craig Heffner, Jeremy Collake\nhttp://www.bitsum.com\n"

Expand All @@ -32,5 +38,8 @@ then
fi

# Extract!
./src/webcomp-tools/webdecomp --httpd="$HTTPD" --www="$WWW" --dir="$OUT" --extract
# key file is written to rootfs, and since may have root ownership, sudo
TMPFILE=`mktemp /tmp/$0.XXXXXX`
./src/webcomp-tools/webdecomp --httpd="$HTTPD" --www="$WWW" --dir="$OUT" --key="$TMPFILE" --extract
$SUDO cp "$TMPFILE" "$KEYFILE"

8 changes: 7 additions & 1 deletion ddwrt-gui-rebuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ fi
eval $(cat shared-ng.inc)
HTTPD="$DIR/usr/sbin/httpd"
WWW="$DIR/etc/www"
KEYFILE="$DIR/webcomp.key"

echo -e "Firmware Mod Kit (ddwrt-gui-rebuild) $VERSION, (c)2011 Craig Heffner, Jeremy Collake\nhttp://www.bitsum.com\n"

Expand All @@ -38,5 +39,10 @@ then
fi

# Restore!
$SUDO ./src/webcomp-tools/webdecomp --httpd="$HTTPD" --www="$WWW" --dir="$WEBDIR" --restore
TMPFILE=`mktemp /tmp/$0.XXXXXX`
# we actually pass a temporary copy of the keyfile to the webdecomp tool so that
# the actual keyfile won't be included in the compiled web file system
$SUDO mv "$KEYFILE" "$TMPFILE"
$SUDO ./src/webcomp-tools/webdecomp --httpd="$HTTPD" --www="$WWW" --dir="$WEBDIR" --key="$TMPFILE" --restore
$SUDO mv "$TMPFILE" "$KEYFILE"

0 comments on commit 5bd03e2

Please sign in to comment.