]> sourceware.org Git - newlib-cygwin.git/commitdiff
fix cygwin-doc postinstall/preremove no SMPrograms/Cygwin dir
authorBrian Inglis <Brian.Inglis@SystematicSW.ab.ca>
Wed, 5 Jul 2017 18:28:54 +0000 (12:28 -0600)
committerCorinna Vinschen <corinna@vinschen.de>
Thu, 6 Jul 2017 08:01:54 +0000 (10:01 +0200)
winsup/doc/etc.postinstall.cygwin-doc.sh
winsup/doc/etc.preremove.cygwin-doc.sh

index 3a9457fbbd66acc6b07f1cbbd699cf2cd249f129..1d41ef0c1489944da012018204ab45233cd11067 100755 (executable)
@@ -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
index 817d6d68e6a4b685ad66f80695743100ca4ac08b..09e0c9efc7ff1a89f6ffb9ad885bc74baf496eb0 100755 (executable)
@@ -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
 
This page took 0.031158 seconds and 5 git commands to generate.