improve install.sh

This commit is contained in:
Gerome Matilla 2020-08-22 06:58:29 +08:00
parent 0a6e1a1840
commit ea34c8aca6

View File

@ -23,14 +23,22 @@ download_bf() {
cp -r "${FF_THEME}"* "${CHROME_DIRECTORY}" cp -r "${FF_THEME}"* "${CHROME_DIRECTORY}"
# Backup user.js instead of overwriting it # Backup user.js instead of overwriting it
if [ -e "${CHROME_DIRECTORY}/user.js" ] if [ -e "${CHROME_DIRECTORY}/../user.js" ]
then then
message "[>>] Backing up user.js to user.js.bak..." message "[>>] Existing user.js detected! Creating backup to user-prefs-backup/..."
cp "${CHROME_DIRECTORY}/user.js" "${CHROME_DIRECTORY}/user.js.bak" user_pref_backup_dir="${CHROME_DIRECTORY}/../user-prefs-backup"
if [[ ! -d "$user_pref_backup_dir" ]];
then
message "[>>] user-prefs-backup/ folder does not exist! Creating..."
mkdir "${CHROME_DIRECTORY}/../user-prefs-backup"
fi
mv --backup=t "${CHROME_DIRECTORY}/../user.js" "${CHROME_DIRECTORY}/../user-prefs-backup/"
fi fi
# Move user.js to the main profile directory # Move user.js to the main profile directory
mv "${CHROME_DIRECTORY}/user.js" "../" mv "${CHROME_DIRECTORY}/user.js" "${CHROME_DIRECTORY}/../"
if [[ $? -eq 0 ]]; if [[ $? -eq 0 ]];
then then
@ -41,7 +49,7 @@ download_bf() {
fi fi
else else
# Download failed # Download failed
message " [!!] Problem detected while downloading the theme. Terminating..." message " [!!] There was a problem while downloading the theme. Terminating..."
exit exit
fi fi
echo "░█▀▄░█░░░█░█░█▀▄░█▀▄░█▀▀░█▀▄" echo "░█▀▄░█░░░█░█░█▀▄░█▀▄░█▀▀░█▀▄"