+setup_rootfs()
It seems that function names not have any relations what they do.
+{
- ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
+}
+setup_login() {
permit_root_login() ?
- [ -n "$ROOT_PASSWD" ] || return
- echo "Changing root password"
- passwd_md5=$(openssl passwd -1 "$ROOT_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()
image2cgz() ?
+{
- echo "Packing package. Please wait."
- find / ! -path "/tmp/${IMAGE_NAME}" | grep -vf /tmp/files-to-exclude | cpio -o -Hnewc | gzip -9 > /tmp/${IMAGE_NAME}
- chmod 644 /tmp/${IMAGE_NAME}
+}
+export_root_passwd() {
- local root_pwd_file="$HOME/.config/compass-ci/rootfs-passwd"
- [ -f "$root_pwd_file" ] || {
echo "[INFO] Please set the password file."
echo "$HOME/.config/compass-ci/rootfs-passwd"
exit 1
}
export ROOT_PASSWD=$(cat "$root_pwd_file")
^^ No alignment
+pull_docker_image() +docker_cp_image()
pull_docker_image cp_docker_image
or
docker_pull_image docker_cp_image
should be consistent
+DIR=$(dirname $(realpath $0)) +cmd=(
docker run
--name init_docker
-v $DIR/create-image:/root/bin/create-image
-v $DIR/packages-to-install:/tmp/packages-to-install
-v $DIR/files-to-exclude:/tmp/files-to-exclude
-e ROOT_PASSWD=$ROOT_PASSWD
-e IMAGE_NAME=$IMAGE_NAME
$image
/root/bin/create-image
+)
+pull_docker_image +${cmd[@]} +docker_cp_image +docker_rm init_docker &> /dev/null
if not print, can add '&> /dev/null' in container/defconfig.sh/-->docker_rm()
Thanks, Yinsi