Updater now has root and user phases.

This commit is contained in:
Scott Duensing 2025-06-08 17:20:50 -05:00
parent da0342c486
commit 8952696c5f

View file

@ -71,11 +71,10 @@ function configureMachine() {
### THIS IS TOTALLY NOT A SECURE WAY TO UPDATE ANYTHING! ###
###
echo "Waiting for network."
while [ "$(hostname -I)" = "" ]; do
while [ "\$(hostname -I)" = "" ]; do
sleep 1
done
sleep 3
if [[ ${EUID} -eq 0 ]]; then
if [[ "\${1}x" == "rootx" ]]; then
if [[ -f unsafe-update-payload.sh ]]; then
source unsafe-update-payload.sh
unsafeUpdateRoot
@ -89,15 +88,16 @@ function configureMachine() {
source unsafe-update-payload.sh
unsafeUpdate
fi
./unsafe-update-root.sh.x
./unsafe-update-root.sh.x root
fi
UPDATE
chmod +x /home/${USER}/unsafe-update.sh
# Compile root update script so it can be suid.
shc -S -f /home/${USER}/unsafe-update.sh
cp -f /home/${USER}/unsafe-update.sh.x /home/${USER}/unsafe-update-root.sh.x
mv -f /home/${USER}/unsafe-update.sh.x /home/${USER}/unsafe-update-root.sh.x
sudo chown root:root /home/${SUDO_USER}/unsafe-update-root.sh.x
sudo chmod u+s /home/${SUDO_USER}/unsafe-update-root.sh.x
rm /home/${USER}/unsafe-update-root.sh.x.c
rm /home/${USER}/unsafe-update.sh.x.c
# Add auto update icon to autostart.
cat <<- ICON > /home/${USER}/.config/autostart/AutoUpdate.desktop
@ -106,7 +106,7 @@ function configureMachine() {
Type=Application
Name=Auto Update
Comment=Duensing Digital Client Auto Update
Exec=/home/${USER}/unsafe-update.sh.x
Exec=/home/${USER}/unsafe-update.sh
Icon=mintupdate-type-backport
Path=/home/${USER}
Terminal=true