From 184235d01e8985b4c627c5e98fc208e1ea89f58f Mon Sep 17 00:00:00 2001 From: Mentor Date: Sun, 18 Sep 2022 21:49:06 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20platypus=20draft?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + battery.sh | 7 ++++++- platypus.sh | 8 ++++++++ setup.sh | 16 +++++++++++----- 4 files changed, 26 insertions(+), 6 deletions(-) create mode 100644 .gitignore create mode 100644 platypus.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7234299 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.app \ No newline at end of file diff --git a/battery.sh b/battery.sh index 47e2faf..a44e48a 100644 --- a/battery.sh +++ b/battery.sh @@ -75,6 +75,7 @@ $( whoami ) ALL = NOPASSWD: BATTERYON # Get parameters action=$1 setting=$2 +platypus=$3 ## ############### ## Helpers @@ -82,7 +83,11 @@ setting=$2 function log() { - echo -e "$(date +%T) - $1" + if [ -z "$platypus" ]; then + echo -e "$(date +%T) - $1" + else + echo -e "$1" + fi } diff --git a/platypus.sh b/platypus.sh new file mode 100644 index 0000000..69b7739 --- /dev/null +++ b/platypus.sh @@ -0,0 +1,8 @@ +#!/bin/sh +binfolder=/usr/local/bin + +# Install/update on application open +bash ./setup.sh "true" + +# Run battery maintain at default percentage +$binfolder/battery maintain 80 "true" diff --git a/setup.sh b/setup.sh index 9e3204a..7ca7b59 100644 --- a/setup.sh +++ b/setup.sh @@ -1,10 +1,14 @@ #!/bin/bash +platypus=$1 + # User welcome message -echo -e "\n####################################################################" -echo '# šŸ‘‹ Welcome, this is the setup script for the battery CLI tool.' -echo -e "# Note: this script will ask for your password once or multiple times." -echo -e "####################################################################\n\n" +if [ -z "$platypus" ]; then + echo -e "\n####################################################################" + echo '# šŸ‘‹ Welcome, this is the setup script for the battery CLI tool.' + echo -e "# Note: this script will ask for your password once or multiple times." + echo -e "####################################################################\n\n" +fi # Ask for sudo once, in most systems this will cache the permissions for a bit sudo echo "šŸ”‹ Starting battery installation" @@ -44,4 +48,6 @@ echo "[ 7/8 ] Removing temp folder $tempfolder" rm -rf $tempfolder echo "[ 8/8 ] Removed temporary build files" -echo -e "\nšŸŽ‰ Battery tool installed. Type \"battery\" for instructions.\n" +if [ -z "$platypus" ]; then + echo -e "\nšŸŽ‰ Battery tool installed. Type \"battery\" for instructions.\n" +fi \ No newline at end of file