import java.nio.file.StandardCopyOption;
import java.security.*;
import java.security.cert.Certificate;
-import java.util.*;
import java.util.concurrent.*;
+import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.zip.GZIPInputStream;
args.add("-Dlauncher.version=" + Build.version());
addSystemPropertyIfNotNull(args, "installer.appdir");
// add the marker indicating the app is running in getdown
- args.add("-D" + Properties.GETDOWN + "=true");
+ args.add("-D" + com.threerings.getdown.data.Properties.GETDOWN + "=true");
args.add("-Dsys.install4jVersion=" + Application.i4jVersion);
addSystemPropertyIfNotNull(args, "installer.template_version");
addSystemPropertyIfNotNull(args, "installer.logfile");
}
}
+ final String installerPropsFilename = "installer.properties";
+ log.info("Creating " + installerPropsFilename);
+ java.util.Properties installerProps = new java.util.Properties();
+ installerProps.setProperty("installer.appdir", applicationAppDir.getAbsolutePath());
+ installerProps.setProperty("installer.appdirhash", EnvConfig.getAppDirHash());
+ for ( String key: new String[] {"installer.template_version", "installer.application_folder", "installer.icon", "installer.mac_icons", "installer.logfile", "installer.logfile_append"}) {
+ String val = System.getProperty(key);
+ if (val != null) {
+ installerProps.put(key, val);
+ }
+ }
+ for (String prop: installerProps.stringPropertyNames()) {
+ log.info("Adding property '" + prop + "'='" + installerProps.getProperty(prop) + "' to " + installerPropsFilename);
+ }
+ File installerPropsFile = new File(userAppDir, installerPropsFilename);
+ try {
+ installerProps.store(new FileOutputStream(installerPropsFile.getAbsolutePath()), "Created by installer launcher in " + applicationAppDir);
+ } catch (IOException e) {
+ log.warning("Could not write installer properties file '" + installerPropsFile.getAbsolutePath() + "'");
+ }
+
MessageDigest md = Digest.getMessageDigest(Digest.VERSION);
for (Resource rsc: copyResources) {
String digestHash = digest2.getDigest(rsc);
}
String appname = StringUtil.isBlank(appName) ? ChannelProperties.FALLBACK_APPNAME : appName;
final String FS = File.separator;
- String appDirHash;
try {
- appDirHash = getFullPathToDirectoryHash(new File(installerAppdir).getCanonicalPath());
+ setAppDirHash(installerAppdir);
} catch (IOException ioex) {
System.err.println("Unable to resolve '"+installerAppdir+"' as a proper path on this system.\nNot generating a user local appdir - getdown may fail to update!");
return null;
}
sb.append(appDataPath).append(FS);
sb.append(append).append(FS);
- sb.append(appDirHash).append(FS);
+ sb.append(getAppDirHash()).append(FS);
sb.append("app");
return sb.toString();
}
appName = System.getProperty("channel.app_name");
}
+ public static String getAppDirHash() {
+ return appDirHash;
+ }
+
+ public static void setAppDirHash(String path) throws IOException {
+ appDirHash = getFullPathToDirectoryHash(new File(path).getCanonicalPath());
+ }
+
private static boolean relaunched = false;
private static final String USER_HOME_KEY = "${user.home}";
private static String appName = null;
+ private static String appDirHash = null;
+
public static final String USER_DEFAULT_APPDIR_PROPERTY = "userdefaultappdir";
protected static final String APPLICATION_APPDIR_PROPERTY = "installer.appdir";