public inbox for cygwin-patches@cygwin.com
 help / color / mirror / Atom feed
* [PATCH] Cygwin: doc: Update postinstall/preremove scripts
@ 2023-03-08 14:17 Jon Turney
  2023-03-13  9:31 ` Corinna Vinschen
  0 siblings, 1 reply; 4+ messages in thread
From: Jon Turney @ 2023-03-08 14:17 UTC (permalink / raw)
  To: cygwin-patches; +Cc: Jon Turney

Update postinstall/preremove scripts to use CYGWIN_START_MENU_SUFFIX and
CYGWIN_SETUP_OPTIONS.
---
 winsup/doc/etc.postinstall.cygwin-doc.sh | 19 +++++++++++++++----
 winsup/doc/etc.preremove.cygwin-doc.sh   |  8 ++++++--
 2 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/winsup/doc/etc.postinstall.cygwin-doc.sh b/winsup/doc/etc.postinstall.cygwin-doc.sh
index 97f88a16d..313c1d3ff 100755
--- a/winsup/doc/etc.postinstall.cygwin-doc.sh
+++ b/winsup/doc/etc.postinstall.cygwin-doc.sh
@@ -36,9 +36,20 @@ do
 	fi
 done
 
+# setup was run with options not to create startmenu items
+case ${CYGWIN_SETUP_OPTIONS} in
+  *no-startmenu*)
+    exit 0
+    ;;
+esac
+
 # Cygwin Start Menu directory
-case $(uname -s) in *-WOW*) wow64=" (32-bit)" ;; esac
-smpc_dir="$($cygp $CYGWINFORALL -P -U --)/Cygwin${wow64}"
+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}"
 
 # ensure Cygwin Start Menu directory exists
 /usr/bin/mkdir -p "$smpc_dir"
@@ -53,7 +64,7 @@ fi
 # create User Guide and API PDF and HTML shortcuts
 while read target name desc
 do
-	[ -r "$target" ] && $mks $CYGWINFORALL -P -n "Cygwin${wow64}/$name" -d "$desc" -- $target
+	[ -r "$target" ] && $mks $CYGWINFORALL -P -n "Cygwin${CYGWIN_START_MENU_SUFFIX}/$name" -d "$desc" -- $target
 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
@@ -64,7 +75,7 @@ EOF
 # create Home Page and FAQ URL link shortcuts
 while read target name desc
 do
-	$mks $CYGWINFORALL -P -n "Cygwin${wow64}/$name" -d "$desc" -a $target -- $launch
+	$mks $CYGWINFORALL -P -n "Cygwin${CYGWIN_START_MENU_SUFFIX}/$name" -d "$desc" -a $target -- $launch
 done <<EOF
 $site/index.html	Home\ Page	Cygwin\ Home\ Page\ Link
 $site/faq.html		FAQ	Cygwin\ Frequently\ Asked\ Questions\ Link
diff --git a/winsup/doc/etc.preremove.cygwin-doc.sh b/winsup/doc/etc.preremove.cygwin-doc.sh
index b098e6dac..cac29ee21 100755
--- a/winsup/doc/etc.preremove.cygwin-doc.sh
+++ b/winsup/doc/etc.preremove.cygwin-doc.sh
@@ -26,8 +26,12 @@ do
 done
 
 # Cygwin Start Menu directory
-case $(uname -s) in *-WOW*) wow64=" (32-bit)" ;; esac
-smpc_dir="$($cygp $CYGWINFORALL -P -U --)/Cygwin${wow64}"
+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}"
 
 # check Cygwin Start Menu directory still exists
 [ -d "$smpc_dir/" ] || exit 0
-- 
2.39.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Cygwin: doc: Update postinstall/preremove scripts
  2023-03-08 14:17 [PATCH] Cygwin: doc: Update postinstall/preremove scripts Jon Turney
@ 2023-03-13  9:31 ` Corinna Vinschen
  2023-03-13 14:18   ` Jon Turney
  0 siblings, 1 reply; 4+ messages in thread
From: Corinna Vinschen @ 2023-03-13  9:31 UTC (permalink / raw)
  To: cygwin-patches

Hi Jon,

On Mar  8 14:17, Jon Turney wrote:
> Update postinstall/preremove scripts to use CYGWIN_START_MENU_SUFFIX and
> CYGWIN_SETUP_OPTIONS.

It would be great if you could explain your change in the commit
message...

>  winsup/doc/etc.postinstall.cygwin-doc.sh | 19 +++++++++++++++----
>  winsup/doc/etc.preremove.cygwin-doc.sh   |  8 ++++++--
>  2 files changed, 21 insertions(+), 6 deletions(-)
> 
> diff --git a/winsup/doc/etc.postinstall.cygwin-doc.sh b/winsup/doc/etc.postinstall.cygwin-doc.sh
> index 97f88a16d..313c1d3ff 100755
> --- a/winsup/doc/etc.postinstall.cygwin-doc.sh
> +++ b/winsup/doc/etc.postinstall.cygwin-doc.sh
> @@ -36,9 +36,20 @@ do
>  	fi
>  done
>  
> +# setup was run with options not to create startmenu items
> +case ${CYGWIN_SETUP_OPTIONS} in
> +  *no-startmenu*)
> +    exit 0
> +    ;;
> +esac
> +
>  # Cygwin Start Menu directory
> -case $(uname -s) in *-WOW*) wow64=" (32-bit)" ;; esac
> -smpc_dir="$($cygp $CYGWINFORALL -P -U --)/Cygwin${wow64}"
> +if [ ! -v CYGWIN_START_MENU_SUFFIX ]

Isn't -v a bash extension? Ideally the shebang should reflect that.
Otherwise, -z?


Thanks,
Corinna

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Cygwin: doc: Update postinstall/preremove scripts
  2023-03-13  9:31 ` Corinna Vinschen
@ 2023-03-13 14:18   ` Jon Turney
  2023-03-13 16:06     ` Corinna Vinschen
  0 siblings, 1 reply; 4+ messages in thread
From: Jon Turney @ 2023-03-13 14:18 UTC (permalink / raw)
  To: Cygwin Patches

On 13/03/2023 09:31, Corinna Vinschen wrote:
> Hi Jon,
> 
> On Mar  8 14:17, Jon Turney wrote:
>> Update postinstall/preremove scripts to use CYGWIN_START_MENU_SUFFIX and
>> CYGWIN_SETUP_OPTIONS.
> 
> It would be great if you could explain your change in the commit
> message...
> 

Yeah, that's fair. How about:

"Since setup 2.925, it indicates to postinstall and preremove scripts 
the start menu suffix to use via the CYGWIN_START_MENU_SUFFIX env var.

It also indicates, via the CYGWIN_SETUP_OPTIONS env var, if the option 
to disable startmenu shortcut creation is supplied.

Update the Cygwin documentation postinstall and preremove scripts to 
take these env vars into consideration."

>>   winsup/doc/etc.postinstall.cygwin-doc.sh | 19 +++++++++++++++----
>>   winsup/doc/etc.preremove.cygwin-doc.sh   |  8 ++++++--
>>   2 files changed, 21 insertions(+), 6 deletions(-)
>>
>> diff --git a/winsup/doc/etc.postinstall.cygwin-doc.sh b/winsup/doc/etc.postinstall.cygwin-doc.sh
>> index 97f88a16d..313c1d3ff 100755
>> --- a/winsup/doc/etc.postinstall.cygwin-doc.sh
>> +++ b/winsup/doc/etc.postinstall.cygwin-doc.sh
>> @@ -36,9 +36,20 @@ do
>>   	fi
>>   done
>>   
>> +# setup was run with options not to create startmenu items
>> +case ${CYGWIN_SETUP_OPTIONS} in
>> +  *no-startmenu*)
>> +    exit 0
>> +    ;;
>> +esac
>> +
>>   # Cygwin Start Menu directory
>> -case $(uname -s) in *-WOW*) wow64=" (32-bit)" ;; esac
>> -smpc_dir="$($cygp $CYGWINFORALL -P -U --)/Cygwin${wow64}"
>> +if [ ! -v CYGWIN_START_MENU_SUFFIX ]
> 
> Isn't -v a bash extension? Ideally the shebang should reflect that.
> Otherwise, -z?

This is actually controlled by setup, which runs postinstall and 
preremove scripts with an .sh extension using bash.

But yeah, I'll change the shebang.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Cygwin: doc: Update postinstall/preremove scripts
  2023-03-13 14:18   ` Jon Turney
@ 2023-03-13 16:06     ` Corinna Vinschen
  0 siblings, 0 replies; 4+ messages in thread
From: Corinna Vinschen @ 2023-03-13 16:06 UTC (permalink / raw)
  To: cygwin-patches

On Mar 13 14:18, Jon Turney wrote:
> On 13/03/2023 09:31, Corinna Vinschen wrote:
> > Hi Jon,
> > 
> > On Mar  8 14:17, Jon Turney wrote:
> > > Update postinstall/preremove scripts to use CYGWIN_START_MENU_SUFFIX and
> > > CYGWIN_SETUP_OPTIONS.
> > 
> > It would be great if you could explain your change in the commit
> > message...
> > 
> 
> Yeah, that's fair. How about:
> 
> "Since setup 2.925, it indicates to postinstall and preremove scripts the
> start menu suffix to use via the CYGWIN_START_MENU_SUFFIX env var.
> 
> It also indicates, via the CYGWIN_SETUP_OPTIONS env var, if the option to
> disable startmenu shortcut creation is supplied.
> 
> Update the Cygwin documentation postinstall and preremove scripts to take
> these env vars into consideration."

Sure, sounds good

> 
> > >   winsup/doc/etc.postinstall.cygwin-doc.sh | 19 +++++++++++++++----
> > >   winsup/doc/etc.preremove.cygwin-doc.sh   |  8 ++++++--
> > >   2 files changed, 21 insertions(+), 6 deletions(-)
> > > 
> > > diff --git a/winsup/doc/etc.postinstall.cygwin-doc.sh b/winsup/doc/etc.postinstall.cygwin-doc.sh
> > > index 97f88a16d..313c1d3ff 100755
> > > --- a/winsup/doc/etc.postinstall.cygwin-doc.sh
> > > +++ b/winsup/doc/etc.postinstall.cygwin-doc.sh
> > > @@ -36,9 +36,20 @@ do
> > >   	fi
> > >   done
> > > +# setup was run with options not to create startmenu items
> > > +case ${CYGWIN_SETUP_OPTIONS} in
> > > +  *no-startmenu*)
> > > +    exit 0
> > > +    ;;
> > > +esac
> > > +
> > >   # Cygwin Start Menu directory
> > > -case $(uname -s) in *-WOW*) wow64=" (32-bit)" ;; esac
> > > -smpc_dir="$($cygp $CYGWINFORALL -P -U --)/Cygwin${wow64}"
> > > +if [ ! -v CYGWIN_START_MENU_SUFFIX ]
> > 
> > Isn't -v a bash extension? Ideally the shebang should reflect that.
> > Otherwise, -z?
> 
> This is actually controlled by setup, which runs postinstall and preremove
> scripts with an .sh extension using bash.
> 
> But yeah, I'll change the shebang.

Great. Just push when you're ready.


Thanks,
Corinna

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-03-13 16:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-08 14:17 [PATCH] Cygwin: doc: Update postinstall/preremove scripts Jon Turney
2023-03-13  9:31 ` Corinna Vinschen
2023-03-13 14:18   ` Jon Turney
2023-03-13 16:06     ` Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).