{"action":"created","issue":{"url":"https://api.github.com/repos/borgbackup/borg/issues/700","repository_url":"https://api.github.com/repos/borgbackup/borg","labels_url":"https://api.github.com/repos/borgbackup/borg/issues/700/labels{/name}","comments_url":"https://api.github.com/repos/borgbackup/borg/issues/700/comments","events_url":"https://api.github.com/repos/borgbackup/borg/issues/700/events","html_url":"https://github.com/borgbackup/borg/issues/700","id":137180506,"number":700,"title":"Add option to pass parameters to remote borg cmdline","user":{"login":"manwegit","id":5763495,"avatar_url":"https://avatars.githubusercontent.com/u/5763495?v=3","gravatar_id":"","url":"https://api.github.com/users/manwegit","html_url":"https://github.com/manwegit","followers_url":"https://api.github.com/users/manwegit/followers","following_url":"https://api.github.com/users/manwegit/following{/other_user}","gists_url":"https://api.github.com/users/manwegit/gists{/gist_id}","starred_url":"https://api.github.com/users/manwegit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/manwegit/subscriptions","organizations_url":"https://api.github.com/users/manwegit/orgs","repos_url":"https://api.github.com/users/manwegit/repos","events_url":"https://api.github.com/users/manwegit/events{/privacy}","received_events_url":"https://api.github.com/users/manwegit/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-02-29T08:10:46Z","updated_at":"2016-02-29T12:21:31Z","closed_at":"2016-02-29T12:21:31Z","body":"We are building a backup system with multiple borg repositories at the remote end.\r\nUser home directory is not writeable so BORG_CACHE_DIR needs to be set on the remote side per backup repository. \r\nNew repositories are created dynamically so adding individual authorized_keys lines is not a feasible option nor is using custom script for each setup (going about thousand repositories at the moment).\r\n\r\nI propose that new non-functional (in sense of borg) argument to be added that is passed to the remote server as cmdline option or ENV variable. This could then be used by the borg-wrapper script to set what ever is needed for the repository before running actual borg cmd on the remote. \r\nBorg-binary on the remote would simply ignore said argument.\r\n\r\nI have a working workaround which is hack.\r\n\r\n`# client:`\r\n```\r\nexport BORG_RSH=\"ssh ${TARGETUSER}@${TARGETSERVER} env BORG_CACHE_DIR=/backup/test/cache  /backup/borgrun \"\r\n\r\nborg init --remote-path=\"\"  ${TARGETUSER}@${TARGETSERVER}:/backup/test/repo\r\n\r\nborg create --remote-path=\"\"  ${TARGETUSER}@${TARGETSERVER}:/backup/test/repo::archive .\r\n```\r\n\r\n`# remote, borgrun - wrapper`\r\n```\r\n#!/bin/bash\r\n## shift out borg provided user/host string to ssh\r\nshift\r\nexec borg \"$@\"\r\n```\r\n\r\nAnd here is how it could work:\r\n\r\nWith new parameter `--serve-option` \r\n`client:`\r\n`borg create --remote-path=\"/backup/borgrun\" --serve-option=\"/backup/test/cache\"  ${TARGETUSER}@${TARGETSERVER}:/backup/test/repo::archive .`\r\n\r\n`# remote, borgrun - wrapper`\r\n```\r\n#!/bin/bash\r\n\r\n#read option\r\n# set cacherdir etc\r\n\r\nexec borg \"$@\"\r\n```\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/borgbackup/borg/issues/comments/190190582","html_url":"https://github.com/borgbackup/borg/issues/700#issuecomment-190190582","issue_url":"https://api.github.com/repos/borgbackup/borg/issues/700","id":190190582,"user":{"login":"manwegit","id":5763495,"avatar_url":"https://avatars.githubusercontent.com/u/5763495?v=3","gravatar_id":"","url":"https://api.github.com/users/manwegit","html_url":"https://github.com/manwegit","followers_url":"https://api.github.com/users/manwegit/followers","following_url":"https://api.github.com/users/manwegit/following{/other_user}","gists_url":"https://api.github.com/users/manwegit/gists{/gist_id}","starred_url":"https://api.github.com/users/manwegit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/manwegit/subscriptions","organizations_url":"https://api.github.com/users/manwegit/orgs","repos_url":"https://api.github.com/users/manwegit/repos","events_url":"https://api.github.com/users/manwegit/events{/privacy}","received_events_url":"https://api.github.com/users/manwegit/received_events","type":"User","site_admin":false},"created_at":"2016-02-29T12:21:31Z","updated_at":"2016-02-29T12:21:31Z","body":"Never mind. Can be achieved with --remote-path and no extra params are needed.. brain freeze with the earlier solution.\r\n--remote-path=\"env BORG_CACHE_DIR=/backup/test/cache  /backup/borgrun\" "}}