6

自动递归下载依赖 deb 包 bash 脚本

 3 years ago
source link: https://blog.frytea.com/archives/575/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

自动递归下载依赖 deb 包 bash 脚本

September 18, 2021 • Read: 92 • 技术价值

本文首发于: https://blog.frytea.com/archives/575/

  • 脚本自动递归下载给定包列表 deb 包及其依赖包,深度 3 层;
  • 若指定参数则下载给定的包及其依赖包(目前仅支持指定 1 个包,不支持多包);
  • 若无参数则默认下载列表中给出的包机器依赖包;
  • 下载到当前目录;
  • 请提前配置好源。
#!/bin/bash
logfile=./auto_deps_log
# 需要获取其所依赖包的包
# 或者用$1,从命令行输入库名字
libs="gdisk logrotate pciutils systemd lvm2 udev logrotate libfuse2 iptables libnetfilter-conntrack3 libnfnetlink0 libusb-1.0-0 cpio xfsprogs libprotobuf-c1 liblmdb0"
ret=""
function getDepends()
echo "fileName is" $1>>$logfile
# use tr to del < >
ret=`apt-cache depends $1|grep Depends |cut -d: -f2 |tr -d "<>"`
echo $ret|tee -a $logfile
if [ ! -n "$*" ] ;then
echo "you have not input a word! get list: $libs"
echo "the list you input is $*"
libs=$1
echo "get $libs"
# download libs dependen. deep in 3
while [ $i -lt 3 ] ;
let i++
echo $i
# download libs
newlist=" "
for j in $libs
added="$(getDepends $j)"
newlist="$newlist $added"
apt-get download $added $j
libs=$newlist

---------------------
Author: Frytea
Title: 自动递归下载依赖 deb 包 bash 脚本
Link: https://blog.frytea.com/archives/575/
Copyright: This work by TL-Song is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

QR Code for this page
Tipping QR Code

Recommend

  • 9
    • note.qidong.name 4 years ago
    • Cache

    利用cmake打deb包

    利用cmake打deb包 2019-11-06 22:53:07 +08  字数:1335  标签: Linux C 手...

  • 11
    • www.devdungeon.com 4 years ago
    • Cache

    Debian Package Tutorial (dpkg/.deb)

    Introduction Debian Package tool dpkg is used on Debian, Ubuntu, Kali, Linux Mint, and other Debian based Linux distributions. This tutorial covers the basics of creating custom .deb packages and managing t...

  • 14

    我想有以下有几个原因促使我写这篇Blog: 1、很多人开始OpenStack之旅是从Ubuntu开始,但是却没有一篇文章系统的介绍如何将修改后的代码重新编译回DEB包。 2、如果我们采用源代码直接安装的方式对OpenStack模块进行管理,一...

  • 68
    • note.qidong.name 4 years ago
    • Cache

    用下载deb的方式来安装docker

    用下载deb的方式来安装docker 2018-07-26 21:27:35 +08  字数:974  标签: Docker

  • 12

    在 Ubuntu Linux 上安装 Deb 文件的 3 种方法 | Linux 中国这篇初学者文章解释了如何在 Ubuntu 中安装 deb 软件包。它稍后也向你展示如何移除这些 deb 软件包。来源:

  • 8
    • www.lujun9972.win 3 years ago
    • Cache

    Ubuntu使用apt安装本地deb软件包

    Ubuntu使用apt安装本地deb软件包 平常都是用 dpkg -i 来安装本地deb软件包。但是 dpkg 不会自动安装依赖包,因此安装很容易出现依赖相关的错误。 之后需要通过运行 sudo apt-get install -f 来安装依赖 ...

  • 8
    • www.myfreax.com 3 years ago
    • Cache

    使用bash递归改变文件的扩展名

    当需要大量改变文件扩展名的时候会非常有用,这情况可能很少遇到。但是在调试测试的时候就非常有用。在本文我们将说明如何使用bash的find参数-exec,mv,rename命令递归改变文件的扩展名。-exec顾名思义就是要执行命令的意思。使用find -exec与m...

  • 10
    • www.lujun9972.win 3 years ago
    • Cache

    在archlinux上安装deb包

    在archlinux上安装deb包 archlinux的受众还是太小了,许多应用只是提供了deb的安装包,虽说 AUR 中的包也是包罗万象,但是总有一些包是其中没有的,这就要求我们不得不安装deb包了。 目前来看,在archlinux上安装deb有两种方法(除了手写p...

  • 12

    需求是批量修改 .crt 和 .key 为 ssl.chain.crt 和 server.key,为什么会有这样的需求主要是踩了一个大坑 Sectigo AddTrust Exter...

  • 5

    小白很久之前介绍过一款好用的YouTube视频下载工具:Youtube 专业下载工具,Youtube-dl & yt-dlp详细使用教程与初学上手示例,我们可以非常方便的把自己喜欢的油管up主的视频下载下来,但是每次都需要手动输...

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK