+#Configure rootfs +make_rootfs() +{
- yum repolist
- yum -y install $(</root/bin/repolist)
- yum clean all
- rm -rf $(</root/bin/dellist)
- ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
- cd /root/modules
- zcat modules-5.8.0.1.cgz | cpio -idmv >/dev/null
Unused balnklines.
Ok. I will delete it.
+}
+#config passwd +pre_config_rootfs() {
- [ -n "$ROOT_NEW_PASSWD" ] && {
echo "Changing root password"
passwd_md5=$(openssl passwd -1 "$ROOT_NEW_PASSWD")
echo $passwd_md5
sed -i -r "s/^root:[^:]*:(.*)/root:${passwd_md5//\//\\/}:\1/" "$ROOTFS_DIR/etc/shadow"
sed -i 's/[# ]PermitRootLogin.*/PermitRootLogin yes/' "$ROOTFS_DIR/etc/ssh/sshd_config"
- }
ditto
Ok.
+}
+#pack cgz package +pack_cgz() +{
- echo "Packing package. Please wait."
- cd /
- find ./ ! -path "./${image_name}" ! -path "./root/modules/modules-5.8.0.1.cgz" |cpio -o -Hnewc |gzip -9 >/${image_name}
- chmod 644 /${image_name}
+}
one blankline is enough.
Ok.
+make_rootfs +pre_config_rootfs +cat $ROOTFS_DIR/etc/shadow
+#check passwd file +check_passwd_file() {
- root_pwd_file="$HOME/.config/compass-ci/rootfs.passwd"
export ROOT_NEW_PASSWD=
[ -f "$root_pwd_file" ] || {
echo "[INFO] Please set the password file."
echo "$HOME/.config/compass-ci/rootfs.passwd"
exit 1
}
export ROOT_NEW_PASSWD=$(cat "$root_pwd_file")
+}
ditto.
Ok
Thanks, Chenglong
Thanks, Xijian