cleanup installer
This commit is contained in:
parent
803ab4d10b
commit
d80d9a721a
38
install.sh
38
install.sh
@ -14,7 +14,8 @@ 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/
|
||||||
|
|
||||||
if [[ $? -eq 0 ]];
|
# Download success!
|
||||||
|
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 "░█▀▄░█░░░█░█░█▀▄░█▀▄░█▀▀░█░█"
|
||||||
@ -45,14 +47,18 @@ download_bf() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function check_profile() {
|
function check_profile() {
|
||||||
case "$OSTYPE" in #Different Paths in Windows compared to Linux
|
# Check OSTYPE
|
||||||
msys*) FF_USER_DIRECTORY="$(find "${HOME}AppData\Roaming\Mozilla\firefox" -maxdepth 1 -type d -regextype egrep -regex '.*[a-zA-Z0-9]+.'${1})" ;;
|
case "$OSTYPE" in
|
||||||
*) FF_USER_DIRECTORY="$(find "${HOME}/.mozilla/firefox/" -maxdepth 1 -type d -regextype egrep -regex '.*[a-zA-Z0-9]+.'${1})" ;;
|
msys*)
|
||||||
|
FF_USER_DIRECTORY="$(find "${HOME}AppData\Roaming\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})"
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function print_args() {
|
function print_help() {
|
||||||
echo "Usage:"
|
echo "Usage:"
|
||||||
echo ""
|
echo ""
|
||||||
echo "help - Show this message"
|
echo "help - Show this message"
|
||||||
@ -71,7 +77,7 @@ function print_args() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Check args
|
# Check args
|
||||||
if [[ ! -z "${@}" ]] && [[ ! -z "${1}" ]] ;
|
if [[ ! -z "${@}" ]] && [[ ! -z "${1}" ]];
|
||||||
then
|
then
|
||||||
|
|
||||||
if [[ "${1}" == "dev" ]];
|
if [[ "${1}" == "dev" ]];
|
||||||
@ -96,11 +102,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
|
||||||
@ -109,20 +115,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"
|
||||||
|
|
||||||
@ -135,9 +141,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
|
||||||
@ -145,6 +152,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