fix installation folder

This commit is contained in:
Dyego Aurélio 2020-10-22 20:39:57 -03:00
parent b3ec1cc9c7
commit 1b07537055
1 changed files with 57 additions and 45 deletions

View File

@ -30,23 +30,9 @@ while getopts 'f:p:g:t:h' flag; do
esac esac
done done
# Define profile folder path. function saveProfile(){
if test -z "$PROFILENAME" cd $FIREFOXFOLDER/$PROFILE_PATH
then
PROFILEFOLDER="$FIREFOXFOLDER/$(current_profile)"
else
PROFILEFOLDER="$FIREFOXFOLDER/$PROFILENAME"
fi
# Enter Firefox profile folder.
if ! cd $PROFILEFOLDER ; then
echo "Error entering profile folder."
echo "Try using -p flag to specify a custom profile name."
exit 1
fi
echo "Installing theme in $PWD" echo "Installing theme in $PWD"
# Create a chrome directory if it doesn't exist. # Create a chrome directory if it doesn't exist.
mkdir -p chrome mkdir -p chrome
cd chrome cd chrome
@ -82,4 +68,30 @@ echo "Set configuration user.js file"
ln -fs chrome/firefox-gnome-theme/configuration/user.js user.js ln -fs chrome/firefox-gnome-theme/configuration/user.js user.js
echo "Done." echo "Done."
cd ..
}
PROFILES_FILE="${FIREFOXFOLDER}/profiles.ini"
if [ ! -f "${PROFILES_FILE}" ]; then
>&2 echo "failed, lease check Firefox installation, unable to find profile.ini at ${FIREFOX_DIR}"
exit 1
fi
echo "Profiles file found"
PROFILES_PATHS=($(grep -E "^Path=" "${PROFILES_FILE}" | cut -d "=" -f2-))
if [ ${#PROFILES_PATHS[@]} -eq 0 ]; then
>&2 echo "failed, no profiles found at ${PROFILES_FILE}"
exit 0
elif [ ${#PROFILES_PATHS[@]} -eq 1 ]; then
echo "one profile found"
saveProfile "0" "${PROFILES_PATHS[0]}"
else
echo "${#PROFILES_PATHS[@]} profiles found"
ITEM=0
for PROFILE_PATH in "${PROFILES_PATHS[@]}"; do
saveProfile "${ITEM}" "${PROFILE_PATH}"
ITEM="$((${ITEM}+1))"
done
fi