diff options
Diffstat (limited to 'install.sh')
-rwxr-xr-x | install.sh | 36 |
1 files changed, 7 insertions, 29 deletions
@@ -34,11 +34,10 @@ case $1 in ;; *) - echo "Usage: $0 <install-mode> [<version>] [<systemd-service>]" + echo "Usage: $0 <install-mode> [<version>]" echo " <install-mode>: (string) 'user' installs to '~/.local/bin/', 'system' installs to '/usr/local/bin'" - echo " <version>: (string) defaults to 'latest' which will determinate the latest tag from git or specified branch/tag" - echo " <systemd-service>: (boolean) defaults to 'false' - Whether to copy and enable system-service" - echo -e "\nPlease note: The order of the parameters *is* relevant, if you want to set '<system-service>' you need to specify '<version>' as well!" + echo " <version>: (string) defaults to local, which will install from the local copy of the repo. Use 'latest', which will discard any change made locally and update the repo" + echo -e "\nPlease note: The order of the parameters *is* relevant." exit 1 ;; esac @@ -70,37 +69,16 @@ done echof ok "done!" VERSION=$2 -if [[ $VERSION == "" ]] || [[ $VERSION == "latest" ]]; then - echof info "Determinate latest release... " - VERSION=$(git describe --tags "$(git rev-list --tags --max-count=1)") +if [[ $VERSION == "latest" ]]; then + echof info "Updating the repo" + git restore . + git clone --no-rebase echof ok "done! ($VERSION)" fi - -BLI_TEMP_DIR=$(mktemp -d) - -git clone -b "$VERSION" https://github.com/betterlockscreen/betterlockscreen "$BLI_TEMP_DIR" &>/dev/null -cd "$BLI_TEMP_DIR" || exit 1 - echof info "Installing Betterlockscreen to '$BL_INSTALL_DIR'... " cp betterlockscreen "$BL_INSTALL_DIR" echof ok "done!" -if [[ $3 == "true" ]]; then - SYSTEMD_SERVICE_DIR="/usr/lib/systemd/system" - - echof info "Installing/enable sytemd-service... " - - if [[ ! -w $SYSTEMD_SERVICE_DIR ]]; then - echof error "\nUnable to write to '$SYSTEMD_SERVICE_DIR'!" - exit 1 - fi - - cp system/betterlockscreen@.service $SYSTEMD_SERVICE_DIR - systemctl enable betterlockscreen@"$USER" - - echof ok "done!" -fi - if [[ $PATH != *"$BL_INSTALL_DIR"* ]]; then echof error "Please ensure to add 'export PATH=\"\$PATH:/home/\$USER/.local/bin\"' to your shell-config!\033[0m" fi |