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