setup complains about cygwin-doc package update
Brian Inglis
Brian.Inglis@SystematicSw.ab.ca
Wed Jul 5 18:35:00 GMT 2017
On 2017-07-05 12:01, Corinna Vinschen wrote:
> On Jul 5 13:44, Ken Brown wrote:
>> On 7/5/2017 1:27 PM, Corinna Vinschen wrote:
>>> On Jul 5 11:20, Brian Inglis wrote:
>>>> On 2017-07-05 08:27, Corinna Vinschen wrote:
>>>>> On Jul 5 13:32, Nellis, Kenneth wrote:
>>>>>> So, these are handy links to have, I guess, but is it appropriate for
>>>>>> cygwin-doc.sh to presume that the directory exists? Maybe it should create it
>>>>>> rather than simply bail out and complain if it doesn't exist.
>>>>>
>>>>> In theory, the script should only create the files if the directory
>>>>> exists. Brian?
>>>>
>>>> Okay - assumed the directory would always be created by setup -
>>>> presumably not true - but do not check that assumption in pi, although
>>>> thought about it -
>>>
>>> User's can decline creating shortcuts in setup.
>>>
>>>> should I check and skip creating shortcuts, rather than create dir and
>>>> shorcuts? Should I also check and skip rm in prerm? And provide
>>>> patches?
>>>
>>> Skipping goes hand in hand with the fact that the user declined the
>>> Start Menu shortcut creation.
>>
>> The script already does check and skip. The only issue is that it skips by
>> calling 'exit 2' instead of 'exit 0', which is what led to the original
>> post.
>
> Note to myself: read source before talking about it.
Patch(es) attached - shuffled the order of a few things to fail quietly in
postinstall - changed preremove to look and take a similar approach to
postinstall for consistency - format-patch should apply cleanly this time.
--
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada
-------------- next part --------------
From 92a3dd37dc9f0da65f958707d93d9e11b6047bd8 Mon Sep 17 00:00:00 2001
From: Brian Inglis <Brian.Inglis@SystematicSW.ab.ca>
Date: Wed, 5 Jul 2017 12:28:54 -0600
Subject: [PATCH] fix cygwin-doc postinstall/preremove no SMPrograms/Cygwin dir
---
winsup/doc/etc.postinstall.cygwin-doc.sh | 35 +++++++++++++++----------
winsup/doc/etc.preremove.cygwin-doc.sh | 45 +++++++++++++++++++++++++++++---
2 files changed, 63 insertions(+), 17 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
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
--
2.12.3
More information about the Cygwin-apps
mailing list