3 changed files with 30 additions and 79 deletions
-
54demo_source.sh
-
45install.sh
-
8none.sh
@ -1,54 +0,0 @@ |
|||
#!/usr/bin/env bash |
|||
|
|||
## CONSTANTS |
|||
|
|||
## FUNCTIONS |
|||
|
|||
function upgrade { |
|||
echo "UPGRADE: $*" |
|||
if sudo -E "$MIAOU_BASH_DIR"/bin/miaou-bash "$MIAOU_BASH_DIR"/none.sh 3>&1; then |
|||
: |
|||
else |
|||
>&2 echo ------------------------------------------------- |
|||
>&2 echo "SORRY: installation process (version 0.0.0) has failed!" |
|||
>&2 echo "Either retry later when a next version will come up" |
|||
>&2 echo "Or report the errorstack printed out above by sending an email to: contact@artcode.re" |
|||
fi |
|||
} |
|||
|
|||
function assert_supported_distro { |
|||
if ! grep -E '^ID=debian|^ID_LIKE=debian' /etc/os-release && |
|||
! grep -E '^ID=arch|^ID_LIKE=arch' /etc/os-release; then |
|||
local distro |
|||
distro=$(grep -oP '^ID=\K(.*)' /etc/os-release) |
|||
>&2 echo "unsupported GNU/Linux distribution: $distro" |
|||
>&2 echo 'only debian-like OR arch-like currently supported' |
|||
return 10 |
|||
fi |
|||
} |
|||
|
|||
function assert_bash { |
|||
if [[ $(basename "$SHELL") != 'bash' ]]; then |
|||
>&2 echo "MIAOU ERROR: you are running on SHELL=$SHELL rather than 'bash'!" |
|||
return 11 |
|||
fi |
|||
} |
|||
|
|||
function sudo_root { |
|||
if [[ "$UID" -ne 0 ]] && ! sudo -vp 'SUDO privilege required: '; then |
|||
>&2 echo "canceled" |
|||
return 12 |
|||
fi |
|||
} |
|||
## MAIN |
|||
|
|||
set -Eeuo pipefail |
|||
if assert_supported_distro && assert_bash && sudo_root; then |
|||
if [[ ! -v MIAOU_BASH_DIR ]]; then |
|||
MIAOU_BASH_DIR=/opt/miaou-bash |
|||
export MIAOU_BASH_DIR |
|||
fi |
|||
upgrade "$@" |
|||
else |
|||
>&2 echo "MIAOU_BASH_ERROR: requirements failure" |
|||
fi |
|||
@ -1,8 +0,0 @@ |
|||
#!/usr/bin/miaou-bash |
|||
|
|||
echo A |
|||
>&2 echo warning1 |
|||
>&2 echo warning2 |
|||
echo B |
|||
false |
|||
echo C |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue