optimize backrest
This commit is contained in:
parent
8f69e39e02
commit
849c43f85a
@ -34,18 +34,23 @@ function update_script() {
|
|||||||
msg_ok "Stopped ${APP}"
|
msg_ok "Stopped ${APP}"
|
||||||
|
|
||||||
msg_info "Updating ${APP} to ${RELEASE}"
|
msg_info "Updating ${APP} to ${RELEASE}"
|
||||||
cd /opt/backrest/bin
|
temp_file=$(mktemp)
|
||||||
curl -fsSL "https://github.com/garethgeorge/backrest/releases/download/v${RELEASE}/backrest_Linux_x86_64.tar.gz" -o "backrest_Linux_x86_64.tar.gz"
|
rm -f /opt/backrest/bin/backrest
|
||||||
tar -xzf backrest_Linux_x86_64.tar.gz
|
curl -fsSL "https://github.com/garethgeorge/backrest/releases/download/v${RELEASE}/backrest_Linux_x86_64.tar.gz" -o "$temp_file"
|
||||||
rm -rf backrest_Linux_x86_64.tar.gz
|
tar zxf "$temp_file" --strip-components=1 -C /opt/backrest/bin
|
||||||
rm -f install.sh uninstall.sh
|
chmod +x /opt/backrest/bin/backrest
|
||||||
chmod +x backrest
|
|
||||||
echo "${RELEASE}" >/opt/${APP}_version.txt
|
echo "${RELEASE}" >/opt/${APP}_version.txt
|
||||||
msg_ok "Updated ${APP} to ${RELEASE}"
|
msg_ok "Updated ${APP} to ${RELEASE}"
|
||||||
|
|
||||||
msg_info "Starting ${APP}"
|
msg_info "Starting ${APP}"
|
||||||
systemctl start backrest
|
systemctl start backrest
|
||||||
msg_ok "Started ${APP}"
|
msg_ok "Started ${APP}"
|
||||||
|
|
||||||
|
msg_info "Cleaning up"
|
||||||
|
rm -f "$temp_file"
|
||||||
|
apt-get -y autoremove
|
||||||
|
apt-get -y autoclean
|
||||||
|
msg_ok "Cleaned up"
|
||||||
msg_ok "Updated Successfully"
|
msg_ok "Updated Successfully"
|
||||||
else
|
else
|
||||||
msg_ok "No update required. ${APP} is already at ${RELEASE}"
|
msg_ok "No update required. ${APP} is already at ${RELEASE}"
|
||||||
|
@ -15,11 +15,11 @@ update_os
|
|||||||
|
|
||||||
msg_info "Installing Backrest"
|
msg_info "Installing Backrest"
|
||||||
RELEASE=$(curl -fsSL https://api.github.com/repos/garethgeorge/backrest/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
RELEASE=$(curl -fsSL https://api.github.com/repos/garethgeorge/backrest/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
||||||
|
temp_file=$(mktemp)
|
||||||
mkdir -p /opt/backrest/{bin,config,data}
|
mkdir -p /opt/backrest/{bin,config,data}
|
||||||
cd /opt/backrest/bin
|
curl -fsSL "https://github.com/garethgeorge/backrest/releases/download/v${RELEASE}/backrest_Linux_x86_64.tar.gz" -o "$temp_file"
|
||||||
curl -fsSL "https://github.com/garethgeorge/backrest/releases/download/v${RELEASE}/backrest_Linux_x86_64.tar.gz" -o "backrest_Linux_x86_64.tar.gz"
|
tar zxf "$temp_file" --strip-components=1 -C /opt/backrest/bin
|
||||||
tar -xzf backrest_Linux_x86_64.tar.gz
|
chmod +x /opt/backrest/bin/backrest
|
||||||
chmod +x backrest
|
|
||||||
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
|
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
|
||||||
msg_ok "Installed Backrest"
|
msg_ok "Installed Backrest"
|
||||||
|
|
||||||
@ -48,8 +48,7 @@ motd_ssh
|
|||||||
customize
|
customize
|
||||||
|
|
||||||
msg_info "Cleaning up"
|
msg_info "Cleaning up"
|
||||||
|
rm -f "$temp_file"
|
||||||
$STD apt-get -y autoremove
|
$STD apt-get -y autoremove
|
||||||
$STD apt-get -y autoclean
|
$STD apt-get -y autoclean
|
||||||
rm -rf backrest_Linux_x86_64.tar.gz
|
|
||||||
rm -f install.sh uninstall.sh
|
|
||||||
msg_ok "Cleaned"
|
msg_ok "Cleaned"
|
||||||
|
@ -32,6 +32,15 @@ install_node_and_modules() {
|
|||||||
NEED_NODE_INSTALL=true
|
NEED_NODE_INSTALL=true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if ! command -v jq &>/dev/null; then
|
||||||
|
$STD msg_info "Installing jq..."
|
||||||
|
$STD apt-get update -qq &>/dev/null
|
||||||
|
$STD apt-get install -y jq &>/dev/null || {
|
||||||
|
msg_error "Failed to install jq"
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
fi
|
||||||
|
|
||||||
# Install Node.js if required
|
# Install Node.js if required
|
||||||
if [[ "$NEED_NODE_INSTALL" == true ]]; then
|
if [[ "$NEED_NODE_INSTALL" == true ]]; then
|
||||||
$STD apt-get purge -y nodejs
|
$STD apt-get purge -y nodejs
|
||||||
|
Loading…
x
Reference in New Issue
Block a user