template unprivileged launcher

This commit is contained in:
AJ ONeal 2018-06-24 01:18:59 -06:00
parent 6137b1c0a8
commit b2288e27c0
1 changed files with 5 additions and 0 deletions

View File

@ -11,6 +11,9 @@ var files = [
, [ (process.env.TELEBIT_PLIST_TPL || path.join(__dirname, 'dist/Library/LaunchDaemons/cloud.telebit.remote.plist.tpl'))
,(process.env.TELEBIT_PLIST || path.join(__dirname, 'dist/Library/LaunchDaemons/cloud.telebit.remote.plist'))
]
, [ (process.env.TELEBIT_USER_PLIST_TPL || path.join(__dirname, 'dist/etc/skel/Library/LaunchAgents/cloud.telebit.remote.plist.tpl'))
,(process.env.TELEBIT_USER_PLIST || path.join(__dirname, 'dist/etc/skel/Library/LaunchAgents/cloud.telebit.remote.plist'))
]
];
var vars = {
telebitPath: process.env.TELEBIT_PATH || path.resolve(__dirname, '../..')
@ -21,6 +24,7 @@ var vars = {
, ].join(' ')
, telebitUser: process.env.TELEBIT_USER || os.userInfo().username
, telebitGroup: process.env.TELEBIT_GROUP || ('darwin' === os.platform() ? 'staff' : os.userInfo().username)
, telebitConfig: process.env.TELEBIT_CONFIG || path.join(os.homedir(), '.config/telebit/telebitd.yml')
};
files.forEach(function (f) {
var text = fs.readFileSync(f[0], 'utf8')
@ -28,6 +32,7 @@ files.forEach(function (f) {
.replace(/{TELEBIT_USER}/g, vars.telebitUser)
.replace(/{TELEBIT_GROUP}/g, vars.telebitGroup)
.replace(/{TELEBIT_RW_DIRS}/g, vars.telebitRwDirs)
.replace(/{TELEBIT_CONFIG}/g, vars.telebitConfig)
;
fs.writeFileSync(f[1], text, 'utf8');
});