diff --git a/README.md b/README.md index 682f7b5..9e079d1 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,10 @@ To automate __our environment__ we wrote this bash script. It may won't work in ## Setup 1. Clone this repository. 1. Make the script executable (if not cloned): `chmod +x moodle-update` +1. Go to your web directory: `cd /var/www` +1. Rename the moodle directory to: `moodle_x.y` like `moodle_4.01` +1. Create a link to this directory with the absolute path: `ln -s /var/www/moodle_4.01 moodle` +1. Tell your web server to serve `/var/www/moodle`. ### Config @@ -14,9 +18,9 @@ The script creates a `settings.conf` file for a standard Debian/Ubuntu Linux. ## Usage options -- Without any parameter: `./update-moodle` -- With new version: `./update-moodle 3.9` -- With new version + explicit download file: `./update-moodle 3.9 https://example.com/moodle-3.9.21.zip` +- Without any parameter: `./moodle-update` +- With new version: `./moodle-update 3.9` +- With new version + explicit download file: `./moodle-update 3.9 https://example.com/moodle-3.9.21.zip` ### Important information for Moodle 4 diff --git a/moodle-update b/moodle-update index 240e08f..93ea05d 100755 --- a/moodle-update +++ b/moodle-update @@ -472,6 +472,88 @@ printf "\n%-30s %s" "previous plugins" ": " # print array printf "${LIGHTCYAN}%d${NC}\n" "${#PLUGIN_DIFF_ARRAY[*]}" + + # check if minor version changes + if test ! "$MOODLE_VERSION_NEXT" = "$MOODLE_VERSION_NOW" + then + # boost_union detection + if test -d "$BACKUP_PATH/theme/boost_union/" + then + echo " " + printf "${LIGHTRED}%-30s${NC}\n" "boost_union detected" + + # suggest urls from: https://moodle.org/plugins/theme_boost_union/versions + if test $MOODLE_VERSION_NEXT = "4.00" + then + printf "%-30s %s\n" "suggested url" ": https://moodle.org/plugins/download.php/29678/theme_boost_union_moodle40_2022080940.zip" + elif test $MOODLE_VERSION_NEXT = "4.01" + then + printf "%-30s %s\n" "suggested url" ": https://moodle.org/plugins/download.php/33570/theme_boost_union_moodle41_2023010570.zip" + elif test $MOODLE_VERSION_NEXT = "4.02" + then + printf "%-30s %s\n" "suggested url" ": https://moodle.org/plugins/download.php/33569/theme_boost_union_moodle42_2023090147.zip" + elif test $MOODLE_VERSION_NEXT = "4.03" + then + printf "%-30s %s\n" "suggested url" ": https://moodle.org/plugins/download.php/33565/theme_boost_union_moodle43_2023102044.zip" + elif test $MOODLE_VERSION_NEXT = "4.04" + then + printf "%-30s %s\n" "suggested url" ": https://moodle.org/plugins/download.php/33590/theme_boost_union_moodle44_2024060103.zip" + elif test $MOODLE_VERSION_NEXT = "4.05" + then + printf "%-30s %s\n" "suggested url" ": https://moodle.org/plugins/download.php/33573/theme_boost_union_moodle45_2024100700.zip" + else + printf "%-30s %s\n" "get a download url from" ": https://moodle.org/plugins/theme_boost_union/versions" + fi + + printf "${ORANGE}%-30s${NC} %s" "enter download url" ": " + read -r PLUGIN_BOOST_UNION_URL + + printf "%-30s %s" "boost_union download" ": " + wget --quiet $PLUGIN_BOOST_UNION_URL -O /tmp/boost_union.zip + checkstatus + echo " " + fi + + # format_topcoll detection + if test -d "$BACKUP_PATH/course/format/topcoll/" + then + echo " " + printf "${LIGHTRED}%-30s${NC}\n" "format_topcoll detected" + + # suggest urls from: https://moodle.org/plugins/format_topcoll/versions + if test $MOODLE_VERSION_NEXT = "4.00" + then + printf "%-30s %s\n" "suggested url" ": https://moodle.org/plugins/download.php/29774/format_topcoll_moodle40_2022041703.zip" + elif test $MOODLE_VERSION_NEXT = "4.01" + then + printf "%-30s %s\n" "suggested url" ": https://moodle.org/plugins/download.php/29775/format_topcoll_moodle41_2022112602.zip" + elif test $MOODLE_VERSION_NEXT = "4.02" + then + printf "%-30s %s\n" "suggested url" ": https://moodle.org/plugins/download.php/29776/format_topcoll_moodle42_2023042401.zip" + elif test $MOODLE_VERSION_NEXT = "4.03" + then + printf "%-30s %s\n" "suggested url" ": https://moodle.org/plugins/download.php/31376/format_topcoll_moodle43_2023100701.zip" + elif test $MOODLE_VERSION_NEXT = "4.04" + then + printf "%-30s %s\n" "suggested url" ": https://moodle.org/plugins/download.php/33218/format_topcoll_moodle44_2024032804.zip" + elif test $MOODLE_VERSION_NEXT = "4.05" + then + printf "%-30s %s\n" "suggested url" ": https://moodle.org/plugins/download.php/33614/format_topcoll_moodle45_2024092200.zip" + else + printf "%-30s %s\n" "get a download url from" ": https://moodle.org/plugins/format_topcoll/versions" + fi + + printf "${ORANGE}%-30s${NC} %s" "enter download url" ": " + read -r PLUGIN_FORMAT_TOPCOLL_URL + + printf "%-30s %s" "format_topcoll download" ": " + wget --quiet $PLUGIN_FORMAT_TOPCOLL_URL -O /tmp/format_topcoll.zip + checkstatus + echo " " + fi + fi + + # choose copy mode until test "$COPYALL" = "y" -o "$COPYALL" = "n" do @@ -507,6 +589,28 @@ printf "\n%-30s %s" "previous plugins" ": " cp -r $BACKUP_PATH/$PLUGIN_PATH/ $MOODLE_NEXT_PATH/${PLUGIN_PATH%/*} + + # check if minor version changes + if test ! "$MOODLE_VERSION_NEXT" = "$MOODLE_VERSION_NOW" + then + # copy format_topcoll + if test "$PLUGIN_PATH" = "course/format/topcoll" + then + rm -r $MOODLE_NEXT_PATH/course/format/topcoll + unzip -q /tmp/format_topcoll.zip -d $MOODLE_NEXT_PATH/course/format/ + rm /tmp/format_topcoll.zip + fi + + # copy boost_union + if test "$PLUGIN_PATH" = "theme/boost_union" + then + rm -r $MOODLE_NEXT_PATH/theme/boost_union + unzip -q /tmp/boost_union.zip -d $MOODLE_NEXT_PATH/theme/ + rm /tmp/boost_union.zip + fi + fi + + if test "$COPYALL" = "y" then printf "%-46s %s" "Copy $PLUGIN_PATH" ": "