diff options
author | Majal | 2015-12-05 11:44:06 +0800 |
---|---|---|
committer | Majal | 2015-12-05 11:44:06 +0800 |
commit | ed307d68b8df0b3d3e9b6a4e32c5295d0a0a4061 (patch) | |
tree | a3855c468d641f0fce111db2b9f5ccc59da38aa2 /arc-theme-upgrade | |
parent | d5d7a1c9846de77f064feff3c712fb0eed9a8307 (diff) | |
download | solarc-theme-ed307d68b8df0b3d3e9b6a4e32c5295d0a0a4061.tar.gz solarc-theme-ed307d68b8df0b3d3e9b6a4e32c5295d0a0a4061.tar.xz solarc-theme-ed307d68b8df0b3d3e9b6a4e32c5295d0a0a4061.zip |
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.
Diffstat (limited to 'arc-theme-upgrade')
-rwxr-xr-x | arc-theme-upgrade | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/arc-theme-upgrade b/arc-theme-upgrade index 3571bb5..ce475b0 100755 --- a/arc-theme-upgrade +++ b/arc-theme-upgrade @@ -35,7 +35,8 @@ echo -e "\033[1;31m$@\033[0m" check_root() { if [[ "${EUID}" -ne 0 ]]; then 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 } @@ -80,15 +81,11 @@ check_directories() { } install_theme() { - # Remove current installation - rm -rf $lightdir $darkerdir $darkdir - # Clean tempdir rm -rf $tempdir && mkdir $tempdir && cd $tempdir - # Get the sources - wget $download_url - tar xf master.tar.gz && cd "$theme_name"-master + # Get the sources && Remove current installation only if download and unpack are successful + wget $download_url && tar xf master.tar.gz && rm -rf $lightdir $darkerdir $darkdir && cd "$theme_name"-master # Build and install ./autogen.sh --prefix=/usr |