public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Marco Atzeri <marco.atzeri@gmail.com>
To: cygwin@cygwin.com
Subject: Re: How to reinstall everything?
Date: Sat, 16 Jan 2021 22:02:24 +0100	[thread overview]
Message-ID: <9f016b30-3338-47ce-b734-36aa6a3e981d@gmail.com> (raw)
In-Reply-To: <DB7PR02MB39968E1E7F98B672D599DB2FE7A60@DB7PR02MB3996.eurprd02.prod.outlook.com>

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

On 16.01.2021 20:55, Hamish McIntyre-Bhatty via Cygwin wrote:
> In reply to Marco Atzeri:
> 
> """
> Some time ago I put a script here:
> https://stackoverflow.com/questions/46829532/cygwin-save-package-selections-for-later-reinstall
> 
> """
> 
> This has been very useful for me. Is this in a git/other repository somewhere? If not, I think it might aid discovery for it to go with some other useful scripts in this repository: https://github.com/michaelgchu/Cygwin_Specific_Repo.
> 
> What do you think of this idea Marco?
> 
> Hamish McIntyre-Bhatty
> 

feel free to use it. I never store anywhere other than stackoverflow.
Attached the current version, I don't rememeber if I changed
it in the meantime.

Attached another that you can find useful
it uses cygcheck and binutils to provide the list of first level
packages containing the needed DLL's

$ cyg-dependency.sh /usr/bin/octave-5.2.0.exe
/usr/bin/cygwin1.dll  =>  cygwin-3.1.7-1
/usr/bin/cygX11-6.dll  =>  libX11_6-1.7.0-1
/usr/bin/cyggcc_s-seh-1.dll  =>  libgcc1-10.2.0-1
/usr/bin/cygstdc++-6.dll  =>  libstdc++6-10.2.0-1
KERNEL32.dll  =>   Windows System

I found useful to avoid some screwup

Regards
Marco


[-- Attachment #2: cyg-reinstall.sh --]
[-- Type: text/plain, Size: 1502 bytes --]

#!/bin/bash
# Create a batch file to reinstall using setup-{ARCH}.exe 
# all packages or the ones reported as incomplete

print_error=1

if [ $# -eq 1 ]
  then
    if [ $1 == "-I" ]
    then
      lista=$(mktemp)
      cygcheck -c | grep "Incomplete" > $lista
      print_error=0
    fi
    if [ $1 == "-A" ]
    then
      lista=$(mktemp)
      cygcheck -cd | sed -e "1,2d" > $lista
      print_error=0
    fi
fi

if [ $# -eq 2 ]
  then
    if [ $1 == "-f" ]
    then
      lista=$2
      print_error=0
    fi
fi

# error message if options are incorrect.
if [ $print_error -eq 1 ]
then
        echo -n "Usage : " $(basename $0)
        echo " [ -A | -I | -f filelist ]"
        echo "  create cyg-reinstall-{ARC}.bat from"
        echo "  options"
        echo "    -A  :  All packages as reported by cygcheck"
        echo "    -I  :  incomplete packages as reported by cygcheck"
        echo "    -f  :  packages in filelist (one per row)"
        exit 1
fi

if [ $(arch) == "x86_64" ]
then
  A="x86_64"
else
  A="x86"
fi

# writing header
echo -n -e "setup-${A}.exe  " > cyg-reinstall-${A}.bat

# option  -x remove and  -P install
# for re-install packages we need both
if [ $1 == "-I" ]
then
  awk 'BEGIN{printf(" -x ")} NR==1{printf $1}{printf ",%s", $1}' ${lista} >> cyg-reinstall-${A}.bat 
fi

awk 'BEGIN{printf(" -P ")} NR==1{printf $1}{printf ",%s", $1} END { printf "\r\n pause "}' ${lista} >> cyg-reinstall-${A}.bat 

# execution permission for the script
chmod +x cyg-reinstall-${A}.bat


[-- Attachment #3: cyg-dependency.sh --]
[-- Type: text/plain, Size: 1039 bytes --]

#!/bin/bash
if [ $# -ne 1 ]
then
    echo "Usage : " $0 "file_name"
    echo "Find package dependency from dll dependency"
    exit 1
fi 

a=1
# mypath=$(echo $PATH | tr ":" " ")
mypath="/usr/bin /usr/lib/lapack"
windir=$(cygpath -u ${WINDIR})"/System32"

for i in  $(objdump -x $1 |grep "DLL Name:" |sed -e "s/\tDLL Name: //g"| tr "\r" " " ) 
do
  if [ $i = "KERNEL32.dll" ]
  then
            echo -n $i 
            echo -n  "  =>  "
	    echo " Windows System"
  else
    fullname=$(find ${mypath}  -maxdepth 1 -name $i)	
    if [ -z "${fullname}" ]
    then
	fullname=$(find ${windir} -maxdepth 1 -iname $i)
	if [ -z "${fullname}" ]
	then
            echo -n $i 
	    echo "  =>  NOT on PATH, Unknown"
        else
            echo -n $i 
            echo -n  "  =>  "
	    echo " Windows System"
        fi
    else
        echo -n $fullname 
        echo -n  "  =>  "
        package=$(cygcheck -f $fullname )
	if [ -z "$package" ]
	then
	    echo "NOT on ANY Package (system one?)"
	else
	    echo $package
	fi 
    fi
  fi
done



  reply	other threads:[~2021-01-16 21:02 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-16 19:55 Hamish McIntyre-Bhatty
2021-01-16 21:02 ` Marco Atzeri [this message]
2021-01-16 21:59   ` Hamish McIntyre-Bhatty
2021-01-21 16:00     ` Hamish McIntyre-Bhatty
2021-01-21 16:24       ` Marco Atzeri
2021-01-21 16:25         ` Hamish McIntyre-Bhatty
2021-01-17 18:23   ` matthew patton
2021-01-17 19:32     ` Brian Inglis
2021-01-17 19:44     ` Achim Gratz
2021-01-17 20:53       ` matthew patton
2021-01-18 22:48         ` Brian Inglis
2021-01-17 20:10     ` Hans-Bernhard Bröker
2021-01-21 17:44     ` Bill Stewart
2021-02-04 14:21   ` Hamish McIntyre-Bhatty
2021-02-04 15:24     ` Marco Atzeri
2021-02-04 15:25       ` Hamish McIntyre-Bhatty
  -- strict thread matches above, loose matches on Subject: below --
2020-06-26 17:47 Eliot Moss
2020-06-26 18:06 ` marco atzeri
2020-06-26 18:17 ` Brian Inglis
2020-06-27 17:39   ` Brian Inglis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9f016b30-3338-47ce-b734-36aa6a3e981d@gmail.com \
    --to=marco.atzeri@gmail.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).