diff options
| author | Mhd Sulhan <ms@kilabit.info> | 2016-01-14 11:39:42 +0700 |
|---|---|---|
| committer | Mhd Sulhan <ms@kilabit.info> | 2016-01-14 11:39:42 +0700 |
| commit | 9247a56488f410490dd1389bea7e22cdd111fe3f (patch) | |
| tree | 976181104d61dcaa9f70236a0771931a3f6bbd78 /scripts | |
| parent | 26abb4fa20af2a7448b80323e28697a85f10414d (diff) | |
| download | arch-docker-9247a56488f410490dd1389bea7e22cdd111fe3f.tar.xz | |
rootfs.sh: check for empty list on removed package and symlink on copy.
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/rootfs.sh | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/scripts/rootfs.sh b/scripts/rootfs.sh index a30ea18..608c00c 100755 --- a/scripts/rootfs.sh +++ b/scripts/rootfs.sh @@ -54,12 +54,15 @@ rootfs_copy() { for k in "${(@k)FILES}"; do echo " from $k to $FILES[$k]" - if [ -f $k ]; then - cp $k $FILES[$k] - chown root:root $FILES[$k] + if [ -h $k ]; then + cp -rL $k $FILES[$k] + chown -R root:root $FILES[$k] elif [ -d $k ]; then cp -r $k $FILES[$k] chown -R root:root $FILES[$k] + elif [ -f $k ]; then + cp $k $FILES[$k] + chown root:root $FILES[$k] fi done } @@ -90,7 +93,9 @@ rootfs_bootstrap() { rootfs_uninstall() { echo "==> uninstalling packages ..." - pacman -r "$ROOTFS" -Rdd --noconfirm ${PKGS_REMOVED} + if [[ ${#PKGS_REMOVED} > 0 ]]; then + pacman -r "$ROOTFS" -Rdd --noconfirm ${PKGS_REMOVED} + fi } rootfs_clean_pacman() { |
