代码拉取完成,页面将自动刷新
同步操作将从 anolis/leapp 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#! /bin/bash
if [[ "$1" == "-v" ]];then
echo "Use -v"
elif [ ! -n "$1" ];then
echo "Default mode"
else
echo "Please use the correct method"
exit 0
fi
while getopts "v:" opt; do
case $opt in
v)
if [[ "$OPTARG" == "8.2" ]];then
echo "put $OPTARG with -v"
sed -i "s/anolis\/\(\w*\.*\w*\)\//anolis\/$OPTARG\//g" ./leapp_upgrade_repositories.repo
elif [[ "$OPTARG" == "8.4" ]];then
echo "put $OPTARG with -v"
sed -i "s/anolis\/\(\w*\.*\w*\)\//anolis\/$OPTARG\//g" ./leapp_upgrade_repositories.repo
else
echo "-v $OPTARG is not available"
exit 0
fi
;;
\?)
echo "Please use -v only"
exit 0
;;
esac
done
if [ -d /usr/share/leapp-repository ]; then
echo "leapp-reposiroty is already installed."
exit 0
fi
# check deps
deps_list=(dnf pciutils libselinux-python policycoreutils-python patch)
for dep in ${deps_list[@]}
do
rpm -q $dep > /dev/null
if [ $? -ne 0 ]; then
echo "$dep is not installed, but is required by leapp-repository"
echo "It will install $dep first"
yum -y install $dep
fi
done
# check dnf version
dnf_version=$(rpm -q dnf --qf "%{VERSION}")
ret=$(awk -v num1=$dnf_version -v num2=4 'BEGIN{print(num1>=num2)?"0":"1"}')
if [ $ret == "1" ]; then
echo "dnf version is too low to run leapp, please update dnf"
exit 1
fi
# check glib2 version
glib2_version=$(rpm -q glib2 --qf "%{VERSION}")
ret=$(awk -v num1=$glib2_version -v num2=2.56.1 'BEGIN{print(num1>=num2)?"0":"1"}')
if [ $ret == "1" ]; then
echo "glib2 version is too low to run leapp, please update glib2"
exit 1
fi
version=0.13.0
rm -rf leapp-repository-$version
tar xf leapp-repository-${version}.tar.gz
cd leapp-repository-$version
for p in $(ls ../*.patch)
do
patch -p1 < $p
done
tar xf ../deps-pkgs-*.tar.gz
mv leapp-deps-*.rpm leapp-repository-deps-*.rpm repos/system_upgrade/el7toel8/files/bundled-rpms/
mkdir -p /usr/share/leapp-repository/custom-repositories
mkdir -p /usr/share/leapp-repository/repositories
cp -r repos/common repos/system_upgrade /usr/share/leapp-repository/repositories
mkdir -p /etc/leapp
mkdir -p /etc/leapp/repos.d
mkdir -p /etc/leapp/transaction
mkdir -p /etc/leapp/files
cp ../leapp_upgrade_repositories.repo /etc/leapp/files
cp ../pes-events.json /etc/leapp/files
cp ../repomap.csv /etc/leapp/files
cp etc/leapp/transaction/to_install etc/leapp/transaction/to_keep etc/leapp/transaction/to_remove /etc/leapp/transaction
rm -rf /usr/share/leapp-repository/repositories/containerization
rm -rf /usr/share/leapp-repository/repositories/test
rm -rf /usr/share/leapp-repository/repositories/common/actors/testactor
find /usr/share/leapp-repository/repositories/common -name "test.py" -delete
rm -rf `find /usr/share/leapp-repository/repositories/ -name "tests" -type d`
find /usr/share/leapp-repository/repositories/ -name "Makefile" -delete
for DIRECTORY in $(find /usr/share/leapp-repository/repositories/ -mindepth 1 -maxdepth 1 -type d)
do
REPOSITORY=$(basename $DIRECTORY)
echo "Enabling repository $REPOSITORY"
rm -rf /etc/leapp/repos.d/$REPOSITORY
ln -s /usr/share/leapp-repository/repositories/$REPOSITORY /etc/leapp/repos.d/$REPOSITORY
done
cd ../
rm -rf leapp-repository-${version}
echo "install leapp-repository successfully."
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。