summaryrefslogtreecommitdiffstats
path: root/winsup/doc/etc.postinstall.cygwin-doc.sh
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/doc/etc.postinstall.cygwin-doc.sh')
-rwxr-xr-xwinsup/doc/etc.postinstall.cygwin-doc.sh35
1 files changed, 21 insertions, 14 deletions
diff --git a/winsup/doc/etc.postinstall.cygwin-doc.sh b/winsup/doc/etc.postinstall.cygwin-doc.sh
index 3a9457fbb..1d41ef0c1 100755
--- a/winsup/doc/etc.postinstall.cygwin-doc.sh
+++ b/winsup/doc/etc.postinstall.cygwin-doc.sh
@@ -6,35 +6,42 @@
# 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/
+# exits quietly if directory does not exist as presumably no shortcuts desired
+doc=/usr/share/doc/cygwin-doc
+site=https://cygwin.com
cygp=/bin/cygpath
mks=/bin/mkshortcut
-un=/bin/uname
-site=https://cygwin.com
-# check for programs
-for p in $un $cygp $mks
+html=$doc/html
+
+# check source directories created
+for d in $doc $html
do
- if [ ! -x $p ]
+ if [ ! -d "$d/" ]
then
- echo "Can't find program '$p'"
+ echo "Can't find directory '$d'"
exit 2
fi
done
-doc=/usr/share/doc/cygwin-doc
-html=$doc/html
-smpc_dir="$($cygp $CYGWINFORALL -P -U)/Cygwin"
-
-for d in $doc $html "$smpc_dir"
+# check for programs
+for p in $cygp $mks
do
- if [ ! -d "$d/" ]
+ if [ ! -x $p ]
then
- echo "Can't find directory '$d'"
+ echo "Can't find program '$p'"
exit 2
fi
done
+# Cygwin Start Menu directory
+smpc_dir="$($cygp $CYGWINFORALL -P -U --)/Cygwin"
+
+# check Cygwin Start Menu directory still exists
+[ -d "$smpc_dir/" ] || exit 0
+
+# check Cygwin Start Menu directory writable
if [ ! -w "$smpc_dir/" ]
then
echo "Can't write to directory '$smpc_dir'"
@@ -42,7 +49,7 @@ then
fi
# mkshortcut works only in current directory - change to Cygwin Start Menu
-cd "$smpc_dir" || exit 2 # quit if not found
+cd "$smpc_dir/" || exit 0 # quit if not found
# create User Guide and API PDF and HTML shortcuts
while read target name desc