voidrice/.local/bin/arkenfox-auto-update
appeasementPolitik f26e5678e6
Fix arkenfox pacman hook complaining about root (#1351)
The previous pull request on LARBS turned out not to work, so make sure `arkenfox-auto-update` runs `arkenfox-update` as the user of the firefox profile. Otherwise it complains that it's running as root and stops.

The way of getting the username is safe, because it gets the username from the owner of the user.js file of that profile.
2023-08-18 12:20:05 +00:00

23 lines
691 B
Bash
Executable file

#!/bin/sh
# A wrapper for the arkenfox-updater that runs it on all pre-existing Arkenfox
# user.js files on the machine.
# On installation of LARBS, this file is copied to /usr/local/lib/ where it is
# run by a pacman hook set up. The user should not have to run this manually.
# Search for all Firefox and Librewolf profiles using Arkenfox.
profiles="$(grep -sH "arkenfox user.js" \
/home/*/.librewolf/*.default-release/user.js \
/home/*/.mozilla/firefox/*.default-release/user.js)"
IFS='
'
# Update each found profile.
for profile in $profiles; do
userjs=${profile%%/user.js*}
user=$(stat -c '%U' "$userjs") || continue
su -l "$user" -c "arkenfox-updater -c -p $userjs -s"
done