You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
69 lines
2.6 KiB
69 lines
2.6 KiB
#!/usr/bin/env sh
|
|
|
|
# ©2021 Brainwrecked Tech
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation, either version 2 of the License, or
|
|
# (at your option) any later version.
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
|
|
# For a copy of this license, see <https://www.gnu.org/licenses/>.
|
|
|
|
[ -z ${1+x} ] && APPS_DIR="." || APPS_DIR="${1}"
|
|
|
|
FOUNDDTF=()
|
|
|
|
while IFS= read -r -d $'\0'; do
|
|
FOUNDDTF+=("${REPLY#./}")
|
|
done < <(find "${APPS_DIR}" -type f -name '*.desktop' -print0)
|
|
|
|
for DSKTPFIL in "${FOUNDDTF[@]}"
|
|
do
|
|
echo "${DSKTPFIL}"
|
|
|
|
WAPPNAME="${DSKTPFIL%.desktop}"
|
|
WAPPNAME="${WAPPNAME%.proxy}"
|
|
|
|
ICONFILE="$(grep '^Icon=' "${DSKTPFIL}" | cut -d= -f2)"
|
|
if [ -e "${ICONFILE}" ]; then
|
|
printf -- '\e[1;32m:: Icon file %s exists\e[0m\n' "${ICONFILE}"
|
|
else
|
|
printf -- '\e[1;31m:: Icon file %s missing\e[0m\n' "${ICONFILE}"
|
|
fi
|
|
|
|
FFCACHE="/run/user/1001/${WAPPNAME}-ssb"
|
|
if [ -e "${FFCACHE}" ]; then
|
|
printf -- '\e[1;32m:: Firefox cache directory %s exists\e[0m\n' "${FFCACHE}"
|
|
else
|
|
printf -- '\e[1;31m:: Firefox cache directory %s missing. Create it? [Y/n] ' "${FFCACHE}"
|
|
read FIXIT
|
|
if [ ! "${FIXIT,,}" = "n" ]; then
|
|
mkdir -p "/run/user/${UID}/${WAPPNAME}-ssb"
|
|
printf -- '\e[1;32m:: Fixed missing Firefox cache directory.\e[0m\n'
|
|
fi
|
|
fi
|
|
|
|
FFPF_DIR="$(find "${HOME}/.mozilla/firefox" -type d -name '*'."${WAPPNAME}-ssb")"
|
|
if [ -n "${FFPF_DIR}" ]; then
|
|
printf -- '\e[1;32m:: Firefox profile %s exists\e[0m\n' "${FFPF_DIR}"
|
|
else
|
|
printf -- '\e[1;31m:: Firefox profile %s/.mozilla/firefox/????????.%s-ssb missing. Create it? [Y/n] ' "${HOME}" "${WAPPNAME}"
|
|
read FIXIT
|
|
if [ ! "${FIXIT,,}" = "n" ]; then
|
|
/usr/bin/firefox -CreateProfile "${WAPPNAME,,}-ssb" -no-remote
|
|
FFPF_DIR="$(find "${HOME}/.mozilla/firefox" -type d -name '*'."${WAPPNAME,,}-ssb")"
|
|
echo 'user_pref("browser.cache.disk.parent_directory", "/run/user/'"${UID}"'/'"${WAPPNAME}"'-ssb");' >> "${FFPF_DIR}/user.js"
|
|
echo 'user_pref("browser.ssb.enabled", true);' >> "${FFPF_DIR}/user.js"
|
|
echo 'user_pref("extensions.pocket.enabled", false);' >> "${FFPF_DIR}/user.js"
|
|
echo 'user_pref("privacy.donottrackheader.enabled", true);' >> "${FFPF_DIR}/user.js"
|
|
printf -- '\e[1;32m:: Fixed missing Firefox profile %s.\e[0m\n' "${FFPF_DIR}"
|
|
fi
|
|
fi
|
|
|
|
done
|