[英]Bash script unable to download source packages from a list
I have a list of packages installed on my Ubuntu 16.04.我的 Ubuntu 16.04 上安装了一个软件包列表。 I have a bash script which tries to download their sources one by one in the appropriate directories (created).我有一个 bash 脚本,它尝试在适当的目录(已创建)中一一下载其源代码。 I am getting an error:我收到一个错误:
Reading package lists...
E: Unable to find a source package for xxxx
~/source
~/sourcexxx
My bash script looks like this:我的 bash 脚本如下所示:
#!/bin/bash
while read package
do
#cd /mnt
mkdir $package
pushd $package
apt-get -d -q source $package
popd
done < ins.txt
I don't want to update any system files.我不想更新任何系统文件。 apt-get -d -q source xxx works on its own, but not in the script above. apt-get -d -q source xxx独立工作,但不在上面的脚本中。 What could be the reason?可能是什么原因?
A part of my ins.txt:我的 ins.txt 的一部分:
adduser
adium-theme-ubuntu
adwaita-icon-theme
alacarte
alsa-base
alsa-utils
amd64-microcode
anacron
apg
app-install-data
app-install-data-partner
apparmor
apparmor-easyprof
When I do individually for eg apt-get -d -q source adduser, it works当我单独为例如 apt-get -d -q source adduser 进行操作时,它可以工作
Using your list, this seems to work fine for me (on Ubuntu 16.04) after removing the dpkg-query -f |
使用您的列表,这对我来说似乎工作正常(在 Ubuntu 16.04 上)删除dpkg-query -f |
part:部分:
#!/bin/bash
while read package
do
echo "Package $package"
mkdir -v $package
pushd $package
apt-get -d -q source $package
popd
done < ins.txt
Maybe some packages don't have a source, or your ins.txt file contains invalid packages.可能有些包没有源代码,或者您的 ins.txt 文件包含无效包。
But that question would sure have been better posted on Ask Ubuntu .但是这个问题肯定会更好地发布在Ask Ubuntu上。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.