Revise remove command
1. print a list of all files and dependencies of those files used by apt-cyg 2. if any are found in the files list of the package to be removed, then fail Unrelated, added an echo each time a postinstall script is run, the name of the script
This commit is contained in:
parent
3ecc4eef4a
commit
1b3c49da14
41
apt-cyg
41
apt-cyg
|
@ -322,7 +322,7 @@ case "$command" in
|
||||||
for pkg in $packages
|
for pkg in $packages
|
||||||
do
|
do
|
||||||
|
|
||||||
already=`grep -c "^$pkg " /etc/setup/installed.db`
|
already=$(grep -c "^$pkg " /etc/setup/installed.db)
|
||||||
if (( already ))
|
if (( already ))
|
||||||
then
|
then
|
||||||
echo Package $pkg is already installed, skipping
|
echo Package $pkg is already installed, skipping
|
||||||
|
@ -429,16 +429,12 @@ case "$command" in
|
||||||
|
|
||||||
# run all postinstall scripts
|
# run all postinstall scripts
|
||||||
|
|
||||||
pis=`ls /etc/postinstall/*.sh 2>/dev/null | wc -l`
|
find /etc/postinstall -name '*.sh' | while read script
|
||||||
if (( pis ))
|
do
|
||||||
then
|
echo Running $script
|
||||||
echo Running postinstall scripts
|
$script
|
||||||
for script in /etc/postinstall/*.sh
|
mv $script $script.done
|
||||||
do
|
done
|
||||||
$script
|
|
||||||
mv $script $script.done
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
echo Package $pkg installed
|
echo Package $pkg installed
|
||||||
|
|
||||||
done
|
done
|
||||||
|
@ -449,20 +445,25 @@ case "$command" in
|
||||||
for pkg in $packages
|
for pkg in $packages
|
||||||
do
|
do
|
||||||
|
|
||||||
already=`grep -c "^$pkg " /etc/setup/installed.db`
|
already=$(grep -c "^$pkg " /etc/setup/installed.db)
|
||||||
if (( ! already ))
|
if (( ! already ))
|
||||||
then
|
then
|
||||||
echo Package $pkg is not installed, skipping
|
echo Package $pkg is not installed, skipping
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
for req in cygwin coreutils gawk bzip2 tar bash
|
|
||||||
do
|
cygcheck awk bash bunzip2 grep gzip mv sed tar xargs xz | awk '
|
||||||
if [[ $pkg = $req ]]
|
NR>1 &&
|
||||||
then
|
/bin/ &&
|
||||||
echo apt-cyg cannot remove package $pkg, exiting
|
! fd[$NF]++ &&
|
||||||
exit 1
|
$0 = $NF
|
||||||
fi
|
' FS='\' > /tmp/cygcheck.txt
|
||||||
done
|
|
||||||
|
if apt-cyg listfiles $pkg | grep -wf /tmp/cygcheck.txt
|
||||||
|
then
|
||||||
|
echo apt-cyg cannot remove package $pkg, exiting
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
if [ ! -e /etc/setup/"$pkg".lst.gz ]
|
if [ ! -e /etc/setup/"$pkg".lst.gz ]
|
||||||
then
|
then
|
||||||
echo Package manifest missing, cannot remove $pkg. Exiting
|
echo Package manifest missing, cannot remove $pkg. Exiting
|
||||||
|
|
Loading…
Reference in New Issue