template unprivileged launcher
This commit is contained in:
parent
6137b1c0a8
commit
b2288e27c0
|
@ -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');
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue