Commit 8ddab0a3 authored by aker@wsusoffline's avatar aker@wsusoffline

- Included complete rewrite of the Linux scripts version CE-2.2 (Special thanks to H. Buhrmester)

- Fix: The root certificates are downloaded using https:// instead of http:// now (Thanks to "hbuhrmester")
- Fix: old files for w60/w61 were not cleaned up (Thanks to "hbuhrmester")
parent c97eac53
......@@ -14,7 +14,7 @@
#pragma compile(ProductName, "WSUS Offline Update - Community Edition")
#pragma compile(ProductVersion, 12.3.0)
Dim Const $caption = "WSUS Offline Update - Community Edition - 12.3 (b2)"
Dim Const $caption = "WSUS Offline Update - Community Edition - 12.3 (b3)"
Dim Const $title = $caption & " - Generator"
Dim Const $downloadURL = "https://gitlab.com/wsusoffline/"
Dim Const $downloadLogFile = "download.log"
......
......@@ -15,7 +15,7 @@
#pragma compile(ProductName, "WSUS Offline Update - Community Edition")
#pragma compile(ProductVersion, 12.3.0)
Dim Const $caption = "WSUS Offline Update - Community Edition - 12.3 (b2) - Installer"
Dim Const $caption = "WSUS Offline Update - Community Edition - 12.3 (b3) - Installer"
; Registry constants
Dim Const $reg_key_wsh_hklm64 = "HKLM64\Software\Microsoft\Windows Script Host\Settings"
......
......@@ -10,7 +10,7 @@ if "%DIRCMD%" NEQ "" set DIRCMD=
cd /D "%~dp0"
set WSUSOFFLINE_VERSION=12.3 (b2)
set WSUSOFFLINE_VERSION=12.3 (b3)
title %~n0 %*
echo Starting WSUS Offline Update - Community Edition - v. %WSUSOFFLINE_VERSION% at %TIME%...
set UPDATE_LOGFILE=%SystemRoot%\wsusofflineupdate.log
......
......@@ -15,7 +15,7 @@ if "%DIRCMD%" NEQ "" set DIRCMD=
cd /D "%~dp0"
set WSUSOFFLINE_VERSION=12.3 (b2)
set WSUSOFFLINE_VERSION=12.3 (b3)
title %~n0 %1 %2 %3 %4 %5 %6 %7 %8 %9
echo Starting WSUS Offline Update - Community Edition - download v. %WSUSOFFLINE_VERSION% for %1 %2...
set DOWNLOAD_LOGFILE=..\log\download.log
......@@ -305,6 +305,9 @@ if exist ..\xslt\ExtractDownloadLinks-wua-x86.xsl del ..\xslt\ExtractDownloadLin
if exist ..\xslt\ExtractDownloadLinks-wua-x64.xsl del ..\xslt\ExtractDownloadLinks-wua-x64.xsl
if exist ..\xslt\ExtractBundledUpdateRelationsAndFileIds.xsl del ..\xslt\ExtractBundledUpdateRelationsAndFileIds.xsl
del /Q ..\xslt\*-win-x86-*.* >nul 2>&1
if exist ../static/StaticDownloadFiles-modified.txt del ../static/StaticDownloadFiles-modified.txt
if exist ../exclude/ExcludeDownloadFiles-modified.txt del ../exclude/ExcludeDownloadFiles-modified.txt
if exist ../client/static/StaticUpdateFiles-modified.txt del ../client/static/StaticUpdateFiles-modified.txt
rem *** Obsolete external stuff ***
if exist ..\bin\extract.exe del ..\bin\extract.exe
......@@ -376,12 +379,12 @@ for %%i in (enu fra esn jpn kor rus ptg ptb deu nld ita chs cht plk hun csy sve
)
if exist ..\xslt\ExtractDownloadLinks-w60-x64-glb.xsl del ..\xslt\ExtractDownloadLinks-w60-x64-glb.xsl
if exist ..\xslt\ExtractDownloadLinks-w60-x86-glb.xsl del ..\xslt\ExtractDownloadLinks-w60-x86-glb.xsl
if exist ..\client\static\StaticDownloadLinks-w60-x64-glb.txt del ..\client\static\StaticDownloadLinks-w60-x64-glb.txt
if exist ..\client\static\StaticDownloadLinks-w60-x86-glb.txt del ..\client\static\StaticDownloadLinks-w60-x86-glb.txt
if exist ..\client\static\StaticDownloadLinks-w60-x64-5lg.txt del ..\client\static\StaticDownloadLinks-w60-x64-5lg.txt
if exist ..\client\static\StaticDownloadLinks-w60-x86-5lg.txt del ..\client\static\StaticDownloadLinks-w60-x86-5lg.txt
if exist ..\client\static\StaticDownloadLinks-w60-x64-alg.txt del ..\client\static\StaticDownloadLinks-w60-x64-alg.txt
if exist ..\client\static\StaticDownloadLinks-w60-x86-alg.txt del ..\client\static\StaticDownloadLinks-w60-x86-alg.txt
if exist ..\static\StaticDownloadLinks-w60-x64-glb.txt del ..\static\StaticDownloadLinks-w60-x64-glb.txt
if exist ..\static\StaticDownloadLinks-w60-x86-glb.txt del ..\static\StaticDownloadLinks-w60-x86-glb.txt
if exist ..\static\StaticDownloadLinks-w60-x64-5lg.txt del ..\static\StaticDownloadLinks-w60-x64-5lg.txt
if exist ..\static\StaticDownloadLinks-w60-x86-5lg.txt del ..\static\StaticDownloadLinks-w60-x86-5lg.txt
if exist ..\static\StaticDownloadLinks-w60-x64-alg.txt del ..\static\StaticDownloadLinks-w60-x64-alg.txt
if exist ..\static\StaticDownloadLinks-w60-x86-alg.txt del ..\static\StaticDownloadLinks-w60-x86-alg.txt
rem *** Windows 7 / Server 2008 R2 stuff ***
if exist ..\client\static\StaticUpdateIds-ie10-w61.txt del ..\client\static\StaticUpdateIds-ie10-w61.txt
......@@ -408,12 +411,12 @@ for %%i in (enu fra esn jpn kor rus ptg ptb deu nld ita chs cht plk hun csy sve
)
if exist ..\xslt\ExtractDownloadLinks-w61-x64-glb.xsl del ..\xslt\ExtractDownloadLinks-w61-x64-glb.xsl
if exist ..\xslt\ExtractDownloadLinks-w61-x86-glb.xsl del ..\xslt\ExtractDownloadLinks-w61-x86-glb.xsl
if exist ..\client\static\StaticDownloadLinks-w61-x64-glb.txt del ..\client\static\StaticDownloadLinks-w61-x64-glb.txt
if exist ..\client\static\StaticDownloadLinks-w61-x86-glb.txt del ..\client\static\StaticDownloadLinks-w61-x86-glb.txt
if exist ..\client\static\StaticDownloadLinks-w61-x64-5lg.txt del ..\client\static\StaticDownloadLinks-w61-x64-5lg.txt
if exist ..\client\static\StaticDownloadLinks-w61-x86-5lg.txt del ..\client\static\StaticDownloadLinks-w61-x86-5lg.txt
if exist ..\client\static\StaticDownloadLinks-w61-x64-alg.txt del ..\client\static\StaticDownloadLinks-w61-x64-alg.txt
if exist ..\client\static\StaticDownloadLinks-w61-x86-alg.txt del ..\client\static\StaticDownloadLinks-w61-x86-alg.txt
if exist ..\static\StaticDownloadLinks-w61-x64-glb.txt del ..\static\StaticDownloadLinks-w61-x64-glb.txt
if exist ..\static\StaticDownloadLinks-w61-x86-glb.txt del ..\static\StaticDownloadLinks-w61-x86-glb.txt
if exist ..\static\StaticDownloadLinks-w61-x64-5lg.txt del ..\static\StaticDownloadLinks-w61-x64-5lg.txt
if exist ..\static\StaticDownloadLinks-w61-x86-5lg.txt del ..\static\StaticDownloadLinks-w61-x86-5lg.txt
if exist ..\static\StaticDownloadLinks-w61-x64-alg.txt del ..\static\StaticDownloadLinks-w61-x64-alg.txt
if exist ..\static\StaticDownloadLinks-w61-x86-alg.txt del ..\static\StaticDownloadLinks-w61-x86-alg.txt
rem *** Windows 8 stuff ***
if exist ..\client\static\StaticUpdateIds-w62-x86.txt del ..\client\static\StaticUpdateIds-w62-x86.txt
......@@ -588,6 +591,7 @@ for %%i in (enu fra esn jpn kor rus ptg ptb deu nld ita chs cht plk hun csy sve
call :Log "Info: Preserved custom language and architecture additions and removals"
echo Updating static and exclude definitions for download and update...
if not exist ..\static\sdd md ..\static\sdd
call :SDDCore https://gitlab.com/wsusoffline/wsusoffline-sdd/-/raw/master/StaticDownloadFiles-modified.txt ..\static\sdd
if not "%SDDCoreReturnValue%"=="0" (
call :Log "Warning: Failed to update StaticDownloadFiles-modified.txt"
......
......@@ -1746,4 +1746,7 @@ Community Edition 12.2 -- 01.08.2020
- Fix: more fixes for CheckOUVersion.cmd/UpdateOU.cmd
--------------------------------------------------------------------------------
Community Edition 12.3 -- ??.??.2020
- Included complete rewrite of the Linux scripts version CE-2.2 (Special thanks to H. Buhrmester)
- C++ 2019 Redistributable Runtime Libraries updated to v. 14.27.29016.0 (Thanks to "harry")
- Fix: The root certificates are downloaded using https:// instead of http:// now (Thanks to "hbuhrmester")
- Fix: old files for w60/w61 were not cleaned up (Thanks to "hbuhrmester")
......@@ -466,8 +466,8 @@ function download_single_file ()
case "${filename}" in
# Since version 1.12, the virus definition files are referenced
# with LinkIDs, which resolve to the filename mpam-fe.exe after
# several redirections.
# with LinkIDs, which resolve to the filenames mpas-fe.exe and
# mpam-fe.exe after several redirections.
*LinkID*)
download_single_file_failsafe "$@"
;;
......
......@@ -44,18 +44,24 @@
# ========== Configuration ================================================
# URLs for the "master" development version
self_update_index="https://gitlab.com/wsusoffline/wsusoffline-sdd/-/raw/master/SelfUpdateVersion-recent.txt"
self_update_links="https://gitlab.com/wsusoffline/wsusoffline-sdd/-/raw/master/StaticDownloadLink-recent.txt"
# ========== Global variables =============================================
wou_installed_version="not-available"
wou_available_version="not-available"
wou_available_archive="not-available" # The filename of the archive
wou_available_hashes="not-available" # The filename of the hashes file
# Version strings
#
# Version "numbers" are strings like "12.0" or "12.1.1", which cannot be
# assigned to integer numbers in the bash. They are converted to integer
# numbers later for an easier comparison.
installed_version="not-available"
available_version="not-available"
# The type can be "beta" (for development versions) or "release"
installed_type=""
available_type=""
wou_timestamp_file="${timestamp_dir}/check-wsusoffline-version.txt"
wsusoffline_timestamp="${timestamp_dir}/check-wsusoffline-version.txt"
# ========== Functions ====================================================
......@@ -63,20 +69,25 @@ wou_timestamp_file="${timestamp_dir}/check-wsusoffline-version.txt"
# which is installed with the zip archive of WSUS Offline Update. This
# file replaces the older file StaticDownloadLink-this.txt.
function get_wou_installed_version ()
function get_installed_version ()
{
wou_installed_version="not-available" # reset global variable to defaults
local ignored_field_2=""
local ignored_field_3=""
local skip_rest=""
# Reset global variables
installed_version="not-available"
installed_type=""
log_info_message "Searching for the installed version of WSUS Offline Update..."
if require_non_empty_file "../static/SelfUpdateVersion-this.txt"
then
IFS=$'\r\n,' read -r wou_installed_version \
ignored_field_2 \
ignored_field_3 \
IFS=$'\r\n,' read -r installed_version \
installed_type \
skip_rest \
< "../static/SelfUpdateVersion-this.txt"
log_debug_message "Installed version=${wou_installed_version}, archive=${ignored_field_2}, hashes=${ignored_field_3}"
# Corrections for compatibility with version 12.0 and 12.1,
# which included the archive filename in the second field
installed_type="${installed_type#wsusofflineCE120.zip}"
installed_type="${installed_type#wsusofflineCE121.zip}"
#log_debug_message "Installed version=${installed_version}, installed type=${installed_type}, skipped fields=${skip_rest}"
else
log_warning_message "The file SelfUpdateVersion-this.txt was not found."
fi
......@@ -91,10 +102,14 @@ function get_wou_installed_version ()
# The download links for the archive and the hashes files are in the
# file StaticDownloadLink-recent.txt.
function get_wou_available_version ()
function get_available_version ()
{
local skip_rest=""
local -i initial_errors="0"
initial_errors="$(get_error_count)"
# Reset global variables
available_version="not-available"
available_type=""
log_info_message "Searching for the most recent version of WSUS Offline Update..."
download_from_gitlab "../static" "${self_update_index}"
......@@ -103,11 +118,11 @@ function get_wou_available_version ()
then
if require_non_empty_file "../static/SelfUpdateVersion-recent.txt"
then
IFS=$'\r\n,' read -r wou_available_version \
wou_available_archive \
wou_available_hashes \
IFS=$'\r\n,' read -r available_version \
available_type \
skip_rest \
< "../static/SelfUpdateVersion-recent.txt"
log_debug_message "Available version=${wou_available_version}, archive=${wou_available_archive}, hashes=${wou_available_hashes}"
#log_debug_message "Available version=${available_version}, available type=${available_type}, skipped fields=${skip_rest}"
else
log_warning_message "The file SelfUpdateVersion-recent.txt was not found."
fi
......@@ -140,20 +155,21 @@ function wsusoffline_initial_installation
log_info_message "There is no version of WSUS Offline Update installed yet."
# Search for the most recent version of WSUS Offline Update
get_wou_available_version
if [[ "${wou_available_version}" == "not-available" ]]
get_available_version
if [[ "${available_version}" == "not-available" ]]
then
log_error_message "The most recent version of WSUS Offline Update could not be evaluated. The script will quit now."
log_error_message "The most recent version of WSUS Offline Update could not be determined. The script will quit now."
exit 1
fi
log_info_message "The most recent version of WSUS Offline Update is ${wou_available_version}."
log_info_message "The most recent version of WSUS Offline Update is ${available_version}."
if [[ "${home_directory}" == */sh ]]
then
log_error_message "For an initial installation of wsusoffline by the Linux scripts, you should NOT rename the script directory to \"sh\", because this directory will be overwritten during installation. This may replace the running script with a previous version."
log_error_message "The script will exit now."
exit 1
fi
log_warning_message "Note, that the wsusoffline archive will be unpacked OUTSIDE of the Linux scripts directory. At this point, you should have created an enclosing directory, which contains the Linux scripts directory, and which will also get the contents of the wsusoffline archive."
log_warning_message "The target directory, to which the wsusoffline archive will be extracted, is \"${wsusoffline_directory}\". Do you wish to proceed and install the wsusoffline archive into this directory?"
read -r -p "[Y|n]: " answer || true
......@@ -180,8 +196,8 @@ function wsusoffline_initial_installation
# new versions of WSUS Offline Update, similar to the Windows script
# CheckOUVersion.cmd.
#
# If the files SelfUpdateVersion-this.txt and SelfUpdateVersion-recent.txt
# are different, then a new version is available.
# It compares the files SelfUpdateVersion-this.txt and
# SelfUpdateVersion-recent.txt to check, if a new version is available.
#
# This test is done once daily, and it can be disabled by setting the
# variable check_for_self_updates to "disabled".
......@@ -190,6 +206,8 @@ function compare_wsusoffline_versions ()
{
local -i interval_length="${interval_length_configuration_files}"
local interval_description="${interval_description_configuration_files}"
local -i installed_version_int="0"
local -i available_version_int="0"
if [[ "${check_for_self_updates}" == "disabled" ]]
then
......@@ -197,53 +215,105 @@ function compare_wsusoffline_versions ()
return 0
fi
if same_day "${wou_timestamp_file}" "${interval_length}"
if same_day "${wsusoffline_timestamp}" "${interval_length}"
then
log_info_message "Skipped searching for new versions of WSUS Offline Update, because it has already been done less than ${interval_description} ago"
return 0
fi
# Get the installed version of WSUS Offline Update
get_wou_installed_version
if [[ "${wou_installed_version}" == "not-available" ]]
get_installed_version
if [[ "${installed_version}" == "not-available" ]]
then
log_error_message "The installed version of WSUS Offline Update could not be evaluated. The script will quit now."
log_error_message "The installed version of WSUS Offline Update could not be determined. The script will quit now."
exit 1
fi
# Search for the most recent version of WSUS Offline Update
get_wou_available_version
if [[ "${wou_available_version}" == "not-available" ]]
get_available_version
if [[ "${available_version}" == "not-available" ]]
then
log_warning_message "The most recent version of WSUS Offline Update could not be evaluated."
log_warning_message "The most recent version of WSUS Offline Update could not be determined."
# The timestamp is not updated, if there was an error
# with the online check. Then the online check will be
# repeated on the next run.
return 0
fi
# Convert the version strings to integer numbers
installed_version_int="$( version_string_to_number "${installed_version}" )"
available_version_int="$( version_string_to_number "${available_version}" )"
#log_debug_message "Installed version: ${installed_version} = ${installed_version_int}"
#log_debug_message "Available version: ${available_version} = ${available_version_int}"
# Compare versions
if [[ "${wou_installed_version}" == "${wou_available_version}" ]]
if (( installed_version_int == available_version_int ))
then
if [[ "${installed_type}" == "${available_type}" ]]
then
log_info_message "No newer version of WSUS Offline Update found"
# The timestamp is updated here, to do the version check
# only once daily.
update_timestamp "${wsusoffline_timestamp}"
else
confirm_wsusoffline_self_update
fi
elif (( installed_version_int < available_version_int ))
then
log_info_message "No newer version of WSUS Offline Update found"
# The timestamp is updated here, to do the version
# check only once daily.
update_timestamp "${wou_timestamp_file}"
else
log_info_message "A new version of WSUS Offline Update is available:"
log_info_message "- Installed version: ${wou_installed_version}"
log_info_message "- Available version: ${wou_available_version}"
confirm_wsusoffline_self_update
else
log_warning_message "The installed version is newer than the latest available release version. This may happen, if the development (beta) versions are installed."
update_timestamp "${wsusoffline_timestamp}"
fi
return 0
}
# Convert version strings like 12.0 and 11.9.1 to decimal numbers,
# which are easier to compare. The results would be, for example:
#
# 11.9.1 -> 110901
# 11.9.2 -> 110902
# 12.0 -> 120000
# 12.1 -> 120100
# 12.1.1 -> 120101
function version_string_to_number ()
{
local version_string="$1"
local first="0"
# The local variables "second" and "third" must not be integer
# variables, or the assignment will fail, if the numbers are padded
# with zeroes
local second="0"
local third="0"
local -i version_number="0"
# Split the version string into three numbers
IFS="." read -r first second third <<< "${version_string}"
# Pad the second and third number with leading zeroes to two digits
second="$( printf '%02d\n' "${second}" )"
third="$( printf '%02d\n' "${third}" )"
# Join the three parts to a decimal version number
version_number="${first}${second}${third}"
# Print the version number to standard output
printf '%s\n' "${version_number}"
return 0
}
function confirm_wsusoffline_self_update ()
{
local answer=""
log_info_message "A new version of WSUS Offline Update is available:"
log_info_message "- Installed version: ${installed_version} ${installed_type}"
log_info_message "- Available version: ${available_version} ${available_type}"
log_info_message "Do you want to install the new version now?"
if [[ "${unattended_updates:-disabled}" == enabled ]]
then
......@@ -265,7 +335,7 @@ EOF
# If the installation was explicitly canceled, then the
# timestamp will be updated. The online check will be
# repeated after one day.
update_timestamp "${wou_timestamp_file}"
update_timestamp "${wsusoffline_timestamp}"
;;
*)
log_warning_message "Unknown answer. Self update not confirmed."
......@@ -290,7 +360,7 @@ EOF
;;
[Nn]*)
log_info_message "Self update not confirmed."
update_timestamp "${wou_timestamp_file}"
update_timestamp "${wsusoffline_timestamp}"
;;
*)
log_warning_message "Unknown answer. Self update not confirmed."
......@@ -307,6 +377,9 @@ function wsusoffline_self_update ()
local -a file_list=()
local current_item=""
local url=""
local filename=""
local archive_filename="not-available"
local hashes_filename="not-available"
local -i initial_errors="0"
initial_errors="$(get_error_count)"
......@@ -322,6 +395,12 @@ function wsusoffline_self_update ()
log_info_message "Downloading archive and accompanying hashes file..."
while IFS=$'\r\n' read -r url
do
filename="${url##*/}"
case "${filename}" in
*.zip) archive_filename="${filename}";;
*_hashes.txt) hashes_filename="${filename}";;
*) log_error_message "File type of ${filename} was not recognized.";;
esac
download_from_gitlab "${cache_dir}" "${url}"
done < "../static/StaticDownloadLink-recent.txt"
same_error_count "${initial_errors}" || exit 1
......@@ -331,43 +410,44 @@ function wsusoffline_self_update ()
fi
log_info_message "Searching downloaded files..."
if [[ -f "${cache_dir}/${wou_available_archive}" ]]
if [[ -f "${cache_dir}/${archive_filename}" ]]
then
log_info_message "Found archive: ${cache_dir}/${wou_available_archive}"
log_info_message "Found archive: ${cache_dir}/${archive_filename}"
else
log_error_message "Archive ${wou_available_archive} was not found"
log_error_message "Archive ${archive_filename} was not found"
exit 1
fi
if [[ -f "${cache_dir}/${wou_available_hashes}" ]]
if [[ -f "${cache_dir}/${hashes_filename}" ]]
then
log_info_message "Found hashes file: ${cache_dir}/${wou_available_hashes}"
log_info_message "Found hashes file: ${cache_dir}/${hashes_filename}"
else
log_error_message "Hashes file ${wou_available_hashes} was not found"
log_error_message "Hashes file ${hashes_filename} was not found"
exit 1
fi
# Validate the archive using hashdeep in audit mode (-a). The bare
# mode (-b) removes any leading directory information. This enables
# us to check files without changing directories with pushd/popd.
log_info_message "Verifying the integrity of the archive ${wou_available_archive} ..."
if hashdeep -a -b -v -v -k "${cache_dir}/${wou_available_hashes}" "${cache_dir}/${wou_available_archive}"
log_info_message "Verifying the integrity of the archive ${archive_filename} ..."
if hashdeep -a -b -v -v -k "${cache_dir}/${hashes_filename}" "${cache_dir}/${archive_filename}"
then
log_info_message "Validated archive ${wou_available_archive}"
log_info_message "Validated archive ${archive_filename}"
else
log_error_message "Validation failed"
exit 1
fi
# The zip archive should be unpacked to the temporary directory;
# if there is already a directory "wsusoffline", it will be removed.
# if there is already a directory "wsusoffline", it will be removed
# first.
if [[ -d "${temp_dir}/wsusoffline" ]]
then
rm -r "${temp_dir}/wsusoffline"
fi
log_info_message "Unpacking zip archive..."
unzip -q "${cache_dir}/${wou_available_archive}" -d "${temp_dir}" || exit 1
unzip -q "${cache_dir}/${archive_filename}" -d "${temp_dir}" || exit 1
log_info_message "Searching unpacked directory..."
if [[ -d "${temp_dir}/wsusoffline" ]]
......@@ -396,19 +476,20 @@ function wsusoffline_self_update ()
fi
# Reevaluating the installed version
get_wou_installed_version
if [[ "${wou_installed_version}" == "not-available" ]]
get_installed_version
if [[ "${installed_version}" == "not-available" ]]
then
log_error_message "The installed version of WSUS Offline Update could not be evaluated."
log_error_message "The installed version of WSUS Offline Update could not be determined."
exit 1
fi
# Recompare the installed and available versions
log_info_message "Recomparing WSUS Offline Update versions:"
log_info_message "- Installed version: ${wou_installed_version}"
log_info_message "- Available version: ${wou_available_version}"
log_info_message "- Installed version: ${installed_version} ${installed_type}"
log_info_message "- Available version: ${available_version} ${available_type}"
if [[ "${wou_installed_version}" == "${wou_available_version}" ]]
if [[ "${installed_version}" == "${available_version}" ]] \
&& [[ "${installed_type}" == "${available_type}" ]]
then
log_info_message "The most recent version of WSUS Offline Update was installed successfully"
......@@ -416,7 +497,7 @@ function wsusoffline_self_update ()
check_custom_static_links
normalize_file_permissions
reschedule_updates_after_wou_update
update_timestamp "${wou_timestamp_file}"
update_timestamp "${wsusoffline_timestamp}"
restart_script
else
log_error_message "The installation of the most recent version of WSUS Offline Update failed for unknown reasons."
......@@ -448,7 +529,7 @@ function check_custom_static_links ()
file_list=(../static/custom/*.txt)
shopt -u nullglob
if (( ${#file_list[@]} > 0 ))
if (( "${#file_list[@]}" > 0 ))
then
for current_file in "${file_list[@]}"
do
......@@ -496,7 +577,8 @@ function reschedule_updates_after_wou_update ()
# all updates, so that they are reevaluated on the next run.
reevaluate_all_updates
rm -f "../timestamps/update-configuration-files.txt"
# Delete SDD index files
# Delete index files for the update of static download definitions
# (sdd) and other configuration files
rm -f "../static/sdd/StaticDownloadFiles-modified.txt"
rm -f "../static/sdd/ExcludeDownloadFiles-modified.txt"
rm -f "../static/sdd/StaticUpdateFiles-modified.txt"
......@@ -513,6 +595,31 @@ function reschedule_updates_after_wou_update ()
return 0
}
function restart_script ()
{
# The scripts update-generator.bash and download-updates.bash create
# new temporary directories with random names on each run. The
# existing temporary directory must be removed at this point.
if [[ -d "${temp_dir}" ]]
then
echo "Cleaning up temporary files ..."
rm -r "${temp_dir}"
fi
log_info_message "Restarting script ${script_name} ..."
echo ""
echo "--------------------------------------------------------------------------------"
echo ""
if (( "${#command_line_parameters[@]}" > 0 ))
then
exec "./${script_name}" "${command_line_parameters[@]}"
else
exec "./${script_name}"
fi
return 0
}
# ========== Commands =====================================================
wsusoffline_initial_installation
......
......@@ -33,6 +33,7 @@
# ========== Configuration ================================================
# URLs for the "master" development version
excludelist_superseded_exclude_url="https://gitlab.com/wsusoffline/wsusoffline-sdd/-/raw/master/ExcludeList-superseded-exclude.txt"
excludelist_superseded_exclude_seconly_url="https://gitlab.com/wsusoffline/wsusoffline-sdd/-/raw/master/ExcludeList-superseded-exclude-seconly.txt"
hidelist_seconly_url="https://gitlab.com/wsusoffline/wsusoffline-sdd/-/raw/master/HideList-seconly.txt"
......@@ -105,7 +106,12 @@ function run_update_configuration_files ()
remove_obsolete_files
update_configuration_files
else
log_info_message "The update of configuration files was postponed, because there is a new version of WSUS Offline Update available, which should be installed first."
log_warning_message "The update of configuration files was skipped, because the installed version of WSUS Offline Update is not the latest available release."
# The timestamp can be updated here, to do this check once
# daily. A successful wsusoffline self-update will delete this
# timestamp and reschedule the update of configuration files
# again.
update_timestamp "${timestamp_file}"
echo ""
fi
return 0
......@@ -139,12 +145,17 @@ function remove_obsolete_files ()
../client/static/StaticUpdateIds-w100-x86.txt
../client/static/StaticUpdateIds-w100-x64.txt
)
# The file ../client/exclude/ExcludeUpdateFiles-modified.txt was
# removed in WSUS Offline Update 10.9
# file_list+=(
# ../client/exclude/ExcludeUpdateFiles-modified.txt
# )
# Additions in WSUS Offline Update, version 12.0
file_list+=(