36 lines
739 B
Plaintext
36 lines
739 B
Plaintext
|
#!/bin/bash
|
||
|
|
||
|
############################################
|
||
|
# lf-updrd - Linux Firmware Updater Daemon #
|
||
|
# Author: q3aql@duck.com #
|
||
|
# License: GPLv2.0 #
|
||
|
############################################
|
||
|
|
||
|
run_wait=30 # 30s
|
||
|
interval=28800 # 8h
|
||
|
|
||
|
# Check if process have root permissions
|
||
|
mkdir -p /etc/root &> /dev/null
|
||
|
administrador=$?
|
||
|
if [ ${administrador} -eq 0 ] ; then
|
||
|
rm -rf /etc/root
|
||
|
else
|
||
|
echo "* Root permissions are required"
|
||
|
exit
|
||
|
fi
|
||
|
|
||
|
# Run daemon
|
||
|
daemon=0
|
||
|
if [ -f /usr/bin/lf-updr ] ; then
|
||
|
echo "* Starting lf-updrd daemon"
|
||
|
sleep ${run_wait}
|
||
|
while [ ${daemon} -eq 0 ] ; do
|
||
|
/usr/bin/lf-updr
|
||
|
sleep ${interval}
|
||
|
done
|
||
|
else
|
||
|
echo "* Error: /usr/bin/lf-updr not found"
|
||
|
exit 1
|
||
|
fi
|
||
|
|