From 319a779d4913157b551d000f3e89416cebc2a9b9 Mon Sep 17 00:00:00 2001 From: Daniel Kukula Date: Sun, 17 Aug 2025 20:19:55 +0200 Subject: [PATCH] cr suggetions --- ct/livebook.sh | 15 ++++++++------- install/livebook-install.sh | 36 ++++++++++++++++++------------------ misc/build.func | 2 +- misc/install.func | 2 +- 4 files changed, 28 insertions(+), 27 deletions(-) diff --git a/ct/livebook.sh b/ct/livebook.sh index 7f9e848e..733cd0e3 100755 --- a/ct/livebook.sh +++ b/ct/livebook.sh @@ -1,5 +1,6 @@ #!/usr/bin/env bash -source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/refs/heads/main/misc/build.func) +source <(curl -fsSL https://raw.githubusercontent.com/dkuku/ProxmoxVED/refs/heads/livebook/misc/build.func) +#source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/refs/heads/main/misc/build.func) # Copyright (c) 2021-2025 community-scripts ORG # Author: dkuku # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE @@ -24,7 +25,7 @@ function update_script() { check_container_storage check_container_resources - if [[ ! -f /opt/.mix/escripts/livebook ]]; then + if [[ ! -f /opt/livebook/.mix/escripts/livebook ]]; then msg_error "No ${APP} Installation Found!" exit 1 fi @@ -32,19 +33,19 @@ function update_script() { msg_info "Checking for updates..." RELEASE=$(curl -fsSL https://api.github.com/repos/livebook-dev/livebook/releases/latest | grep "tag_name" | awk -F'"' '{print $4}') - if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt 2>/dev/null)" ]]; then + if [[ "${RELEASE}" != "$(cat /opt/.livebook 2>/dev/null)" ]]; then msg_info "Updating ${APP} LXC" $STD apt-get update $STD apt-get -y upgrade msg_ok "Updated ${APP} LXC" msg_info "Updating ${APP} to ${RELEASE}" - source /opt/.env - cd /opt || exit 1 + source /opt/livebook/.env + cd /opt/livebook || exit 1 mix escript.install hex livebook --force - echo "$RELEASE" | $STD tee /opt/${APP}_version.txt >/dev/null - chown -R livebook:livebook /opt /data + echo "$RELEASE" | $STD tee /opt/.livebook + chown -R livebook:livebook /opt/livebook /data msg_ok "Successfully updated to ${RELEASE}" else diff --git a/install/livebook-install.sh b/install/livebook-install.sh index c87e2ca4..aa2e1b03 100644 --- a/install/livebook-install.sh +++ b/install/livebook-install.sh @@ -13,7 +13,7 @@ setting_up_container network_check update_os -msg_info "Installing Dependencies (matching Livebook Dockerfile)" +msg_info "Installing Dependencies" $STD apt-get install -y \ build-essential \ ca-certificates \ @@ -23,24 +23,24 @@ $STD apt-get install -y \ msg_ok "Installed Dependencies" msg_info "Creating livebook user" -adduser --system --group --home /opt --shell /bin/bash livebook +adduser --system --group --home /opt/livebook --shell /bin/bash livebook msg_ok "Created livebook user" msg_info "Installing Erlang and Elixir" -mkdir -p /opt /data -export HOME=/opt -cd /opt || exit 1 +mkdir -p /opt/livebook /data +export HOME=/opt/livebook +cd /opt/livebook || exit 1 curl -fsSO https://elixir-lang.org/install.sh $STD sh install.sh elixir@latest otp@latest RELEASE=$(curl -fsSL https://api.github.com/repos/livebook-dev/livebook/releases/latest | grep "tag_name" | awk -F'"' '{print $4}') -ERLANG_VERSION=$(ls /opt/.elixir-install/installs/otp/ | head -n1) -ELIXIR_VERSION=$(ls /opt/.elixir-install/installs/elixir/ | head -n1) +ERLANG_VERSION=$(ls /opt/livebook/.elixir-install/installs/otp/ | head -n1) +ELIXIR_VERSION=$(ls /opt/livebook/.elixir-install/installs/elixir/ | head -n1) -export ERLANG_BIN="/opt/.elixir-install/installs/otp/$ERLANG_VERSION/bin" -export ELIXIR_BIN="/opt/.elixir-install/installs/elixir/$ELIXIR_VERSION/bin" +export ERLANG_BIN="/opt/livebook/.elixir-install/installs/otp/$ERLANG_VERSION/bin" +export ELIXIR_BIN="/opt/livebook/.elixir-install/installs/elixir/$ELIXIR_VERSION/bin" export PATH="$ERLANG_BIN:$ELIXIR_BIN:$PATH" $STD mix local.hex --force @@ -49,13 +49,13 @@ $STD mix escript.install hex livebook --force LIVEBOOK_PASSWORD=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c16) -cat < /opt/livebook.creds +cat < /opt/livebook/livebook.creds Livebook-Credentials Livebook Password: $LIVEBOOK_PASSWORD EOF -cat < /opt/.env -export HOME=/opt +cat < /opt/livebook/.env +export HOME=/opt/livebook export LIVEBOOK_VERSION=$RELEASE export ERLANG_VERSION=$ERLANG_VERSION export ELIXIR_VERSION=$ELIXIR_VERSION @@ -63,9 +63,9 @@ export LIVEBOOK_PORT=8080 export LIVEBOOK_IP="::" export LIVEBOOK_HOME=/data export LIVEBOOK_PASSWORD="$LIVEBOOK_PASSWORD" -export ESCRIPTS_BIN=/opt/.mix/escripts -export ERLANG_BIN="/opt/.elixir-install/installs/otp/\${ERLANG_VERSION}/bin" -export ELIXIR_BIN="/opt/.elixir-install/installs/elixir/\${ELIXIR_VERSION}/bin" +export ESCRIPTS_BIN=/opt/livebook/.mix/escripts +export ERLANG_BIN="/opt/livebook/.elixir-install/installs/otp/\${ERLANG_VERSION}/bin" +export ELIXIR_BIN="/opt/livebook/.elixir-install/installs/elixir/\${ELIXIR_VERSION}/bin" export PATH="\$ESCRIPTS_BIN:\$ERLANG_BIN:\$ELIXIR_BIN:\$PATH" EOF @@ -82,8 +82,8 @@ Type=exec User=livebook Group=livebook WorkingDirectory=/data -EnvironmentFile=-/opt/.env -ExecStart=/bin/bash -c 'source /opt/.env && cd /opt && livebook server' +EnvironmentFile=-/opt/livebook/.env +ExecStart=/bin/bash -c 'source /opt/livebook/.env && cd /opt/livebook && livebook server' Restart=always RestartSec=5 @@ -92,7 +92,7 @@ WantedBy=multi-user.target EOF msg_info "Setting ownership and permissions" -chown -R livebook:livebook /opt /data +chown -R livebook:livebook /opt/livebook /data msg_ok "Set ownership and permissions" systemctl enable -q --now livebook diff --git a/misc/build.func b/misc/build.func index c40a57bd..49b20b7f 100644 --- a/misc/build.func +++ b/misc/build.func @@ -1438,7 +1438,7 @@ EOF' fi msg_ok "Customized LXC Container" - lxc-attach -n "$CTID" -- bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/install/${var_install}.sh)" + lxc-attach -n "$CTID" -- bash -c "$(curl -fsSL https://raw.githubusercontent.com/dkuku/ProxmoxVED/refs/heads/livebook/install/${var_install}.sh)" } destroy_lxc() { diff --git a/misc/install.func b/misc/install.func index e3751c29..d1facfa4 100644 --- a/misc/install.func +++ b/misc/install.func @@ -196,7 +196,7 @@ EOF systemctl restart $(basename $(dirname $GETTY_OVERRIDE) | sed 's/\.d//') msg_ok "Customized Container" fi - echo "bash -c \"\$(curl -fsSL https://github.com/community-scripts/ProxmoxVED/raw/main/ct/${app}.sh)\"" >/usr/bin/update + echo "bash -c \"\$(curl -fsSL https://raw.githubusercontent.com/dkuku/ProxmoxVED/refs/heads/livebook/ct/${app}.sh)\"" >/usr/bin/update chmod +x /usr/bin/update if [[ -n "${SSH_AUTHORIZED_KEY}" ]]; then mkdir -p /root/.ssh