diff --git a/lib/clean.js b/lib/clean.js index 9aada2d..02a3a5b 100644 --- a/lib/clean.js +++ b/lib/clean.js @@ -7,7 +7,7 @@ module.exports = function (root, pkg) { var specsDirectory = files.specsDirectory(root); var sourcesDirectory = files.sourcesDirectory(root); - rimraf.sync(serviceFilePath); + // rimraf.sync(serviceFilePath); rimraf.sync(specsDirectory); rimraf.sync(sourcesDirectory); }; diff --git a/lib/serviceProperties.js b/lib/serviceProperties.js index f214cce..c4d3110 100644 --- a/lib/serviceProperties.js +++ b/lib/serviceProperties.js @@ -9,7 +9,7 @@ function getEnvironment(pkg) { } function getInstallDir(pkg) { - return _.get(pkg, 'spec.installDir', '/opt'); + return _.get(pkg, 'spec.installDir', '/opt/' + pkg.name); } module.exports = function (pkg) { diff --git a/lib/spec.js b/lib/spec.js index df4cc6e..f52bdd9 100644 --- a/lib/spec.js +++ b/lib/spec.js @@ -26,7 +26,7 @@ function getNoArch(pkg) { } function getInstallDir(pkg) { - return _.get(pkg, 'spec.installDir', '/opt'); + return _.get(pkg, 'spec.installDir', '/opt/' + pkg.name); } function getNodeVersion(pkg) { @@ -36,7 +36,7 @@ function getNodeVersion(pkg) { function getExecutableFiles(pkg) { var name = pkg.name; var executableFiles = _.get(pkg, 'spec.executable', []).map(function (file) { - return path.join(getInstallDir(pkg), name, file); + return path.join(getInstallDir(pkg), file); }); return { diff --git a/templates/spec.mustache b/templates/spec.mustache index 94d2907..676c8da 100644 --- a/templates/spec.mustache +++ b/templates/spec.mustache @@ -14,7 +14,6 @@ Release: %{release} {{/dist}} Summary: {{name}} -Group: Installation Script License: {{license}} Source: %{name}.tar.gz BuildRoot: %{buildroot} @@ -54,11 +53,11 @@ npm rebuild %pre getent group {{username}} >/dev/null || groupadd -r {{username}} -getent passwd {{username}} >/dev/null || useradd -r -g {{username}} -G {{username}} -d / -s /sbin/nologin -c "{{username}}" {{username}} +getent passwd {{username}} >/dev/null || useradd -r -g {{username}} -G {{username}} -d / -s /sbin/nologin {{username}} %install -mkdir -p %{buildroot}{{installDir}}/{{name}} -cp -r ./* %{buildroot}{{installDir}}/{{name}} +mkdir -p %{buildroot}{{installDir}} +cp -r ./* %{buildroot}{{installDir}} %post {{#postInstallCommands}} @@ -70,7 +69,7 @@ rm -rf %{buildroot} %files %defattr(644, {{username}}, {{username}}, 755) -{{installDir}}/{{name}} +{{installDir}} {{#hasExecutableFiles}} %defattr(755, {{username}}, {{username}}, 755) {{#executableFiles}}