arkenfox.js and add-ons by default

This commit is contained in:
Luke Smith 2023-01-18 21:46:24 -05:00
parent cf1130b20f
commit 2077c372e3

View file

@ -192,6 +192,7 @@ putgitrepo() {
}
vimplugininstall() {
# TODO remove shortcuts error message
# Installs vim plugins.
whiptail --infobox "Installing neovim plugins..." 7 60
mkdir -p "/home/$name/.config/nvim/autoload"
@ -200,6 +201,36 @@ vimplugininstall() {
sudo -u "$name" nvim -c "PlugInstall|q|q"
}
makeuserjs(){
arkenfox="$pdir/arkenfox.js"
larbs="/home/$name/.config/firefox/larbs.js"
userjs="$pdir/user.js"
[ ! -f "$arkenfox" ] && curl -sL "https://raw.githubusercontent.com/arkenfox/user.js/master/user.js" > "$arkenfox"
cat "$arkenfox" "$larbs" > "$userjs"
chown "$name:wheel" "$arkenfox" "$userjs"
}
installffaddons(){
addontmp="$(mktemp -d)"
trap "rm -fr $addontmp" HUP INT QUIT TERM PWR EXIT
IFS='
'
sudo -u "$name" mkdir -p "$pdir/extensions/"
for addon in $addonlist; do
file="${addon##*/}"
sudo -u "$name" curl -LOs "$addon" > "$addontmp/$file"
id="$(unzip -p "$file" manifest.json | grep "\"id\"")"
id="${id%\"*}"
id="${id##*\"}"
sudo -u "$name" mv "$file" "$pdir/extensions/$id.xpi"
done
# Fix a Vim Vixen bug with dark mode not fixed on upstream:
sudo -u "$name" mkdir -p "$pdir/chrome"
[ ! -f "$pdir/chrome/userContent.css" ] && sudo -u "$name" echo ".vimvixen-console-frame {
color-scheme: light !important;
}" > "$pdir/chrome/userContent.css"
}
finalize() {
whiptail --title "All done!" \
--msgbox "Congrats! Provided there were no hidden errors, the script completed successfully and all the programs and configuration files should be in place.\\n\\nTo run the new graphical environment, log out and log back in as your new user, then run the command \"startx\" to start the graphical environment (it will start automatically in tty1).\\n\\n.t Luke" 13 80
@ -299,6 +330,31 @@ echo "export \$(dbus-launch)" >/etc/profile.d/dbus.sh
Option "Tapping" "on"
EndSection' >/etc/X11/xorg.conf.d/40-libinput.conf
# All this below to get Librefox installed with add-ons and non-bad settings.
whiptail --infobox "Setting browser privacy settings and add-ons..." 7 60
addonlist="https://addons.mozilla.org/firefox/downloads/file/3929378/ublock_origin-1.42.0-an+fx.xpi
https://addons.mozilla.org/firefox/downloads/file/3902154/decentraleyes-2.0.17.xpi
https://addons.mozilla.org/firefox/downloads/file/4035245/istilldontcareaboutcookies-1.1.0.xpi
https://addons.mozilla.org/firefox/downloads/file/3845233/vim_vixen-1.2.3-an+fx.xpi"
browserdir="/home/$name/.librewolf"
profilesini="$browserdir/profiles.ini"
# Start librewolf headless so it generates a profile. Then get that profile in a variable.
sudo -u "$name" librewolf --headless >/dev/null 2>&1 &
sleep 1
profile="$(sed -n "/Default=.*.default-release/ s/.*=//p" "$profilesini")"
pdir="$browserdir/$profile"
[ -d "$pdir" ] && makeuserjs
[ -d "$pdir" ] && installffaddons
# Kill the now unnecessary librewolf instance.
pkill -u "$name" librewolf
# Allow wheel users to sudo with password and allow several system commands
# (like `shutdown` to run without password).
echo "%wheel ALL=(ALL:ALL) ALL" >/etc/sudoers.d/00-larbs-wheel-can-sudo
@ -307,4 +363,3 @@ echo "Defaults editor=/usr/bin/nvim" >/etc/sudoers.d/02-larbs-visudo-editor
# Last message! Install complete!
finalize
#clear