Exemplo n.º 1
0
  public void copyApksToRepo(List<String> appsToCopy) {
    for (final String packageName : appsToCopy) {
      final App app = apps.get(packageName);

      if (app.installedApk != null) {
        SanitizedFile outFile = new SanitizedFile(repoDir, app.installedApk.apkName);
        if (Utils.symlinkOrCopyFile(app.installedApk.installedFile, outFile)) continue;
      }
      // if we got here, something went wrong
      throw new IllegalStateException("Unable to copy APK");
    }
  }
Exemplo n.º 2
0
  private String writeFdroidApkToWebroot() {
    ApplicationInfo appInfo;
    String fdroidClientURL = "https://f-droid.org/FDroid.apk";

    try {
      appInfo = pm.getApplicationInfo(fdroidPackageName, PackageManager.GET_META_DATA);
      SanitizedFile apkFile = SanitizedFile.knownSanitized(appInfo.publicSourceDir);
      SanitizedFile fdroidApkLink = new SanitizedFile(webRoot, "fdroid.client.apk");
      attemptToDelete(fdroidApkLink);
      if (Utils.symlinkOrCopyFile(apkFile, fdroidApkLink))
        fdroidClientURL = "/" + fdroidApkLink.getName();
    } catch (PackageManager.NameNotFoundException e) {
      Log.e(TAG, "Could not set up F-Droid apk in the webroot", e);
    }
    return fdroidClientURL;
  }
Exemplo n.º 3
0
 private void symlinkFileElsewhere(String fileName, String symlinkPrefix, File directory) {
   SanitizedFile index = new SanitizedFile(directory, fileName);
   attemptToDelete(index);
   Utils.symlinkOrCopyFile(new SanitizedFile(new File(directory, symlinkPrefix), fileName), index);
 }