public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Capturing a Cygwin instance from another PC
@ 2023-11-22 14:53 Jose Isaias Cabrera
  2023-11-22 15:43 ` Bill Stewart
                   ` (5 more replies)
  0 siblings, 6 replies; 20+ messages in thread
From: Jose Isaias Cabrera @ 2023-11-22 14:53 UTC (permalink / raw)
  To: cygwin List


Greetings!

I have a new Win11 PC, and I wanted to capture the same Cygwin setup that I have in another Win10 PC. I copied the C:\cygwin64 folder from the Win10 pc to the Win11 pc, then I downloaded a fresh setup-x86_64.exe from cygwin.com to the win11 PC. I ran it and chose "Install from Local Directory" and only one shortcut for "Cygwin64 Terminal" was created on the desktop. No Cygwin nor Cygwin-X folders were created on the Start menu. The original cygwin from the Win10 PC had X installed also. 

Any idea how to get this done automatically? I know I can go and create folders manually, etc., but it kind of a pain. Any help would be greatly appreciated. Thanks.

josé

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

* Re: Capturing a Cygwin instance from another PC
  2023-11-22 14:53 Capturing a Cygwin instance from another PC Jose Isaias Cabrera
@ 2023-11-22 15:43 ` Bill Stewart
  2023-11-22 16:15   ` Eliot Moss
  2023-11-22 16:20 ` EXTERNAL SENDER: " Dale Lobb (Sys Admin)
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 20+ messages in thread
From: Bill Stewart @ 2023-11-22 15:43 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 694 bytes --]

On Wed, Nov 22, 2023 at 7:53 AM Jose Isaias Cabrera wrote:

I have a new Win11 PC, and I wanted to capture the same Cygwin setup that I
> have in another Win10 PC. I copied the C:\cygwin64 folder from the Win10 pc
> to the Win11 pc, then I downloaded a fresh setup-x86_64.exe from
> cygwin.com to the win11 PC. I ran it and chose "Install from Local
> Directory" and only one shortcut for "Cygwin64 Terminal" was created on the
> desktop. No Cygwin nor Cygwin-X folders were created on the Start menu. The
> original cygwin from the Win10 PC had X installed also.
>

I don't think "Install from Local Directory" means "reproduce same cygwin
installation on a separate computer".

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

* Re: Capturing a Cygwin instance from another PC
  2023-11-22 15:43 ` Bill Stewart
@ 2023-11-22 16:15   ` Eliot Moss
  2023-11-22 21:38     ` Jose Isaias Cabrera
  2023-11-22 22:44     ` Cedric Blancher
  0 siblings, 2 replies; 20+ messages in thread
From: Eliot Moss @ 2023-11-22 16:15 UTC (permalink / raw)
  To: Bill Stewart, cygwin

On 11/22/2023 10:43 AM, Bill Stewart via Cygwin wrote:
> On Wed, Nov 22, 2023 at 7:53 AM Jose Isaias Cabrera wrote:
> 
> I have a new Win11 PC, and I wanted to capture the same Cygwin setup that I
>> have in another Win10 PC. I copied the C:\cygwin64 folder from the Win10 pc
>> to the Win11 pc, then I downloaded a fresh setup-x86_64.exe from
>> cygwin.com to the win11 PC. I ran it and chose "Install from Local
>> Directory" and only one shortcut for "Cygwin64 Terminal" was created on the
>> desktop. No Cygwin nor Cygwin-X folders were created on the Start menu. The
>> original cygwin from the Win10 PC had X installed also.
>>
> 
> I don't think "Install from Local Directory" means "reproduce same cygwin
> installation on a separate computer".

In fact, it means to install using the package files in some local directory,
i.e., "assume the packages are already downloaded".

It would be reasonable to copy over downloaded packages.

I believe there are commands / techniques that would then make it fairly
easy to install that specific set of packages "from scratch" (but from
the local copy of the packages).  Copying *installed* file hierarchies
is trickier because of permission / ownership concerns.

Best - EM

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

* RE: EXTERNAL SENDER: Capturing a Cygwin instance from another PC
  2023-11-22 14:53 Capturing a Cygwin instance from another PC Jose Isaias Cabrera
  2023-11-22 15:43 ` Bill Stewart
@ 2023-11-22 16:20 ` Dale Lobb (Sys Admin)
  2023-11-22 21:49   ` Jose Isaias Cabrera
  2023-11-23 18:40 ` ASSI
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 20+ messages in thread
From: Dale Lobb (Sys Admin) @ 2023-11-22 16:20 UTC (permalink / raw)
  To: Jose Isaias Cabrera; +Cc: cygwin

> -----Original Message-----
> From: Cygwin <cygwin-bounces+dale.lobb=bryanhealth.org@cygwin.com>
> On Behalf Of Jose Isaias Cabrera via Cygwin
> Sent: Wednesday, November 22, 2023 8:53 AM
> To: cygwin List <cygwin@cygwin.com>
> Subject: EXTERNAL SENDER: Capturing a Cygwin instance from another PC
>
>
> Greetings!
>
> I have a new Win11 PC, and I wanted to capture the same Cygwin setup that I
> have in another Win10 PC. I copied the C:\cygwin64 folder from the Win10 pc
> to the Win11 pc, then I downloaded a fresh setup-x86_64.exe from
> cygwin.com to the win11 PC. I ran it and chose "Install from Local Directory"
> and only one shortcut for "Cygwin64 Terminal" was created on the desktop.
> No Cygwin nor Cygwin-X folders were created on the Start menu. The
> original cygwin from the Win10 PC had X installed also.
>
> Any idea how to get this done automatically? I know I can go and create
> folders manually, etc., but it kind of a pain. Any help would be greatly
> appreciated. Thanks.
>
> josé
>
> --
<snip>

  I've had some success doing this in the past (pre Cygwin64 days), but I did it using rsync from inside a Cygwin shell on the original machine, copying to a windows mapped drive pointing to the "C$" admin share of the target machine.  Note: You will need admin privs on the target machine to use the C$ share.  You also will have to have the default mount setting in /etc/fstab to NOT include "noacl" (which it doesn’t by default) so that Cygwin file protection masks get copied, and you need to use a set of options for rsync that copy the file privs and dates.  I believe I used "rsync -av /cygdrive/c/cygwin64 /cygdrive/<mapped drive letter/", but then, I did not have any special files in my Cygwin tree, so YMMV.

  Also, Cygwin has a registry hive located at \HKEY_LOCAL_MACHINE\SOFTWARE\Cygwin that you will want to export and import into the new machine.  You may need to modify the locations listed in some of the sub-keys, if you changed the physical location of the installation during the move (e.g. if you copied it from the C drive on the original machine to the "D" drive on the target, or if you renamed the installation directory).

  In order to use the "Install from Local directory" option, You will probably have to find and move, or at least reference, the original installation directories, where the binary packages were downloaded in order to correctly update the installation after the move.

  Good Luck!

Best Regards,

Dale



________________________________

CONFIDENTIALITY NOTICE: This e-mail message, including any attachments, is for the sole use of the intended recipients and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.

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

* Re: Capturing a Cygwin instance from another PC
  2023-11-22 16:15   ` Eliot Moss
@ 2023-11-22 21:38     ` Jose Isaias Cabrera
  2023-11-22 22:01       ` Ken Brown
  2023-11-23  3:25       ` Eliot Moss
  2023-11-22 22:44     ` Cedric Blancher
  1 sibling, 2 replies; 20+ messages in thread
From: Jose Isaias Cabrera @ 2023-11-22 21:38 UTC (permalink / raw)
  To: Bill Stewart, cygwin, Eliot Moss

[-- Attachment #1: Type: text/plain, Size: 1065 bytes --]

On Wednesday, November 22, 2023 11:15 AM, Eliot Moss expressed:
>
> On 11/22/2023 10:43 AM, Bill Stewart via Cygwin wrote:
> > On Wed, Nov 22, 2023 at 7:53 AM Jose Isaias Cabrera wrote:
[clip]
> >> desktop. No Cygwin nor Cygwin-X folders were created on the Start menu. The
> >> original cygwin from the Win10 PC had X installed also.
> >>
> >
> > I don't think "Install from Local Directory" means "reproduce same cygwin
> > installation on a separate computer".
>
> In fact, it means to install using the package files in some local directory,
> i.e., "assume the packages are already downloaded".
>
> It would be reasonable to copy over downloaded packages.
>
> I believe there are commands / techniques that would then make it fairly
> easy to install that specific set of packages "from scratch" (but from
> the local copy of the packages).  Copying *installed* file hierarchies
> is trickier because of permission / ownership concerns.

Thanks, Eliot. Hmmm... I would have thought that by now this process would have been thought of.

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

* Re: EXTERNAL SENDER: Capturing a Cygwin instance from another PC
  2023-11-22 16:20 ` EXTERNAL SENDER: " Dale Lobb (Sys Admin)
@ 2023-11-22 21:49   ` Jose Isaias Cabrera
  0 siblings, 0 replies; 20+ messages in thread
From: Jose Isaias Cabrera @ 2023-11-22 21:49 UTC (permalink / raw)
  To: Dale Lobb (Sys Admin); +Cc: cygwin

[-- Attachment #1: Type: text/plain, Size: 654 bytes --]

On Wednesday, November 22, 2023 11:20 AM, Dale Lobb (Sys Admin) expressed:
> Cc: cygwin@cygwin.com <cygwin@cygwin.com>
> <snip>
>
> I've had some success doing this in the past (pre Cygwin64 days), but I did it using rsync [clip]
>
Thanks, Dale. Too much work. ;-)

Interestingly enough, after running setup pointing locally, and then running setup pointing to "Install from Internet", it found some updates. But, still no X icons. I know what I need to do, but I just thought it would be as easy as what I thought would be logically thinking. :-)

Perhaps, this is a feature that should be added to setup. Just thinking out-loud. :-)

josé

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

* Re: Capturing a Cygwin instance from another PC
  2023-11-22 21:38     ` Jose Isaias Cabrera
@ 2023-11-22 22:01       ` Ken Brown
  2023-11-23  3:25       ` Eliot Moss
  1 sibling, 0 replies; 20+ messages in thread
From: Ken Brown @ 2023-11-22 22:01 UTC (permalink / raw)
  To: cygwin; +Cc: Jose Isaias Cabrera

On 11/22/2023 4:38 PM, Jose Isaias Cabrera via Cygwin wrote:
> Thanks, Eliot. Hmmm... I would have thought that by now this process would have been thought of.

It has been:

   https://cygwin.com/pipermail/cygwin/2020-June/245384.html

Ken

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

* Re: Capturing a Cygwin instance from another PC
  2023-11-22 16:15   ` Eliot Moss
  2023-11-22 21:38     ` Jose Isaias Cabrera
@ 2023-11-22 22:44     ` Cedric Blancher
  2023-11-23 15:24       ` Corinna Vinschen
  1 sibling, 1 reply; 20+ messages in thread
From: Cedric Blancher @ 2023-11-22 22:44 UTC (permalink / raw)
  To: cygwin

On Wed, 22 Nov 2023 at 17:15, Eliot Moss via Cygwin <cygwin@cygwin.com> wrote:
>
> On 11/22/2023 10:43 AM, Bill Stewart via Cygwin wrote:
> > On Wed, Nov 22, 2023 at 7:53 AM Jose Isaias Cabrera wrote:
> >
> > I have a new Win11 PC, and I wanted to capture the same Cygwin setup that I
> >> have in another Win10 PC. I copied the C:\cygwin64 folder from the Win10 pc
> >> to the Win11 pc, then I downloaded a fresh setup-x86_64.exe from
> >> cygwin.com to the win11 PC. I ran it and chose "Install from Local
> >> Directory" and only one shortcut for "Cygwin64 Terminal" was created on the
> >> desktop. No Cygwin nor Cygwin-X folders were created on the Start menu. The
> >> original cygwin from the Win10 PC had X installed also.
> >>
> >
> > I don't think "Install from Local Directory" means "reproduce same cygwin
> > installation on a separate computer".
>
> In fact, it means to install using the package files in some local directory,
> i.e., "assume the packages are already downloaded".
>
> It would be reasonable to copy over downloaded packages.
>
> I believe there are commands / techniques that would then make it fairly
> easy to install that specific set of packages "from scratch" (but from
> the local copy of the packages).  Copying *installed* file hierarchies
> is trickier because of permission / ownership concerns.

Does Cygwin have a way to dump the list of installed packages, and
feed that list back to Cygwin setup.exe?

Ced
-- 
Cedric Blancher <cedric.blancher@gmail.com>
[https://plus.google.com/u/0/+CedricBlancher/]
Institute Pasteur

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

* Re: Capturing a Cygwin instance from another PC
  2023-11-22 21:38     ` Jose Isaias Cabrera
  2023-11-22 22:01       ` Ken Brown
@ 2023-11-23  3:25       ` Eliot Moss
  2023-11-23  9:12         ` Backwoods BC
  1 sibling, 1 reply; 20+ messages in thread
From: Eliot Moss @ 2023-11-23  3:25 UTC (permalink / raw)
  To: Jose Isaias Cabrera, Bill Stewart, cygwin

On 11/22/2023 4:38 PM, Jose Isaias Cabrera wrote:
> On Wednesday, November 22, 2023 11:15 AM, Eliot Moss expressed:
>>
>> On 11/22/2023 10:43 AM, Bill Stewart via Cygwin wrote:
>> > On Wed, Nov 22, 2023 at 7:53 AM Jose Isaias Cabrera wrote:
> [clip]
>> >> desktop. No Cygwin nor Cygwin-X folders were created on the Start menu. The
>> >> original cygwin from the Win10 PC had X installed also.
>> >>
>> >
>> > I don't think "Install from Local Directory" means "reproduce same cygwin
>> > installation on a separate computer".
>>
>> In fact, it means to install using the package files in some local directory,
>> i.e., "assume the packages are already downloaded".
>>
>> It would be reasonable to copy over downloaded packages.
>>
>> I believe there are commands / techniques that would then make it fairly
>> easy to install that specific set of packages "from scratch" (but from
>> the local copy of the packages).  Copying *installed* file hierarchies
>> is trickier because of permission / ownership concerns.
> 
> Thanks, Eliot. Hmmm... I would have thought that by now this process would have been thought of.

Not saying it hasn't, but since I don't have a ready answer to your
question I was leaving that to other, more knowledgeable, folks to
jump in and ill the gap :-) ...

EM

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

* Re: Capturing a Cygwin instance from another PC
  2023-11-23  3:25       ` Eliot Moss
@ 2023-11-23  9:12         ` Backwoods BC
  0 siblings, 0 replies; 20+ messages in thread
From: Backwoods BC @ 2023-11-23  9:12 UTC (permalink / raw)
  Cc: cygwin

On Thu, Nov 23, 2023 at 12:39 AM Eliot Moss via Cygwin
<cygwin@cygwin.com> wrote:
> On 11/22/2023 4:38 PM, Jose Isaias Cabrera wrote:
> > On Wednesday, November 22, 2023 11:15 AM, Eliot Moss expressed:
> >>
> >> On 11/22/2023 10:43 AM, Bill Stewart via Cygwin wrote:
> >> > On Wed, Nov 22, 2023 at 7:53 AM Jose Isaias Cabrera wrote:
> > [clip]
> >> >> desktop. No Cygwin nor Cygwin-X folders were created on the Start menu. The
> >> >> original cygwin from the Win10 PC had X installed also.
> >> >>
> >> >
> >> > I don't think "Install from Local Directory" means "reproduce same cygwin
> >> > installation on a separate computer".
> >>
> >> In fact, it means to install using the package files in some local directory,
> >> i.e., "assume the packages are already downloaded".
> >>
> >> It would be reasonable to copy over downloaded packages.
> >>
> >> I believe there are commands / techniques that would then make it fairly
> >> easy to install that specific set of packages "from scratch" (but from
> >> the local copy of the packages).  Copying *installed* file hierarchies
> >> is trickier because of permission / ownership concerns.
> >
> > Thanks, Eliot. Hmmm... I would have thought that by now this process would have been thought of.
>
> Not saying it hasn't, but since I don't have a ready answer to your
> question I was leaving that to other, more knowledgeable, folks to
> jump in and ill the gap :-) ...

I'll also add my vote for "this should be easier." I've done it a half
a dozen times over the years and I found that the fastest method was
to take several screen shots of Cygwin setup showing what I have
installed, take those to the new machine, and manually go down the
list selecting the same things. It's stupidly low tech, but it's
actually quite fast (~ 5 minutes) and I know that it will always work
without annoying glitches.

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

* Re: Capturing a Cygwin instance from another PC
  2023-11-22 22:44     ` Cedric Blancher
@ 2023-11-23 15:24       ` Corinna Vinschen
  0 siblings, 0 replies; 20+ messages in thread
From: Corinna Vinschen @ 2023-11-23 15:24 UTC (permalink / raw)
  To: cygwin

On Nov 22 23:44, Cedric Blancher via Cygwin wrote:
> On Wed, 22 Nov 2023 at 17:15, Eliot Moss via Cygwin <cygwin@cygwin.com> wrote:
> >
> > On 11/22/2023 10:43 AM, Bill Stewart via Cygwin wrote:
> > > On Wed, Nov 22, 2023 at 7:53 AM Jose Isaias Cabrera wrote:
> > >
> > > I have a new Win11 PC, and I wanted to capture the same Cygwin setup that I
> > >> have in another Win10 PC. I copied the C:\cygwin64 folder from the Win10 pc
> > >> to the Win11 pc, then I downloaded a fresh setup-x86_64.exe from
> > >> cygwin.com to the win11 PC. I ran it and chose "Install from Local
> > >> Directory" and only one shortcut for "Cygwin64 Terminal" was created on the
> > >> desktop. No Cygwin nor Cygwin-X folders were created on the Start menu. The
> > >> original cygwin from the Win10 PC had X installed also.
> > >>
> > >
> > > I don't think "Install from Local Directory" means "reproduce same cygwin
> > > installation on a separate computer".
> >
> > In fact, it means to install using the package files in some local directory,
> > i.e., "assume the packages are already downloaded".
> >
> > It would be reasonable to copy over downloaded packages.
> >
> > I believe there are commands / techniques that would then make it fairly
> > easy to install that specific set of packages "from scratch" (but from
> > the local copy of the packages).  Copying *installed* file hierarchies
> > is trickier because of permission / ownership concerns.
> 
> Does Cygwin have a way to dump the list of installed packages, and
> feed that list back to Cygwin setup.exe?

You just call `cygcheck -cd' and create a tiny script massaging the output
into a comma-separated list.

This you can feed into a setup-x86-64.exe -P call.


Corinna

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

* Re: Capturing a Cygwin instance from another PC
  2023-11-22 14:53 Capturing a Cygwin instance from another PC Jose Isaias Cabrera
  2023-11-22 15:43 ` Bill Stewart
  2023-11-22 16:20 ` EXTERNAL SENDER: " Dale Lobb (Sys Admin)
@ 2023-11-23 18:40 ` ASSI
  2023-11-23 20:27   ` Doug Henderson
  2023-11-27  2:36 ` Chris Wagner
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 20+ messages in thread
From: ASSI @ 2023-11-23 18:40 UTC (permalink / raw)
  To: cygwin

Jose Isaias Cabrera via Cygwin writes:
> I have a new Win11 PC, and I wanted to capture the same Cygwin setup
> that I have in another Win10 PC. I copied the C:\cygwin64 folder from
> the Win10 pc to the Win11 pc,

This doesn't really work unless both machines are domain joined and all
SID for the installation are identical on both machines plus you'd need
to ensure that symlinks and stuff make it to the new machine unharmed.
It's actually easier to re-install from scratch and don't worry about
all those things.

>  then I downloaded a fresh
> setup-x86_64.exe from cygwin.com to the win11 PC. I ran it and chose
> "Install from Local Directory" and only one shortcut for "Cygwin64
> Terminal" was created on the desktop. No Cygwin nor Cygwin-X folders
> were created on the Start menu. The original cygwin from the Win10 PC
> had X installed also.
>
> Any idea how to get this done automatically? I know I can go and
> create folders manually, etc., but it kind of a pain. Any help would
> be greatly appreciated. Thanks.

Do a base install on the new machine, then copy over the
/etc/setup/installed.db from the old machine.  Then reset all the
version/release numbers in that file to zero:

sed -re 's/^(.+) (\1)-[0-9].+(\.bz2)/\1 \1-0-0\3/' -i.bak /etc/setup/installed.db

Close the Cygwin shell and run setup again and it will re-install
everything you've had installed on your old machine, thus ensuring that
all postinstall scripts will execute in the correct order.

If you've changed any system-wide configuration files like
/etc/nsswitch.conf or /etc/fstab, compare those to the new files just
installed and decide which version to keep.  Take note if you've used
the "desc" schema for user mapping and re-apply those to the SAM for
local accounts.  If you've had an SSH server running on the old machine
you will of course need to create new host keys and install the
services, again that's easier to do from scratch IMHO.

Once the system is set up to your satisfaction, copy any home
directories you want to keep on the new machine.


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

SD adaptation for Waldorf rackAttack V1.04R1:
http://Synth.Stromeko.net/Downloads.html#WaldorfSDada

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

* Re: Capturing a Cygwin instance from another PC
  2023-11-23 18:40 ` ASSI
@ 2023-11-23 20:27   ` Doug Henderson
  0 siblings, 0 replies; 20+ messages in thread
From: Doug Henderson @ 2023-11-23 20:27 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 807 bytes --]

> Jose Isaias Cabrera via Cygwin writes:
> > I have a new Win11 PC, and I wanted to capture the same Cygwin setup
> > that I have in another Win10 PC. I copied the C:\cygwin64 folder from
> > the Win10 pc to the Win11 pc,

I use the attached script (rename it to remove the .txt extension) to
clone my cygwin installation.

You can use the generated script to
1. perform a clean reinstall with the same set of packages as a
current  instance.
2. clone an existing install to another instance on this or another machine.

USE AT YOUR OWN RISK.

You must change the variables in the configuration section to your requirements.

You can also edit the generated script, which is created in the same
folder as the cygwin setup executable.


HTH
Doug
-- 
Doug Henderson, Calgary, Alberta, Canada - from gmail.com

[-- Attachment #2: djh-reinstall.sh.txt --]
[-- Type: text/plain, Size: 11732 bytes --]

#!/usr/bin/bash -e
# djh-reinstall.sh
# created by Doug Henderson
# inspired by similar code posted on stackoverflow and the cygwin mailing list
# updated 2020-05-26 by Doug Henderson
# updated 2023-11-23 by Doug Henderson

# *** USE AT YOUR OWN RISK ***

# djh-reinstall.sh determines a minimal set of packages which will reinstall
# an existing cygwin instance.
#
# You can use the generated script to
# 1. perform clean reinstall with the same set of packages as a current
#    instance.
# 2. clone an existing install to another instance on this or another
#    machine.
#
# It uses the cygcheck-dep script from the cygcheck-dep package to
# determine a set of packages which have no dependent packages.
# It relies on cygwin setup to compute all dependencies.
# You must change the variables in the configuration section to your requirements.


arch=$( uname -m)
if [ $arch = "x86"    ] ; then
	bits=32
elif [ $arch = "x86_64" ] ; then
	bits=64
else
	echo "Failed to determine bits for $arch"
	exit 1
fi

################################
# start of configuration section
# You must change the variables in this section to your requirements.

# SETUP_DIR contains the Cygwin setup executable
# This where you saved the installer from https://www/cygwin.com
SETUP_DIR_W="D:\\Users\\Doug\\Down_Loads\\cygwin"

# ROOT is the windows directory which will be the cygwin root directory.
# All of cygwin is installed below this directory.
# Select the 1st following line to install to same dir.
# select the  2nd following line for the recommended root directory.
# I recommend C:\cygwin32 and C:\cygwin64 for 32 bit and 64 bit installs.
# ROOT_W="$( cygpath -wa / )"
  ROOT_W="C:\\cygwin${bits}"

# CACHE is the windows directory containing the local package cache
# You can use one directory, or one for each architecture.
# It is strongly recommended that you use one for each architecture.
# This folder must not be under the ROOT folder.
  CACHE_W="D:\\Users\\Doug\\Down_Loads\\cygwin${bits}cache"

# MIRROR is the URL of a Cygwin mirror site. Pick your favourite, or fastest.
# Use the same one as you select when running the installer: setup_*.exe
  MIRROR="http://mirrors.kernel.org/sourceware/cygwin/"

# end of configuration section
##############################

# remove scatch files
rm -f /tmp/djh-check.*

USAGE="Usage: $0 [--incomplete | -I] [--long | -L] [--overlay DIR | -O DIR] [--pause | -P]
	--incomplete, -I      - reinstall incomplete packages only
	--long, -L            - use setup's long instead of short form options
	--overlay DIR, -O DIR - use DIR as an overlay package server
	--pause, -P           - add a pause at end of command script
	--verbose, -v         - verbose, show some extra info
	--debug, -D           - debug, show lots of extra info
	--help, -h            - display usage message and exit

	WARNING: reinstalling incomplete python packages will downgrade
	those python packages that were upgraded by using 'pip install -U PKG'.
"

INCOMPLETE=
LONG=
OVERLAY=
PAUSE=
VERBOSE=
VERSION=
DEBUG=

die() { echo "$*" >&2 ; exit 2 ; }  # complain to STDERR and exit with error
needs_arg() { if [ -z "$OPTARG" ] ; then die "No arg for --$OPT option" ; fi ; }

while getopts "hvDILO:PV-:" OPT ; do
	# echo "*1st: OPT=$OPT OPTIND=$OPTIND NAME=$NAME OPTARG=$OPTARG"
	if [ "$OPT" = "-" ]; then     # long option: reformulate OPT and OPTARG
		OPT="${OPTARG%%=*}"       # extract long option name
		OPTARG="${OPTARG#$OPT}"   # extract long option argument (may be empty)
		OPTARG="${OPTARG#=}"      # if long option argument, remove assigning `=`
		# echo "*2nd: OPT=$OPT OPTIND=$OPTIND NAME=$NAME OPTARG=$OPTARG"
	fi
	case $OPT in
	h | help )			echo "$USAGE" ; exit 0 ;;
	v | verbose )		VERBOSE=true ;;
	D | debug )			DEBUG=true ;;
	I | incomplete )	INCOMPLETE=true ;;
	L | long )			LONG=true ;;
	O | overlay )		needs_arg; OVERLAY=$OPTARG ;;
	P | pause )			PAUSE=true ;;
	V | version )		VERSION=true ;;
	??* )				die "Illegal option --$OPT" ;;  # bad long option
	\?)					exit 2 ;;  # bad short option (error reported via getopts)
	*)
		echo "*WTF: OPT=$OPT OPTIND=$OPTIND NAME=$NAME OPTARG=$OPTARG"
		exit 1
		;;
	esac
done
shift $((OPTIND-1)) # remove parsed options and args from $@ list

if [ -n "$DEBUG" ] ; then
	echo "Options: INCOMPLETE=$INCOMPLETE LONG=$LONG OVERLAY=$OVERLAY"
	echo "         PAUSE=$PAUSE VERBOSE=$VERBOSE DEBUG=$DEBUG"
	echo ""
fi

# precompute some variables

# SETUP_EXE is the architecture dependent Cygwin setup executable.
SETUP_EXE="setup-$(arch).exe"

# SETUP_PATH_W is the full windows path to the Cygwin setup executable.
SETUP_PATH_W="${SETUP_DIR_W}\\${SETUP_EXE}"

# CMD_W is the full windows path to the reinstall command we are creating.
CMD_W="${SETUP_DIR_W}\\djh-reinstall${bits}.cmd"

# CMD_U is the full cygwin path to the reinstall command we are creating.
CMD_U="$( cygpath -u ${CMD_W} )"

# show the configuration variables
show_vars() {
	EFMT="INFO: %-14s = %-60s # %s\n"
	printf "${EFMT}"  SETUP_DIR_W  ${SETUP_DIR_W}  "windows dir containing setup exe"
	printf "${EFMT}"  ROOT_W       ${ROOT_W}       "windows path of cygwin root"
	printf "${EFMT}"  CACHE_W      ${CACHE_W}      "setup exe cache directory"
	printf "${EFMT}"  MIRROR       ${MIRROR}       "URL of preferred mirror"

	if true ; then
		echo ""
		printf "${EFMT}"  reinstall.sh  ${0}             "this script"
		printf "${EFMT}"  arch          ${arch}          "architecture name X86 or X86_64"
		printf "${EFMT}"  bits          ${bits}          "architecture bits 32 or 64"
		printf "${EFMT}"  SETUP_EXE     ${SETUP_EXE}     "setup executable name"
		printf "${EFMT}"  SETUP_PATH_W  ${SETUP_PATH_W}  "windows path to setup executable"
		printf "${EFMT}"  CMD_W         ${CMD_W}         "windows path to output cmd script"
		printf "${EFMT}"  CMD_U         ${CMD_U}         "unix path to output cmd script"
	fi
}
if [ -n "$VERBOSE" ] || [ -n "$DEBUG" ] ; then
	show_vars
fi

# check that required programs are installed
check_dep() {
	if [ ! -x $( which $1 > /dev/null 2>&1 ) ] ; then
		echo >&2 "$1 : command not found"
		pkg=$( cygcheck -f /usr/bin/$1 )
		echo >&2 "Please install $pkg which provides $1"
		exit 1
	fi
}
check_dep cygcheck-dep
check_dep unix2dos.exe

if [ ! -f $( cygpath -u "${SETUP_PATH_W}" ) ] ; then
	echo >&2 "WARNING: setup not found: $( cygpath -u ${SETUP_PATH_W} )"
	echo >&2 "WARNING: ${SETUP_EXE} must be installed to run the generated script"
fi

FMT="INFO: %-24s shows %4d packages\n"
if [ -n "$INCOMPLETE" ] ; then
	echo "WARNING: This resets all Python packages upgraded using 'pip install -U PKG'."

	cygcheck -c | grep -a "Incomplete" >> /tmp/djh-check.p2.log

	# our sed script does:
	# remove everything after the first space to end of line.
	# delete line(s) starting with '_' (just in case).
	sed	< /tmp/djh-check.p2.log \
		-e 's/ .*$//' \
		-e '/^_/d' \
		> /tmp/djh-check.p2a.log

	p2=( $( sort --unique /tmp/djh-check.p2a.log ) )
	printf "${FMT}" "cgcheck -c Incomp" ${#p2[*]}
else
	# p1 is the list of all installed packages
	# p2 is the list of "leaf" packages
	# p3 is the list of packages recursively required by "leaf" packages

	echo "========================================================================"
	echo "(This may take a minute or so)"
	echo "# generated at $( date --rfc-3339=sec )" > /tmp/djh-check.p1.log
	cygcheck -c >> /tmp/djh-check.p1.log

	# our sed script does:
	# delete first 2 lines.
	# remove everything after the first space to end of line.
	# delete line(s) starting with '_'.
	sed	< /tmp/djh-check.p1.log \
		-e '1,2d' \
		-e 's/ .*$//' \
		-e '/^_/d' \
		> /tmp/djh-check.p1a.log
	p1=( $( sort --unique /tmp/djh-check.p1a.log ) )
	printf "${FMT}" "cgcheck -c" ${#p1[*]}
	( echo "p1 =" ; echo "    ${p1[*]}" ) > /tmp/djh-check.p1b.log

	echo "========================================================================"
	echo "(This may take a minute or so)"
	echo "# generated at $( date --rfc-3339=sec )" > /tmp/djh-check.dep-pp2.log
	( cygcheck-dep -c -l -I 2> /dev/null || true ) >> /tmp/djh-check.dep-pp2.log

	# our sed script does:
	# delete lines starting with '/', \s+, ' _'.
	# remove open and closing parenthesis.
	# strip leading spaces.
	# strip trailing spaces.
	# replace multiple spaces with a single space.
	# delete empty lines.
	# replace spaces with newlines.
	sed	< /tmp/djh-check.dep-pp2.log \
		-e '/^\//d' \
		-e '/^\#/d' \
		-e '/^ _/d' \
		-e '/^ ( /s/[()]//g' \
		-e 's/\[Base\]//g' \
		-e 's/^  *//' \
		-e 's/  *$//' \
		-e 's/  */ /' \
		-e '/^$/d' \
		-e 's/ /\n/g' \
		> /tmp/djh-check.dep-pp2a.log
	p2=( $( sort --unique /tmp/djh-check.dep-pp2a.log ) )
	printf "${FMT}" "cygcheck-dep -c -l -I" ${#p2[*]}
	( echo "p2 =" ; echo "    ${p2[*]}" ) > /tmp/djh-check.dep-pp2b.log

	echo "========================================================================"
	echo "(This may take a minute or so)"
	echo "# generated at $( date --rfc-3339=sec )" > /tmp/djh-check.dep-pp3.log
	( cygcheck-dep -c -R ${p2[*]} 2> /dev/null || true ) >> /tmp/djh-check.dep-pp3.log

	# our sed script does:
	# delete lines starting with '_'.
	# remove 'recursively requires ' comments.
	# remove ')'.
	# strip leading spaces.
	# strip trailing spaces.
	# replace multiple spaces with a single space.
	# delete empty lines.
	# replace spaces with newlines.
	sed	< /tmp/djh-check.dep-pp3.log \
		-e '/^\#/d' \
		-e '/^_/d' \
		-e 's/: recursively requires ( */ /' \
		-e 's/ *) *$//' \
		-e 's/^ *//' \
		-e 's/  *$//' \
		-e '/^$/d' \
		-e 's/ /\n/g' \
		> /tmp/djh-check.dep-pp3a.log
	p3=( $( sort --unique /tmp/djh-check.dep-pp3a.log ) )
	printf "${FMT}" "cygcheck-dep -c -R" ${#p3[*]}
	( echo "p3 =" ; echo "    ${p3[*]}" ) > /tmp/djh-check.dep-pp3b.log
fi

echo "========================================================================"
# create the djh-reinstall command script.

if [ -z $LONG ] ; then
	# use short options to save space
	opt_delete_orphans=-o
	opt_local_package_dir=-l
	opt_no_desktop=-d
	opt_no_shortcuts=-n
	opt_no_verify=-X
	opt_only_site=-O
	opt_packages=-P
	opt_pubkey=-K
	opt_quiet=-q
	opt_root=-R
	opt_site=-s
	opt_upgrade_also=-g
else
	# use long options for readability
	opt_delete_orphans=--delete-orphans
	opt_local_package_dir=--local-package-dir
	opt_no_desktop=--no-desktop
	opt_no_shortcuts=--no-shortcuts
	opt_no_verify=--no-verify
	opt_only_site=--only-site
	opt_packages=--packages
	opt_pubkey=--pubkey
	opt_quiet=--quiet-mode
	opt_root=--root
	opt_site=--site
	opt_upgrade_also=--upgrade-also
fi

# echo    "DEBUG: \$CMD_U = $CMD_U"
rm -f   ${CMD_U}
touch   ${CMD_U}

cat	>> ${CMD_U} <<EOF
@echo off
@rem This file is $CMD_W
@rem It was generated
@rem   by    ${USER}@${HOSTNAME}
@rem   at    $( date --rfc-3339=sec )
@rem   using $( cygpath -au $0 )
@rem   AKA   $( cygpath -aw $0 )
@rem
@rem WARNING: Changes will be overwritten without warning.
@rem
@SETLOCAL
@SETLOCAL ENABLEEXTENSIONS
${SETUP_PATH_W} ^
 $opt_quiet $opt_no_desktop $opt_no_shortcuts ^
 $opt_delete_orphans $opt_upgrade_also $opt_only_site ^
 $opt_root "${ROOT_W}" ^
 $opt_local_package_dir "${CACHE_W}" ^
$( if [ -n "$OVERLAY" ]; then echo " $opt_no_verify $opt_site $OVERLAY ^\n" ; fi; )\
 $opt_site ${MIRROR} ^
 $opt_packages ${p2[*]}
$( if [ -n "$PAUSE" ]; then echo "@pause" ; else echo "@rem" ; fi )
EOF
# sed -i -e 's/  / /g' ${CMD_U}

echo "INFO: cmd line length (max=~8192): $( wc --max-line-length < ${CMD_U} )"
echo "INFO: when the line length exceeds the max, you must edit \"${CMD_W}\""
echo ""

# display the command script without non-echoed lines (optional)
# sed < ${CMD_U} -e '/^\@/d'

# Convert the command script from unix to dos line endings
unix2dos -ascii --keepdate --quiet --oldfile ${CMD_U}

# remove scatch files
if [ -z "$DEBUG" ] ; then
	rm -f /tmp/djh-check.*
fi

# -30-

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

* Re: Capturing a Cygwin instance from another PC
  2023-11-22 14:53 Capturing a Cygwin instance from another PC Jose Isaias Cabrera
                   ` (2 preceding siblings ...)
  2023-11-23 18:40 ` ASSI
@ 2023-11-27  2:36 ` Chris Wagner
  2023-11-27  8:24   ` ASSI
  2023-11-27  2:46 ` Capturing a Cygwin instance from another PC (CORRECTION) Chris Wagner
  2023-12-07 22:59 ` Capturing a Cygwin instance from another PC Andrew Schulman
  5 siblings, 1 reply; 20+ messages in thread
From: Chris Wagner @ 2023-11-27  2:36 UTC (permalink / raw)
  To: Jose Isaias Cabrera; +Cc: cygwin List

On 2023-11-22 9:53 am, Jose Isaias Cabrera via Cygwin wrote:
> I have a new Win11 PC, and I wanted to capture the same Cygwin setup 
> that I have in another Win10 PC. I copied the C:\cygwin64 folder from 
> the Win10 pc to the Win11 pc, then I downloaded a fresh 
> setup-x86_64.exe from cygwin.com to the win11 PC. I ran it and chose 
> "Install from Local Directory" and only one shortcut for "Cygwin64 
> Terminal" was created on the desktop. No Cygwin nor Cygwin-X folders 
> were created on the Start menu. The original cygwin from the Win10 PC 
> had X installed also.
> 
> Any idea how to get this done automatically? I know I can go and create 
> folders manually, etc., but it kind of a pain. Any help would be 
> greatly appreciated. Thanks.
> 
> josé

Unfortunately you can't "just copy it" because Cygwin sets up file 
permissions and creates symlinks in very particular ways.  Even using 
WinRAR in Admin mode with all the capturing things turned on won't give 
you an exact copy.

To create a snapshot of a Cygwin installation you have to do it within 
Cygwin itself and then unpack it in another Cygwin environment.  The 
best option is this:

1. On the source: tar -vczf /cygwin64.tgz /etc /sbin /usr /var
2. Install only base-cygwin on the new machine using setup.exe
3. Unpack on the new machine: cd /; tar -vxzf /cygwin64.tgz


If you just want to duplicate the package selection this trick is all 
you need.

1. Get the current list: cygcheck -cd |perl -ane '$\=","; print $F[0]'
2. Ignore the "Cygwin,Package" at the front.
3. Copy all that and put it as the command line argument to setup.exe -P

You can see setup options with setup.exe -h.


HTH, thanks.



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

* Re: Capturing a Cygwin instance from another PC (CORRECTION)
  2023-11-22 14:53 Capturing a Cygwin instance from another PC Jose Isaias Cabrera
                   ` (3 preceding siblings ...)
  2023-11-27  2:36 ` Chris Wagner
@ 2023-11-27  2:46 ` Chris Wagner
  2023-12-07 22:59 ` Capturing a Cygwin instance from another PC Andrew Schulman
  5 siblings, 0 replies; 20+ messages in thread
From: Chris Wagner @ 2023-11-27  2:46 UTC (permalink / raw)
  To: Jose Isaias Cabrera; +Cc: cygwin List

*** CORRECTION

On 2023-11-22 9:53 am, Jose Isaias Cabrera via Cygwin wrote:
> I have a new Win11 PC, and I wanted to capture the same Cygwin setup 
> that I have in another Win10 PC. I copied the C:\cygwin64 folder from 
> the Win10 pc to the Win11 pc, then I downloaded a fresh 
> setup-x86_64.exe from cygwin.com to the win11 PC. I ran it and chose 
> "Install from Local Directory" and only one shortcut for "Cygwin64 
> Terminal" was created on the desktop. No Cygwin nor Cygwin-X folders 
> were created on the Start menu. The original cygwin from the Win10 PC 
> had X installed also.
> 
> Any idea how to get this done automatically? I know I can go and create 
> folders manually, etc., but it kind of a pain. Any help would be 
> greatly appreciated. Thanks.
> 
> josé

Unfortunately you can't "just copy it" because Cygwin sets up file 
permissions and creates symlinks in very particular ways.  Even using 
WinRAR in Admin mode with all the capturing things turned on won't give 
you an exact copy.

To create a snapshot of a Cygwin installation you have to do it within 
Cygwin itself and then unpack it in another Cygwin environment.  The 
best option is this:

1. On the source: tar -vczf /cygwin64.tgz /etc /sbin /usr /var
2. Install only the *** Base category *** on the new machine using 
setup.exe
3. Unpack on the new machine: cd /; tar -vxzf /cygwin64.tgz


If you just want to duplicate the package selection this trick is all 
you need.

1. Get the current list: cygcheck -cd |perl -ane '$\=","; print $F[0]'
2. Ignore the "Cygwin,Package" at the front.
3. Copy all that and put it as the command line argument to setup.exe -P

You can see setup options with setup.exe -h.


HTH, thanks.



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

* Re: Capturing a Cygwin instance from another PC
  2023-11-27  2:36 ` Chris Wagner
@ 2023-11-27  8:24   ` ASSI
  2023-11-27 17:43     ` Brian Inglis
  0 siblings, 1 reply; 20+ messages in thread
From: ASSI @ 2023-11-27  8:24 UTC (permalink / raw)
  To: cygwin

Chris Wagner via Cygwin writes:
> If you just want to duplicate the package selection this trick is all
> you need.
>
> 1. Get the current list: cygcheck -cd |perl -ane '$\=","; print $F[0]'
> 2. Ignore the "Cygwin,Package" at the front.
> 3. Copy all that and put it as the command line argument to setup.exe -P

That will lose the information about which packages were installed by
explicit user request vs. installed as a dependency.


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

SD adaptation for Waldorf rackAttack V1.04R1:
http://Synth.Stromeko.net/Downloads.html#WaldorfSDada

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

* Re: Capturing a Cygwin instance from another PC
  2023-11-27  8:24   ` ASSI
@ 2023-11-27 17:43     ` Brian Inglis
  2023-11-29 17:42       ` Jose Isaias Cabrera
  2024-01-14 19:23       ` Andrey Repin
  0 siblings, 2 replies; 20+ messages in thread
From: Brian Inglis @ 2023-11-27 17:43 UTC (permalink / raw)
  To: cygwin

On 2023-11-27 01:24, ASSI via Cygwin wrote:
> Chris Wagner via Cygwin writes:
>> If you just want to duplicate the package selection this trick is all
>> you need.
>> 1. Get the current list: cygcheck -cd |perl -ane '$\=","; print $F[0]'
>> 2. Ignore the "Cygwin,Package" at the front.
>> 3. Copy all that and put it as the command line argument to setup.exe -P

> That will lose the information about which packages were installed by
> explicit user request vs. installed as a dependency.

What that means is the complete information is only available in:

	/etc/setup/installed.db

which has header:

	INSTALLED.DB 3

then a list of installed packages in which each line specifies 3 fields:

	NAME NAME-VERSION-RELEASE.tar.bz2 MANUALLY_PICKED_FLAG

in that 2nd field .tar.bz2 is the historically available download format but 
only VERSION-RELEASE is now significant, and the only packages you should be 
selecting to install are those which have a 3rd field manually picked flag == 1 
as the others with 0 are automatically installed dependencies e.g.

$ awk '1 < FNR && /1/ == $3 { printf( "%s ", $1) }; END { printf( "\n" ) }' \
	~/cygwin-64t/etc/setup/installed.db | wc
       1      52     686
$ grep -c '\s0$' ~/cygwin-64t/etc/setup/installed.db
364
$ awk '1 < FNR && /1/ == $3 { printf( "%s ", $1) }; END { printf( "\n" ) }' \
	~/cygwin-64/etc/setup/installed.db | wc
       1     884   12124
$ grep -c '\s0$' ~/cygwin-64/etc/setup/installed.db
1638

so from 2-7 times as many packages as manually picked could be dependencies 
automatically installed.

-- 
Take care. Thanks, Brian Inglis              Calgary, Alberta, Canada

La perfection est atteinte                   Perfection is achieved
non pas lorsqu'il n'y a plus rien à ajouter  not when there is no more to add
mais lorsqu'il n'y a plus rien à retirer     but when there is no more to cut
                                 -- Antoine de Saint-Exupéry

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

* Re: Capturing a Cygwin instance from another PC
  2023-11-27 17:43     ` Brian Inglis
@ 2023-11-29 17:42       ` Jose Isaias Cabrera
  2024-01-14 19:23       ` Andrey Repin
  1 sibling, 0 replies; 20+ messages in thread
From: Jose Isaias Cabrera @ 2023-11-29 17:42 UTC (permalink / raw)
  To: cygwin; +Cc: Brian Inglis

[-- Attachment #1: Type: text/plain, Size: 2127 bytes --]

On Monday, November 27, 2023 12:43 PM, Brian Inglis expressed:
> Cc: Brian Inglis <Brian.Inglis@Shaw.ca>
>
> On 2023-11-27 01:24, ASSI via Cygwin wrote:
> > Chris Wagner via Cygwin writes:
> >> If you just want to duplicate the package selection this trick is all
> >> you need.
> >> 1. Get the current list: cygcheck -cd |perl -ane '$\=","; print $F[0]'
> >> 2. Ignore the "Cygwin,Package" at the front.
> >> 3. Copy all that and put it as the command line argument to setup.exe -P
>
[clip]

> so from 2-7 times as many packages as manually picked could be dependencies
> automatically installed.

Thank you for all the responses on this thread, but, I went with Backwoods BC's method who wrote:

>I'll also add my vote for "this should be easier." I've done it a half
>a dozen times over the years and I found that the fastest method was
>to take several screen shots of Cygwin setup showing what I have
>installed, take those to the new machine, and manually go down the
>list selecting the same things. It's stupidly low tech, but it's
>actually quite fast (~ 5 minutes) and I know that it will always work
>without annoying glitches.

Which worked by me. I ran setup and by choosing "Picked" in the "View" choice in the machine that I wanted to clone, which I only had one screen. I know this is not asked often, but I have done this multiple times through my many years of my cygwin life, and I am sure many others have done it. If it was available, it would be used much frequently. So, here is my input on this (Perhaps a 9 step process):
1. Run setup on the machine to be cloned (MachineA)
2. Click on the "Create File For Cloning" checkbox (NEW)
3. Click next (This will create a file that will be used for cloning) (NEW)
4. Place the file created on step 3 on the machine which will use the Cygwin close (MachineB)
5. Run setup on MachineB
6. Click on the "Use Clone File" (NEW)
7. Browse to choose the cloning file (NEW)
8. Read the cloning file (NEW)
9. Click Next and continue normal setup, but now, the packages will be chosen.

This will be a nice and easy way of cloning.

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

* Re: Capturing a Cygwin instance from another PC
  2023-11-22 14:53 Capturing a Cygwin instance from another PC Jose Isaias Cabrera
                   ` (4 preceding siblings ...)
  2023-11-27  2:46 ` Capturing a Cygwin instance from another PC (CORRECTION) Chris Wagner
@ 2023-12-07 22:59 ` Andrew Schulman
  5 siblings, 0 replies; 20+ messages in thread
From: Andrew Schulman @ 2023-12-07 22:59 UTC (permalink / raw)
  To: cygwin

> I have a new Win11 PC, and I wanted to capture the same Cygwin setup that I have in another Win10 PC. I copied the C:\cygwin64 folder from the Win10 pc to the Win11 pc, then I downloaded a fresh setup-x86_64.exe from cygwin.com to the win11 PC. I ran it and chose "Install from Local Directory" and only one shortcut for "Cygwin64 Terminal" was created on the desktop. No Cygwin nor Cygwin-X folders were created on the Start menu. The original cygwin from the Win10 PC had X installed also. 
> 
> Any idea how to get this done automatically? I know I can go and create folders manually, etc., but it kind of a pain. Any help would be greatly appreciated. Thanks.

https://stackoverflow.com/a/7366200/937392


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

* Re: Capturing a Cygwin instance from another PC
  2023-11-27 17:43     ` Brian Inglis
  2023-11-29 17:42       ` Jose Isaias Cabrera
@ 2024-01-14 19:23       ` Andrey Repin
  1 sibling, 0 replies; 20+ messages in thread
From: Andrey Repin @ 2024-01-14 19:23 UTC (permalink / raw)
  To: Brian Inglis via Cygwin, cygwin

Greetings, Brian Inglis via Cygwin!

>> That will lose the information about which packages were installed by
>> explicit user request vs. installed as a dependency.

> What that means is the complete information is only available in:

>         /etc/setup/installed.db

> which has header:

>         INSTALLED.DB 3

> then a list of installed packages in which each line specifies 3 fields:

>         NAME NAME-VERSION-RELEASE.tar.bz2 MANUALLY_PICKED_FLAG

> in that 2nd field .tar.bz2 is the historically available download format
> but only VERSION-RELEASE is now significant, and the only packages you
> should be selecting to install are those which have a 3rd field manually
> picked flag == 1 as the others with 0 are automatically installed dependencies e.g.

> $ awk '1 < FNR && /1/ == $3 { printf( "%s ", $1) }; END { printf( "\n" ) }' \
>         ~/cygwin-64t/etc/setup/installed.db | wc
>        1      52     686
> $ grep -c '\s0$' ~/cygwin-64t/etc/setup/installed.db
> 364
> $ awk '1 < FNR && /1/ == $3 { printf( "%s ", $1) }; END { printf( "\n" ) }' \
>         ~/cygwin-64/etc/setup/installed.db | wc
>        1     884   12124
> $ grep -c '\s0$' ~/cygwin-64/etc/setup/installed.db
> 1638

Been struck by the same situation (though, in a less distributed environment -
I've had to move Cygwin installation from one partition to another), I went
with a simple sed script:

>> sed -Ee '/ 1$/s/^([^[:space:]]+) [^[:space:]]+?(\.tar[^[:space:]]+ 1)$/\1 \1-0\2/; t; d;' < installed.db

In essence:
  - for each line that ends with "1" (for packages, that were manually
    installed), replace version string with "0";
  - if replacement was successful, go to next line;
  - delete line.

Once I made sure the script is right, I just appended its output to the end of
installed.db on target partition. Then run setup.exe and everything happened
according to plan.

This works for v3 database, so to be on a safe side, run setup once on the
source machine to update installation and database to the latest version.


-- 
With best regards,
Andrey Repin
Sunday, January 14, 2024 22:15:59

Sorry for my terrible english...


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

end of thread, other threads:[~2024-01-14 19:35 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-22 14:53 Capturing a Cygwin instance from another PC Jose Isaias Cabrera
2023-11-22 15:43 ` Bill Stewart
2023-11-22 16:15   ` Eliot Moss
2023-11-22 21:38     ` Jose Isaias Cabrera
2023-11-22 22:01       ` Ken Brown
2023-11-23  3:25       ` Eliot Moss
2023-11-23  9:12         ` Backwoods BC
2023-11-22 22:44     ` Cedric Blancher
2023-11-23 15:24       ` Corinna Vinschen
2023-11-22 16:20 ` EXTERNAL SENDER: " Dale Lobb (Sys Admin)
2023-11-22 21:49   ` Jose Isaias Cabrera
2023-11-23 18:40 ` ASSI
2023-11-23 20:27   ` Doug Henderson
2023-11-27  2:36 ` Chris Wagner
2023-11-27  8:24   ` ASSI
2023-11-27 17:43     ` Brian Inglis
2023-11-29 17:42       ` Jose Isaias Cabrera
2024-01-14 19:23       ` Andrey Repin
2023-11-27  2:46 ` Capturing a Cygwin instance from another PC (CORRECTION) Chris Wagner
2023-12-07 22:59 ` Capturing a Cygwin instance from another PC Andrew Schulman

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).