improve install.sh part 2

This commit is contained in:
Gerome Matilla 2020-08-22 07:08:23 +08:00
parent ea34c8aca6
commit 6b1da451c8

View File

@ -28,13 +28,13 @@ download_bf() {
message "[>>] Existing user.js detected! Creating backup to user-prefs-backup/..." message "[>>] Existing user.js detected! Creating backup to user-prefs-backup/..."
user_pref_backup_dir="${CHROME_DIRECTORY}/../user-prefs-backup" user_pref_backup_dir="${CHROME_DIRECTORY}/../user-prefs-backup"
if [[ ! -d "$user_pref_backup_dir" ]]; if [[ ! -d "${user_pref_backup_dir}" ]];
then then
message "[>>] user-prefs-backup/ folder does not exist! Creating..." message "[>>] user-prefs-backup/ folder does not exist! Creating..."
mkdir "${CHROME_DIRECTORY}/../user-prefs-backup" mkdir "${user_pref_backup_dir}"
fi fi
mv --backup=t "${CHROME_DIRECTORY}/../user.js" "${CHROME_DIRECTORY}/../user-prefs-backup/" mv --backup=t "${CHROME_DIRECTORY}/../user.js" "${user_pref_backup_dir}"
fi fi
# Move user.js to the main profile directory # Move user.js to the main profile directory
@ -135,17 +135,17 @@ then
# If there's a current theme, make a backup # If there's a current theme, make a backup
if [ ${#content[@]} -gt 0 ]; if [ ${#content[@]} -gt 0 ];
then then
message "[>>] Existing chrome folder detected! Creating a backup..." message "[>>] Existing chrome folder detected! Creating a backup to chrome-backup/..."
backup_dir="${CHROME_DIRECTORY}-backup" backup_dir="${CHROME_DIRECTORY}-backup"
# Create backup folder # Create backup folder
if [[ ! -d "${backup_dir}" ]]; if [[ ! -d "${backup_dir}" ]];
then then
message "[>>] chrome-backup/ folder does not exist! Creating..."
mkdir "${backup_dir}" mkdir "${backup_dir}"
fi fi
mv --backup=t "${CHROME_DIRECTORY}" "${CHROME_DIRECTORY}-backup" mv --backup=t "${CHROME_DIRECTORY}" "${backup_dir}"
mkdir "${CHROME_DIRECTORY}" mkdir "${CHROME_DIRECTORY}"
fi fi
# Download theme # Download theme
@ -162,7 +162,7 @@ then
# Download theme # Download theme
download_bf download_bf
else else
message "[!!] There was a problem creating the directory. Terminating..." message "[!!] There was a problem while creating the directory. Terminating..."
exit 1; exit 1;
fi fi
fi fi