From eee1d9147c45c246474ccf608313ef46ca107636 Mon Sep 17 00:00:00 2001 From: qewer33 Date: Fri, 7 Jan 2022 20:06:08 +0300 Subject: [PATCH] Revamp package.sh and use the HOME variable in install.sh --- install.sh | 2 +- package.sh | 27 ++++++++++++++++++++++++--- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/install.sh b/install.sh index f389a4b..675daf0 100755 --- a/install.sh +++ b/install.sh @@ -9,7 +9,7 @@ get_project_id() { } PROJECT_ID=$(get_project_id) -INSTALL_LOCATION="/home/${USER}/.local/share/plasma/plasmoids/" +INSTALL_LOCATION="${HOME}/.local/share/plasma/plasmoids/" echo "Installing ${PROJECT_ID}" diff --git a/package.sh b/package.sh index 0afa474..7e6c08d 100755 --- a/package.sh +++ b/package.sh @@ -1,8 +1,29 @@ #!/usr/bin/env bash -PACKAGE_NAME="ClearClock" +prompt() { + while true; do + echo -e "$1 [y/n]: " + read -r yn + case ${yn} in + [Yy]*) return 0 ;; + [Nn]*) return 1 ;; + esac + done +} + +get_project_name() { + line=$(grep "^Name" package/metadata.desktop) + IFS='=' + read -ra array <<< "${line}" + projectname=${array[1]} + echo ${projectname} +} + +PACKAGE_NAME=$(get_project_name) tar -czvf "${PACKAGE_NAME}.tar.gz" -C "package/" . -git add . -git commit -m "Update package" + +prompt "Do you want to commit and push the changes to the git repository?" && \ +git add . && \ +git commit -m "Update package" && \ git push