mirror of
https://github.com/community-scripts/ProxmoxVE
synced 2025-02-09 01:09:16 +00:00
Compare commits
6 Commits
8bb0424acd
...
456751e7cc
Author | SHA1 | Date | |
---|---|---|---|
|
456751e7cc | ||
|
ef5bb1bd28 | ||
|
709ae1742e | ||
|
186e392fac | ||
|
d66bbc4d10 | ||
|
c1d86513d5 |
@ -25,26 +25,40 @@ color
|
||||
catch_errors
|
||||
|
||||
function update_script() {
|
||||
header_info
|
||||
check_container_storage
|
||||
check_container_resources
|
||||
if [[ ! -f /opt/opengist/opengist ]]; then
|
||||
msg_error "No ${APP} Installation Found!"
|
||||
exit
|
||||
fi
|
||||
msg_info "Updating ${APP} LXC"
|
||||
LATEST_URL=$(curl -s https://api.github.com/repos/thomiceli/opengist/releases/latest | jq -r '.assets[] | select(.name | contains("linux-amd64.tar.gz")).browser_download_url')
|
||||
wget "$LATEST_URL"
|
||||
mv opengist*.tar.gz opengist.tar.gz
|
||||
tar -xf opengist.tar.gz
|
||||
mv opengist/opengist /opt/opengist/opengist
|
||||
mv opengist/config.yml /opt/opengist/config.yml
|
||||
chmod +x /opt/opengist/opengist
|
||||
rm -rf opengist*
|
||||
apt-get update &>/dev/null
|
||||
apt-get -y upgrade &>/dev/null
|
||||
msg_ok "Updated Successfully"
|
||||
header_info
|
||||
check_container_storage
|
||||
check_container_resources
|
||||
if [[ ! -d /opt/opengist ]]; then
|
||||
msg_error "No ${APP} Installation Found!"
|
||||
exit
|
||||
fi
|
||||
msg_info "Stopping Service"
|
||||
systemctl stop opengist.service
|
||||
msg_ok "Stopped Service"
|
||||
apt-get update &>/dev/null
|
||||
apt-get upgrade &>/dev/null
|
||||
RELEASE=$(curl -s https://api.github.com/repos/thomiceli/opengist/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 "Updating ${APP} to v${RELEASE}"
|
||||
cd /opt
|
||||
wget -qO "https://github.com/thomiceli/opengist/releases/download/v${RELEASE}/opengist${RELEASE}-linux-amd64.tar.gz"
|
||||
rm -rf /opt/opengist
|
||||
tar -xzf opengist${RELEASE}-linux-amd64.tar.gz
|
||||
chmod +x /opt/opengist/opengist
|
||||
echo "${RELEASE}" >"/opt/${APP}_version.txt"
|
||||
rm -rf /opt/opengist${RELEASE}-linux-amd64.tar.gz
|
||||
apt-get -y autoremove &>/dev/null
|
||||
apt-get -y autoclean &>/dev/null
|
||||
msg_ok "Updated ${APP} LXC"
|
||||
|
||||
msg_info "Starting Service"
|
||||
systemctl start opengist.service
|
||||
msg_ok "Started Service"
|
||||
|
||||
else
|
||||
msg_ok "No update required. ${APP} is already at v${RELEASE}."
|
||||
fi
|
||||
exit
|
||||
}
|
||||
|
||||
start
|
||||
|
@ -2,8 +2,7 @@
|
||||
|
||||
# Copyright (c) 2021-2025 community-scripts ORG
|
||||
# Author: Jonathan (jd-apprentice)
|
||||
# License: MIT
|
||||
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
|
||||
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
||||
color
|
||||
@ -14,25 +13,26 @@ network_check
|
||||
update_os
|
||||
|
||||
msg_info "Installing Dependencies"
|
||||
$STD apt-get install -y curl
|
||||
$STD apt-get install -y jq
|
||||
$STD apt-get install -y sudo
|
||||
$STD apt-get install -y git
|
||||
$STD apt-get install -y \
|
||||
mc \
|
||||
curl \
|
||||
sudo
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
msg_info "Download Opengist Binary"
|
||||
LATEST_URL=$(curl -s https://api.github.com/repos/thomiceli/opengist/releases/latest | jq -r '.assets[] | select(.name | contains("linux-amd64.tar.gz")).browser_download_url')
|
||||
wget "$LATEST_URL"
|
||||
msg_ok "Downloaded Opengist Binary"
|
||||
|
||||
msg_info "Creating Systemd Service"
|
||||
mkdir -p /opt/opengist
|
||||
mv opengist*.tar.gz opengist.tar.gz
|
||||
tar -xf opengist.tar.gz
|
||||
mv opengist/opengist /opt/opengist/opengist
|
||||
mv opengist/config.yml /opt/opengist/config.yml
|
||||
msg_info "Install Opengist"
|
||||
RELEASE=$(curl -s https://api.github.com/repos/thomiceli/opengist/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
||||
echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt"
|
||||
wget -q "https://github.com/thomiceli/opengist/releases/download/v${RELEASE}/opengist${RELEASE}-linux-amd64.tar.gz"
|
||||
tar -xzf opengist${RELEASE}-linux-amd64.tar.gz
|
||||
mv opengist /opt/opengist
|
||||
chmod +x /opt/opengist/opengist
|
||||
rm -rf opengist*
|
||||
mkdir -p /opt/opengist-data
|
||||
msg_ok "Installed Opengist"
|
||||
|
||||
msg_info "Creating Service"
|
||||
|
||||
sed -i 's|opengist-home:.*|opengist-home: /opt/opengist-data|' /opt/opengist/config.yml
|
||||
|
||||
cat <<EOF >/etc/systemd/system/opengist.service
|
||||
[Unit]
|
||||
Description=Opengist server to manage your Gists
|
||||
@ -40,24 +40,21 @@ After=network.target
|
||||
|
||||
[Service]
|
||||
WorkingDirectory=/opt/opengist
|
||||
ExecStart=/opt/opengist/opengist
|
||||
ExecStart=/opt/opengist/opengist --config config.yaml
|
||||
Restart=always
|
||||
User=root
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
msg_ok "Created Systemd Service"
|
||||
|
||||
msg_info "Starting Service"
|
||||
systemctl daemon-reload
|
||||
systemctl enable -q --now opengist.service
|
||||
msg_ok "Started Service"
|
||||
msg_ok "Created Service"
|
||||
|
||||
motd_ssh
|
||||
customize
|
||||
|
||||
msg_info "Cleaning up"
|
||||
rm -rf /opengist${RELEASE}-linux-amd64.tar.gz
|
||||
$STD apt-get -y autoremove
|
||||
$STD apt-get -y autoclean
|
||||
msg_ok "Cleaned"
|
||||
|
Loading…
Reference in New Issue
Block a user