Business-Edition on NixOS

Get help for specific problems
Posts: 13
Joined: 30 Dec 2020

Thiemo

Hi

I have been building a NixOS package for FreeFileSync Business Edition for its capabilities of silent installation. However, there are several problems.
- The file names contain [] but nix interpretes those as array marker or something. I agree, that nix should be able handle that correctly, however, on the command line this characters in file names are tiresome escape needies.
- The installer looks for /bin/bash. This is not quite portable. Why does it not rely on the path?
- I set symlink on a bash to that path but still the installer fails miserably with "Could not find path to terminal executable" quite immediately.

Are there any plans to support systems like NixOS?

Kind regards

Thiemo
freefilesync.nix
# $Header$

broken

{ config, pkgs, ... }:

let
  # Installer lokal holen
  ffsInstaller = pkgs.fetchurl {
    url = "file://${./packages/FreeFileSync_Business_Install.run_4_nix}";
    sha256 = "329973562a0d6c5679167d3885a37dc00f6029cb0ffc0c4927c7bae3a13a1a1d";
    name = "FreeFileSync_Install.run";
  };

  # Lizenz lokal holen (wird nur während Installation benötigt)
  ffsLicense = pkgs.fetchurl {
    url = "file://${./packages/FreeFileSync_Business_Install.license_4_nix}";
    sha256 = "b5baa8b91f705f1562be7a6fadd6c3f622ee785f51b454deeb69317c9ea91c55";
    name = "FreeFileSync_Install.license";  # Gleicher Basename wie .run
  };

  ffsPkg = pkgs.stdenv.mkDerivation {
    pname = "freefilesync";
    version = "14.10";

    src = ffsInstaller;

    nativeBuildInputs = with pkgs; [
      autoPatchelfHook  # Patcht Binaries automatisch für NixOS
      xvfb-run          # Virtueller X-Server für headless GUI-Apps
    ];

    buildInputs = with pkgs; [
      gtk3
      glib
      libssh2
      openssl
      curl
      stdenv.cc.cc.lib
    ];

    dontUnpack = true;

    installPhase = ''
      # Kopiere Installer und Lizenz ins selbe Verzeichnis
      # Beide müssen identischen Basename haben (außer Suffix)
      mkdir -p install-dir
      cp $src install-dir/FreeFileSync_Install.run
      cp ${ffsLicense} install-dir/FreeFileSync_Install.license
      chmod +x install-dir/FreeFileSync_Install.run

      cd install-dir

      # Patche den Installer für NixOS (fixt /bin/bash Problem)
      patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" FreeFileSync_Install.run || true

      # Erstelle temporäres /bin/bash für den Installer
      mkdir -p bin
      ln -s ${pkgs.bash}/bin/bash bin/bash
      export PATH=$PWD/bin:$PATH

      # Führe Installer im Silent-Modus aus mit virtuellem X-Server
      # Der Installer erstellt Binaries, Desktop-Einträge und Icons selbst
      # Lizenz wird während der Installation gelesen, danach nicht mehr benötigt
      mkdir -p $out

      # Setze Terminal-Umgebungsvariablen für den Installer
      export TERM=xterm
      export SHELL=${pkgs.bash}/bin/bash
      export TERMINFO=${pkgs.ncurses}/share/terminfo

      # Debug: Was passiert beim Start?
      echo "=== Installer start ==="
      HOME=$PWD xvfb-run -a -s "-screen 0 1024x768x24" ./FreeFileSync_Install.run /silent /dir="$out" /create_shortcuts=no || {
        echo "=== Installer failed, checking what was created ==="
        ls -la $out/ || true
        exit 1
      }

      # Der Installer sollte alles Notwendige eingerichtet haben
      # autoPatchelfHook patcht die Binaries automatisch nach der Installation
    '';

    meta = with pkgs.lib; {
      description = "FreeFileSync - Folder comparison and synchronization";
      homepage = "https://freefilesync.org/";
      license = licenses.unfree;  # Business-Lizenz
      platforms = platforms.linux;
    };
  };
in {
  # FreeFileSync installieren
  environment.systemPackages = [ ffsPkg ];

  # Lizenz wird während der Installation gelesen und muss nicht im System bleiben
}
User avatar
Site Admin
Posts: 7532
Joined: 9 Dec 2007

Zenju

I've switched to
#!/usr/bin/env bash
which hopefully is an overall improvement.

Not sure about the brackets, though. Other than NixOS, I'm not aware of any issues.
Posts: 13
Joined: 30 Dec 2020

Thiemo

Thanks

I am not quite sure how to take "switched to". I just downloaded the zip and a grep on the runner does not quite reflect the switch. Maybe that is just my very limited knowledge about the runner.
thiemo_geima @ hotrod ~/Downloads % grep -Fa bash FreeFileSync_14.10_\[Business\]_Linux/FreeFileSync_14.10_\[Business\]_Install.run 26-07-15 15:00
1�1�H���SHH�H�CH9�tH)�H��H�CP�[���P�����[��S�+���H�▒�
H�������H�[pH��u�H�=72 �����H�=�& �|���H�=�% [�o���PX�Error code %d: %s [%s]; read -n1 -s -p '<Press a key>'GNOME_TERMINAL_SCREENunsetenv(GNOME_TERMINAL_SCREEN)/bin/bash-c/usr/bin/gnome-terminal--/usr/bin/ptyxis/usr/bin/konsole-e/usr/bin/xfce4-terminal-x/usr/bin/xterm/usr/bin/lxterminal/usr/bin/mate-terminalCould not find path to terminal executable.isattyError starting "%s".
%s/bin/bash '/install.sh'File name "%s" is missing an extension..license --supporter-edition '; exitCode=$?;
install.sh0000755000175000017500000005547715220160343012151 0ustar zenjuzenju#!/bin/bash
#https://misc.flogisoft.com/bash/tip_colors_and_formatting
installDir=$(bash -c "echo $installDir"); #get rid of whitespace and quotes if user drag & dropped the path
exec sudo /bin/bash "$0" "${initArgs[@]}"; exit 1; fi
exec sudo --user $userName /bin/bash "$0" "${initArgs[@]}"; exit 1; fi
/bin/bash "$installDirOld/uninstall.sh" --keep-shortcuts
#!/bin/bash
exec sudo /bin/bash "\$0" "\$@"; exit 1; fi
exec sudo --user $userName /bin/bash "\$0" "\$@"; exit 1; fi
animals.sh0000755000175000017500000000714615220160343012115 0ustar zenjuzenju#!/bin/bash
Am I missing something else?

Kind regards