How to reinstall everything?
Marco Atzeri
marco.atzeri@gmail.com
Sat Jan 16 21:02:24 GMT 2021
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
-------------- next part --------------
#!/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
-------------- next part --------------
#!/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
More information about the Cygwin
mailing list