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!"
|
||||
exit
|
||||
fi
|
||||
|
||||
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
|
||||
if check_for_gh_release "stylus" "mmastrac/stylus"; then
|
||||
msg_info "Stopping $APP"
|
||||
systemctl stop stylus
|
||||
msg_ok "Stopped $APP"
|
||||
@ -39,7 +37,7 @@ function update_script() {
|
||||
msg_info "Updating $APP"
|
||||
$STD rustup update
|
||||
$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_info "Starting $APP"
|
||||
|
@ -12,7 +12,7 @@
|
||||
"documentation": "https://mmastrac.github.io/stylus/",
|
||||
"website": "https://github.com/mmastrac/stylus",
|
||||
"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.",
|
||||
"install_methods": [
|
||||
{
|
||||
@ -33,7 +33,7 @@
|
||||
},
|
||||
"notes": [
|
||||
{
|
||||
"text": "Configuration Path: `/opt/stylus/`",
|
||||
"text": "Configuration Path: `/opt/stylus/config.yaml`",
|
||||
"type": "info"
|
||||
}
|
||||
]
|
||||
|
@ -30,20 +30,21 @@ msg_ok "Installed Rust"
|
||||
msg_info "Installing Stylus"
|
||||
$STD cargo install 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_info "Creating service"
|
||||
|
||||
cat >/etc/systemd/system/stylus.service <<EOF
|
||||
cat <<EOF >/etc/systemd/system/stylus.service
|
||||
[Unit]
|
||||
Description=Stylus
|
||||
Description=Stylus Service
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=$HOME/.cargo/bin/stylus run /opt/stylus
|
||||
Restart=on-failure
|
||||
RestartSec=5
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
Loading…
x
Reference in New Issue
Block a user