[Why] the docker image usually use '.tar' and '.tar.xz' as the suffix. so use array save the suffix.
Signed-off-by: Wang Chenglong 18509160991@163.com --- container/docker-rootfs/common | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/container/docker-rootfs/common b/container/docker-rootfs/common index fe37da9..89fad87 100755 --- a/container/docker-rootfs/common +++ b/container/docker-rootfs/common @@ -29,7 +29,7 @@ usage() Usage: ./run <src_docker_file_abspath> <dst_rootfs_new_abspath>
- src_docker_file_abspath: source .tar.xz file absolute path with suffix: [ tar.xz ]. + src_docker_file_abspath: source .tar.xz file absolute path with suffix: [ .tar, tar.xz ]. dst_rootfs_new_abspath: destination absolute path to create for rootfs
Example: @@ -43,14 +43,14 @@ check_docker_img_file() local docker_img_name local docker_img_suffix - allow_docker_img_suffix='tar.xz' + allow_docker_img_suffix=('tar' 'tar.xz') docker_img_name=$(basename "$1") docker_img_suffix=${docker_img_name##*.}
[ "$docker_img_suffix" == 'tar.xz' ] || { - docker_img_suffix=$(echo "$docker_img_name" |awk -F '.' '{print $(NF-1)"."$NF}') - echo "${allow_docker_img_suffix}" |grep -wq "$docker_img_suffix" || { - echo "[ERROR] Only support: .tar.xz file!" + docker_img_suffix=$(echo "$docker_img_name" | awk -F '.' '{print $(NF-1)"."$NF}') + echo "${allow_docker_img_suffix[@]}" |grep -wq "$docker_img_suffix" || { + echo "[ERROR] Only support: .tar .tar.xz file!" exit 2 } }
On Fri, Dec 25, 2020 at 02:33:48PM +0800, Wang Chenglong wrote:
[Why] the docker image usually use '.tar' and '.tar.xz' as the suffix. so use array save the suffix.
Signed-off-by: Wang Chenglong 18509160991@163.com
container/docker-rootfs/common | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/container/docker-rootfs/common b/container/docker-rootfs/common index fe37da9..89fad87 100755 --- a/container/docker-rootfs/common +++ b/container/docker-rootfs/common @@ -29,7 +29,7 @@ usage() Usage: ./run <src_docker_file_abspath> <dst_rootfs_new_abspath>
src_docker_file_abspath: source .tar.xz file absolute path with suffix: [ tar.xz ].
src_docker_file_abspath: source .tar.xz file absolute path with suffix: [ .tar, tar.xz ]. dst_rootfs_new_abspath: destination absolute path to create for rootfs
Example:
@@ -43,14 +43,14 @@ check_docker_img_file() local docker_img_name local docker_img_suffix
- allow_docker_img_suffix='tar.xz'
- allow_docker_img_suffix=('tar' 'tar.xz') docker_img_name=$(basename "$1") docker_img_suffix=${docker_img_name##*.}
$ suff="xxxx.tar.xz" $ echo ${suff##*.} $ xz
[ "$docker_img_suffix" == 'tar.xz' ] || {
if image end with "tar.xz" , it seems that both will not handle it.
docker_img_suffix=$(echo "$docker_img_name" |awk -F '.' '{print $(NF-1)"."$NF}')
echo "${allow_docker_img_suffix}" |grep -wq "$docker_img_suffix" || {
echo "[ERROR] Only support: .tar.xz file!"
docker_img_suffix=$(echo "$docker_img_name" | awk -F '.' '{print $(NF-1)"."$NF}')
echo "${allow_docker_img_suffix[@]}" |grep -wq "$docker_img_suffix" || {
^----- add space.
}echo "[ERROR] Only support: .tar .tar.xz file!" exit 2 }
enn... just handle "tar.xz" suffix? where is to handle "tar" ?
Thanks, Liushaofei
-- 2.23.0