Am 21.01.2020 um 01:58 schrieb Lavrentiev, Anton (NIH/NLM/NCBI) [C] via cygwin:
Hi List,

I have a question, is there a way to clone-install Cygwin?

Like I have installed whatever packages I selected on some PC, then maintained 
that installation for a while,
doing upgrades etc.  Now I need to install the exact same set on another PC.  
Can I pull up a list and use it
in a sort of a batch install with setup.exe?  I want to avoid to dumb-copy the 
entire C:\cygwin tree from one PC to another,
rather use a semi-automatic install procedure from scratch, if possible, using 
the list of packages that I need.

Thanks for all the insights you can provide.

Cheers,
Anton


attached my solution to re-install or duplicate the packages of an existing installation.


$ ./cyg-reinstall.sh
Usage :  cyg-reinstall.sh [ -A | -I | -f filelist ]
  create cyg-reinstall-{ARC}.bat from
  options
    -A  :  All packages as reported by cygcheck
    -I  :  incomplete packages as reported by cygcheck
    -f  :  packages in filelist (one per row)

$ ./cyg-reinstall.sh -A

and the batch file is ready

$ ls -s cyg-reinstall-x86_64.bat
32K cyg-reinstall-x86_64.bat

$ head -c 100 cyg-reinstall-x86_64.bat
setup-x86_64.exe -P _autorebase,_autorebase,_update-info-dir,a2ps,adobe-source-code-pro-fonts,adob

Regards
Marco

#!/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

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

Reply via email to