X-Recipient: archive-cygwin@delorie.com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1CE493858D39
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
	s=default; t=1705260929;
	bh=5xScfnBYc99016hAR1KC3oVVOCMbaXxDHoHVUVoV7sY=;
	h=Date:To:Subject:In-Reply-To:References:List-Id:List-Unsubscribe:
	 List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:
	 From;
	b=Zc5j+wrfZdzb7ZMmQmuJOQNunAiKbzjqrur7/LBRbD2ySie04IRSmIuxM28dUVV0b
	 Dwg6tnI8yCGZWw9aNX2bajaAvsC4QbIE0vvJcM5ffXOqLW0imRGZm/kz64xqdRx3pQ
	 Y6UJFm2YuIlDGxVkOib1B2xp0KE4mdH3Vy+G1Ju8=
X-Original-To: cygwin@cygwin.com
Delivered-To: cygwin@cygwin.com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A7EF13858D28
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A7EF13858D28
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705260908; cv=none;
 b=hyCCTAp4zzk2uPyAonem9nN3grRL+CEBQBLUp8CQxG5owRKfq1KsKsNAT0SIu2ObWQiJYzmo+XpH272qPrPIJNR42lG4tlHzfMMztWYjLbe3r31nLCLcui/PizC65AwRnlL63bvxLocuJs6vjhUW3oFrd0L2QQmyaWJptUn+jBc=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
 t=1705260908; c=relaxed/simple;
 bh=U2rhKRaSSWBbcJURkse3LC9/xIEj3tyXQjWCwF0MYWo=;
 h=DKIM-Signature:Date:From:Message-ID:To:Subject:MIME-Version;
 b=njWnir2//UQ8ALCQCYzkU+BnGIxZ1ZHn8Qfvx5ioHDjcsWMmV7yby18pEdVK3Ltvk7R67nGE8OwhrPLwmtc4ctanDz49zEk+2BIZHzMsMIaz3HpmQHxn1RbibkUcEshROMKlbqDE55Fo7rm0A9MJtgli9txRl9wvsnf8rh3+Qwk=
ARC-Authentication-Results: i=1; server2.sourceware.org
X-Yandex-Fwd: 1
Date: Sun, 14 Jan 2024 22:23:26 +0300
X-Mailer: The Bat! (v9.3.4) Professional
Message-ID: <229633151.20240114222326@yandex.ru>
To: Brian Inglis via Cygwin <cygwin@cygwin.com>, cygwin@cygwin.com
Subject: Re: Capturing a Cygwin instance from another PC
In-Reply-To: <7b39e912-1cf4-4ab7-b3a4-c0973d186594@Shaw.ca>
References: <DB9P251MB00639D5E85344DBC6BB9E9A2DEBAA@DB9P251MB0063.EURP251.PROD.OUTLOOK.COM>
 <09578ac85d3f64c90f2b6610545bd8dc@plebeian.com> <87plzvd2ok.fsf@>
 <7b39e912-1cf4-4ab7-b3a4-c0973d186594@Shaw.ca>
MIME-Version: 1.0
X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00, DKIM_SIGNED,
 DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, KAM_THEBAT,
 NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,
 SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE,
 XM_LIGHT_HEAVY autolearn=no autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on
 server2.sourceware.org
X-BeenThere: cygwin@cygwin.com
X-Mailman-Version: 2.1.30
Precedence: list
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-request@cygwin.com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=subscribe>
From: Andrey Repin via Cygwin <cygwin@cygwin.com>
Reply-To: cygwin@cygwin.com
Cc: Andrey Repin <anrdaemon@yandex.ru>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: cygwin-bounces+archive-cygwin=delorie.com@cygwin.com
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie.com@cygwin.com>

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


-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple
