Skip to content

Commit

Permalink
Update sweethome3d
Browse files Browse the repository at this point in the history
  • Loading branch information
ivan-hc authored Jun 26, 2024
1 parent acc6f9c commit b2c9804
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions programs/x86_64/sweethome3d
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@ chmod a+x "/opt/$APP/remove"

# DOWNLOAD AND PREPARE THE APP, $version is also used for updates
version=$(curl -Ls https://www.sweethome3d.com/download.jsp | tr "'" '\n' | grep linux-x64.tgz | head -1)
wget "$version" || exit 1
wget "$version" -O "$APP.tgz" || exit 1
[ -e ./*7z ] && 7z x ./*7z && rm -f ./*7z
[ -e ./*tar.* ] && tar fx ./*tar.* && rm -f ./*tar.*
[ -e ./*tgz* ] && tar fx ./*tgz* && rm -f ./*tgz*
[ -e ./*zip ] && unzip -qq ./*zip 1>/dev/null && rm -f ./*zip
cd ..
if [ -d ./tmp/* 2>/dev/null ]; then mv ./tmp/*/* ./; else mv ./tmp/* ./"$APP" 2>/dev/null || mv ./tmp/* ./; fi
rm -R -f ./tmp || exit 1
echo "$version" > ./version
chmod a+x "/opt/$APP/$APP" || exit 1
chmod a+x "/opt/$APP/SweetHome3D" || exit 1

# LINK TO PATH
ln -s "/opt/$APP/$APP" "/usr/local/bin/$APP"
ln -s "/opt/$APP/SweetHome3D" "/usr/local/bin/$APP"

# SCRIPT TO UPDATE THE PROGRAM
cat >> "/opt/$APP/AM-updater" << 'EOF'
Expand All @@ -38,13 +38,13 @@ version=$(curl -Ls https://www.sweethome3d.com/download.jsp | tr "'" '\n' | grep
if [ "$version" != "$version0" ]; then
mkdir "/opt/$APP/tmp" && cd "/opt/$APP/tmp" || exit 1
notify-send "A new version of $APP is available, please wait"
wget "$version" || exit 1
wget "$version" -O "$APP.tgz" || exit 1
[ -e ./*7z ] && 7z x ./*7z && rm -f ./*7z
[ -e ./*tar.* ] && tar fx ./*tar.* && rm -f ./*tar.*
[ -e ./*tgz* ] && tar fx ./*tgz* && rm -f ./*tgz*
[ -e ./*zip ] && unzip -qq ./*zip 1>/dev/null && rm -f ./*zip
cd ..
if [ -d ./tmp/* 2>/dev/null ]; then mv --backup=t ./tmp/*/* ./; else mv --backup=t ./tmp/* ./"$APP" 2>/dev/null || mv --backup=t ./tmp/* ./; fi
chmod a+x "/opt/$APP/$APP" || exit 1
chmod a+x "/opt/$APP/SweetHome3D" || exit 1
echo "$version" > ./version
rm -R -f ./tmp ./*~
notify-send "$APP is updated!"
Expand Down

0 comments on commit b2c9804

Please sign in to comment.