Comhaid
rocm-systems/packaging/create_hip_samples_installer.sh
T
Maneesh Gupta 9a25f6ad8f Add packaging scripts for creating hip_samples package
Change-Id: I38205ce851ee2d8affce532c80c9a9fd4f66b345
2016-05-06 14:39:10 +05:30

24 línte
616 B
Bash
Comhad Infheidhmithe

#!/bin/bash
function die {
echo "${1-Died}." >&2
exit 1
}
payload=$1
script=$2
[ "$payload" != "" ] || [ "$script" != "" ] || die "Invalid arguments!"
tmp=__extract__$RANDOM
printf "#!/bin/bash
samples_dir=\$1
[ \"\$samples_dir\" != \"\" ] || read -e -p \"Enter the path to extract the HIP samples: \" samples_dir
mkdir -p \$samples_dir
PAYLOAD=\`awk '/^__PAYLOAD_BELOW__/ {print NR + 1; exit 0; }' \$0\`
tail -n+\$PAYLOAD \$0 | tar -xz -C \$samples_dir
echo \"HIP samples installed in \$samples_dir\"
exit 0
__PAYLOAD_BELOW__\n" > "$tmp"
cat "$tmp" "$payload" > "$script" && rm "$tmp"
chmod +x "$script"