{"id":14235828,"url":"https://github.com/solidsnack/arx","last_synced_at":"2025-05-15T20:07:13.521Z","repository":{"id":62435553,"uuid":"2629746","full_name":"solidsnack/arx","owner":"solidsnack","description":"Bundles code and a job to run for local or remote execution.","archived":false,"fork":false,"pushed_at":"2025-02-04T02:50:32.000Z","size":318,"stargazers_count":186,"open_issues_count":3,"forks_count":17,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-05-10T02:07:49.888Z","etag":null,"topics":["haskell","jobs","shell","tmp"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/solidsnack.png","metadata":{"files":{"readme":"README","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2011-10-23T07:14:47.000Z","updated_at":"2025-02-05T05:55:32.000Z","dependencies_parsed_at":"2025-03-27T04:12:50.052Z","dependency_job_id":"290fda5f-6276-4c88-9702-b35eac35358c","html_url":"https://github.com/solidsnack/arx","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solidsnack%2Farx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solidsnack%2Farx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solidsnack%2Farx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solidsnack%2Farx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/solidsnack","download_url":"https://codeload.github.com/solidsnack/arx/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253655924,"owners_count":21943072,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["haskell","jobs","shell","tmp"],"created_at":"2024-08-20T21:02:23.399Z","updated_at":"2025-05-15T20:07:08.388Z","avatar_url":"https://github.com/solidsnack.png","language":"Shell","funding_links":[],"categories":["Shell"],"sub_categories":[],"readme":"SYNOPSIS\n          arx (-h | -[?] | --help)\n          arx (-v | --version)\n          arx shdat (-b \u003csize\u003e)? (-o \u003coutput file\u003e)? \u003c input\n          arx shdat (-b \u003csize\u003e)? (-o \u003coutput file\u003e)? \u003cinput file\u003e+\n          arx tmpx \u003coption,archive\u003e* (//+ \u003ccommand\u003e (//+ \u003coption,archive\u003e*)?)?\n\nDESCRIPTION\n       A  UNIX  executable is a simple thing -- a file the kernel can execute,\n       one way or another, via an interpreter  or  directly  as  object  code.\n       Every  executable induces a family of executions -- instances of execu-\n       tion with different command line arguments, with different files in the\n       working directory and with different environment variables present.\n\n       The  arx  tool captures the parameters of an execution and encodes them\n       as an executable, making for easy, consistent transfer  and  repetition\n       of  a  particular  run.  The generated executable ensures that each run\n       occurs in a  freshly  allocated  temporary  directory,  with  only  the\n       desired  files  in  scope;  it uses traps to ensure the cleanup of this\n       directory; and its format is a simple POSIX shell  script,  relying  on\n       just a few shell tools.\n\nDEPENDENCIES\n       The  arx  tool relies on the presence of sed, tr, date, head, tar, hex-\n       dump and sh. When unpacking tar archives, it  may  use  the  -j  or  -z\n       (bzip2 and gzip, respectively) options of tar. Scripts have been tested\n       with dash and the GNU tools as well as the sh implementation and  user-\n       land tools that are part of busybox.\n\nAPPLICATION\n       The  tmpx  subcommand  of  arx offers a variety of options for bundling\n       code and a task to run. The shdat subcommand  exposes  the  lower-level\n       functionality  of  encoding  binary data in a shell script that outputs\n       that binary data, using HERE documents and some odd  replacement  rules\n       for nulls.\n\n       Scripts generated by tmpx and shdat may be fed to sh over STDIN to exe-\n       cute them. This can be helpful when using ssh and sudo  to  set  up  an\n       execution context; for example:\n\n          arx tmpx ... | ssh user@host.com sudo sh\n\n       Scripts  generated  by  tmpx will pass their arguments to the contained\n       script or command. To pass arguments when piping to sh, use -s:\n\n          arx tmpx ... | ssh user@host.com sudo sh -s a b c\n\n       Some arguments to the  generated  script  will  be  treated  specially,\n       namely,  --extract,  --no-rm  and  --no-run.  Please see the section on\n       Passing Arguments, below, for more information about these options.\n\nARX COMMANDLINE PROCESSING\n       For all subcommands, when options overlap in their effect -- for  exam-\n       ple,  setting  the  output with -o -- the rightmost option takes prece-\n       dence.  Whenever -h, -? or --help is present on the command line,  help\n       is displayed and the program exits.\n\n       When  paths  are  specified on an arx command line, they must be quali-\n       fied, starting with /, ./ or ../. This simplifies the command line syn-\n       tax, overall, without introducing troublesome ambiguities.\n\nTMPX\n       The tmpx subcommand bundles together archives, environment settings and\n       an executable or shell command in to a  Bourne-compatible  script  that\n       runs  the  command or executable in a temporary directory, after having\n       unpacked the archives and set the environment.\n\n       Any number of file path arguments may be specified; they will be inter-\n       preted  as  tar  archives  to include in bundled script. If - is given,\n       then STDIN will be included as an archive stream. If no  arguments  are\n       given,  it is assumed that no archives are desired and only the command\n       and environment are bundled.\n\n       The temporary directory created by the script  is  different  for  each\n       invocation,  with a name of the form /tmp/tmpx-\u003ctimestamp\u003e-\u003crandomhex\u003e.\n       The timestamp format is %Y.%m.%dT%H.%M.%SZ, in UTC.  One  happy  conse-\n       quence  of  this  is that earlier jobs sort ASCIIbetically before later\n       jobs. After execution, the temporary  directory  is  removed  (or  not,\n       depending on the -rm[10!_] family of options).\n\n          -rm0, -rm1, -rm_, -rm!\n                 By  default,  the  temporary  directory created by the script\n                 will be deleted no matter the exit status status of the task.\n                 These options cause a script to be generated that deletes the\n                 temporary directory only on success, only on failure,  always\n                 (the default) or never.\n\n          --shared\n                 Causes  the temporary directory to be identified by a hash of\n                 the ARX archive, instead of by date and time. Different  runs\n                 of  the same archive will share the same directory. Note that\n                 this implies shared state and every disadvantage thereof.\n\n          -b \u003csize\u003e\n                 Please see the documentation for  this  option,  shared  with\n                 shdat, below.\n\n          -o \u003cpath\u003e\n                 By  default, the generated script is sent to STDOUT. With -o,\n                 output is redirected to the given path.\n\n          -e \u003cpath\u003e\n                 Causes the file specified to be packaged as the  task  to  be\n                 run.  A  binary  executable, a Ruby script or a longish shell\n                 script all fit here.\n\n       In addition to these options, arguments of the form VAR=VALUE are  rec-\n       ognized  as  environment  mappings and stored away in the script, to be\n       sourced on execution.\n\n       Without -e, the tmpx subcommand tries to find the task to be run  as  a\n       sequence  of  arguments  delimited  by  a run of slashes. The following\n       forms are all recognized:\n\n          arx tmpx  ...some args... // ...command...\n          arx tmpx  ...some args... // ...command... // ...more args...\n          arx tmpx // ...command... // ...some args...\n\n       The slash runs must have the same number of slashes  and  must  be  the\n       longest  continuous  runs  of  slashes on the command line. The command\n       will be included as-is in a Bourne shell script.\n\nSHDAT\n       The shdat subcommand translates binary data in to a shell script  which\n       outputs  the binary data. The data is encoded in HERE documents in such\n       a way that data without NULs is not changed and that data with NULs  is\n       minimally  expanded:  about  1% for randomish data like compressed tar-\n       balls and about 10% in pathological cases.\n\n       The shdat subcommand can be given any number of paths,  which  will  be\n       concatenated in the order given. If no path is given, or if - is given,\n       then STDIN will be read.\n\n          -b \u003csize\u003e\n                 The size of data chunks to place in each HERE  document.  The\n                 argument  is  a positive integer followed by suffixes like B,\n                 K, KiB, M and MiB, in the manner of dd, head and  many  other\n                 tools.  The default is 4MiB.  This is unlikely to make a dif-\n                 ference for you unless the generated script is intended to be\n                 run on a memory-constrained system.\n\n          -o \u003cpath\u003e\n                 By  default, the generated script is sent to STDOUT. With -o,\n                 output is redirected to the given path.\n\nEXAMPLES\n          # Installer script that preserves failed builds.\n          git archive HEAD | bzip2 | arx tmpx -rm0 - // make install \u003e go.sh\n          # Now install as root; but don't log in as root.\n          cat ./go.sh | ssh joey@hostname sudo /bin/sh\n\n          # Variation of the above.\n          git archive HEAD | bzip2 | arx tmpx -rm0 - -e ./build-script.py \u003e go.sh\n\n          # Bundle an instance of an application with DB credentials and run it.\n          arx tmpx -rm! ./app.tbz ./stage-info.tgz // rake start | ssh ...\n\n          # Get dump of linking info for build that works here but not there.\n          arx tmpx ./server-build.tgz LD_DEBUG=files // ./bin/start | ssh ...\n\n          # Test out Cabal source distribution of this package:\n          arx tmpx // 'cd arx-* \u0026\u0026 cabal configure \u0026\u0026 cabal build' // \\\n                   -rm0 ./dist/arx-0.0.0.tar.gz | sh\n\nPASSING ARGUMENTS TO GENERATED SCRIPTS\n       The scripts generated by tmpx treat some arguments as special, internal\n       options,  to allow for inspecting them should there be a need to deter-\n       mine their contents.\n\n          --extract\n                 Unpack the data in the present directory and do nothing else.\n\n          --no-rm\n                 Run the script as normal but do not delete the generated tem-\n                 porary directory.\n\n          --no-run\n                 Unpack into a temporary directory as normal but  do  not  run\n                 the user's command.\n\n       To  prevent arguments from being specially treated, use // in the argu-\n       ment list:\n\n          a-tmpx-script.sh --no-rm // a b c --extract\n\n       In the above example, --extract will be passed to the inner command, in\n       the same way as a, b, c. The following example causes ab, c and --no-rm\n       to be printed one after another, each on their own line.\n\n          arx tmpx // printf \"'%s\\n'\" '\"$@\"' | sh -s // ab c --no-rm\n\nNOTES\n       The timestamp is not the common ISO  8601  format,  %Y-%m-%dT%H:%M:%SZ,\n       because  of software and build processes that attach special meaning to\n       colons in pathnames.\n\nBUGS\n       The command line parser offers no hints or help of any kind;  it  fails\n       with  the simple message \"argument error\". The two most common mistakes\n       I make are:\n\n       o Not qualifying paths with /, ./ or ../.\n\n       o Not specifying a subcommand (tmpx or shdat).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsolidsnack%2Farx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsolidsnack%2Farx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsolidsnack%2Farx/lists"}