From c553a95243906a103a5250121833e5bc9e28f760 Mon Sep 17 00:00:00 2001 From: Jon Turney Date: Thu, 2 Mar 2023 21:33:32 +0000 Subject: [PATCH] Cygwin: doc: Update postinstall/preremove scripts setup >=2.925 indicates to postinstall and preremove scripts the Start Menu suffix to use via the CYGWIN_START_MENU_SUFFIX env var. It also indicates, via the CYGWIN_SETUP_OPTIONS env var, if the option to disable Start Menu shortcut creation is supplied. Update the Cygwin documentation postinstall and preremove scripts to take these env vars into consideration. --- winsup/doc/etc.postinstall.cygwin-doc.sh | 21 ++++++++++++++++----- winsup/doc/etc.preremove.cygwin-doc.sh | 8 ++++++-- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/winsup/doc/etc.postinstall.cygwin-doc.sh b/winsup/doc/etc.postinstall.cygwin-doc.sh index 97f88a16d..b9115ef92 100755 --- a/winsup/doc/etc.postinstall.cygwin-doc.sh +++ b/winsup/doc/etc.postinstall.cygwin-doc.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # /etc/postinstall/cygwin-doc.sh - cygwin-doc postinstall script. # installs Cygwin Start Menu shortcuts for Cygwin User Guide and API PDF and # HTML if in doc dir, and links to Cygwin web site home page and FAQ @@ -36,9 +36,20 @@ do fi done +# setup was run with options not to create startmenu items +case ${CYGWIN_SETUP_OPTIONS} in + *no-startmenu*) + exit 0 + ;; +esac + # Cygwin Start Menu directory -case $(uname -s) in *-WOW*) wow64=" (32-bit)" ;; esac -smpc_dir="$($cygp $CYGWINFORALL -P -U --)/Cygwin${wow64}" +if [ ! -v CYGWIN_START_MENU_SUFFIX ] +then + case $(uname -s) in *-WOW*) CYGWIN_START_MENU_SUFFIX=" (32-bit)" ;; esac +fi + +smpc_dir="$($cygp $CYGWINFORALL -P -U --)/Cygwin${CYGWIN_START_MENU_SUFFIX}" # ensure Cygwin Start Menu directory exists /usr/bin/mkdir -p "$smpc_dir" @@ -53,7 +64,7 @@ fi # create User Guide and API PDF and HTML shortcuts while read target name desc do - [ -r "$target" ] && $mks $CYGWINFORALL -P -n "Cygwin${wow64}/$name" -d "$desc" -- $target + [ -r "$target" ] && $mks $CYGWINFORALL -P -n "Cygwin${CYGWIN_START_MENU_SUFFIX}/$name" -d "$desc" -- $target done <