From aebacbf56f885b2babdedd52ea6b3d33283fa3cb Mon Sep 17 00:00:00 2001 From: "aynic.os" Date: Sun, 9 May 2021 09:03:52 +0200 Subject: [PATCH 01/15] cleanup warning git clone --- .../addon_data/plugin.video.vstream/Cookie_www_zt-za_com.txt | 1 - .../addon_data/plugin.video.vstream/Cookie_zt-protect_com.txt | 1 - .../{Cookie_zt-protect_net.txt => cookie_zt-protect_net.txt} | 0 3 files changed, 2 deletions(-) delete mode 100644 .install/.kodi/userdata/addon_data/plugin.video.vstream/Cookie_www_zt-za_com.txt delete mode 100644 .install/.kodi/userdata/addon_data/plugin.video.vstream/Cookie_zt-protect_com.txt rename .install/.kodi/userdata/addon_data/plugin.video.vstream/{Cookie_zt-protect_net.txt => cookie_zt-protect_net.txt} (100%) diff --git a/.install/.kodi/userdata/addon_data/plugin.video.vstream/Cookie_www_zt-za_com.txt b/.install/.kodi/userdata/addon_data/plugin.video.vstream/Cookie_www_zt-za_com.txt deleted file mode 100644 index 3d46abf..0000000 --- a/.install/.kodi/userdata/addon_data/plugin.video.vstream/Cookie_www_zt-za_com.txt +++ /dev/null @@ -1 +0,0 @@ -swp_token=1605043494:0cb63ecc71f6d029418e827aed3e7c9f:c8201b8ffdb3703b1d01884bce4f7584 \ No newline at end of file diff --git a/.install/.kodi/userdata/addon_data/plugin.video.vstream/Cookie_zt-protect_com.txt b/.install/.kodi/userdata/addon_data/plugin.video.vstream/Cookie_zt-protect_com.txt deleted file mode 100644 index ec58db7..0000000 --- a/.install/.kodi/userdata/addon_data/plugin.video.vstream/Cookie_zt-protect_com.txt +++ /dev/null @@ -1 +0,0 @@ -swp_token=1603922533:31aac141fc8c1f57a856ac4be928d2c0:067e0bd7719ed36e424bd1d672ebecdb \ No newline at end of file diff --git a/.install/.kodi/userdata/addon_data/plugin.video.vstream/Cookie_zt-protect_net.txt b/.install/.kodi/userdata/addon_data/plugin.video.vstream/cookie_zt-protect_net.txt similarity index 100% rename from .install/.kodi/userdata/addon_data/plugin.video.vstream/Cookie_zt-protect_net.txt rename to .install/.kodi/userdata/addon_data/plugin.video.vstream/cookie_zt-protect_net.txt From b76111f017e61bd06a3acc909552a39db5a9c09b Mon Sep 17 00:00:00 2001 From: "aynic.os" Date: Sun, 9 May 2021 14:50:17 +0200 Subject: [PATCH 02/15] add make --- Makefile | 7 +++++++ specs/astrXbian_spec.sh | 15 +++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 Makefile create mode 100644 specs/astrXbian_spec.sh diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..8be89b1 --- /dev/null +++ b/Makefile @@ -0,0 +1,7 @@ +tests: ~/.zen/secret.june shellcheck-specs shellspec-specs + +shellcheck-%: + shellcheck $*/* + +shellspec-%: + shellspec $* diff --git a/specs/astrXbian_spec.sh b/specs/astrXbian_spec.sh new file mode 100644 index 0000000..6e57e6f --- /dev/null +++ b/specs/astrXbian_spec.sh @@ -0,0 +1,15 @@ +#shellcheck shell=sh + +Describe "AstrXbian" + Describe "install()" + install() { + echo # + } + + It "installs world, but not implemented" + Pending "You should implement install function" + When call install world + The output should eq "amen" + End + End +End From a5ea0292f2aa92d619194d228eeee53f36b07023 Mon Sep 17 00:00:00 2001 From: "aynic.os" Date: Sun, 9 May 2021 19:27:07 +0200 Subject: [PATCH 03/15] 1st test --- Makefile | 2 ++ include.sh | 13 +++++++++++++ install.sh | 8 +++++--- specs/astrXbian_spec.sh | 24 ++++++++++++++---------- 4 files changed, 34 insertions(+), 13 deletions(-) create mode 100644 include.sh diff --git a/Makefile b/Makefile index 8be89b1..0cc7de9 100644 --- a/Makefile +++ b/Makefile @@ -5,3 +5,5 @@ shellcheck-%: shellspec-%: shellspec $* + +~/.zen/secret.june: diff --git a/include.sh b/include.sh new file mode 100644 index 0000000..1811918 --- /dev/null +++ b/include.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +i_am() { + echo 'v0.4' +} + +i_am_root() { + [ $(id -u) -eq 0 ] +} + +i_should_install() { + [[ ! -f ~/.zen/secret.june ]] +} diff --git a/install.sh b/install.sh index 5eeea4b..ea54064 100755 --- a/install.sh +++ b/install.sh @@ -1,13 +1,15 @@ #!/bin/bash +set -x +. ./include.sh ######################################################################## -# Version: 0.3 +# Version: 0.4 # License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/) ######################################################################## { -[ $(id -u) -eq 0 ] && echo "LANCEMENT root INTERDIT. Utilisez un simple utilisateur du groupe \"sudo\" SVP" && exit 1 +i_am_root && echo "LANCEMENT root INTERDIT. Utilisez un simple utilisateur du groupe \"sudo\" SVP" && exit 1 # MAIN # -if [[ ! -f ~/.zen/secret.june ]]; +if i_should_install; then # Check requirements diff --git a/specs/astrXbian_spec.sh b/specs/astrXbian_spec.sh index 6e57e6f..f9d3201 100644 --- a/specs/astrXbian_spec.sh +++ b/specs/astrXbian_spec.sh @@ -1,15 +1,19 @@ #shellcheck shell=sh -Describe "AstrXbian" - Describe "install()" - install() { - echo # - } - - It "installs world, but not implemented" - Pending "You should implement install function" - When call install world - The output should eq "amen" +Describe 'AstrXbian' + Describe 'install()' + Include ./include.sh + It 'should be me' + When call i_am + The output should eq 'v0.4' + End + It 'should not be superuser' + When call i_am_root + The status should not be success + End + It 'should install AstrXbian' + When call i_should_install + The status should be success End End End From d2b1d94967fda9aa08fcbd1e3ea6b0a68a9b51f7 Mon Sep 17 00:00:00 2001 From: "aynic.os" Date: Wed, 12 May 2021 17:25:49 +0200 Subject: [PATCH 04/15] test --- include.sh | 15 +++++++++++++++ install.sh | 14 +------------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/include.sh b/include.sh index 1811918..15395ab 100644 --- a/include.sh +++ b/include.sh @@ -1,5 +1,20 @@ #!/bin/sh +check_requirements() { +sudo apt-get update +sudo apt-get install git fail2ban inotify-tools curl net-tools libsodium* python3-dev python3-pip python3-setuptools python3-wheel python3-dotenv mpack libssl-dev libffi-dev -y +sudo apt-get install build-essential qrencode jq bc gawk ffmpeg sqlite dnsutils v4l-utils vlc mp3info musl-dev openssl* cargo detox httrack -y +[[ ! $(which kodi) && "$USER" != "xbian" ]] && sudo apt-get install kodi -y +sudo apt-get install python3-opencv -y +[[ "$USER" != "xbian" ]] && sudo apt-get install x11-utils zenity handbrake* -y +## INSTALL PYTHON CRYPTO LAYER +echo 'export PATH=$PATH:$HOME/.local/bin' >> ~/.bashrc && source ~/.bashrc +python3 -m pip install -U pip +python3 -m pip install -U setuptools wheel +python3 -m pip install -U cryptography Ed25519 base58 google protobuf duniterpy +# python3 -m pip install -U silkaj +} + i_am() { echo 'v0.4' } diff --git a/install.sh b/install.sh index ea54064..2e669d9 100755 --- a/install.sh +++ b/install.sh @@ -14,19 +14,7 @@ then # Check requirements echo "AstrXbian installateur pour XBIAN (https://xbian.org) et ditributions DEBIAN et dérivées (https://www.linuxmint.com/)" -sudo apt-get update -sudo apt-get install git fail2ban inotify-tools curl net-tools libsodium* python3-dev python3-pip python3-setuptools python3-wheel python3-dotenv mpack libssl-dev libffi-dev -y -sudo apt-get install build-essential qrencode jq bc gawk ffmpeg sqlite dnsutils v4l-utils vlc mp3info musl-dev openssl* cargo detox httrack sudo -y -[[ ! $(which kodi) && "$USER" != "xbian" ]] && sudo apt-get install kodi -y -sudo apt-get install python3-opencv -y -[[ "$USER" != "xbian" ]] && sudo apt-get install x11-utils zenity handbrake* -y -## INSTALL PYTHON CRYPTO LAYER -echo 'export PATH=$PATH:$HOME/.local/bin' >> ~/.bashrc && source ~/.bashrc -python3 -m pip install -U pip -python3 -m pip install -U setuptools wheel -python3 -m pip install -U cryptography Ed25519 base58 google protobuf duniterpy -# python3 -m pip install -U silkaj - +check_requirements ######################################################################## echo "Clonage git astrXbian depuis https://git.p2p.legal" mkdir -p ~/.zen From e9e1fd989dba1ee87fcf7fe50a66fa43ec327ad9 Mon Sep 17 00:00:00 2001 From: "aynic.os" Date: Wed, 12 May 2021 17:36:31 +0200 Subject: [PATCH 05/15] test --- include.sh | 30 ++++++++++++++++++------------ install.sh | 4 +--- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/include.sh b/include.sh index 15395ab..e15492a 100644 --- a/include.sh +++ b/include.sh @@ -1,18 +1,24 @@ #!/bin/sh check_requirements() { -sudo apt-get update -sudo apt-get install git fail2ban inotify-tools curl net-tools libsodium* python3-dev python3-pip python3-setuptools python3-wheel python3-dotenv mpack libssl-dev libffi-dev -y -sudo apt-get install build-essential qrencode jq bc gawk ffmpeg sqlite dnsutils v4l-utils vlc mp3info musl-dev openssl* cargo detox httrack -y -[[ ! $(which kodi) && "$USER" != "xbian" ]] && sudo apt-get install kodi -y -sudo apt-get install python3-opencv -y -[[ "$USER" != "xbian" ]] && sudo apt-get install x11-utils zenity handbrake* -y -## INSTALL PYTHON CRYPTO LAYER -echo 'export PATH=$PATH:$HOME/.local/bin' >> ~/.bashrc && source ~/.bashrc -python3 -m pip install -U pip -python3 -m pip install -U setuptools wheel -python3 -m pip install -U cryptography Ed25519 base58 google protobuf duniterpy -# python3 -m pip install -U silkaj + sudo apt-get update + sudo apt-get install git fail2ban inotify-tools curl net-tools libsodium* python3-dev python3-pip python3-setuptools python3-wheel python3-dotenv mpack libssl-dev libffi-dev -y + sudo apt-get install build-essential qrencode jq bc gawk ffmpeg sqlite dnsutils v4l-utils vlc mp3info musl-dev openssl* cargo detox httrack -y + [[ ! $(which kodi) && "$USER" != "xbian" ]] && sudo apt-get install kodi -y + sudo apt-get install python3-opencv -y + [[ "$USER" != "xbian" ]] && sudo apt-get install x11-utils zenity handbrake* -y + ## INSTALL PYTHON CRYPTO LAYER + echo 'export PATH=$PATH:$HOME/.local/bin' >> ~/.bashrc && source ~/.bashrc + python3 -m pip install -U pip + python3 -m pip install -U setuptools wheel + python3 -m pip install -U cryptography Ed25519 base58 google protobuf duniterpy + # python3 -m pip install -U silkaj +} + +git_clone() { + mkdir -p ~/.zen + cd ~/.zen + git clone https://git.p2p.legal/axiom-team/astrXbian.git } i_am() { diff --git a/install.sh b/install.sh index 2e669d9..349461c 100755 --- a/install.sh +++ b/install.sh @@ -17,9 +17,7 @@ echo "AstrXbian installateur pour XBIAN (https://xbian.org) et ditributions DEBI check_requirements ######################################################################## echo "Clonage git astrXbian depuis https://git.p2p.legal" -mkdir -p ~/.zen -cd ~/.zen -git clone https://git.p2p.legal/axiom-team/astrXbian.git +git_clone ######################################################################## echo "IMPORT configuration ASTROPORT dans ~/.kodi" From fba00c3225b1cfc3fcb8b36e9c49554499f5f85d Mon Sep 17 00:00:00 2001 From: "aynic.os" Date: Wed, 12 May 2021 17:41:30 +0200 Subject: [PATCH 06/15] test --- include.sh | 16 ++++++++++------ install.sh | 4 ++-- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/include.sh b/include.sh index e15492a..8ce0c42 100644 --- a/include.sh +++ b/include.sh @@ -15,12 +15,6 @@ check_requirements() { # python3 -m pip install -U silkaj } -git_clone() { - mkdir -p ~/.zen - cd ~/.zen - git clone https://git.p2p.legal/axiom-team/astrXbian.git -} - i_am() { echo 'v0.4' } @@ -32,3 +26,13 @@ i_am_root() { i_should_install() { [[ ! -f ~/.zen/secret.june ]] } + +import_astrXbian() { + mkdir -p ~/.zen + cd ~/.zen + git clone https://git.p2p.legal/axiom-team/astrXbian.git +} + +import_kodi() { + cp -Rf ~/.zen/astrXbian/.install/.kodi ~/ +} diff --git a/install.sh b/install.sh index 349461c..fd1b9f6 100755 --- a/install.sh +++ b/install.sh @@ -17,11 +17,11 @@ echo "AstrXbian installateur pour XBIAN (https://xbian.org) et ditributions DEBI check_requirements ######################################################################## echo "Clonage git astrXbian depuis https://git.p2p.legal" -git_clone +import_astrXbian ######################################################################## echo "IMPORT configuration ASTROPORT dans ~/.kodi" -cp -Rf ~/.zen/astrXbian/.install/.kodi ~/ +import_kodi ######################################################################## echo "Installation de IPFS https://ipfs.io" From c7b272dfc50f38583dec661b73beefbece290c45 Mon Sep 17 00:00:00 2001 From: "aynic.os" Date: Wed, 12 May 2021 17:51:18 +0200 Subject: [PATCH 07/15] test --- include.sh | 9 +++++++++ install.sh | 5 ++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/include.sh b/include.sh index 8ce0c42..b31791b 100644 --- a/include.sh +++ b/include.sh @@ -1,5 +1,14 @@ #!/bin/sh +check_ipfs() { + ~/.zen/astrXbian/.install/ipfs_alone.sh +} + +check_jaklis() { + cd ~/.zen/astrXbian/zen/jaklis + ./setup.sh +} + check_requirements() { sudo apt-get update sudo apt-get install git fail2ban inotify-tools curl net-tools libsodium* python3-dev python3-pip python3-setuptools python3-wheel python3-dotenv mpack libssl-dev libffi-dev -y diff --git a/install.sh b/install.sh index fd1b9f6..f511a2b 100755 --- a/install.sh +++ b/install.sh @@ -25,12 +25,11 @@ import_kodi ######################################################################## echo "Installation de IPFS https://ipfs.io" -~/.zen/astrXbian/.install/ipfs_alone.sh +check_ipfs ######################################################################## echo "Configuration jaklis: Centre de communication GCHANGE+" -cd ~/.zen/astrXbian/zen/jaklis -./setup.sh +check_jaklis ######################################################################## echo "Sécurisation DEFCON SUDOERS FAIL2BAN" From 68ccdcb3942fd7a749cd52a58a8f1cf0dcdaa836 Mon Sep 17 00:00:00 2001 From: "aynic.os" Date: Wed, 12 May 2021 18:12:02 +0200 Subject: [PATCH 08/15] test --- specs/astrXbian_spec.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/specs/astrXbian_spec.sh b/specs/astrXbian_spec.sh index f9d3201..a8044a4 100644 --- a/specs/astrXbian_spec.sh +++ b/specs/astrXbian_spec.sh @@ -15,5 +15,30 @@ Describe 'AstrXbian' When call i_should_install The status should be success End + It 'should check requirements, but not tested' + Pending "You should implement check_requirements tests" + When call check_requirements + The status should be success + End + It 'should import AstrXbian, but not tested' + Pending "You should implement import_astrXbian tests" + When call import_astrXbian + The status should be success + End + It 'should import Kodi, but not tested' + Pending "You should implement import_kodi tests" + When call import_kodi + The status should be success + End + It 'should check IPFS, but not tested' + Pending "You should implement check_ipfs tests" + When call check_ipfs + The status should be success + End + It 'should check Jaklis, but not tested' + Pending "You should implement check_jaklis tests" + When call check_jaklis + The status should be success + End End End From 2dfa0ee7d2499c7295fe45acd6aa7a8eda53ae11 Mon Sep 17 00:00:00 2001 From: "aynic.os" Date: Wed, 12 May 2021 18:47:13 +0200 Subject: [PATCH 09/15] test --- include.sh | 4 ++++ install.sh | 2 +- specs/astrXbian_spec.sh | 34 +++++++++++++++++++--------------- 3 files changed, 24 insertions(+), 16 deletions(-) diff --git a/include.sh b/include.sh index b31791b..0574219 100644 --- a/include.sh +++ b/include.sh @@ -32,6 +32,10 @@ i_am_root() { [ $(id -u) -eq 0 ] } +i_am_xbian() { + [[ "$USER" == "xbian" ]] +} + i_should_install() { [[ ! -f ~/.zen/secret.june ]] } diff --git a/install.sh b/install.sh index f511a2b..6e80ca9 100755 --- a/install.sh +++ b/install.sh @@ -35,7 +35,7 @@ check_jaklis echo "Sécurisation DEFCON SUDOERS FAIL2BAN" ## XBIAN fail2ban ERROR correction ## #[....] Starting authentication failure monitor: fail2ban No file(s) found for glob /var/log/auth.log -[[ "$USER" == "xbian" ]] && sudo sed -i "s/auth.log/faillog/g" /etc/fail2ban/paths-common.conf +i_am_xbian && sudo sed -i "s/auth.log/faillog/g" /etc/fail2ban/paths-common.conf # NODE activates fail2ban IN zen/ipfs_SWARM_refresh.sh ### MODIFIYING /etc/sudoers ### diff --git a/specs/astrXbian_spec.sh b/specs/astrXbian_spec.sh index a8044a4..563efcb 100644 --- a/specs/astrXbian_spec.sh +++ b/specs/astrXbian_spec.sh @@ -3,6 +3,21 @@ Describe 'AstrXbian' Describe 'install()' Include ./include.sh + It 'should check IPFS, but not tested' + Pending "You should implement check_ipfs tests" + When call check_ipfs + The status should be success + End + It 'should check Jaklis, but not tested' + Pending "You should implement check_jaklis tests" + When call check_jaklis + The status should be success + End + It 'should check requirements, but not tested' + Pending "You should implement check_requirements tests" + When call check_requirements + The status should be success + End It 'should be me' When call i_am The output should eq 'v0.4' @@ -11,13 +26,12 @@ Describe 'AstrXbian' When call i_am_root The status should not be success End - It 'should install AstrXbian' - When call i_should_install + It 'should be xbian' + When call i_am_xbian The status should be success End - It 'should check requirements, but not tested' - Pending "You should implement check_requirements tests" - When call check_requirements + It 'should install AstrXbian' + When call i_should_install The status should be success End It 'should import AstrXbian, but not tested' @@ -30,15 +44,5 @@ Describe 'AstrXbian' When call import_kodi The status should be success End - It 'should check IPFS, but not tested' - Pending "You should implement check_ipfs tests" - When call check_ipfs - The status should be success - End - It 'should check Jaklis, but not tested' - Pending "You should implement check_jaklis tests" - When call check_jaklis - The status should be success - End End End From 785f715830a34a263c9e9a2275e26d95c9a67a8c Mon Sep 17 00:00:00 2001 From: "aynic.os" Date: Wed, 12 May 2021 19:00:14 +0200 Subject: [PATCH 10/15] test --- include.sh | 13 +++++++++++++ install.sh | 31 +++++++++++++------------------ 2 files changed, 26 insertions(+), 18 deletions(-) diff --git a/include.sh b/include.sh index 0574219..cdebc7f 100644 --- a/include.sh +++ b/include.sh @@ -40,6 +40,10 @@ i_should_install() { [[ ! -f ~/.zen/secret.june ]] } +iso_config() { + ~/.zen/astrXbian/ISOconfig.sh +} + import_astrXbian() { mkdir -p ~/.zen cd ~/.zen @@ -49,3 +53,12 @@ import_astrXbian() { import_kodi() { cp -Rf ~/.zen/astrXbian/.install/.kodi ~/ } + +prepare_next_boot() { + ## Rpi Xbian install. + cat /etc/rc.local | grep -Ev "exit 0" > /tmp/new.rc.local ## REMOVE "exit 0" + # PREPARE NEXT BOOT - Network config - NEXTBOOT - ISOConfig - NEXTBOOT - OK + echo "su - xbian -c '~/.zen/astrXbian/FirstBOOT.sh'" >> /tmp/new.rc.local + echo "exit 0" >> /tmp/new.rc.local + sudo cp -f /tmp/new.rc.local /etc/rc.local +} diff --git a/install.sh b/install.sh index 6e80ca9..1cceb48 100755 --- a/install.sh +++ b/install.sh @@ -39,12 +39,12 @@ i_am_xbian && sudo sed -i "s/auth.log/faillog/g" /etc/fail2ban/paths-common.conf # NODE activates fail2ban IN zen/ipfs_SWARM_refresh.sh ### MODIFIYING /etc/sudoers ### -[[ "$USER" == "xbian" ]] && echo "xbian ALL=(ALL) NOPASSWD:ALL" | (sudo su -c 'EDITOR="tee" visudo -f /etc/sudoers.d/astroport') +i_am_xbian && echo "xbian ALL=(ALL) NOPASSWD:ALL" | (sudo su -c 'EDITOR="tee" visudo -f /etc/sudoers.d/astroport') # PERSONNAL DEFCON LEVEL # cp ~/.zen/astrXbian/DEFCON ~/.zen/ -if [[ "$USER" == "xbian" ]] +if i_am_xbian then echo "enabling ipfs initV service autostart" cd /etc/rc2.d && sudo ln -s ../init.d/ipfs S02ipfs @@ -67,25 +67,20 @@ mkdir -p ~/astroport/film mkdir -p ~/astroport/serie mkdir -p ~/astroport/anime -if [[ "$USER" != "xbian" ]] +if ! i_am_xbian then - ## Desktop install - echo "INITIALISATIOn Astroport/KODI" - echo "Appuyez sur la touche ENTREE pour créer votre nouvelle identité" - echo "sinon interrompez ici l'installation pour copier la restauration d'une sauvegarde" - read - ~/.zen/astrXbian/ISOconfig.sh + ## Desktop install + echo "INITIALISATIOn Astroport/KODI" + echo "Appuyez sur la touche ENTREE pour créer votre nouvelle identité" + echo "sinon interrompez ici l'installation pour copier la restauration d'une sauvegarde" + read + iso_config else - ## Rpi Xbian install. - cat /etc/rc.local | grep -Ev "exit 0" > /tmp/new.rc.local ## REMOVE "exit 0" - # PREPARE NEXT BOOT - Network config - NEXTBOOT - ISOConfig - NEXTBOOT - OK - echo "su - xbian -c '~/.zen/astrXbian/FirstBOOT.sh'" >> /tmp/new.rc.local - echo "exit 0" >> /tmp/new.rc.local - sudo cp -f /tmp/new.rc.local /etc/rc.local + prepare_next_boot - echo "STOP!! Redémarrer Xbian pour continuer la configuration de votre station Astroport/KODI" - echo "Faites une ISO : sudo xbian-config" - exit 0 + echo "STOP!! Redémarrer Xbian pour continuer la configuration de votre station Astroport/KODI" + echo "Faites une ISO : sudo xbian-config" + exit 0 fi # MAIN # -f ~/.zen/secret.june (ISOConfig déjà lancé) ## From a1976ed4987ace0c2d830d2678204e41b25a7ab9 Mon Sep 17 00:00:00 2001 From: "aynic.os" Date: Wed, 12 May 2021 19:15:43 +0200 Subject: [PATCH 11/15] test --- specs/astrXbian_spec.sh | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/specs/astrXbian_spec.sh b/specs/astrXbian_spec.sh index 563efcb..69ee156 100644 --- a/specs/astrXbian_spec.sh +++ b/specs/astrXbian_spec.sh @@ -3,21 +3,6 @@ Describe 'AstrXbian' Describe 'install()' Include ./include.sh - It 'should check IPFS, but not tested' - Pending "You should implement check_ipfs tests" - When call check_ipfs - The status should be success - End - It 'should check Jaklis, but not tested' - Pending "You should implement check_jaklis tests" - When call check_jaklis - The status should be success - End - It 'should check requirements, but not tested' - Pending "You should implement check_requirements tests" - When call check_requirements - The status should be success - End It 'should be me' When call i_am The output should eq 'v0.4' @@ -34,6 +19,21 @@ Describe 'AstrXbian' When call i_should_install The status should be success End + It 'should check IPFS, but not tested' + Pending "You should implement check_ipfs tests" + When call check_ipfs + The status should be success + End + It 'should check Jaklis, but not tested' + Pending "You should implement check_jaklis tests" + When call check_jaklis + The status should be success + End + It 'should check requirements, but not tested' + Pending "You should implement check_requirements tests" + When call check_requirements + The status should be success + End It 'should import AstrXbian, but not tested' Pending "You should implement import_astrXbian tests" When call import_astrXbian From 5d6a32c1d5e1378e619eef0e442f2137f5ff0177 Mon Sep 17 00:00:00 2001 From: "aynic.os" Date: Thu, 13 May 2021 15:28:46 +0200 Subject: [PATCH 12/15] test --- specs/astrXbian_spec.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/specs/astrXbian_spec.sh b/specs/astrXbian_spec.sh index 69ee156..71a36ac 100644 --- a/specs/astrXbian_spec.sh +++ b/specs/astrXbian_spec.sh @@ -44,5 +44,15 @@ Describe 'AstrXbian' When call import_kodi The status should be success End + It 'should prepare astrXbian for first boot, but not tested' + Pending "You should implement prepare_next_boot tests" + When call prepare_next_boot + The status should be success + End + It 'should create astrXbian id, but not tested' + Pending "You should implement iso_config tests" + When call iso_config + The status should be success + End End End From dac3cfb1586d1ed87db6edd6b92d8b4760cccc55 Mon Sep 17 00:00:00 2001 From: "aynic.os" Date: Sat, 15 May 2021 18:31:46 +0200 Subject: [PATCH 13/15] test --- Makefile | 2 +- include.sh | 33 ++++++++++++++++++++------------- install.sh | 4 ++-- specs/astrXbian_spec.sh | 32 ++++++++++++++------------------ 4 files changed, 37 insertions(+), 34 deletions(-) diff --git a/Makefile b/Makefile index 0cc7de9..1631547 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,6 @@ shellcheck-%: shellcheck $*/* shellspec-%: - shellspec $* + shellspec -f tap $* ~/.zen/secret.june: diff --git a/include.sh b/include.sh index cdebc7f..266670d 100644 --- a/include.sh +++ b/include.sh @@ -1,15 +1,7 @@ #!/bin/sh -check_ipfs() { - ~/.zen/astrXbian/.install/ipfs_alone.sh -} - -check_jaklis() { - cd ~/.zen/astrXbian/zen/jaklis - ./setup.sh -} - check_requirements() { + return 0 sudo apt-get update sudo apt-get install git fail2ban inotify-tools curl net-tools libsodium* python3-dev python3-pip python3-setuptools python3-wheel python3-dotenv mpack libssl-dev libffi-dev -y sudo apt-get install build-essential qrencode jq bc gawk ffmpeg sqlite dnsutils v4l-utils vlc mp3info musl-dev openssl* cargo detox httrack -y @@ -40,21 +32,36 @@ i_should_install() { [[ ! -f ~/.zen/secret.june ]] } -iso_config() { - ~/.zen/astrXbian/ISOconfig.sh -} - import_astrXbian() { + return 0 mkdir -p ~/.zen cd ~/.zen git clone https://git.p2p.legal/axiom-team/astrXbian.git } +import_ipfs() { + return 0 + ~/.zen/astrXbian/.install/ipfs_alone.sh +} + +import_jaklis() { + return 0 + cd ~/.zen/astrXbian/zen/jaklis + ./setup.sh +} + import_kodi() { + return 0 cp -Rf ~/.zen/astrXbian/.install/.kodi ~/ } +iso_config() { + return 0 + ~/.zen/astrXbian/ISOconfig.sh +} + prepare_next_boot() { + return 0 ## Rpi Xbian install. cat /etc/rc.local | grep -Ev "exit 0" > /tmp/new.rc.local ## REMOVE "exit 0" # PREPARE NEXT BOOT - Network config - NEXTBOOT - ISOConfig - NEXTBOOT - OK diff --git a/install.sh b/install.sh index 1cceb48..6c5b670 100755 --- a/install.sh +++ b/install.sh @@ -25,11 +25,11 @@ import_kodi ######################################################################## echo "Installation de IPFS https://ipfs.io" -check_ipfs +import_ipfs ######################################################################## echo "Configuration jaklis: Centre de communication GCHANGE+" -check_jaklis +import_jaklis ######################################################################## echo "Sécurisation DEFCON SUDOERS FAIL2BAN" diff --git a/specs/astrXbian_spec.sh b/specs/astrXbian_spec.sh index 71a36ac..190dce8 100644 --- a/specs/astrXbian_spec.sh +++ b/specs/astrXbian_spec.sh @@ -11,24 +11,10 @@ Describe 'AstrXbian' When call i_am_root The status should not be success End - It 'should be xbian' - When call i_am_xbian - The status should be success - End - It 'should install AstrXbian' + It 'should allow install' When call i_should_install The status should be success End - It 'should check IPFS, but not tested' - Pending "You should implement check_ipfs tests" - When call check_ipfs - The status should be success - End - It 'should check Jaklis, but not tested' - Pending "You should implement check_jaklis tests" - When call check_jaklis - The status should be success - End It 'should check requirements, but not tested' Pending "You should implement check_requirements tests" When call check_requirements @@ -44,9 +30,14 @@ Describe 'AstrXbian' When call import_kodi The status should be success End - It 'should prepare astrXbian for first boot, but not tested' - Pending "You should implement prepare_next_boot tests" - When call prepare_next_boot + It 'should import IPFS, but not tested' + Pending "You should implement import_ipfs tests" + When call import_ipfs + The status should be success + End + It 'should import Jaklis, but not tested' + Pending "You should implement import_jaklis tests" + When call import_jaklis The status should be success End It 'should create astrXbian id, but not tested' @@ -54,5 +45,10 @@ Describe 'AstrXbian' When call iso_config The status should be success End + It 'should prepare astrXbian for first boot, but not tested' + Pending "You should implement prepare_next_boot tests" + When call prepare_next_boot + The status should be success + End End End From ead1ba7a578af0f68a4e76d0ead9f091d0b207e5 Mon Sep 17 00:00:00 2001 From: "aynic.os" Date: Mon, 31 May 2021 00:10:07 +0200 Subject: [PATCH 14/15] test --- specs/astrXbian_spec.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/specs/astrXbian_spec.sh b/specs/astrXbian_spec.sh index 190dce8..390bd65 100644 --- a/specs/astrXbian_spec.sh +++ b/specs/astrXbian_spec.sh @@ -3,15 +3,15 @@ Describe 'AstrXbian' Describe 'install()' Include ./include.sh - It 'should be me' + It 'should check it applies to me' When call i_am The output should eq 'v0.4' End - It 'should not be superuser' + It 'should check I am not superuser' When call i_am_root The status should not be success End - It 'should allow install' + It 'should check I allow install' When call i_should_install The status should be success End From bc5c14d2aeafe11b474564dd4194fc96ce6613f2 Mon Sep 17 00:00:00 2001 From: "aynic.os" Date: Wed, 9 Jun 2021 00:55:20 +0200 Subject: [PATCH 15/15] rebase master --- Makefile | 2 ++ include.sh | 9 +-------- specs/astrXbian_spec.sh | 30 +++++++++++++++--------------- 3 files changed, 18 insertions(+), 23 deletions(-) diff --git a/Makefile b/Makefile index 1631547..ed3d763 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,5 @@ +-include $(if $(MYOS),$(MYOS),../myos)/make/include.mk + tests: ~/.zen/secret.june shellcheck-specs shellspec-specs shellcheck-%: diff --git a/include.sh b/include.sh index 266670d..22bd7b9 100644 --- a/include.sh +++ b/include.sh @@ -1,10 +1,9 @@ #!/bin/sh check_requirements() { - return 0 sudo apt-get update sudo apt-get install git fail2ban inotify-tools curl net-tools libsodium* python3-dev python3-pip python3-setuptools python3-wheel python3-dotenv mpack libssl-dev libffi-dev -y - sudo apt-get install build-essential qrencode jq bc gawk ffmpeg sqlite dnsutils v4l-utils vlc mp3info musl-dev openssl* cargo detox httrack -y + sudo apt-get install build-essential qrencode jq bc gawk ffmpeg sqlite dnsutils v4l-utils vlc mp3info musl-dev openssl* cargo detox httrack sudo -y [[ ! $(which kodi) && "$USER" != "xbian" ]] && sudo apt-get install kodi -y sudo apt-get install python3-opencv -y [[ "$USER" != "xbian" ]] && sudo apt-get install x11-utils zenity handbrake* -y @@ -33,35 +32,29 @@ i_should_install() { } import_astrXbian() { - return 0 mkdir -p ~/.zen cd ~/.zen git clone https://git.p2p.legal/axiom-team/astrXbian.git } import_ipfs() { - return 0 ~/.zen/astrXbian/.install/ipfs_alone.sh } import_jaklis() { - return 0 cd ~/.zen/astrXbian/zen/jaklis ./setup.sh } import_kodi() { - return 0 cp -Rf ~/.zen/astrXbian/.install/.kodi ~/ } iso_config() { - return 0 ~/.zen/astrXbian/ISOconfig.sh } prepare_next_boot() { - return 0 ## Rpi Xbian install. cat /etc/rc.local | grep -Ev "exit 0" > /tmp/new.rc.local ## REMOVE "exit 0" # PREPARE NEXT BOOT - Network config - NEXTBOOT - ISOConfig - NEXTBOOT - OK diff --git a/specs/astrXbian_spec.sh b/specs/astrXbian_spec.sh index 390bd65..83e181a 100644 --- a/specs/astrXbian_spec.sh +++ b/specs/astrXbian_spec.sh @@ -11,43 +11,43 @@ Describe 'AstrXbian' When call i_am_root The status should not be success End - It 'should check I allow install' + It 'should check I need to install' When call i_should_install The status should be success End It 'should check requirements, but not tested' - Pending "You should implement check_requirements tests" - When call check_requirements + Skip "You should implement check_requirements tests" + When run check_requirements The status should be success End It 'should import AstrXbian, but not tested' - Pending "You should implement import_astrXbian tests" - When call import_astrXbian + Skip "You should implement import_astrXbian tests" + When run import_astrXbian The status should be success End It 'should import Kodi, but not tested' - Pending "You should implement import_kodi tests" - When call import_kodi + Skip "You should implement import_kodi tests" + When run import_kodi The status should be success End It 'should import IPFS, but not tested' - Pending "You should implement import_ipfs tests" - When call import_ipfs + Skip "You should implement import_ipfs tests" + When run import_ipfs The status should be success End It 'should import Jaklis, but not tested' - Pending "You should implement import_jaklis tests" - When call import_jaklis + Skip "You should implement import_jaklis tests" + When run import_jaklis The status should be success End It 'should create astrXbian id, but not tested' - Pending "You should implement iso_config tests" - When call iso_config + Skip "You should implement iso_config tests" + When run iso_config The status should be success End It 'should prepare astrXbian for first boot, but not tested' - Pending "You should implement prepare_next_boot tests" - When call prepare_next_boot + Skip "You should implement prepare_next_boot tests" + When run prepare_next_boot The status should be success End End