本文共 610 字,大约阅读时间需要 2 分钟。
使用以下脚本下载keepalived deb安装包及其3层依赖
#!/bin/bash
logfile=./
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}#需要获取其所依赖包的包libs="keepalived" # 或者用$1,从命令行输入库名字apt-get download $libs #download libs dependen. deep in 3
i=0while [ $i -lt 3 ] ;dolet i++echo $i#download libsnewlist=" "for j in $libsdoadded="$(getDepends $j)"newlist="$newlist $added"#apt install $added --reinstall -d -yapt-get download $addeddonelibs=$newlist
done
转载于:https://blog.51cto.com/a1liujin/2046699