Skip to content

Commit

Permalink
Implement option ENABLE_ROOT_LOGIN; fix usage comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
rssnsj committed Jan 6, 2015
1 parent 8e756ed commit 022cf40
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 13 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ OpenWrt firmware patching and repackaging tools

### Usage

openwrt-repack.sh <major_model> <ROM_file> ... patch firmware <ROM_file> and repackage
openwrt-repack.sh -c clean temporary and target files
openwrt-repack.sh <ROM_file> [options] ... patch firmware <ROM_file> and repackage
openwrt-repack.sh -c clean temporary and target files
Options:
-o <output_file> filename of newly built firmware
-r <package> remove opkg package, can be multiple
-i <ipk_file> install package with ipk file path or URL, can be multiple
-e enable root login
-w enable wireless by default
-x <commands> execute commands after all other operations
-o <output_file> filename of newly built firmware
-r <package> remove opkg package (can be multiple)
-i <package> install package with ipk file path or URL (can be multiple)
-e enable root login
-w enable wireless by default
-x <commands> execute commands after all other operations

### Example

Expand Down
20 changes: 15 additions & 5 deletions openwrt-repack.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash -e

export SQUASHFS_ROOT=`pwd`/squashfs-root
ENABLE_ROOT_LOGIN=Y
ENABLE_ROOT_LOGIN=N
ENABLE_WIRELESS=N
OPKG_REMOVE_LIST=
OPKG_INSTALL_LIST=
Expand Down Expand Up @@ -45,13 +45,13 @@ print_help()
local arg0=`basename "$0"`
cat <<EOF
Usage:
$arg0 <major_model> <ROM_file> ... patch firmware <ROM_file> and repackage
$arg0 -c clean temporary and target files
$arg0 <ROM_file> [options] ... patch firmware <ROM_file> and repackage
$arg0 -c clean temporary and target files
Options:
-o <output_file> filename of newly built firmware
-r <package> remove opkg package, can be multiple
-i <ipk_file> install package with ipk file path or URL, can be multiple
-r <package> remove opkg package (can be multiple)
-i <package> install package with ipk file path or URL (can be multiple)
-e enable root login
-w enable wireless by default
-x <commands> execute commands after all other operations
Expand Down Expand Up @@ -82,6 +82,16 @@ modify_rootfs()
sed -i '/option \+disabled \+1/d;/# *REMOVE THIS LINE/d' lib/wifi/mac80211.sh
fi

# Root the firmware (only for the HCxxxx ROMs)
if [ "$ENABLE_ROOT_LOGIN" = Y ]; then
# Hack this line: 'sed -i "/login/d" /etc/inittab'
[ -f lib/functions/system.sh ] && sed -i '/sed.*\/login\/d.*inittab/d' lib/functions/system.sh || :
if ! ls etc/rc.d/S*dropbear &>/dev/null; then
ln -sv ../init.d/dropbear etc/rc.d/S50dropbear
fi
print_red "WARNING: Enabled root login permanently for the firmware."
fi

# Run custom commands
if [ -n "$ROOTFS_CMDS" ]; then
print_green ">>> Executing custom commands ..."
Expand Down

0 comments on commit 022cf40

Please sign in to comment.