1 Star 0 Fork 16

Funda Wang/netdata

forked from src-openEuler/netdata 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
make-shebang-patch.sh 1.55 KB
一键复制 编辑 原始数据 按行查看 历史
Funda Wang 提交于 2024-09-16 13:21 . 1.47.1
#!/bin/bash
source='a'
target='b'
version=$(rpmspec -P netdata.spec | grep -i '^version' | awk -F ':' '{print $2}' | tr -d ' ')
[ -z "${version}" ] && read -p 'version: ' version
[ -f "v${version}.tar.gz" ] && tar -xzf v${version}.tar.gz
[ -f "netdata-${version}.tar.gz" ] && tar -xzf netdata-${version}.tar.gz
[ -d a ] && rm -rf a
[ -d b ] && rm -rf b
if [ -d "netdata-${version}" ]
then
mv netdata-${version} a
elif [ -d "netdata-v${version}" ]
then
mv netdata-v${version} a
else
echo "Error: Archive is not extracted or archive is corrupted"
exit 1
fi
cp -a a b
pushd ${target}
for script in $(grep -R '/usr/bin/env bash' * | cut -d ':' -f1) $(grep -R '/usr/bin/env sh' * | cut -d ':' -f1)
do
[ "$(basename ${script})" == "README.md" ] && continue
echo ${script}
sed -i -e '1s^env bash^bash^' -e '1s^env sh^sh^' ${script}
done
for script in $(grep -R '/usr/bin/env python' * | cut -d ':' -f1)
do
[ "$(basename ${script})" == "README.md" ] && continue
echo ${script}
if [ "$(basename ${script})" == "boinc_client.py" ]
then
sed -i -e '1s^!/usr/bin/env python$^^' ${script}
else
sed -i -e '1s^env python$^python3^' ${script}
fi
done
popd
cat << EOF > netdata-fix-shebang-${version}.patch
Fix shebang according to
https://docs.fedoraproject.org/en-US/packaging-guidelines/#_shebang_lines
EOF
patchver=$(echo ${version} | cut -d- -f1)
diff -rup a b >> netdata-fix-shebang-${patchver}.patch
#sed -e 's^/usr/bin/sh^/bin/sh^' -e 's^/usr/bin/bash^/bin/bash^' netdata-fix-shebang-${patchver}.patch > netdata-fix-shebang-${patchver}.el6.patch
rm -rf a b
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/fundawang/netdata.git
[email protected]:fundawang/netdata.git
fundawang
netdata
netdata
master

搜索帮助