Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: AdventureLog - update script bug #1334

Merged

Conversation

JesperDramsch
Copy link
Contributor

@JesperDramsch JesperDramsch commented Jan 8, 2025

🛠️ Note:
We are meticulous about merging code into the main branch, so please understand that pull requests not meeting the project's standards may be rejected. It's never personal!
🎮 Note for game-related scripts: These have a lower likelihood of being merged.


✍️ Description

Adventure log wasn't updating correctly.

This fixes several things:

  1. Move original installation into a backup location
  2. Update installation
  3. Move user-generated data back to installation (media and env files)
  4. Return to PWD, which was left in the script and then files were left strewn around.

Fixes #1331


🛠️ Type of Change

Please check the relevant options:

  • Bug fix (non-breaking change that resolves an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change unexpectedly)
  • New script (a fully functional and thoroughly tested script or set of scripts)

✅ Prerequisites

The following steps must be completed for the pull request to be considered:

  • Self-review performed (I have reviewed my code to ensure it follows established patterns and conventions.)
  • Testing performed (I have thoroughly tested my changes and verified expected functionality.)
  • Documentation updated (I have updated any relevant documentation)

📋 Additional Information (optional)

Provide any extra context or screenshots about the feature or fix here.

I ran the code on my own installation. I made the design decision to keep prior files (sans media due to size) around as AdventureLog is changing quite a bit, which means I don't want to just rm -rf the old installation. But you can make the decision this would be more correct.

@JesperDramsch JesperDramsch requested a review from a team as a code owner January 8, 2025 19:46
@github-actions github-actions bot added the update script A change that updates a script label Jan 8, 2025
Copy link
Contributor

github-actions bot commented Jan 8, 2025

Script validation

❌ We found issues in the following changed files:

Not executable:

  • ct/adventurelog.sh
  • ct/checkmk.sh
  • install/checkmk-install.sh

Copyright header line missing or invalid:

  • install/checkmk-install.sh

License header line missing or invalid:

  • install/checkmk-install.sh

Source header line missing or invalid:

  • install/checkmk-install.sh

Script formatting

❌ We found issues in the formatting of the following changed files:

diff ct/checkmk.sh.orig ct/checkmk.sh
--- ct/checkmk.sh.orig
+++ ct/checkmk.sh
@@ -29,7 +29,7 @@
     msg_error "No ${APP} Installation Found!"
     exit
   fi
-  RELEASE=$(curl -fsSL https://api.github.com/repos/checkmk/checkmk/tags | grep "name" | awk '{print substr($2, 3, length($2)-4) }') 
+  RELEASE=$(curl -fsSL https://api.github.com/repos/checkmk/checkmk/tags | grep "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}"
     omd stop monitoring &>/dev/null
@@ -38,7 +38,7 @@
     apt-get install -y /opt/checkmk.deb &>/dev/null
     omd --force -V ${RELEASE}.cre update --conflict=install monitoring &>/dev/null
     omd start monitoring &>/dev/null
-    omd -f rm monitoringbackup  &>/dev/null
+    omd -f rm monitoringbackup &>/dev/null
     omd cleanup &>/dev/null
     rm -rf /opt/checkmk.deb
     msg_ok "Updated ${APP} to v${RELEASE}"
diff install/checkmk-install.sh.orig install/checkmk-install.sh
--- install/checkmk-install.sh.orig
+++ install/checkmk-install.sh
@@ -5,7 +5,6 @@
 # License: MIT
 # https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
 
-
 source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
 color
 verb_ip6
@@ -18,7 +17,7 @@
 $STD apt-get install -y \
   curl \
   sudo \
-  mc 
+  mc
 msg_ok "Installed Dependencies"
 
 msg_info "Install Checkmk"
@@ -35,10 +34,10 @@
 PASSWORD=$(omd create monitoring | grep "password:" | awk '{print $NF}')
 $STD omd start
 {
-    echo "Application-Credentials"
-    echo "Username: cmkadmin"
-    echo "Password: $PASSWORD"
-} >> ~/checkmk.creds
+  echo "Application-Credentials"
+  echo "Username: cmkadmin"
+  echo "Password: $PASSWORD"
+} >>~/checkmk.creds
 msg_ok "Created Service"
 
 msg_info "Cleaning up"

ct/adventurelog.sh Outdated Show resolved Hide resolved
ct/adventurelog.sh Outdated Show resolved Hide resolved
ct/adventurelog.sh Outdated Show resolved Hide resolved
ct/adventurelog.sh Outdated Show resolved Hide resolved
ct/adventurelog.sh Outdated Show resolved Hide resolved
ct/adventurelog.sh Outdated Show resolved Hide resolved
ct/adventurelog.sh Outdated Show resolved Hide resolved
JesperDramsch and others added 6 commits January 9, 2025 10:50
Co-authored-by: Michel Roegl-Brunner <[email protected]>
Co-authored-by: Michel Roegl-Brunner <[email protected]>
Co-authored-by: Michel Roegl-Brunner <[email protected]>
Co-authored-by: Michel Roegl-Brunner <[email protected]>
ct/adventurelog.sh Outdated Show resolved Hide resolved
@MickLesk MickLesk changed the title fix(adventurelog): update script bug Fix: AdventureLog - update script bug Jan 9, 2025
@MickLesk MickLesk merged commit d56d8dd into community-scripts:main Jan 9, 2025
4 of 6 checks passed
@Aloe-recite
Copy link

Now that this fix has been merged (thanks guys for your awesome dedication!), shall I run the script again in the host shell, or just run the "update" function in the existing container? Thanks guys

@MickLesk
Copy link
Member

MickLesk commented Jan 9, 2025

It's the same. Unless you have not updated the “update” call, then it still uses ttecks repo

@Solear
Copy link

Solear commented Jan 9, 2025

The merged update does not work (LXC with adventurelog 0.7.1):

` ✔️ Services Stopped
⠧mv: cannot stat '/opt/AdventureLog-0.8.0': No such file or directory

[ERROR] in line 46: exit code 0: while executing command mv /opt/AdventureLog-${RELEASE} /opt/adventurelog

`

@MickLesk
Copy link
Member

MickLesk commented Jan 9, 2025

create an issue and mark @JesperDramsch

@community-scripts community-scripts locked as off-topic and limited conversation to collaborators Jan 9, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
update script A change that updates a script
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] AdventureLog update does not update
5 participants