Added new check_for_gh_release function and changed version file to new home. Config path now points to a file. Revisioned cat command on install script.
This commit is contained in:
parent
2dcc7736dc
commit
9be8f3724c
@ -29,9 +29,7 @@ function update_script() {
|
|||||||
msg_error "No ${APP} Installation Found!"
|
msg_error "No ${APP} Installation Found!"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
if check_for_gh_release "stylus" "mmastrac/stylus"; then
|
||||||
RELEASE=$(curl -fsSL https://api.github.com/repos/mmastrac/stylus/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
|
||||||
if [[ ! -f /opt/stylus/stylus_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/stylus/stylus_version.txt)" ]]; then
|
|
||||||
msg_info "Stopping $APP"
|
msg_info "Stopping $APP"
|
||||||
systemctl stop stylus
|
systemctl stop stylus
|
||||||
msg_ok "Stopped $APP"
|
msg_ok "Stopped $APP"
|
||||||
@ -39,7 +37,7 @@ function update_script() {
|
|||||||
msg_info "Updating $APP"
|
msg_info "Updating $APP"
|
||||||
$STD rustup update
|
$STD rustup update
|
||||||
$STD cargo install-update -a
|
$STD cargo install-update -a
|
||||||
$STD su -c "cargo install --list | grep 'stylus' | cut -d' ' -f2 | sed 's/^v//;s/:$//' > /opt/stylus/stylus_version.txt"
|
$STD su -c "cargo install --list | grep 'stylus' | cut -d' ' -f2 | sed 's/^v//;s/:$//' > ~/.stylus"
|
||||||
msg_ok "Updated $APP"
|
msg_ok "Updated $APP"
|
||||||
|
|
||||||
msg_info "Starting $APP"
|
msg_info "Starting $APP"
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
"documentation": "https://mmastrac.github.io/stylus/",
|
"documentation": "https://mmastrac.github.io/stylus/",
|
||||||
"website": "https://github.com/mmastrac/stylus",
|
"website": "https://github.com/mmastrac/stylus",
|
||||||
"logo": null,
|
"logo": null,
|
||||||
"config_path": "/opt/stylus/",
|
"config_path": "/opt/stylus/config.yaml",
|
||||||
"description": "Stylus (style + status) is a lightweight status page for infrastructure and networks. Configure a set of bash scripts that test the various parts of your infrastructure, set up visualizations with minimal configuration, and Stylus will generate you a dashboard for your system.",
|
"description": "Stylus (style + status) is a lightweight status page for infrastructure and networks. Configure a set of bash scripts that test the various parts of your infrastructure, set up visualizations with minimal configuration, and Stylus will generate you a dashboard for your system.",
|
||||||
"install_methods": [
|
"install_methods": [
|
||||||
{
|
{
|
||||||
@ -33,7 +33,7 @@
|
|||||||
},
|
},
|
||||||
"notes": [
|
"notes": [
|
||||||
{
|
{
|
||||||
"text": "Configuration Path: `/opt/stylus/`",
|
"text": "Configuration Path: `/opt/stylus/config.yaml`",
|
||||||
"type": "info"
|
"type": "info"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -30,20 +30,21 @@ msg_ok "Installed Rust"
|
|||||||
msg_info "Installing Stylus"
|
msg_info "Installing Stylus"
|
||||||
$STD cargo install stylus
|
$STD cargo install stylus
|
||||||
$STD stylus init /opt/stylus/
|
$STD stylus init /opt/stylus/
|
||||||
$STD su -c "cargo install --list | grep 'stylus' | cut -d' ' -f2 | sed 's/^v//;s/:$//' > /opt/stylus/stylus_version.txt"
|
$STD su -c "cargo install --list | grep 'stylus' | cut -d' ' -f2 | sed 's/^v//;s/:$//' > ~/.stylus"
|
||||||
msg_ok "Installed Stylus"
|
msg_ok "Installed Stylus"
|
||||||
|
|
||||||
msg_info "Creating service"
|
msg_info "Creating service"
|
||||||
|
|
||||||
cat >/etc/systemd/system/stylus.service <<EOF
|
cat <<EOF >/etc/systemd/system/stylus.service
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Stylus
|
Description=Stylus Service
|
||||||
After=network.target
|
After=network.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
ExecStart=$HOME/.cargo/bin/stylus run /opt/stylus
|
ExecStart=$HOME/.cargo/bin/stylus run /opt/stylus
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
|
RestartSec=5
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
Loading…
x
Reference in New Issue
Block a user