add locking
This commit is contained in:
parent
f691f134f6
commit
b34c0e5236
|
@ -20,6 +20,11 @@ which works on webOS 3.5 and newer.
|
|||
If you have the LG Developer Mode app installed, you *must* remove it before
|
||||
rebooting. **Do not** install it while your TV is rooted.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
If the script fails, you must delete `autoroot.once` from the USB drive before
|
||||
it will run again.
|
||||
|
||||
## Support
|
||||
|
||||
You can find more information at [webosbrew.org](https://www.webosbrew.org/).
|
||||
|
|
13
autoroot.sh
13
autoroot.sh
|
@ -52,6 +52,13 @@ get_sdkversion() {
|
|||
luna-send -w 1000 -n 1 -q 'sdkVersion' -f 'luna://com.webos.service.tv.systemproperty/getSystemInfo' '{"keys":["sdkVersion"]}' | sed -n -e 's/^\s*"sdkVersion":\s*"\([0-9.]\+\)"\s*$/\1/p'
|
||||
}
|
||||
|
||||
lockfile='/tmp/autoroot.lock'
|
||||
exec 200>"${lockfile}"
|
||||
|
||||
flock -x -n -- 200 || { echo '[!] Another instance of this script is currently running'; exit 2; }
|
||||
|
||||
trap -- "rm -f -- '${lockfile}'" EXIT
|
||||
|
||||
toast 'Script is running!'
|
||||
|
||||
umask 022
|
||||
|
@ -80,6 +87,12 @@ debug "temp dir: ${tempdir}"
|
|||
log "date: $(date -u -- '+%Y-%m-%d %H:%M:%S UTC')"
|
||||
log "id: $(id)"
|
||||
|
||||
oncefile="${USB_PATH}/autoroot.once"
|
||||
|
||||
[ -e "${oncefile}" ] && { log 'Script already executed'; exit 3; }
|
||||
|
||||
touch -- "${oncefile}"
|
||||
|
||||
webos_ver="$(get_sdkversion)"
|
||||
|
||||
log "webOS version: ${webos_ver}"
|
||||
|
|
Loading…
Reference in New Issue