Compare commits

..

No commits in common. "e2e4784136c9af3ef4ec3c6fb0655b4863e7d62d" and "e643fe6699ff4f1ac1a4ec342bb1498061d92145" have entirely different histories.

4 changed files with 32 additions and 10 deletions

View File

@ -20,9 +20,9 @@ EOF
header_info
echo -e "Loading..."
APP="Cockpit"
var_disk="4"
var_cpu="2"
var_ram="1024"
var_disk="2"
var_cpu="1"
var_ram="512"
var_os="debian"
var_version="12"
variables

View File

@ -55,7 +55,32 @@ function default_settings() {
function update_script() {
header_info
if [[ ! -d /opt/tianji ]]; then msg_error "No ${APP} Installation Found!"; exit; fi
msg_error "There is currently no update path available."
if (( $(df /boot | awk 'NR==2{gsub("%","",$5); print $5}') > 80 )); then
read -r -p "Warning: Storage is dangerously low, continue anyway? <y/N> " prompt
[[ ${prompt,,} =~ ^(y|yes)$ ]] || exit
fi
RELEASE=$(curl -s https://api.github.com/repos/msgbyte/tianji/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
msg_info "Stopping ${APP} Service"
systemctl stop tianji
msg_ok "Stopped ${APP} Service"
msg_info "Updating ${APP} to ${RELEASE}"
cd /opt/tianji
git checkout -f -q v${RELEASE}
cd src/server
pnpm db:migrate:apply >/dev/null 2>&1
echo "${RELEASE}" >/opt/${APP}_version.txt
msg_ok "Updated ${APP} to ${RELEASE}"
msg_info "Starting ${APP}"
systemctl start tianji
msg_ok "Started ${APP}"
msg_ok "Updated Successfully"
else
msg_ok "No update required. ${APP} is already at ${RELEASE}."
fi
exit
}

View File

@ -22,10 +22,7 @@ $STD apt-get install -y mc
msg_ok "Installed Dependencies"
msg_info "Installing Cockpit"
source /etc/os-release
echo "deb http://deb.debian.org/debian ${VERSION_CODENAME}-backports main" >/etc/apt/sources.list.d/backports.list
$STD apt-get update
$STD apt-get install -t ${VERSION_CODENAME}-backports cockpit --no-install-recommends -y
$STD apt install -y cockpit --no-install-recommends
sed -i "s/root//g" /etc/cockpit/disallowed-users
msg_ok "Installed Cockpit"

View File

@ -31,7 +31,7 @@ $STD apt-get install -y \
mc
msg_ok "Installed Dependencies"
msg_info "Installing Node.js"
msg_info "Installing Node.js, pnpm & pm2"
mkdir -p /etc/apt/keyrings
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" >/etc/apt/sources.list.d/nodesource.list
@ -39,7 +39,7 @@ $STD apt-get update
$STD apt-get install -y nodejs
$STD npm install -g pnpm@9.7.1
export NODE_OPTIONS="--max_old_space_size=4096"
msg_ok "Installed Node.js"
msg_ok "Installed Node.js, pnpm & pm2"
msg_info "Setting up PostgreSQL"
DB_NAME=tianji_db