diff options
| author | Mhd Sulhan <ms@kilabit.info> | 2015-11-28 16:59:44 +0700 |
|---|---|---|
| committer | Mhd Sulhan <ms@kilabit.info> | 2015-11-28 16:59:44 +0700 |
| commit | 1e9c24d3f47fbf4b22241bebfc11de9c9c615f02 (patch) | |
| tree | ecc732688e91e63b09db8dd04ec057b8decc7af8 | |
| parent | bb392b3bf7ce2085c2cec10d575ab623452017c7 (diff) | |
| download | arch-docker-1e9c24d3f47fbf4b22241bebfc11de9c9c615f02.tar.xz | |
Remove packages only after bootstraping is finished.
* arch-base: remove unneeded packages.
| -rwxr-xr-x | arch-base/bootstrap_base.sh | 2 | ||||
| -rwxr-xr-x | arch-base/vars.sh | 6 | ||||
| -rwxr-xr-x | scripts/bootstrap.sh | 3 | ||||
| -rwxr-xr-x | scripts/create_image.sh | 2 | ||||
| -rwxr-xr-x | scripts/rootfs.sh | 20 |
5 files changed, 20 insertions, 13 deletions
diff --git a/arch-base/bootstrap_base.sh b/arch-base/bootstrap_base.sh index fa82e4a..05358f5 100755 --- a/arch-base/bootstrap_base.sh +++ b/arch-base/bootstrap_base.sh @@ -10,8 +10,6 @@ bootstrap_timezone bootstrap_locales -bootstrap_remove_packages - bootstrap_clean_common bootstrap_clean_base diff --git a/arch-base/vars.sh b/arch-base/vars.sh index f611de8..77644d4 100755 --- a/arch-base/vars.sh +++ b/arch-base/vars.sh @@ -2,11 +2,11 @@ THISD=${0:a:h} -PKGS+=(coreutils ca-certificates pacman sed binutils file grep) -PKGS_REMOVED+=(perl db) +PKGS=(coreutils binutils findutils sed gzip file) +PKGS_REMOVED+=(file gzip sed findutils less bzip2 pcre binutils perl db gdbm linux-api-headers) IMAGE_NAME="sulhan/arch-base" +IMAGE_ARGS=() -FILES+=("${THISD}/pacman.conf" "$ROOTFS/etc") FILES+=("${THISD}/bootstrap_base.sh" "${ROOTFS}/") BOOTSTRAP_S+=("/bootstrap_base.sh") diff --git a/scripts/bootstrap.sh b/scripts/bootstrap.sh index 9959f7e..b0854aa 100755 --- a/scripts/bootstrap.sh +++ b/scripts/bootstrap.sh @@ -30,8 +30,7 @@ bootstrap_clean_common() { rm -rf /usr/share/info/* rm -rf /var/cache/pacman/pkg/* rm -rf /var/log/* - rm -f /bootstrap.sh - rm -f /run_bootstrap.sh + rm -f /*.sh } bootstrap_hostname() { diff --git a/scripts/create_image.sh b/scripts/create_image.sh index 131028a..938fe4d 100755 --- a/scripts/create_image.sh +++ b/scripts/create_image.sh @@ -3,4 +3,6 @@ . ../scripts/rootfs.sh . ./vars.sh +rootfs_clean_pacman + rootfs_to_docker ${IMAGE_NAME} ${IMAGE_ARGS[@]} diff --git a/scripts/rootfs.sh b/scripts/rootfs.sh index 000beda..a30ea18 100755 --- a/scripts/rootfs.sh +++ b/scripts/rootfs.sh @@ -84,7 +84,19 @@ rootfs_bootstrap() { chmod +x ${RUN_BOOTSTRAP} ## run the bootstrap script. - arch-chroot "$ROOTFS" /bin/sh -c "/`basename ${RUN_BOOTSTRAP}`" + ${SCRIPTD}/arch-chroot.sh "$ROOTFS" /bin/sh -c "/`basename ${RUN_BOOTSTRAP}`" + wait +} + +rootfs_uninstall() { + echo "==> uninstalling packages ..." + pacman -r "$ROOTFS" -Rdd --noconfirm ${PKGS_REMOVED} +} + +rootfs_clean_pacman() { + echo "==> remove pacman db and local ..." + rm -rf "${ROOTFS}/var/lib/pacman/sync/*" + rm -rf "${ROOTFS}/var/lib/pacman/local/*" } ## @@ -102,6 +114,7 @@ rootfs_main() { rootfs_install rootfs_copy rootfs_bootstrap + rootfs_uninstall } rootfs_backup() { @@ -121,11 +134,6 @@ rootfs_backup() { ## Convert rootfs to docker image. ## rootfs_to_docker() { - if [[ $# < 2 ]]; then - echo "args: rootfs_to_docker [image-name] [options]" - exit 1 - fi - rootfs_backup sudo tar --numeric-owner --xattrs --acls -C "$ROOTFS" -c . | |
