Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Inglis <Brian.Inglis@SystematicSW.ab.ca>2017-07-05 21:28:54 +0300
committerCorinna Vinschen <corinna@vinschen.de>2017-07-06 11:01:54 +0300
commitcff8513220bac1c938c366df90757372e4a1bb76 (patch)
tree116fd98f9452daf5a0e9269a5efda08d439e0b5a /winsup/doc/etc.preremove.cygwin-doc.sh
parentddb6f8a02ad404796ff3cb901cb34c2d6d317c4a (diff)
fix cygwin-doc postinstall/preremove no SMPrograms/Cygwin dir
Diffstat (limited to 'winsup/doc/etc.preremove.cygwin-doc.sh')
-rwxr-xr-xwinsup/doc/etc.preremove.cygwin-doc.sh45
1 files changed, 42 insertions, 3 deletions
diff --git a/winsup/doc/etc.preremove.cygwin-doc.sh b/winsup/doc/etc.preremove.cygwin-doc.sh
index 817d6d68e..09e0c9efc 100755
--- a/winsup/doc/etc.preremove.cygwin-doc.sh
+++ b/winsup/doc/etc.preremove.cygwin-doc.sh
@@ -6,9 +6,48 @@
# CYGWINFORALL=-A if remove for All Users
# remove 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
-cd "$(/bin/cygpath $CYGWINFORALL -P -U)/Cygwin" || exit 2
+doc=/usr/share/doc/cygwin-doc
+cygp=/bin/cygpath
+rm=/bin/rm
-/bin/rm -f -- "User Guide (PDF).lnk" "User Guide (HTML).lnk" \
- "API (PDF).lnk" "API (HTML).lnk" "Home Page.lnk" "FAQ.lnk"
+html=$doc/html
+
+# check for programs
+for p in $cygp $rm
+do
+ if [ ! -x $p ]
+ then
+ 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'"
+ exit 1
+fi
+
+# remove User Guide and API PDF and HTML, Home Page and FAQ URL link shortcuts
+while read target name desc
+do
+ lnk="$smpc_dir/$name.lnk"
+ [ -f "$lnk" ] && $rm -f -- "$lnk"
+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
+$site/index.html Home\ Page Cygwin\ Home\ Page\ Link
+$site/faq.html FAQ Cygwin\ Frequently\ Asked\ Questions\ Link
+EOF