2023-03-03 05:33:32 +08:00
|
|
|
#!/bin/bash
|
2017-04-21 19:26:10 +08:00
|
|
|
# /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
|
|
|
|
#
|
|
|
|
# CYGWINFORALL=-A if install for All Users
|
|
|
|
# installs local shortcuts for All Users or Current User in
|
|
|
|
# {ProgramData,~/Appdata/Roaming}/Microsoft/Windows/Start Menu/Programs/Cygwin/
|
2017-07-06 02:28:54 +08:00
|
|
|
# exits quietly if directory does not exist as presumably no shortcuts desired
|
2017-04-21 19:26:10 +08:00
|
|
|
|
2017-07-06 02:28:54 +08:00
|
|
|
doc=/usr/share/doc/cygwin-doc
|
|
|
|
site=https://cygwin.com
|
2017-12-23 02:35:56 +08:00
|
|
|
cygp=/usr/bin/cygpath
|
|
|
|
mks=/usr/bin/mkshortcut
|
|
|
|
launch=/usr/bin/cygstart
|
2017-04-21 19:26:10 +08:00
|
|
|
|
2017-07-06 02:28:54 +08:00
|
|
|
html=$doc/html
|
|
|
|
|
|
|
|
# check source directories created
|
|
|
|
for d in $doc $html
|
2017-04-21 19:26:10 +08:00
|
|
|
do
|
2017-07-06 02:28:54 +08:00
|
|
|
if [ ! -d "$d/" ]
|
2017-04-21 19:26:10 +08:00
|
|
|
then
|
2017-07-06 02:28:54 +08:00
|
|
|
echo "Can't find directory '$d'"
|
2017-04-21 19:26:10 +08:00
|
|
|
exit 2
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2017-07-06 02:28:54 +08:00
|
|
|
# check for programs
|
2017-07-06 17:35:34 +08:00
|
|
|
for p in $cygp $mks $launch
|
2017-04-21 19:26:10 +08:00
|
|
|
do
|
2017-12-23 02:35:56 +08:00
|
|
|
if [ ! -x "$p" ]
|
2017-04-21 19:26:10 +08:00
|
|
|
then
|
2017-07-06 02:28:54 +08:00
|
|
|
echo "Can't find program '$p'"
|
2017-04-21 19:26:10 +08:00
|
|
|
exit 2
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2023-03-03 05:33:32 +08:00
|
|
|
# setup was run with options not to create startmenu items
|
|
|
|
case ${CYGWIN_SETUP_OPTIONS} in
|
|
|
|
*no-startmenu*)
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2017-07-06 02:28:54 +08:00
|
|
|
# Cygwin Start Menu directory
|
2023-03-03 05:33:32 +08:00
|
|
|
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}"
|
2017-07-06 02:28:54 +08:00
|
|
|
|
2020-03-19 21:54:10 +08:00
|
|
|
# ensure Cygwin Start Menu directory exists
|
|
|
|
/usr/bin/mkdir -p "$smpc_dir"
|
2017-07-06 02:28:54 +08:00
|
|
|
|
|
|
|
# check Cygwin Start Menu directory writable
|
2017-04-21 19:26:10 +08:00
|
|
|
if [ ! -w "$smpc_dir/" ]
|
|
|
|
then
|
|
|
|
echo "Can't write to directory '$smpc_dir'"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2017-06-27 03:43:40 +08:00
|
|
|
# create User Guide and API PDF and HTML shortcuts
|
|
|
|
while read target name desc
|
|
|
|
do
|
2023-03-03 05:33:32 +08:00
|
|
|
[ -r "$target" ] && $mks $CYGWINFORALL -P -n "Cygwin${CYGWIN_START_MENU_SUFFIX}/$name" -d "$desc" -- $target
|
2017-06-27 03:43:40 +08:00
|
|
|
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
|
|
|
|
$doc/cygwin-api.pdf API\ \(PDF\) Cygwin\ API\ Reference\ PDF
|
|
|
|
$html/cygwin-api/index.html API\ \(HTML\) Cygwin\ API\ Reference\ HTML
|
|
|
|
EOF
|
|
|
|
|
|
|
|
# create Home Page and FAQ URL link shortcuts
|
|
|
|
while read target name desc
|
|
|
|
do
|
2023-03-03 05:33:32 +08:00
|
|
|
$mks $CYGWINFORALL -P -n "Cygwin${CYGWIN_START_MENU_SUFFIX}/$name" -d "$desc" -a $target -- $launch
|
2017-06-27 03:43:40 +08:00
|
|
|
done <<EOF
|
|
|
|
$site/index.html Home\ Page Cygwin\ Home\ Page\ Link
|
|
|
|
$site/faq.html FAQ Cygwin\ Frequently\ Asked\ Questions\ Link
|
|
|
|
EOF
|