1 #!/bin/bash 2 3 # 4 # Complete testing of jpackage platform-specific packaging. 5 # 6 # The script does the following: 7 # 1. Create packages. 8 # 2. Install created packages. 9 # 3. Verifies packages are installed. 10 # 4. Uninstall created packages. 11 # 5. Verifies packages are uninstalled. 12 # 13 # For the list of accepted command line arguments see `run_tests.sh` script. 14 # 15 16 # Fail fast 17 set -e; set -o pipefail; 18 19 # Script debug 20 dry_run=${JPACKAGE_TEST_DRY_RUN} 21 22 # Default directory where jpackage should write bundle files 23 output_dir=~/jpackage_bundles 24 25 26 set_args () 27 { 28 args=() 29 local arg_is_output_dir= 30 local arg_is_mode= 31 local output_dir_set= 32 for arg in "$@"; do 33 if [ "$arg" == "-o" ]; then 34 arg_is_output_dir=yes 35 output_dir_set=yes 36 elif [ "$arg" == "-m" ]; then 37 arg_is_mode=yes 38 continue 39 elif [ -n "$arg_is_output_dir" ]; then 40 arg_is_output_dir= 41 output_dir="$arg" 42 elif [ -n "$arg_is_mode" ]; then 43 arg_is_mode= 44 continue 45 fi 46 47 args+=( "$arg" ) 48 done 49 [ -n "$output_dir_set" ] || args=( -o "$output_dir" "${args[@]}" ) 50 } 51 52 53 exec_command () 54 { 55 if [ -n "$dry_run" ]; then 56 echo "$@" 57 else 58 eval "$@" 59 fi 60 } 61 62 set_args "$@" 63 basedir="$(dirname $0)" 64 exec_command "$basedir/run_tests.sh" -m create "${args[@]}" 65 exec_command "$basedir/manage_packages.sh" -d "$output_dir" 66 exec_command "$basedir/run_tests.sh" -m verify-install "${args[@]}" 67 exec_command "$basedir/manage_packages.sh" -d "$output_dir" -u 68 exec_command "$basedir/run_tests.sh" -m verify-uninstall "${args[@]}"