1
0
mirror of https://github.com/horst3180/arc-theme.git synced 2024-10-27 19:04:02 +00:00

1. Re-execute as root, 2. Fail safe remove dirs

1. When not root, automatically re-execute as root instead of exit 1
2. Perform `rm -rf $lightdir $darkerdir $darkdir` only after download of package and extraction completes without error.
This commit is contained in:
Majal 2015-12-05 11:44:06 +08:00
parent d5d7a1c984
commit ed307d68b8

View File

@ -35,7 +35,8 @@ echo -e "\033[1;31m$@\033[0m"
check_root() { check_root() {
if [[ "${EUID}" -ne 0 ]]; then if [[ "${EUID}" -ne 0 ]]; then
show_error "This script has to be run as root" show_error "This script has to be run as root"
exit 1; echo
exec sudo "$0" "$@" # Instead of exit, just re-execute as root
fi fi
} }
@ -80,15 +81,11 @@ check_directories() {
} }
install_theme() { install_theme() {
# Remove current installation
rm -rf $lightdir $darkerdir $darkdir
# Clean tempdir # Clean tempdir
rm -rf $tempdir && mkdir $tempdir && cd $tempdir rm -rf $tempdir && mkdir $tempdir && cd $tempdir
# Get the sources # Get the sources && Remove current installation only if download and unpack are successful
wget $download_url wget $download_url && tar xf master.tar.gz && rm -rf $lightdir $darkerdir $darkdir && cd "$theme_name"-master
tar xf master.tar.gz && cd "$theme_name"-master
# Build and install # Build and install
./autogen.sh --prefix=/usr ./autogen.sh --prefix=/usr