Browse Source

install2

main
pvincent 3 weeks ago
parent
commit
7cb8306c23
  1. 14
      install2.sh
  2. 2
      lib/functions.bash

14
install2.sh

@ -18,7 +18,7 @@ function install {
cd /tmp
curl -sO $MAIN_TAR_GZ_URL
sudo tar -xzf main.tar.gz --directory $(dirname "$MIAOU_BASH_DIR")
sudo tar -xzf main.tar.gz --directory "$(dirname "$MIAOU_BASH_DIR")"
execute_miaou_lib initiate
source /etc/profile
@ -28,7 +28,8 @@ function install {
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=$(grep -oP '^ID=\K(.*)' /etc/os-release)
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'
exit 2
@ -42,14 +43,17 @@ function once_installed {
}
function execute_miaou_lib {
sudo -E "$MIAOU_BASH_DIR"/bin/miaou-bash "$MIAOU_BASH_DIR/lib/"$1".bash"
sudo -E "$MIAOU_BASH_DIR"/bin/miaou-bash "$MIAOU_BASH_DIR"/lib/"$1".bash
}
function sudo_root {
[[ "$UID" -ne 0 ]] && sudo -vp 'SUDO privilege required: '
}
## MAIN
# source <(curl -s https://git.artcode.re/miaou/miaou-bash/raw/branch/main/install2.sh)
set -Eeuo pipefail
assert_supported_distro
[[ "$UID" -ne 0 ]] && sudo -vp 'SUDO privilege required: '
once_installed && upgrade || install
sudo_root
if once_installed; then upgrade; else install; fi

2
lib/functions.bash

@ -12,7 +12,7 @@ function assert_root {
}
function assert_container {
cat /proc/self/cgroup | awk -F / '{print $NF}' | grep -qE '^(session-c|\.lxc)'
cat /proc/self/cgroup | grep -E '/session-c[0-9]+.scope'
}
function assert_system_mode {

Loading…
Cancel
Save