diff --git a/bin/pct-create b/bin/pct-create index 15e3aa3..43847e9 100755 --- a/bin/pct-create +++ b/bin/pct-create @@ -6,7 +6,7 @@ BASEDIR=$(dirname "$0") CONTAINER_NAME=$1 TEMPLATE_DIR=/var/lib/vz/template/cache TAG_NAME=debian13 -SSH_PUBKEYS="$BASEDIR/pct-administrators.pubkeys" +SSH_PUBKEYS="$BASEDIR/../config/admin.pubkeys" # FUNCTIONS @@ -78,7 +78,7 @@ function existing_container { set -Eue [[ "$#" -lt 1 ]] && usage && exit 1 -source "$BASEDIR/pct-default.config" +source "$BASEDIR/../config/default.config" # show_defaults existing_container && false || create_container diff --git a/install.sh b/install.sh index f3767b5..4f610c2 100755 --- a/install.sh +++ b/install.sh @@ -11,12 +11,33 @@ function halt_on_error { } function assert_root { - [ "$(id -u)" -ne 0 ] && halt_on_error 'root privilege required!' + [ "$(id -u)" -ne 0 ] && halt_on_error 'root privilege required!' 1 } function assert_proxmox { grep -q ^ID=debian /etc/os-release || halt_on_error 'distro debian required!' 2 command -v pct >/dev/null || halt_on_error 'command `pct` not found!' 3 + command -v curl >/dev/null || halt_on_error 'command `curl` not found!' 4 +} + +function install_miaou_bash { + if [[ ! -d /opt/miaou-bash ]]; then + echo 'installing miaou-bash...' + curl https://git.artcode.re/miaou/miaou-bash/raw/branch/main/install.sh | sudo bash -s + fi +} + +function install_miaou_proxmox { + if [[ ! -d /opt/miaou-proxmox ]]; then + echo 'installing miaou-proxmox...' + git clone https://git.artcode.re/miaou/miaou-proxmox.git /opt/miaou-proxmox + else + cd /opt/miaou-proxmox + git pull + cd - >/dev/null + fi + status=$(append_or_replace '^PATH=\$PATH:/opt/miaou-proxmox/bin' 'PATH=$PATH:/opt/miaou-proxmox/bin' $HOME/.bashrc) + [[ $status == 'appended' ]] && echo 'successfully installed! please run `source $HOME/.bashrc`' } # MAIN @@ -24,4 +45,5 @@ function assert_proxmox { set Eue assert_root assert_proxmox -echo OK +install_miaou_bash +install_miaou_proxmox