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.
This commit is contained in:
Jon Turney 2023-03-02 21:33:32 +00:00
parent dfd14093e3
commit c553a95243
No known key found for this signature in database
GPG Key ID: C7C86F0370285C81
2 changed files with 22 additions and 7 deletions

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# /etc/postinstall/cygwin-doc.sh - cygwin-doc postinstall script. # /etc/postinstall/cygwin-doc.sh - cygwin-doc postinstall script.
# installs Cygwin Start Menu shortcuts for Cygwin User Guide and API PDF and # 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 # HTML if in doc dir, and links to Cygwin web site home page and FAQ
@ -36,9 +36,20 @@ do
fi fi
done 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 # Cygwin Start Menu directory
case $(uname -s) in *-WOW*) wow64=" (32-bit)" ;; esac if [ ! -v CYGWIN_START_MENU_SUFFIX ]
smpc_dir="$($cygp $CYGWINFORALL -P -U --)/Cygwin${wow64}" 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 # ensure Cygwin Start Menu directory exists
/usr/bin/mkdir -p "$smpc_dir" /usr/bin/mkdir -p "$smpc_dir"
@ -53,7 +64,7 @@ fi
# create User Guide and API PDF and HTML shortcuts # create User Guide and API PDF and HTML shortcuts
while read target name desc while read target name desc
do 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 done <<EOF
$doc/cygwin-ug-net.pdf User\ Guide\ \(PDF\) Cygwin\ User\ Guide\ PDF $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 $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 # create Home Page and FAQ URL link shortcuts
while read target name desc while read target name desc
do 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 done <<EOF
$site/index.html Home\ Page Cygwin\ Home\ Page\ Link $site/index.html Home\ Page Cygwin\ Home\ Page\ Link
$site/faq.html FAQ Cygwin\ Frequently\ Asked\ Questions\ Link $site/faq.html FAQ Cygwin\ Frequently\ Asked\ Questions\ Link

View File

@ -26,8 +26,12 @@ do
done done
# Cygwin Start Menu directory # Cygwin Start Menu directory
case $(uname -s) in *-WOW*) wow64=" (32-bit)" ;; esac if [ ! -v CYGWIN_START_MENU_SUFFIX ]
smpc_dir="$($cygp $CYGWINFORALL -P -U --)/Cygwin${wow64}" 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 # check Cygwin Start Menu directory still exists
[ -d "$smpc_dir/" ] || exit 0 [ -d "$smpc_dir/" ] || exit 0