diff options
author | marlonivo <email@marlonivo.xyz> | 2024-08-12 01:22:17 +0000 |
---|---|---|
committer | marlonivo <email@marlonivo.xyz> | 2024-08-12 01:22:17 +0000 |
commit | 36adc787ee5750eb79fe59b4f55a8d86c775c21b (patch) | |
tree | c6aac8101867f032c4d9bc3f8dab04682382ca32 | |
parent | a001a9f4eafc78aaba2426d5cc1fd00dcaaa7a0c (diff) |
update
-rw-r--r-- | install.sh | 44 | ||||
-rw-r--r-- | makefile | 54 |
2 files changed, 54 insertions, 44 deletions
diff --git a/install.sh b/install.sh deleted file mode 100644 index bf83876..0000000 --- a/install.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/sh - -# Autobootstrap Script for unifox.js -# by Marlon Ivo <email@marlonivo.xyz> -# License: GNU GPLv3 - -### OPTIONS AND VARIABLES ### - -dotfilesrepo="https://github.com/marlonivo/ricebowl.git" -progsfile="https://raw.githubusercontent.com/LukeSmithxyz/LARBS/master/static/progs.csv" -aurhelper="yay" -repobranch="master" -export TERM=ansi - -### Copying addons.json, pref.js, userChrome and userContent.css -mkdir -p ~/.mozilla/firefox/*.default-release/chrome -mkdir -p ~/.mozilla/firefox/*.default-release/chrome/img -cp -r chrome ~/.mozilla/firefox/*.default-release/ -cp prefs.js ~/.mozilla/firefox/*.default-release/ -cp addons.json ~/.mozilla/firefox/*.default-release/ - - -### INSTALLING AND CONFIGURING ADDONS -installffaddons(){ - addonlist="ublock-origin decentraleyes istilldontcareaboutcookies vimimium-c" - 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 - if [ "$addon" = "ublock-origin" ]; then - addonurl="$(curl -sL https://api.github.com/repos/gorhill/uBlock/releases/latest | grep -E 'browser_download_url.*\.firefox\.xpi' | cut -d '"' -f 4)" - else - addonurl="$(curl --silent "https://addons.mozilla.org/en-US/firefox/addon/${addon}/" | grep -o 'https://addons.mozilla.org/firefox/downloads/file/[^"]*')" - fi - file="${addonurl##*/}" - sudo -u "$name" curl -LOs "$addonurl" > "$addontmp/$file" - id="$(unzip -p "$file" manifest.json | grep "\"id\"")" - id="${id%\"*}" - id="${id##*\"}" - mv "$file" "$pdir/extensions/$id.xpi" - done - chown -R "$name:$name" "$pdir/extensions" -} diff --git a/makefile b/makefile new file mode 100644 index 0000000..fbb43ea --- /dev/null +++ b/makefile @@ -0,0 +1,54 @@ +# Makefile für das unifox.js Projekt + +# Variablen +PROFILE_NAME="unifox" +PROFILE_DIR="$(HOME)/.mozilla/firefox" + +# Ziel: alles +all: setup + +# Ziel: setup +setup: + # Neues Profil erstellen + firefox -CreateProfile "$(PROFILE_NAME)" + + # Pfad des neuen Profils ermitteln + NEW_PROFILE_PATH=$(shell grep -oP "(?<=^Path=).*$" "$(PROFILE_DIR)/profiles.ini" | grep "$(PROFILE_NAME)") + + # Notwendige Verzeichnisse erstellen + mkdir -p "$(PROFILE_DIR)/$(NEW_PROFILE_PATH)/chrome" + mkdir -p "$(PROFILE_DIR)/$(NEW_PROFILE_PATH)/chrome/img" + + # Konfigurationsdateien kopieren + cp -r chrome "$(PROFILE_DIR)/$(NEW_PROFILE_PATH)/" + cp prefs.js "$(PROFILE_DIR)/$(NEW_PROFILE_PATH)/" + cp addons.json "$(PROFILE_DIR)/$(NEW_PROFILE_PATH)/" + + # Add-ons installieren und konfigurieren + @$(MAKE) install_addons + + # Hintergrundbild kopieren + cp /path/to/custom/background.png "$(PROFILE_DIR)/$(NEW_PROFILE_PATH)/chrome/img/background.png" + + # Finale Konfiguration + echo "user_pref('toolkit.legacyUserProfileCustomizations.stylesheets', true);" >> "$(PROFILE_DIR)/$(NEW_PROFILE_PATH)/prefs.js" + + @echo "Firefox setup for profile $(PROFILE_NAME) completed." + +# Ziel: Add-ons installieren +install_addons: + ADDON_LIST="ublock-origin decentraleyes istilldontcareaboutcookies vimimium-c" + ADDON_TMP="$(shell mktemp -d)" + trap "rm -fr $$ADDON_TMP" HUP INT QUIT TERM PWR EXIT + for ADDON in $$ADDON_LIST; do \ + if [ "$$ADDON" = "ublock-origin" ]; then \ + ADDON_URL="$$($(shell curl -sL https://api.github.com/repos/gorhill/uBlock/releases/latest | grep -E 'browser_download_url.*\.firefox\.xpi' | cut -d '"' -f 4))"; \ + else \ + ADDON_URL="$$($(shell curl --silent "https://addons.mozilla.org/en-US/firefox/addon/$$ADDON/" | grep -o 'https://addons.mozilla.org/firefox/downloads/file/[^"]*'))"; \ + fi \ + FILE="$$($(shell basename "$$ADDON_URL"))"; \ + curl -LOs "$$ADDON_URL" -o "$$ADDON_TMP/$$FILE"; \ + ID="$$($(shell unzip -p "$$ADDON_TMP/$$FILE" manifest.json | grep "\"id\""))"; \ + ID="$$($(shell echo "$$ID" | sed 's/\"//g'))"; \ + mv "$$ADDON_TMP/$$FILE" "$(PROFILE_DIR)/$(NEW_PROFILE_PATH)/extensions/$$ID.xpi"; \ + done |