#!/bin/sh if [ -z "$FRIDA_VERSION" ]; then echo "FRIDA_VERSION must be set" > /dev/stderr exit 2 fi if [ $# -ne 2 ]; then echo "Usage: $0 path/to/prefix output.deb" > /dev/stderr exit 3 fi prefix=$1 output_deb=$2 executable=$prefix/usr/bin/frida-server if [ ! -f "$executable" ]; then echo "$executable: not found" > /dev/stderr exit 4 fi agent=$prefix/usr/lib/frida/frida-agent.dylib if [ ! -f "$agent" ]; then echo "$agent: not found" > /dev/stderr exit 5 fi tmpdir="$(mktemp -d /tmp/package-server.XXXXXX)" mkdir -p "$tmpdir/var/jb/usr/sbin/" cp "$executable" "$tmpdir/var/jb/usr/sbin/frida-server" chmod 755 "$tmpdir/var/jb/usr/sbin/frida-server" mkdir -p "$tmpdir/var/jb/usr/lib/frida/" cp "$agent" "$tmpdir/var/jb/usr/lib/frida/frida-agent.dylib" chmod 755 "$tmpdir/var/jb/usr/lib/frida/frida-agent.dylib" mkdir -p "$tmpdir/var/jb/Library/LaunchDaemons/" cat >"$tmpdir/var/jb/Library/LaunchDaemons/re.frida.server.plist" < Label re.frida.server Program /var/jb/usr/sbin/frida-server ProgramArguments /var/jb/usr/sbin/frida-server EnvironmentVariables _MSSafeMode 1 UserName root POSIXSpawnType Interactive RunAtLoad KeepAlive ThrottleInterval 5 ExecuteAllowed EOF chmod 644 "$tmpdir/var/jb/Library/LaunchDaemons/re.frida.server.plist" installed_size=$(du -sk "$tmpdir" | cut -f1) mkdir -p "$tmpdir/DEBIAN/" cat >"$tmpdir/DEBIAN/control" < Author: Frida Developers Section: Development Conflicts: re.frida.server64 EOF chmod 644 "$tmpdir/DEBIAN/control" cat >"$tmpdir/DEBIAN/extrainst_" <"$tmpdir/DEBIAN/prerm" < "$tmpdir/DEBIAN/control_" mv "$tmpdir/DEBIAN/control_" "$tmpdir/DEBIAN/control" dpkg-deb $dpkg_options --build "$tmpdir" "$output_deb" rm -rf "$tmpdir"