diff --git a/docs/environment.md b/docs/environment.md index 15506d28..2b9929be 100644 --- a/docs/environment.md +++ b/docs/environment.md @@ -105,6 +105,7 @@ An empty default means the variable is unset and its value is determined automat |---|---|---| | `SAMBA` | `Y` | Enables the Samba shared folder. | | `SAMBA_DEBUG` | `N` | Enables Samba debug output. | +| `SHORTCUT` | `Y` | Creates desktop and drive shortcuts to the shared folder. | ## ⚙️ System diff --git a/src/answer.sh b/src/answer.sh index 27eb2fe2..24a1975c 100644 --- a/src/answer.sh +++ b/src/answer.sh @@ -604,6 +604,21 @@ updateXML() { sed -i "s|| \n $key\n OnError\n \n |g" "$asset" || return 1 fi + if disabled "$SHORTCUT" || disabled "$SAMBA"; then + if ! sed -i -E ' + /])/ { + :command + N + /<\/SynchronousCommand>/!b command + /Create desktop shortcut to shared folder<\/Description>/d + /Map shared folder<\/Description>/d + } + ' "$asset"; then + error "Failed to remove shared folder shortcuts from answer file!" + return 1 + fi + fi + if ! xmllint --nonet --noout "$asset"; then error "The generated answer file is not valid XML!" return 1 diff --git a/src/define.sh b/src/define.sh index e5219f9f..e3ee0585 100644 --- a/src/define.sh +++ b/src/define.sh @@ -18,6 +18,7 @@ set -Eeuo pipefail : "${LANGUAGE:=""}" : "${USERNAME:=""}" : "${PASSWORD:=""}" +: "${SHORTCUT:=""}" : "${DOMAIN_OU:=""}" : "${WORKGROUP:=""}" : "${AUTOLOGIN:=""}" @@ -36,7 +37,6 @@ LANGUAGE=$(strip "$LANGUAGE") USERNAME=$(strip "$USERNAME") DOMAIN_OU=$(strip "$DOMAIN_OU") WORKGROUP=$(strip "$WORKGROUP") -AUTOLOGIN=$(strip "$AUTOLOGIN") MIRRORS=3