cleanup installer
This commit is contained in:
parent
1a5d6358bf
commit
fb90753ff6
24
install.sh
24
install.sh
@ -14,6 +14,7 @@ download_bf() {
|
|||||||
|
|
||||||
curl -LJ0 https://github.com/manilarome/blurredfox/archive/master.tar.gz | tar -xz -C /tmp/
|
curl -LJ0 https://github.com/manilarome/blurredfox/archive/master.tar.gz | tar -xz -C /tmp/
|
||||||
|
|
||||||
|
# Download success!
|
||||||
if [[ $? -eq 0 ]];
|
if [[ $? -eq 0 ]];
|
||||||
then
|
then
|
||||||
message "[>>] Copying..."
|
message "[>>] Copying..."
|
||||||
@ -29,11 +30,12 @@ download_bf() {
|
|||||||
rm -rf "/tmp/blurredfox-master"
|
rm -rf "/tmp/blurredfox-master"
|
||||||
else
|
else
|
||||||
message " [!!] There was a problem while copying the files. Terminating..."
|
message " [!!] There was a problem while copying the files. Terminating..."
|
||||||
return 1
|
exit
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
# Download failed
|
||||||
message " [!!] Problem detected while downloading the theme. Terminating..."
|
message " [!!] Problem detected while downloading the theme. Terminating..."
|
||||||
return 1
|
exit
|
||||||
fi
|
fi
|
||||||
echo "░█▀▄░█░░░█░█░█▀▄░█▀▄░█▀▀░█▀▄"
|
echo "░█▀▄░█░░░█░█░█▀▄░█▀▄░█▀▀░█▀▄"
|
||||||
echo "░█▀▄░█░░░█░█░█▀▄░█▀▄░█▀▀░█░█"
|
echo "░█▀▄░█░░░█░█░█▀▄░█▀▄░█▀▀░█░█"
|
||||||
@ -48,7 +50,7 @@ function check_profile() {
|
|||||||
FF_USER_DIRECTORY="$(find "${HOME}/.mozilla/firefox/" -maxdepth 1 -type d -regextype egrep -regex '.*[a-zA-Z0-9]+.'${1})"
|
FF_USER_DIRECTORY="$(find "${HOME}/.mozilla/firefox/" -maxdepth 1 -type d -regextype egrep -regex '.*[a-zA-Z0-9]+.'${1})"
|
||||||
}
|
}
|
||||||
|
|
||||||
function print_args() {
|
function print_help() {
|
||||||
echo "Usage:"
|
echo "Usage:"
|
||||||
echo ""
|
echo ""
|
||||||
echo "help - Show this message"
|
echo "help - Show this message"
|
||||||
@ -67,7 +69,7 @@ function print_args() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Check args
|
# Check args
|
||||||
if [[ ! -z "${@}" ]] && [[ ! -z "${1}" ]] ;
|
if [[ ! -z "${@}" ]] && [[ ! -z "${1}" ]];
|
||||||
then
|
then
|
||||||
|
|
||||||
if [[ "${1}" == "dev" ]];
|
if [[ "${1}" == "dev" ]];
|
||||||
@ -92,11 +94,11 @@ then
|
|||||||
check_profile "default-esr"
|
check_profile "default-esr"
|
||||||
elif [[ "${1}" == "help" ]];
|
elif [[ "${1}" == "help" ]];
|
||||||
then
|
then
|
||||||
print_args
|
print_help
|
||||||
exit
|
exit
|
||||||
else
|
else
|
||||||
echo -ne "Invalid parameter!\n"
|
echo -ne "Invalid parameter!\n"
|
||||||
print_args
|
print_help
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
@ -105,20 +107,20 @@ else
|
|||||||
check_profile "default-release"
|
check_profile "default-release"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -n $FF_USER_DIRECTORY ]];
|
if [[ -n "$FF_USER_DIRECTORY" ]];
|
||||||
then
|
then
|
||||||
message "[>>] Firefox user profile directory located..."
|
message "[>>] Firefox user profile directory located..."
|
||||||
CHROME_DIRECTORY="$(find "$FF_USER_DIRECTORY/" -maxdepth 1 -type d -name 'chrome')"
|
CHROME_DIRECTORY="$(find "$FF_USER_DIRECTORY/" -maxdepth 1 -type d -name 'chrome')"
|
||||||
if [[ -n "$CHROME_DIRECTORY" ]];
|
if [[ -n "$CHROME_DIRECTORY" ]];
|
||||||
then
|
then
|
||||||
# Check if the chrome folder contains files
|
# Check if the chrome folder is not empty
|
||||||
shopt -s nullglob dotglob
|
shopt -s nullglob dotglob
|
||||||
content="${CHROME_DIRECTORY}/"
|
content="${CHROME_DIRECTORY}/"
|
||||||
|
|
||||||
# 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 "[>>] Current chrome folder is not empty. Creating a backup in the same directory..."
|
message "[>>] Existing chrome folder detected! Creating a backup..."
|
||||||
|
|
||||||
backup_dir="${CHROME_DIRECTORY}-backup"
|
backup_dir="${CHROME_DIRECTORY}-backup"
|
||||||
|
|
||||||
@ -131,9 +133,10 @@ then
|
|||||||
mv --backup=t "${CHROME_DIRECTORY}" "${CHROME_DIRECTORY}-backup"
|
mv --backup=t "${CHROME_DIRECTORY}" "${CHROME_DIRECTORY}-backup"
|
||||||
mkdir "${CHROME_DIRECTORY}"
|
mkdir "${CHROME_DIRECTORY}"
|
||||||
fi
|
fi
|
||||||
|
# Download theme
|
||||||
download_bf
|
download_bf
|
||||||
else
|
else
|
||||||
message "[>>] Chrome directory does not exist! Creating one..."
|
message "[>>] Chrome folder does not exist! Creating one..."
|
||||||
mkdir "${FF_USER_DIRECTORY}/chrome"
|
mkdir "${FF_USER_DIRECTORY}/chrome"
|
||||||
|
|
||||||
# Check if backup folder exist
|
# Check if backup folder exist
|
||||||
@ -141,6 +144,7 @@ then
|
|||||||
then
|
then
|
||||||
CHROME_DIRECTORY="${FF_USER_DIRECTORY}/chrome"
|
CHROME_DIRECTORY="${FF_USER_DIRECTORY}/chrome"
|
||||||
|
|
||||||
|
# Download theme
|
||||||
download_bf
|
download_bf
|
||||||
else
|
else
|
||||||
message "[!!] There was a problem creating the directory. Terminating..."
|
message "[!!] There was a problem creating the directory. Terminating..."
|
||||||
|
Reference in New Issue
Block a user