shell 两个rpm包做差分
当前目录下两个rpm包做差分。
*.rpm
两个目录,解压rpm包。
export LANG=c
差分判断是脚本还是Binary Files
脚本添加命令行提示符,awk。
[root@sj_x861 diff_rwz]# cat diff_rpm.sh
#!/bin/bash
export LANG=c
source ~/.bashrc
#############################
#basic command label
#############################
if [ "$(whoami)" = "$(basename $(pwd))" ]; then
cmd_label="[$(whoami)@$(hostname) ~]# "
else
cmd_label="[$(whoami)@$(hostname) $(basename $(pwd))]# "
fi
mkdir new_bin/ new_rpm/ old_bin/ old_rpm/
rpms=(`ls *.rpm`)
cp -a ${rpms[0]} old_rpm
cp -a ${rpms[1]} new_rpm
echo -e "${cmd_label}ls"
ls
echo -e "${cmd_label}ls -l */*.rpm"
ls -l */*.rpm
echo -e "${cmd_label}md5sum */*.rpm"
md5sum */*.rpm
echo -e "${cmd_label}cd new_bin/"
cd new_bin/
echo -e "${cmd_label}ls"
ls
echo -e "${cmd_label}rpm2cpio ../new_rpm/*.rpm | cpio -idm"
rpm2cpio ../new_rpm/*.rpm | cpio -idm
echo -e "${cmd_label}cd ../old_bin/"
cd ../old_bin/
echo -e "${cmd_label}ls"
ls
echo -e "${cmd_label}rpm2cpio ../old_rpm/*.rpm | cpio -idm"
rpm2cpio ../old_rpm/*.rpm | cpio -idm
echo -e "${cmd_label}ls"
ls
echo -e "${cmd_label}cd .."
cd ..
echo -e "${cmd_label}ls"
ls
echo -e "${cmd_label}diff -r old_bin/ new_bin/"
diff -r old_bin/ new_bin/
diff -r old_bin/ new_bin/ | grep "Binary files " >/var/tmp/diff_rpm.txt
if [[ -s /var/tmp/diff_rpm.txt ]];then
echo -e "${cmd_label}diff -r old_bin/ new_bin/ | grep \"Binary files \" | awk '{print \$3; print \$5}' | xargs md5sum"
diff -r old_bin/ new_bin/ | grep "Binary files " | awk '{print $3; print $5}' | xargs md5sum
fi
diff -r old_bin/ new_bin/ | grep "diff -r " >/var/tmp/diff_rpm.txt
if [[ -s /var/tmp/diff_rpm.txt ]];then
echo -e "${cmd_label}diff -r old_bin/ new_bin/ | grep \"diff -r \" | awk '{print \$3; print \$4}' | xargs md5sum"
diff -r old_bin/ new_bin/ | grep "diff -r " | awk '{print $3; print $4}' | xargs md5sum
fi
rm -rf new_bin/ new_rpm/ old_bin/ old_rpm/
[root@sj_x861 diff_rwz]# cat
awk
[root@sj_x861 diff_rms]# cat temp
ls
ll */*.rpm
md5sum */*.rpm
cd new_bin/
ls
rpm2cpio ../new_rpm/*.rpm | cpio -idm
cd ../old_bin/
ls
rpm2cpio ../old_rpm/*.rpm | cpio -idm
ls
cd ..
ls
diff -r old_bin/ new_bin/
diff -r old_bin/ new_bin/ | grep "Binary files " | awk '{print $3; print $5}' | xargs md5sum =>双引号和美元符号需要转义.
#diff -r old_bin/ new_bin/ | grep "diff -r " | awk '{print $3; print $4}' | xargs md5sum
[root@sj_x861 diff_rms]# cat temp | awk '{ print "echo -e \"${cmd_label}"$0"\""; print $0}'
echo -e "${cmd_label}ls"
ls
echo -e "${cmd_label}ll */*.rpm"
ll */*.rpm
echo -e "${cmd_label}md5sum */*.rpm"
md5sum */*.rpm
echo -e "${cmd_label}cd new_bin/"
cd new_bin/
echo -e "${cmd_label}ls"
ls
echo -e "${cmd_label}rpm2cpio ../new_rpm/*.rpm | cpio -idm"
rpm2cpio ../new_rpm/*.rpm | cpio -idm
echo -e "${cmd_label}cd ../old_bin/"
cd ../old_bin/
echo -e "${cmd_label}ls"
ls
echo -e "${cmd_label}rpm2cpio ../old_rpm/*.rpm | cpio -idm"
rpm2cpio ../old_rpm/*.rpm | cpio -idm
end
shell 两个rpm包做差分的更多相关文章
- shell如何生成rpm包仓库列表文件的对比结果
基本步骤: 1.切换至仓库目录RPM_LIST_DIR1和RPM_LIST_DIR2 2.ls列出仓库的rpm包文件并分别重定向至输出文件rpm_list_file1和rpm_list_file2 3 ...
- 制作RPM包
RPM包制作过程 1.1 前期工作 1)创建打包用的目录rpmbuild/{BUILD,SPECS,RPMS, SOURCES,SRPMS} 建议使用普通用户,在用户家目录中创建 2)确定好制作的对象 ...
- MySQL5.6.36 linux rpm包安装配置文档
一.卸载自带mysql,删除MySQL的lib库,服务文件 [root@localhost ~]#rpm -qa|grep mysql qt-mysql-4.6.2-26.el6_4.x86_64 m ...
- RPM包的版本号比较
版本号表示格式为 epoch:version-release,例如 1:2-3 第一条原则是 rpm 属性优先级 epoch > version > release 两个 r ...
- 定制化rpm包及本地yum仓库搭建
为方便本地yum的管理,一般都是在公司局域网内搭建本地yum仓库,实现公司内部快速安装常用软件. 步骤如下: 1.搭建要实现本地yum管理的软件,测试该软件搭建成功与否: 2.定制rpm包及其相关依赖 ...
- rpm包制作介绍
RPM(Rpm Package Management)在ReadHat等发行版下被用作软件包管理程序,其将某个软件相关的文件置入一个.rpm包中,用rpm命令,我们可以方便地完成Linux下软件安装. ...
- 其他综合-搭建本地yum仓库及自制rpm包
搭建本地yum仓库及自制rpm包 实验目的 为方便本地 yum 的管理,建本地 yum 仓库,实现局域网内部快速安装常用软件 实验环境 VMware:12版本 系统版本:CentOS Linux re ...
- Ceph 客户端的 RPM 包升级问题
问题 最近想把一个现有的 Ceph 客户端升级为最新的 M 版: [root@overcloud-ovscompute-0 ~]# rpm -qa | grep ceph puppet-ceph-2. ...
- 制作FastDFS的RPM包
首先获取fastdfs的源码,因为fastdfs还依赖一个libfastcommon的库,所以也要准备好. fastdfs的源码目录结构: libfastcommon的源码目录结构: 接下来将以Cen ...
随机推荐
- Android 常用UI控件之TabHost(1)TabHost的两种布局方式
TabHost是Android中的tab组件. TabHost布局文件的基本结构 TabHost下有个layout,这个layout中有TabWidget与FrameLayout.TabWidget是 ...
- Wzplayer C++ 版本,WzplayerPro
WzplayerPro 是Wzplayer的C++版本,新版本支持插件解码器加载等等功能,以上是预览界面. 将会与Wzplayer一样,支持更多的平台,而且WzPlayer在初始化方面将会更快. 联系 ...
- Leap Years
Description: In this kata you should simply determine, whether a given year is a leap year or not. I ...
- WCF - Self Hosting
WCF - Self Hosting Here, the WCF service is hosted in a console application. Given below is the proc ...
- 结构体dict_table_t
typedef struct dict_table_struct dict_table_t; /** Data structure for a database table. Most fields ...
- bzoj1823
第一道2sat, 其实2sat问题不难,只要记住一个:通过“推导出”连边 什么意思呢?就是一般题目中的变量都有两个状态,只能取一个,我们定义为true和false 对于每一个变量i,我们都拆成两个点, ...
- 【随笔】Linux & Shell & Minecraft
官方的服务器依然会报 异常.[搁置] 准备再搭一次minecraft server,从官方的开始,毕竟是最简单的,只要有运行权限就够了. # 2015年12月16日 20:30:50 在阿里云租的虚拟 ...
- Datatable转换成List实体对象列表 几个实例
一, /// <summary> /// 将Datatable转换为List集合 /// </summary> /// <typeparam name="T&q ...
- LR 录制时,web_link出现乱码
在录制时,用到了web_link,但是web_link不能实别中文,因此在回放时,不能识别web_link,问题如下: web_link("??", "Text=?? ...
- SR4000笔记
长时间运行情况下需要有降温处理(40度以下) 建议使用触发模式而非连续模式 850nm波长的光(虽然无害,建议不要直视) 12V DC 滤波镜头(允许24个LED激光波长的通过) 快闪:获取数据 慢闪 ...