download command
This is similar to the "apt-get --download-only install" command.
This commit is contained in:
parent
8882af76ca
commit
72fe905e4e
56
apt-cyg
56
apt-cyg
|
@ -40,6 +40,7 @@ Commands:
|
||||||
install Install packages
|
install Install packages
|
||||||
remove Remove packages
|
remove Remove packages
|
||||||
update Update setup.ini
|
update Update setup.ini
|
||||||
|
download Download only - do NOT install or unpack archives
|
||||||
show Displays the package records for the named packages
|
show Displays the package records for the named packages
|
||||||
depends Performs recursive dependency listings
|
depends Performs recursive dependency listings
|
||||||
rdepends Display packages which require X to be installed,
|
rdepends Display packages which require X to be installed,
|
||||||
|
@ -111,13 +112,12 @@ getsetup()
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkpackages()
|
function checkpackages () {
|
||||||
{
|
|
||||||
if [[ $packages ]]
|
if [[ $packages ]]
|
||||||
then
|
then
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
echo Nothing to do.
|
echo No packages found
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -149,13 +149,13 @@ apt-list () {
|
||||||
apt-listfiles () {
|
apt-listfiles () {
|
||||||
checkpackages
|
checkpackages
|
||||||
findworkspace
|
findworkspace
|
||||||
local pkg
|
local pkg sbq
|
||||||
for pkg in "${packages[@]}"
|
for pkg in "${packages[@]}"
|
||||||
do
|
do
|
||||||
(( notfirst++ )) && echo
|
(( sbq++ )) && echo
|
||||||
if [ ! -e /etc/setup/"$pkg".lst.gz ]
|
if [ ! -e /etc/setup/"$pkg".lst.gz ]
|
||||||
then
|
then
|
||||||
download "$pkg" || continue
|
download "$pkg"
|
||||||
fi
|
fi
|
||||||
gzip -cd /etc/setup/"$pkg".lst.gz
|
gzip -cd /etc/setup/"$pkg".lst.gz
|
||||||
done
|
done
|
||||||
|
@ -243,8 +243,19 @@ apt-rdepends () {
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
apt-download () {
|
||||||
|
checkpackages
|
||||||
|
findworkspace
|
||||||
|
local pkg sbq
|
||||||
|
for pkg in "${packages[@]}"
|
||||||
|
do
|
||||||
|
(( sbq++ )) && echo
|
||||||
|
download "$pkg"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
download () {
|
download () {
|
||||||
local pkg install file digest digactual
|
local pkg file digest digactual
|
||||||
pkg=$1
|
pkg=$1
|
||||||
# look for package and save desc file
|
# look for package and save desc file
|
||||||
|
|
||||||
|
@ -252,25 +263,23 @@ download () {
|
||||||
awk '$1 == pc' RS='\n\n@ ' FS='\n' pc=$pkg setup.ini > release/$pkg/desc
|
awk '$1 == pc' RS='\n\n@ ' FS='\n' pc=$pkg setup.ini > release/$pkg/desc
|
||||||
if [ ! -s release/$pkg/desc ]
|
if [ ! -s release/$pkg/desc ]
|
||||||
then
|
then
|
||||||
echo Package $pkg not found or ambiguous name
|
echo Unable to locate package $pkg
|
||||||
rm -r release/"$pkg"
|
rm -r release/"$pkg"
|
||||||
return 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo Found package $pkg >&2
|
|
||||||
|
|
||||||
# download and unpack the bz2 or xz file
|
# download and unpack the bz2 or xz file
|
||||||
|
|
||||||
# pick the latest version, which comes first
|
# pick the latest version, which comes first
|
||||||
install=$(awk '/^install: / {print $2; exit}' release/"$pkg"/desc)
|
cd release/$pkg
|
||||||
if [[ ! $install ]]
|
file=$(awk '$1=="install:" && !s++ && $0=$5' FS='[ /]' desc)
|
||||||
|
if [[ ! $file ]]
|
||||||
then
|
then
|
||||||
echo 'Could not find "install" in package description: obsolete package?'
|
echo 'Could not find "install" in package description: obsolete package?'
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
file=$(basename $install)
|
wget -nc $mirror/$ARCH/release/$pkg/$file
|
||||||
cd release/"$pkg"
|
|
||||||
wget -nc $mirror/$install
|
|
||||||
|
|
||||||
# check the md5
|
# check the md5
|
||||||
digest=$(awk '/^install: / {print $4; exit}' desc)
|
digest=$(awk '/^install: / {print $4; exit}' desc)
|
||||||
|
@ -282,7 +291,8 @@ download () {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
tar tf $file | gzip > /etc/setup/"$pkg".lst.gz
|
tar tf $file | gzip > /etc/setup/"$pkg".lst.gz
|
||||||
echo $file
|
cd ~-
|
||||||
|
echo $file > /tmp/dn
|
||||||
}
|
}
|
||||||
|
|
||||||
apt-search () {
|
apt-search () {
|
||||||
|
@ -339,7 +349,8 @@ apt-install () {
|
||||||
echo
|
echo
|
||||||
echo Installing $pkg
|
echo Installing $pkg
|
||||||
|
|
||||||
file=$(download $pkg) || continue
|
download $pkg
|
||||||
|
read file </tmp/dn
|
||||||
cd release/$pkg
|
cd release/$pkg
|
||||||
echo Unpacking...
|
echo Unpacking...
|
||||||
|
|
||||||
|
@ -503,14 +514,15 @@ do
|
||||||
;;
|
;;
|
||||||
|
|
||||||
install \
|
install \
|
||||||
| list \
|
| remove \
|
||||||
| listfiles \
|
| download \
|
||||||
|
| show \
|
||||||
| depends \
|
| depends \
|
||||||
| rdepends \
|
| rdepends \
|
||||||
|
| list \
|
||||||
|
| listfiles \
|
||||||
| search \
|
| search \
|
||||||
| searchall \
|
| searchall)
|
||||||
| remove \
|
|
||||||
| show)
|
|
||||||
if [[ $command ]]
|
if [[ $command ]]
|
||||||
then
|
then
|
||||||
packages+=("$1")
|
packages+=("$1")
|
||||||
|
|
Loading…
Reference in New Issue