Merge "prevent to delete the yum repo"

This commit is contained in:
Jenkins 2016-12-16 08:22:42 +00:00 committed by Gerrit Code Review
commit 98b0119538

View File

@ -164,29 +164,11 @@ mkdir -p $OS_INSTALL_DST
NFS_SERVER_ADDRESS=192.170.0.1
[ ! -d $OS_INSTALL_SRC ] && { mkdir -p $OS_INSTALL_SRC; }
mount -o nolock $NFS_SERVER_ADDRESS:/home/install_share/macaddr $OS_INSTALL_SRC
[ ! -d $OS_ISO_SRC ] && { mkdir -p $OS_ISO_SRC; }
mount -o nolock $NFS_SERVER_ADDRESS:iso_nfs_dir $OS_ISO_SRC
mkdir -p $OS_ISO_MOUNT_SRC
mount -o loop -t iso9660 ${OS_ISO_SRC}/*.iso $OS_ISO_MOUNT_SRC
cp -f ${OS_INSTALL_SRC}/os.json ${OS_INSTALL_DST}/
cp -rf ${OS_INSTALL_SRC}/usrdata ${OS_INSTALL_DST}/
# copy bin file
cp -rf $OS_ISO_MOUNT_SRC/*.bin $OS_INSTALL_DST/
#zenic项目需求centos系统时保留iso源
if [ ! -e $OS_INSTALL_DST/*.bin ];then
OS_ISO_DST=$LOCAL_DISK_ROOT/var/tfg-sys/os_iso
mkdir -p $OS_ISO_DST
#copy iso to $OS_ISO_DST
cp -rf ${OS_ISO_MOUNT_SRC}/* ${OS_ISO_DST}/
fi
umount $OS_INSTALL_SRC
umount $OS_ISO_MOUNT_SRC
umount $OS_ISO_SRC
%end
%post
@ -197,8 +179,6 @@ tmpline=`uuidgen`
tmpline=`echo $tmpline|tr -d '-'`
echo "$tmpline"> /etc/hostname
TFG_BIN=/home/os_install/*.bin
#lv_glance_nomount
#end lv_glance_nomount
@ -212,57 +192,7 @@ cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys
REPO_ROUTE=/etc/yum.repos.d
[ ! -d ${REPO_ROUTE} ] && { mkdir -p ${REPO_ROUTE}; echo "create ${REPO_ROUTE}" >> /home/os_install/usrdata/pxe_install.log; }
rm -rf ${REPO_ROUTE}/*
if [ -e ${TFG_BIN} ]; then
systemctl enable httpd.service
systemctl start httpd.service
vgrename cindervolumes cinder-volumes
#sriov
systemctl restart sriov.service
systemctl disable superpathd.service
systemctl disable multipathd.service
chmod +x /etc/rc.d/rc.local
#config os
[ -e /usr/bin/opencosos-doctor.sh ] && { /usr/bin/opencosos-doctor.sh --auto; echo "os is cgslv5" >> /home/os_install/usrdata/pxe_install.log; }
if [ -e /usr/bin/doctor.sh ]; then
/usr/bin/doctor.sh --auto
echo "os is TFG" >> /home/os_install/usrdata/pxe_install.log
fi
#install TFG bin
if [ -e ${TFG_BIN} ]; then
export HOME=/root; chmod +x ${TFG_BIN}; ${TFG_BIN} install reboot=n; echo "${TFG_BIN} install reboot=n" >> /home/os_install/usrdata/pxe_install.log;
rm -rf ${TFG_BIN}
fi
#clean iptables
if [[ -e /usr/sbin/iptables ]]; then
iptables -A INPUT -p tcp -m tcp --dport 22 -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
service iptables save
fi
if [[ -e /etc/sysconfig/iptables ]]; then
sed -i "/reject-with/d" /etc/sysconfig/iptables
fi
systemctl disable iptables.service
systemctl disable ip6tables.service
#end clean iptables
else
#zenic项目需求centos系统时保留iso源
#create repos
REPO_FILE=${REPO_ROUTE}/OS_ISO.repo
[ ! -d ${REPO_ROUTE} ] && { mkdir -p ${REPO_ROUTE}; echo "create ${REPO_ROUTE}" >> /home/os_install/usrdata/pxe_install.log; }
rm -rf ${REPO_ROUTE}/*
touch ${REPO_FILE}
echo "[OS_ISO]" >${REPO_FILE}
echo "name=OS_ISO" >>${REPO_FILE}
echo "baseurl=file:/var/tfg-sys/os_iso" >>${REPO_FILE}
echo "enabled=1" >>${REPO_FILE}
echo "gpgcheck=0" >>${REPO_FILE}
fi
#nic fix
NIC_CFG=/home/os_install/usrdata/nic_net_cfg.sh