Path: blob/master/tools/testing/selftests/gen_kselftest_tar.sh
26282 views
#!/bin/bash1#2# SPDX-License-Identifier: GPL-2.03# gen_kselftest_tar4# Generate kselftest tarball5# Author: Shuah Khan <[email protected]>6# Copyright (C) 2015 Samsung Electronics Co., Ltd.78# main9main()10{11if [ "$#" -eq 0 ]; then12echo "$0: Generating default compression gzip"13copts="cvzf"14ext=".tar.gz"15else16case "$1" in17tar)18copts="cvf"19ext=".tar"20;;21targz)22copts="cvzf"23ext=".tar.gz"24;;25tarbz2)26copts="cvjf"27ext=".tar.bz2"28;;29tarxz)30copts="cvJf"31ext=".tar.xz"32;;33*)34echo "Unknown tarball format $1"35exit 136;;37esac38fi3940# Create working directory.41dest=`pwd`42install_work="$dest"/kselftest_install43install_name=kselftest44install_dir="$install_work"/"$install_name"45mkdir -p "$install_dir"4647# Run install using INSTALL_KSFT_PATH override to generate install48# directory49./kselftest_install.sh "$install_dir"50(cd "$install_work"; tar $copts "$dest"/kselftest${ext} $install_name)5152# Don't put the message at the actual end as people may be parsing the53# "archive created" line in their scripts.54echo -e "\nConsider using 'make gen_tar' instead of this script\n"5556echo "Kselftest archive kselftest${ext} created!"5758# clean up top-level install work directory59rm -rf "$install_work"60}6162main "$@"636465