+# Install functions
Useless comment, please remove.
+install_packages() +{
- echo "install"
- yum repolist
- yum -y install --skip-broken $(</tmp/packages-to-install)
- yum clean all
+}
+# Setup functions
ditto
+setup_rootfs() +{
- echo "setup"
- ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
+}
+# Config password
ditto
+setup_login() {
- [ -n "$ROOT_NEW_PASSWD" ] || return
- echo "Changing root password"
- passwd_md5=$(openssl passwd -1 "$ROOT_NEW_PASSWD")
- 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"
+}
+# Pack cgz package
ditto
+# Check password file
ditto
+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")
+}
+# Pull docker image
ditto
+pull_docker_image() +{
- docker pull $image
- if [ $? = 0 ]; then
echo "finish downloading image"
- else
echo "[INFO] Pull docker image failed."
exit
- fi
+}
+# cp image package to host
ditto
+cp_image()
cp_image => docker_cp_image
+{
- docker cp -a init_docker:/tmp/${image_name} $HOME/
- echo "result: $(ls $HOME/${image_name})"
+}
Thanks, Fengguang