[PATCH] Cygwin: doc: Update postinstall/preremove scripts
Jon Turney
jon.turney@dronecode.org.uk
Wed Mar 8 14:17:19 GMT 2023
Update postinstall/preremove scripts to use CYGWIN_START_MENU_SUFFIX and
CYGWIN_SETUP_OPTIONS.
---
winsup/doc/etc.postinstall.cygwin-doc.sh | 19 +++++++++++++++----
winsup/doc/etc.preremove.cygwin-doc.sh | 8 ++++++--
2 files changed, 21 insertions(+), 6 deletions(-)
diff --git a/winsup/doc/etc.postinstall.cygwin-doc.sh b/winsup/doc/etc.postinstall.cygwin-doc.sh
index 97f88a16d..313c1d3ff 100755
--- a/winsup/doc/etc.postinstall.cygwin-doc.sh
+++ b/winsup/doc/etc.postinstall.cygwin-doc.sh
@@ -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 <<EOF
$doc/cygwin-ug-net.pdf User\ Guide\ \(PDF\) Cygwin\ User\ Guide\ PDF
$html/cygwin-ug-net/index.html User\ Guide\ \(HTML\) Cygwin\ User\ Guide\ HTML
@@ -64,7 +75,7 @@ EOF
# create Home Page and FAQ URL link shortcuts
while read target name desc
do
- $mks $CYGWINFORALL -P -n "Cygwin${wow64}/$name" -d "$desc" -a $target -- $launch
+ $mks $CYGWINFORALL -P -n "Cygwin${CYGWIN_START_MENU_SUFFIX}/$name" -d "$desc" -a $target -- $launch
done <<EOF
$site/index.html Home\ Page Cygwin\ Home\ Page\ Link
$site/faq.html FAQ Cygwin\ Frequently\ Asked\ Questions\ Link
diff --git a/winsup/doc/etc.preremove.cygwin-doc.sh b/winsup/doc/etc.preremove.cygwin-doc.sh
index b098e6dac..cac29ee21 100755
--- a/winsup/doc/etc.preremove.cygwin-doc.sh
+++ b/winsup/doc/etc.preremove.cygwin-doc.sh
@@ -26,8 +26,12 @@ do
done
# 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}"
# check Cygwin Start Menu directory still exists
[ -d "$smpc_dir/" ] || exit 0
--
2.39.0
More information about the Cygwin-patches
mailing list