This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
nrsw:usb-autorun [2015/04/01 16:11] – hess | nrsw:usb-autorun [Unknown date] (current) – removed - external edit (Unknown date) 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== USB Autorun ====== | ||
- | This feature can be used to automatically launch a shell script or perform a software/ | ||
- | It can be downloaded from that page and holds the SHA256 hash key of the admin password. The file can hold multiple hashes which will be processed line-by-line during authentication which can be used for setting up more systems with different admin | ||
- | passwords. For new devices with an empty password the hash key | ||
- | '' | ||
- | can be used. | ||
- | The hash keys can be generated by running the command '' | ||
- | Once authentication has succeeded, the system scans for other files in the root directory which can perform the following actions: | ||
- | - For running a script: '' | ||
- | - For a configuration update: '' | ||
- | - For a software update: '' | ||
- | |||
- | <code - autorun.key> | ||
- | e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 | ||
- | </ | ||
- | |||
- | <code bash autorun.sh> | ||
- | # This autorun.sh script applies all *.cfg files that are provided on a USB stick | ||
- | # Make sure autorun.status=1 or the router is set back to factory defaults | ||
- | # and a file autorun.key with e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 is on the stick as well | ||
- | |||
- | # $MNTPATH is passed via environment variable but we want to be sure :) | ||
- | mountpoint="" | ||
- | max=60 | ||
- | config="/ | ||
- | serial=$(cli status system -s | grep SERIAL_NUMBER | cut -d= -f2 | tr -d '"' | ||
- | for i in `seq 1 $max` | ||
- | do | ||
- | / | ||
- | mountpoint=$(mount | grep sda | cut -d" " -f3) | ||
- | if [ -n " | ||
- | / | ||
- | break | ||
- | fi | ||
- | sleep 1 | ||
- | done | ||
- | # concatenate common.cfg and individual.cfg on USB stick and save it in temp file. | ||
- | cat $mountpoint/ | ||
- | # apply the whole config in one step | ||
- | cli update config " | ||
- | / | ||
- | # write applied config and log back on stick | ||
- | cat / | ||
- | tail -n 100 / | ||
- | exit 0 | ||
- | |||
- | |||
- | </ | ||