author | herrick |
Tue, 24 Sep 2019 13:41:16 -0400 | |
branch | JDK-8200758-branch |
changeset 58301 | e0efb29609bd |
child 58888 | d802578912f3 |
permissions | -rw-r--r-- |
58301
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
1 |
#!/bin/bash |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
2 |
|
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
3 |
# |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
4 |
# Script to install/uninstall packages produced by jpackage jtreg |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
5 |
# tests doing platform specific packaging. |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
6 |
# |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
7 |
# The script will install/uninstall all packages from the files |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
8 |
# found in the current directory or the one specified with command line option. |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
9 |
# |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
10 |
# When jtreg jpackage tests are executed with jpackage.test.output |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
11 |
# Java property set, produced package files (msi, exe, deb, rpm, etc.) will |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
12 |
# be saved in the directory specified with this property. |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
13 |
# |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
14 |
# Usage example: |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
15 |
# # Set directory where to save package files from jtreg jpackage tests |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
16 |
# JTREG_OUTPUT_DIR=/tmp/jpackage_jtreg_packages |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
17 |
# |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
18 |
# # Run tests and fill $JTREG_OUTPUT_DIR directory with package files |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
19 |
# jtreg -Djpackage.test.output=$JTREG_OUTPUT_DIR ... |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
20 |
# |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
21 |
# # Install all packages |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
22 |
# manage_pachages.sh -d $JTREG_OUTPUT_DIR |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
23 |
# |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
24 |
# # Uninstall all packages |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
25 |
# manage_pachages.sh -d $JTREG_OUTPUT_DIR -u |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
26 |
# |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
27 |
|
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
28 |
# |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
29 |
# When using with MSI installers, Cygwin shell from which this script is |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
30 |
# executed should be started as administrator. Otherwise silent installation |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
31 |
# won't work. |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
32 |
# |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
33 |
|
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
34 |
# Fail fast |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
35 |
set -e; set -o pipefail; |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
36 |
|
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
37 |
|
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
38 |
help_usage () |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
39 |
{ |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
40 |
echo "Usage: `basename $0` [OPTION]" |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
41 |
echo "Options:" |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
42 |
echo " -h - print this message" |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
43 |
echo " -v - verbose output" |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
44 |
echo " -d <dir> - path to directory where to look for package files" |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
45 |
echo " -u - uninstall packages instead of the default install" |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
46 |
echo " -t - dry run, print commands but don't execute them" |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
47 |
} |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
48 |
|
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
49 |
error () |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
50 |
{ |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
51 |
echo "$@" > /dev/stderr |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
52 |
} |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
53 |
|
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
54 |
fatal () |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
55 |
{ |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
56 |
error "$@" |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
57 |
exit 1 |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
58 |
} |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
59 |
|
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
60 |
fatal_with_help_usage () |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
61 |
{ |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
62 |
error "$@" |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
63 |
help_usage |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
64 |
exit 1 |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
65 |
} |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
66 |
|
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
67 |
|
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
68 |
# Directory where to look for package files. |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
69 |
package_dir=$PWD |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
70 |
|
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
71 |
# Script debug. |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
72 |
verbose= |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
73 |
|
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
74 |
# Operation mode. |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
75 |
mode=install |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
76 |
|
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
77 |
dryrun= |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
78 |
|
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
79 |
while getopts "vhd:ut" argname; do |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
80 |
case "$argname" in |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
81 |
v) verbose=yes;; |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
82 |
t) dryrun=yes;; |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
83 |
u) mode=uninstall;; |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
84 |
d) package_dir="$OPTARG";; |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
85 |
h) help_usage; exit 0;; |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
86 |
?) help_usage; exit 1;; |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
87 |
esac |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
88 |
done |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
89 |
shift $(( OPTIND - 1 )) |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
90 |
|
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
91 |
[ -d "$package_dir" ] || fatal_with_help_usage "Package directory [$package_dir] is not a directory" |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
92 |
|
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
93 |
[ -z "$verbose" ] || set -x |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
94 |
|
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
95 |
|
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
96 |
function find_packages_of_type () |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
97 |
{ |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
98 |
# sort output alphabetically |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
99 |
find "$package_dir" -maxdepth 1 -type f -name '*.'"$1" | sort |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
100 |
} |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
101 |
|
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
102 |
function find_packages () |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
103 |
{ |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
104 |
local package_suffixes=(deb rpm msi exe) |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
105 |
for suffix in "${package_suffixes[@]}"; do |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
106 |
if [ "$mode" == "uninstall" ]; then |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
107 |
packages=$(find_packages_of_type $suffix | tac) |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
108 |
else |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
109 |
packages=$(find_packages_of_type $suffix) |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
110 |
fi |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
111 |
if [ -n "$packages" ]; then |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
112 |
package_type=$suffix |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
113 |
break; |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
114 |
fi |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
115 |
done |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
116 |
} |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
117 |
|
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
118 |
|
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
119 |
# RPM |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
120 |
install_cmd_rpm () |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
121 |
{ |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
122 |
echo sudo rpm --install "$@" |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
123 |
} |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
124 |
uninstall_cmd_rpm () |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
125 |
{ |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
126 |
local package_name=$(rpm -qp --queryformat '%{Name}' "$@") |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
127 |
echo sudo rpm -e "$package_name" |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
128 |
} |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
129 |
|
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
130 |
# DEB |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
131 |
install_cmd_deb () |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
132 |
{ |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
133 |
echo sudo dpkg -i "$@" |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
134 |
} |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
135 |
uninstall_cmd_deb () |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
136 |
{ |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
137 |
local package_name=$(dpkg-deb -f "$@" Package) |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
138 |
echo sudo dpkg -r "$package_name" |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
139 |
} |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
140 |
|
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
141 |
# MSI |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
142 |
install_cmd_msi () |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
143 |
{ |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
144 |
echo msiexec /qn /norestart /i $(cygpath -w "$@") |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
145 |
} |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
146 |
uninstall_cmd_msi () |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
147 |
{ |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
148 |
echo msiexec /qn /norestart /x $(cygpath -w "$@") |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
149 |
} |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
150 |
|
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
151 |
# EXE |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
152 |
install_cmd_exe () |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
153 |
{ |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
154 |
echo "$@" |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
155 |
} |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
156 |
uninstall_cmd_exe () |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
157 |
{ |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
158 |
error No implemented |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
159 |
} |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
160 |
|
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
161 |
|
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
162 |
# Find packages |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
163 |
packages= |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
164 |
find_packages |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
165 |
if [ -z "$packages" ]; then |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
166 |
echo "No packages found in $package_dir directory" |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
167 |
exit |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
168 |
fi |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
169 |
|
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
170 |
# Build list of commands to execute |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
171 |
declare -a commands |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
172 |
for p in $packages; do |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
173 |
commands[${#commands[@]}]=$(${mode}_cmd_${package_type} "$p") |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
174 |
done |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
175 |
|
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
176 |
if [ -z "$dryrun" ]; then |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
177 |
# Run commands |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
178 |
for cmd in "${commands[@]}"; do |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
179 |
echo Running: $cmd |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
180 |
$cmd || true; |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
181 |
done |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
182 |
else |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
183 |
# Print commands |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
184 |
for cmd in "${commands[@]}"; do echo $cmd; done |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff
changeset
|
185 |
fi |