Compare commits
No commits in common. "17406376ad89526cd79ef6496052ee4be3b1ea3e" and "1b968f3166a40d425cb6d36620ce88a25e716ef1" have entirely different histories.
17406376ad
...
1b968f3166
41
install.sh
41
install.sh
|
@ -69,56 +69,27 @@ if [ ${error_cloning} -ne 0 ] ; then
|
|||
fi
|
||||
|
||||
# Install script and cron
|
||||
if [ -f "$(dirname $0)/lf-updr" ] ; then
|
||||
if [ -f "$(dirname $0)/lf-updr.sh" ] ; then
|
||||
echo "* Installing /usr/bin/lf-updr"
|
||||
cp -rf $(dirname $0)/lf-updr /usr/bin/lf-updr
|
||||
cp -rf $(dirname $0)/lf-updr.sh /usr/bin/lf-updr
|
||||
chmod +x /usr/bin/lf-updr
|
||||
else
|
||||
echo "* Error installing /usr/bin/lf-updr"
|
||||
echo "* File $(dirname $0)/lf-updr not found"
|
||||
echo "* File $(dirname $0)/lf-updr.sh not found"
|
||||
exit 1
|
||||
fi
|
||||
if [ -f "$(dirname $0)/lf-updrd" ] ; then
|
||||
echo "* Installing /usr/sbin/lf-updrd"
|
||||
cp -rf $(dirname $0)/lf-updrd /usr/sbin/lf-updrd
|
||||
chmod +x /usr/sbin/lf-updrd
|
||||
else
|
||||
echo "* Error installing /usr/sbin/lf-updrd"
|
||||
echo "* File $(dirname $0)/lf-updrd not found"
|
||||
exit 1
|
||||
fi
|
||||
if [ -f "$(dirname $0)/lf-updr-install" ] ; then
|
||||
echo "* Installing /usr/bin/lf-updr-install"
|
||||
cp -rf $(dirname $0)/lf-updr-install /usr/bin/lf-updr-install
|
||||
chmod +x /usr/bin/lf-updr-install
|
||||
else
|
||||
echo "* Error installing /usr/bin/lf-updr-install"
|
||||
echo "* File $(dirname $0)/lf-updr-install not found"
|
||||
exit 1
|
||||
fi
|
||||
if [ -f "$(dirname $0)/lf-updr.cron" ] ; then
|
||||
if [ -f "$(dirname $0)/lf-updr" ] ; then
|
||||
echo "* Installing /etc/cron.d/lf-updr"
|
||||
cp -rf $(dirname $0)/lf-updr.cron /etc/cron.d/lf-updr
|
||||
cp -rf $(dirname $0)/lf-updr /etc/cron.d/lf-updr
|
||||
chmod 644 /etc/cron.d/lf-updr
|
||||
else
|
||||
echo "* Error installing /etc/crond./lf-updr"
|
||||
echo "* File $(dirname $0)/lf-updr.cron not found"
|
||||
exit 1
|
||||
fi
|
||||
if [ -f "$(dirname $0)/lf-updrd.service" ] ; then
|
||||
echo "* Installing /etc/systemd/system/lf-updrd.service"
|
||||
cp -rf $(dirname $0)/lf-updrd.service /etc/systemd/system/lf-updrd.service
|
||||
chmod 644 /etc/systemd/system/lf-updrd.service
|
||||
else
|
||||
echo "* Error installing /etc/systemd/system/lf-updrd.service"
|
||||
echo "* File $(dirname $0)/lf-updrd.service not found"
|
||||
echo "* File $(dirname $0)/lf-updr not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
systemctl enable lf-updrd
|
||||
# Run update-initramfs
|
||||
echo "* Running update-initramfs"
|
||||
if [ -x /usr/sbin/update-initramfs ]; then
|
||||
/usr/sbin/update-initramfs -u -k all
|
||||
fi
|
||||
systemctl start lf-updrd
|
||||
|
|
70
lf-updr
Executable file → Normal file
70
lf-updr
Executable file → Normal file
|
@ -1,66 +1,4 @@
|
|||
#!/bin/bash
|
||||
|
||||
####################################
|
||||
# lf-updr - Linux Firmware Updater #
|
||||
# Author: q3aql@duck.com #
|
||||
# License: GPLv2.0 #
|
||||
####################################
|
||||
|
||||
# Repo Linux Firmware
|
||||
repo_firmware="https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git"
|
||||
branch="main"
|
||||
dir_repo="/lib/firmware"
|
||||
|
||||
echo "** lf-updr - Linux Firmware Updater **"
|
||||
echo ""
|
||||
|
||||
# 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
|
||||
|
||||
# Check dependencies
|
||||
path_check="/usr/bin /usr/sbin/ /bin /sbin/ /usr/local/bin $HOME/.local/bin $(brew --prefix 2> /dev/null)/bin"
|
||||
dependencies="git update-initramfs"
|
||||
dependencies_found=""
|
||||
dependencies_not_found=""
|
||||
for checkPath in $path_check ; do
|
||||
for checkDependencies in $dependencies ; do
|
||||
if [ -f $checkPath/$checkDependencies ] ; then
|
||||
dependencies_found="$dependencies_found $checkDependencies"
|
||||
fi
|
||||
done
|
||||
done
|
||||
for notFound in $dependencies ; do
|
||||
check_found_one=$(echo $dependencies_found | grep " $notFound")
|
||||
check_found_two=$(echo $dependencies_found | grep "$notFound ")
|
||||
if_not_found="$check_found_one$check_found_two"
|
||||
if [ -z "$if_not_found" ] ; then
|
||||
dependencies_not_found="$dependencies_not_found $notFound"
|
||||
fi
|
||||
done
|
||||
# Show if all tools are installed
|
||||
if [ -z "$dependencies_not_found" ] ; then
|
||||
echo > /dev/null
|
||||
else
|
||||
echo "* Some required tools are not installed:$dependencies_not_found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Update linux-firmware
|
||||
echo "* Updating linux-firmware"
|
||||
if [ -d ${dir_repo} ] ; then
|
||||
cd ${dir_repo}
|
||||
git pull origin ${branch}
|
||||
fi
|
||||
|
||||
# Run update-initramfs
|
||||
echo "* Running update-initramfs"
|
||||
if [ -x /usr/sbin/update-initramfs ]; then
|
||||
/usr/sbin/update-initramfs -u -k all
|
||||
fi
|
||||
@reboot root /usr/bin/lf-updr
|
||||
0 8 * * * root /usr/bin/lf-updr
|
||||
0 16 * * * root /usr/bin/lf-updr
|
||||
0 0 * * * root /usr/bin/lf-updr
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
#@reboot root /usr/bin/lf-updr
|
||||
#0 8 * * * root /usr/bin/lf-updr
|
||||
#0 16 * * * root /usr/bin/lf-updr
|
||||
#0 0 * * * root /usr/bin/lf-updr
|
|
@ -1,10 +1,10 @@
|
|||
#!/bin/bash
|
||||
|
||||
##############################################
|
||||
# lf-updr - Linux Firmware Updater Installer #
|
||||
# Author: q3aql@duck.com #
|
||||
# License: GPLv2.0 #
|
||||
##############################################
|
||||
####################################
|
||||
# lf-updr - Linux Firmware Updater #
|
||||
# Author: q3aql@duck.com #
|
||||
# License: GPLv2.0 #
|
||||
####################################
|
||||
|
||||
# Repo Linux Firmware
|
||||
repo_firmware="https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git"
|
||||
|
@ -52,20 +52,11 @@ else
|
|||
exit 1
|
||||
fi
|
||||
|
||||
# Install linux-firmware
|
||||
# Update linux-firmware
|
||||
echo "* Updating linux-firmware"
|
||||
if [ -d ${dir_repo} ] ; then
|
||||
echo "* Moving ${dir_repo} to ${dir_repo}.old"
|
||||
rm -rf ${dir_repo}.old
|
||||
mv ${dir_repo} ${dir_repo}.old
|
||||
fi
|
||||
echo "* Cloning linux-firmware to ${dir_repo}"
|
||||
git clone ${repo_firmware} ${dir_repo}
|
||||
error_cloning=$?
|
||||
if [ ${error_cloning} -ne 0 ] ; then
|
||||
echo "* Error: Fail cloning linux-firmware"
|
||||
echo "* Rolling back ${dir_repo}.old"
|
||||
mv ${dir_repo}.old ${dir_repo}
|
||||
exit 1
|
||||
cd ${dir_repo}
|
||||
git pull origin ${branch}
|
||||
fi
|
||||
|
||||
# Run update-initramfs
|
35
lf-updrd
35
lf-updrd
|
@ -1,35 +0,0 @@
|
|||
#!/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
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
[Unit]
|
||||
Description=Daemon for lf-updr
|
||||
After=dbus.service
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/sbin/lf-updrd
|
||||
Type=simple
|
||||
RemainAfterExit=yes
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -22,13 +22,6 @@ fi
|
|||
# Remove files
|
||||
echo "* Removing /usr/bin/lf-updr"
|
||||
rm -rf /usr/bin/lf-updr
|
||||
echo "* Removing /usr/bin/lf-updr-install"
|
||||
rm -rf /usr/bin/lf-updr-install
|
||||
echo "* Removing /etc/cron.d/lf-updr"
|
||||
rm -rf /etc/cron.d/lf-updr
|
||||
echo "* Removing /usr/sbin/lf-updrd"
|
||||
rm -rf /usr/sbin/lf-updrd
|
||||
systemctl disable lf-updrd
|
||||
echo "* Removing /etc/systemd/system/lf-updrd.service"
|
||||
rm -rf /etc/systemd/system/lf-updrd.service
|
||||
echo "* Done"
|
||||
|
|
Loading…
Reference in New Issue
Block a user