%global npm_version 0.9.5-a Name: meshcommander Version: %(echo "%{npm_version}" | tr '-' '~') Release: %autorelease Summary: Intel AMT management console License: ASL 2.0 and BSD and ISC and MIT URL: https://www.meshcommander.com/meshcommander Source0: https://registry.npmjs.org/%{name}/-/%{name}-%{npm_version}.tgz Source1: %{name}-%{npm_version}-nm-prod.tgz Source2: %{name}-%{npm_version}-bundled-licenses.txt Source3: %{name}.service Source4: %{name}.sysusers Source5: %{name}.sysconfig BuildArch: noarch ExclusiveArch: %{nodejs_arches} noarch Requires: nodejs BuildRequires: nodejs-devel BuildRequires: sed BuildRequires: systemd-rpm-macros %description MeshCommander is an entirely web based remote management tool for Intel AMT computers. Built-in support for KVM, SOL and IDE-R along with logs, configuration options and much more means you have full access to Intel AMT features in a single place. %prep %setup -q -n package cp %{SOURCE2} . # Fix line endings sed -i 's/\r$//' bin/%{name} readme.txt # Remove useless bundled library and thumbnail cache # https://github.com/Ylianst/MeshCommander/pull/71 rm bin/Microsoft.NodejsTools.WebRole.dll public/images-commander/Thumbs.db %build # Setup bundled node modules tar xfz %{SOURCE1} mkdir -p node_modules pushd node_modules ln -s ../node_modules_prod/* . ln -s ../node_modules_prod/.bin . popd %install mkdir -p %{buildroot}%{nodejs_sitelib}/%{name} cp -pr package.json *.js public/ %{buildroot}%{nodejs_sitelib}/%{name} # Copy over bundled nodejs modules cp -pr node_modules node_modules_prod %{buildroot}%{nodejs_sitelib}/%{name} mkdir -p %{buildroot}%{nodejs_sitelib}/%{name}/bin install -Dpm0755 -t %{buildroot}%{nodejs_sitelib}/%{name}/bin bin/%{name} mkdir -p %{buildroot}%{_bindir} ln -sf %{nodejs_sitelib}/%{name}/bin/%{name} %{buildroot}%{_bindir}/%{name} # Install systemd unit install -Dpm0644 -t %{buildroot}%{_unitdir} %{SOURCE3} install -Dpm0644 %{SOURCE4} %{buildroot}%{_sysusersdir}/%{name}.conf install -Dpm0644 %{SOURCE5} %{buildroot}%{_sysconfdir}/sysconfig/%{name} %check %nodejs_symlink_deps --check %pre %sysusers_create_compat %{SOURCE4} %post %systemd_post %{name}.service %preun %systemd_preun %{name}.service %postun %systemd_postun_with_restart %{name}.service %files %doc readme.txt %license LICENSE %{name}-%{npm_version}-bundled-licenses.txt %{nodejs_sitelib}/%{name} %{_bindir}/%{name} %config(noreplace) %{_sysconfdir}/sysconfig/%{name} %{_sysusersdir}/%{name}.conf %{_unitdir}/%{name}.service %changelog %autochangelog