121 String dir = INSTALL_DIR.fetchFrom(params);
122 return (dir != null) ? dir : "/Applications";
123 },
124 (s, p) -> s
125 );
126
127 public static final BundlerParamInfo<String> INSTALLER_SUFFIX =
128 new StandardBundlerParam<> (
129 "mac.pkg.installerName.suffix",
130 String.class,
131 params -> "",
132 (s, p) -> s);
133
134 public File bundle(Map<String, ? super Object> params,
135 File outdir) throws PackagerException {
136 Log.verbose(MessageFormat.format(I18N.getString("message.building-pkg"),
137 APP_NAME.fetchFrom(params)));
138
139 IOUtils.writableOutputDir(outdir.toPath());
140
141 File appImageDir = null;
142 try {
143 appImageDir = prepareAppBundle(params, false);
144
145 if (appImageDir != null && prepareConfigFiles(params)) {
146
147 File configScript = getConfig_Script(params);
148 if (configScript.exists()) {
149 Log.verbose(MessageFormat.format(I18N.getString(
150 "message.running-script"),
151 configScript.getAbsolutePath()));
152 IOUtils.run("bash", configScript);
153 }
154
155 return createPKG(params, outdir, appImageDir);
156 }
157 return null;
158 } catch (IOException ex) {
159 Log.verbose(ex);
160 throw new PackagerException(ex);
161 }
162 }
163
|
121 String dir = INSTALL_DIR.fetchFrom(params);
122 return (dir != null) ? dir : "/Applications";
123 },
124 (s, p) -> s
125 );
126
127 public static final BundlerParamInfo<String> INSTALLER_SUFFIX =
128 new StandardBundlerParam<> (
129 "mac.pkg.installerName.suffix",
130 String.class,
131 params -> "",
132 (s, p) -> s);
133
134 public File bundle(Map<String, ? super Object> params,
135 File outdir) throws PackagerException {
136 Log.verbose(MessageFormat.format(I18N.getString("message.building-pkg"),
137 APP_NAME.fetchFrom(params)));
138
139 IOUtils.writableOutputDir(outdir.toPath());
140
141 try {
142 File appImageDir = prepareAppBundle(params);
143
144 if (appImageDir != null && prepareConfigFiles(params)) {
145
146 File configScript = getConfig_Script(params);
147 if (configScript.exists()) {
148 Log.verbose(MessageFormat.format(I18N.getString(
149 "message.running-script"),
150 configScript.getAbsolutePath()));
151 IOUtils.run("bash", configScript);
152 }
153
154 return createPKG(params, outdir, appImageDir);
155 }
156 return null;
157 } catch (IOException ex) {
158 Log.verbose(ex);
159 throw new PackagerException(ex);
160 }
161 }
162
|