From ba86818bebc708e164becb7858d01993d38fa0a2 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Tue, 18 Jul 2023 09:49:09 +0200 Subject: [PATCH 01/22] GitHub Action to test the install process --- .github/workflows/test_install.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .github/workflows/test_install.yml diff --git a/.github/workflows/test_install.yml b/.github/workflows/test_install.yml new file mode 100644 index 0000000..10a91fa --- /dev/null +++ b/.github/workflows/test_install.yml @@ -0,0 +1,19 @@ +name: test_install +on: + pull_request: + branches: [master] + push: + branches: [master] +jobs: + test_install: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: 3.x + cache: 'pip' + - run: pip install --upgrade pip + - run: pwd + - run: ls -hal + - run: echo "1\n" | ./install.sh From da0fd466ed52e2b80e920565eb9b0963cccf4ccf Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Tue, 18 Jul 2023 09:53:41 +0200 Subject: [PATCH 02/22] TERM: "whatever" --- .github/workflows/test_install.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test_install.yml b/.github/workflows/test_install.yml index 10a91fa..781e625 100644 --- a/.github/workflows/test_install.yml +++ b/.github/workflows/test_install.yml @@ -16,4 +16,6 @@ jobs: - run: pip install --upgrade pip - run: pwd - run: ls -hal - - run: echo "1\n" | ./install.sh + - env: + TERM: "whatever" + run: echo "1\n" | ./install.sh From 483fb42740a24e26b24f359f61dc5850897814b3 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Tue, 18 Jul 2023 09:55:58 +0200 Subject: [PATCH 03/22] TERM: "linux" --- .github/workflows/test_install.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_install.yml b/.github/workflows/test_install.yml index 781e625..06fed58 100644 --- a/.github/workflows/test_install.yml +++ b/.github/workflows/test_install.yml @@ -17,5 +17,5 @@ jobs: - run: pwd - run: ls -hal - env: - TERM: "whatever" + TERM: "linux" run: echo "1\n" | ./install.sh From 7646ee3a6fc298618373650b44252ea6c01bbc42 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Tue, 18 Jul 2023 09:57:21 +0200 Subject: [PATCH 04/22] echo "1\n" | sudo ./install.sh --- .github/workflows/test_install.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_install.yml b/.github/workflows/test_install.yml index 06fed58..0879b6c 100644 --- a/.github/workflows/test_install.yml +++ b/.github/workflows/test_install.yml @@ -18,4 +18,4 @@ jobs: - run: ls -hal - env: TERM: "linux" - run: echo "1\n" | ./install.sh + run: echo "1\n" | sudo ./install.sh From f21b8e2047c7a356f4e5c56574c82276d5274414 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Tue, 18 Jul 2023 10:00:29 +0200 Subject: [PATCH 05/22] echo "\n1\n" | sudo ./install.sh --- .github/workflows/test_install.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_install.yml b/.github/workflows/test_install.yml index 0879b6c..33f8ac1 100644 --- a/.github/workflows/test_install.yml +++ b/.github/workflows/test_install.yml @@ -18,4 +18,4 @@ jobs: - run: ls -hal - env: TERM: "linux" - run: echo "1\n" | sudo ./install.sh + run: echo "\n1\n" | sudo ./install.sh From e6f0e39f77ae58d5dae8decadabbde0b65e93e27 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Tue, 18 Jul 2023 10:04:07 +0200 Subject: [PATCH 06/22] echo -e "\n1\n1\n1\n" | sudo ./install.sh --- .github/workflows/test_install.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test_install.yml b/.github/workflows/test_install.yml index 33f8ac1..778fc76 100644 --- a/.github/workflows/test_install.yml +++ b/.github/workflows/test_install.yml @@ -14,8 +14,7 @@ jobs: python-version: 3.x cache: 'pip' - run: pip install --upgrade pip - - run: pwd - - run: ls -hal + - run: pwd && ls -hal - env: TERM: "linux" - run: echo "\n1\n" | sudo ./install.sh + run: echo -e "\n1\n1\n1\n" | sudo ./install.sh From 90eb7f2980f6054e997fc1af21923e53338b0a0c Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Tue, 18 Jul 2023 10:10:44 +0200 Subject: [PATCH 07/22] choice=$1 --- install.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 844f4e9..1fd60e3 100755 --- a/install.sh +++ b/install.sh @@ -50,7 +50,10 @@ echo -e "${WHITE} [2] Arch Linux (pacman)" # added arch linux suppo echo -e "${WHITE} [0] Exit " echo -e "${COLOR}┌──($USER㉿$HOST)-[$(pwd)]" -read -p "└─$>>" choice +choice=$1 +if [[ $choice =~ ^[1-2]+$ ]]; then + read -p "└─$>>" choice +fi # Define installation directories From 78c57596bac33db2563091cea8a7284fea7705a5 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Tue, 18 Jul 2023 10:13:27 +0200 Subject: [PATCH 08/22] sudo ./install.sh 1 --- .github/workflows/test_install.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test_install.yml b/.github/workflows/test_install.yml index 778fc76..a6f7d45 100644 --- a/.github/workflows/test_install.yml +++ b/.github/workflows/test_install.yml @@ -15,6 +15,8 @@ jobs: cache: 'pip' - run: pip install --upgrade pip - run: pwd && ls -hal - - env: - TERM: "linux" - run: echo -e "\n1\n1\n1\n" | sudo ./install.sh + # How can we pipe in responses to `read` prompts? + #- env: + # TERM: "linux" + # run: echo -e "\n1\n1\n1\n" | sudo ./install.sh + - run: sudo ./install.sh 1 From 173c18570fab9efbdcdd1dd27e662daf3c993835 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Tue, 18 Jul 2023 10:27:31 +0200 Subject: [PATCH 09/22] if [[ ! $choice =~ ^[1-2]+$ ]]; then --- install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index 1fd60e3..c9f1d03 100755 --- a/install.sh +++ b/install.sh @@ -51,11 +51,11 @@ echo -e "${WHITE} [0] Exit " echo -e "${COLOR}┌──($USER㉿$HOST)-[$(pwd)]" choice=$1 -if [[ $choice =~ ^[1-2]+$ ]]; then +echo "choice is $choice" +if [[ ! $choice =~ ^[1-2]+$ ]]; then read -p "└─$>>" choice fi - # Define installation directories install_dir="/usr/share/hackingtool" bin_dir="/usr/bin" From 27c6941795687af0672158b1996b59556ca196c5 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Tue, 18 Jul 2023 10:34:31 +0200 Subject: [PATCH 10/22] Update test_install.yml --- .github/workflows/test_install.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test_install.yml b/.github/workflows/test_install.yml index a6f7d45..e303003 100644 --- a/.github/workflows/test_install.yml +++ b/.github/workflows/test_install.yml @@ -19,4 +19,6 @@ jobs: #- env: # TERM: "linux" # run: echo -e "\n1\n1\n1\n" | sudo ./install.sh - - run: sudo ./install.sh 1 + - env: + TERM: "linux" + run: sudo ./install.sh 1 From 0e0b8fac6cbd7cfa26af9be1b22c3f0eeb905a57 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Tue, 18 Jul 2023 10:46:09 +0200 Subject: [PATCH 11/22] Update test_install.yml --- .github/workflows/test_install.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test_install.yml b/.github/workflows/test_install.yml index e303003..f73089e 100644 --- a/.github/workflows/test_install.yml +++ b/.github/workflows/test_install.yml @@ -7,6 +7,8 @@ on: jobs: test_install: runs-on: ubuntu-latest + env: + TERM: "linux" steps: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 @@ -16,9 +18,8 @@ jobs: - run: pip install --upgrade pip - run: pwd && ls -hal # How can we pipe in responses to `read` prompts? - #- env: - # TERM: "linux" # run: echo -e "\n1\n1\n1\n" | sudo ./install.sh - - env: - TERM: "linux" - run: sudo ./install.sh 1 + - run: sudo ./install.sh 1 + - run: pwd && ls -hal + # `2` should use the default path /home/hackingtool/ + - run: echo "2\n" | hackingtool From 0c64994bdb936d5d5cb4e306cd0e1505c42ebc76 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Tue, 18 Jul 2023 10:53:50 +0200 Subject: [PATCH 12/22] skip ci --- install.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/install.sh b/install.sh index c9f1d03..59abb13 100755 --- a/install.sh +++ b/install.sh @@ -51,7 +51,6 @@ echo -e "${WHITE} [0] Exit " echo -e "${COLOR}┌──($USER㉿$HOST)-[$(pwd)]" choice=$1 -echo "choice is $choice" if [[ ! $choice =~ ^[1-2]+$ ]]; then read -p "└─$>>" choice fi From 952e737279ca6e8d9424ea71cdcdadea39a30c89 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Tue, 18 Jul 2023 10:55:33 +0200 Subject: [PATCH 13/22] echo "2\n" | hackingtool.py --- .github/workflows/test_install.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test_install.yml b/.github/workflows/test_install.yml index f73089e..4cee030 100644 --- a/.github/workflows/test_install.yml +++ b/.github/workflows/test_install.yml @@ -22,4 +22,5 @@ jobs: - run: sudo ./install.sh 1 - run: pwd && ls -hal # `2` should use the default path /home/hackingtool/ - - run: echo "2\n" | hackingtool + - run: echo "2\n" | hackingtool # Does not take the echoed input + - run: echo "2\n" | hackingtool.py From a4cc799dfb4baf16b7d45196cfecea150e20d270 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Tue, 18 Jul 2023 10:59:25 +0200 Subject: [PATCH 14/22] echo "2\n" | ./hackingtool.py --- .github/workflows/test_install.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_install.yml b/.github/workflows/test_install.yml index 4cee030..b9faf27 100644 --- a/.github/workflows/test_install.yml +++ b/.github/workflows/test_install.yml @@ -23,4 +23,4 @@ jobs: - run: pwd && ls -hal # `2` should use the default path /home/hackingtool/ - run: echo "2\n" | hackingtool # Does not take the echoed input - - run: echo "2\n" | hackingtool.py + - run: echo "2\n" | ./hackingtool.py From e87c63e499bbb88ee1fdfb941a884b976d3781c4 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Tue, 18 Jul 2023 11:04:16 +0200 Subject: [PATCH 15/22] echo -e "2\n" | ./hackingtool.py --- .github/workflows/test_install.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_install.yml b/.github/workflows/test_install.yml index b9faf27..412325c 100644 --- a/.github/workflows/test_install.yml +++ b/.github/workflows/test_install.yml @@ -22,5 +22,5 @@ jobs: - run: sudo ./install.sh 1 - run: pwd && ls -hal # `2` should use the default path /home/hackingtool/ - - run: echo "2\n" | hackingtool # Does not take the echoed input - - run: echo "2\n" | ./hackingtool.py + - run: echo -e "2\n" | hackingtool # Does not take the echoed input + - run: echo -e "2\n" | ./hackingtool.py From cf34f54a9ce6aebc1eaf7b73674b6fda71ca21a3 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Tue, 18 Jul 2023 11:18:26 +0200 Subject: [PATCH 16/22] Update test_install.yml --- .github/workflows/test_install.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test_install.yml b/.github/workflows/test_install.yml index 412325c..6a64bf7 100644 --- a/.github/workflows/test_install.yml +++ b/.github/workflows/test_install.yml @@ -18,9 +18,9 @@ jobs: - run: pip install --upgrade pip - run: pwd && ls -hal # How can we pipe in responses to `read` prompts? - # run: echo -e "\n1\n1\n1\n" | sudo ./install.sh + #- run: echo -e "\n1\n1\n1\n" | sudo ./install.sh - run: sudo ./install.sh 1 - run: pwd && ls -hal - # `2` should use the default path /home/hackingtool/ - - run: echo -e "2\n" | hackingtool # Does not take the echoed input - - run: echo -e "2\n" | ./hackingtool.py + - run: echo -e "1\n/home/runner/work/hackingtool/hackingtool\n" | hackingtool + - run: pwd && ls -hal + From bf5c1c90909a75b7eb61477310f024d96d7309ef Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Tue, 18 Jul 2023 11:25:04 +0200 Subject: [PATCH 17/22] fpath = "~/hackingtoolpath.txt" --- hackingtool.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hackingtool.py b/hackingtool.py index 7626400..1e6da0b 100755 --- a/hackingtool.py +++ b/hackingtool.py @@ -74,7 +74,7 @@ class AllTools(HackingToolsCollection): if __name__ == "__main__": try: if system() == 'Linux': - fpath = "/home/hackingtoolpath.txt" + fpath = "~/hackingtoolpath.txt" if not os.path.exists(fpath): os.system('clear') # run.menu() From 8dff887a4b6679e0b197dad7d443402074d8f698 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Tue, 18 Jul 2023 11:37:40 +0200 Subject: [PATCH 18/22] Update hackingtool.py --- hackingtool.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hackingtool.py b/hackingtool.py index 1e6da0b..4bd8729 100755 --- a/hackingtool.py +++ b/hackingtool.py @@ -74,7 +74,8 @@ class AllTools(HackingToolsCollection): if __name__ == "__main__": try: if system() == 'Linux': - fpath = "~/hackingtoolpath.txt" + # Testing platforms like GitHub Actions define a $CI environment variable + fpath = "/tmp/hackingtoolpath.txt" if os.getenv("CI") else "/home/hackingtoolpath.txt" if not os.path.exists(fpath): os.system('clear') # run.menu() From 946151b21166d663b181862fd56d589568ba086a Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Tue, 18 Jul 2023 11:43:11 +0200 Subject: [PATCH 19/22] Update hackingtool.py --- hackingtool.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hackingtool.py b/hackingtool.py index 4bd8729..20b9778 100755 --- a/hackingtool.py +++ b/hackingtool.py @@ -75,7 +75,8 @@ if __name__ == "__main__": try: if system() == 'Linux': # Testing platforms like GitHub Actions define a $CI environment variable - fpath = "/tmp/hackingtoolpath.txt" if os.getenv("CI") else "/home/hackingtoolpath.txt" + print(f'{os.getenv("CI") = }') + fpath = "/tmp/hackingtoolpath.txt" # if os.getenv("CI") else "/home/hackingtoolpath.txt" if not os.path.exists(fpath): os.system('clear') # run.menu() From 4e2e76935ed4c09b8f273dd26a7a075127e24e94 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Tue, 18 Jul 2023 12:34:07 +0200 Subject: [PATCH 20/22] os.path.expanduser("~/hackingtoolpath.txt") --- hackingtool.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/hackingtool.py b/hackingtool.py index 20b9778..68ac0a7 100755 --- a/hackingtool.py +++ b/hackingtool.py @@ -74,9 +74,7 @@ class AllTools(HackingToolsCollection): if __name__ == "__main__": try: if system() == 'Linux': - # Testing platforms like GitHub Actions define a $CI environment variable - print(f'{os.getenv("CI") = }') - fpath = "/tmp/hackingtoolpath.txt" # if os.getenv("CI") else "/home/hackingtoolpath.txt" + os.path.expanduser("~/hackingtoolpath.txt") if not os.path.exists(fpath): os.system('clear') # run.menu() From 6f55416aad9d967724b8404b7fd0ec6fbab5c01a Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Tue, 18 Jul 2023 12:34:48 +0200 Subject: [PATCH 21/22] fpath --- hackingtool.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hackingtool.py b/hackingtool.py index 68ac0a7..2334456 100755 --- a/hackingtool.py +++ b/hackingtool.py @@ -74,7 +74,7 @@ class AllTools(HackingToolsCollection): if __name__ == "__main__": try: if system() == 'Linux': - os.path.expanduser("~/hackingtoolpath.txt") + fpath = os.path.expanduser("~/hackingtoolpath.txt") if not os.path.exists(fpath): os.system('clear') # run.menu() From c7e73b1d1359cb3dbfd15df83f169adb65bf53a1 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Tue, 18 Jul 2023 12:40:34 +0200 Subject: [PATCH 22/22] Update test_install.yml --- .github/workflows/test_install.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_install.yml b/.github/workflows/test_install.yml index 6a64bf7..dc75a26 100644 --- a/.github/workflows/test_install.yml +++ b/.github/workflows/test_install.yml @@ -21,6 +21,6 @@ jobs: #- run: echo -e "\n1\n1\n1\n" | sudo ./install.sh - run: sudo ./install.sh 1 - run: pwd && ls -hal - - run: echo -e "1\n/home/runner/work/hackingtool/hackingtool\n" | hackingtool + - run: echo -e "1\n/home/runner/work/hackingtool/hackingtool\n" | hackingtool || true - run: pwd && ls -hal