Summary:  %APP_NAME% micro service
Name: %APP_NAME%
Version: stable
Release: l
License: user EULA
Source: %APP_NAME%-%VERSION%.tgz
Group: utimes/microservice
BuildRoot: /tmp

%define __debug_install_post   \
   %{_rpmconfigdir}/find-debuginfo.sh %{?_find_debuginfo_opts} "%{_builddir}/%{?buildsubdir}"\
%{nil}

%description
%prep
%setup -c

%install
echo %VERSION%
mkdir -p ${RPM_BUILD_ROOT}/opt/%SERVICE_NAME%/bin
install ./%APP_NAME% ${RPM_BUILD_ROOT}/opt/%SERVICE_NAME%/bin

mkdir -p ${RPM_BUILD_ROOT}/etc/init.d/
install ./sh/app ${RPM_BUILD_ROOT}/etc/init.d/%SERVICE_NAME% 

mkdir -p ${RPM_BUILD_ROOT}/etc/%SERVICE_NAME%/lib/
install ./sh/init-multi-mode ${RPM_BUILD_ROOT}/etc/%SERVICE_NAME%/lib/
install ./sh/start-stop-functions ${RPM_BUILD_ROOT}/etc/%SERVICE_NAME%/lib/
install ./conf/app.conf ${RPM_BUILD_ROOT}/etc/%SERVICE_NAME%/app.conf
install ./gitlog ${RPM_BUILD_ROOT}/etc/%SERVICE_NAME%/
install ./conf/microsoft.ttf ${RPM_BUILD_ROOT}/etc/%SERVICE_NAME%/
install ./conf/mplus-1p-bold.ttf ${RPM_BUILD_ROOT}/etc/%SERVICE_NAME%/

mkdir -p  ${RPM_BUILD_ROOT}/etc/%SERVICE_NAME%/swagger
cp -a swagger/* ${RPM_BUILD_ROOT}/etc/%SERVICE_NAME%/swagger

mkdir -p ${RPM_BUILD_ROOT}/usr/lib/systemd/system/
install ./conf/%SERVICE_NAME%.service ${RPM_BUILD_ROOT}/usr/lib/systemd/system/

%files
/opt/%SERVICE_NAME%/bin/%APP_NAME%
/etc/init.d/%SERVICE_NAME%
/etc/%SERVICE_NAME%/lib/start-stop-functions
/etc/%SERVICE_NAME%/lib/init-multi-mode
/etc/%SERVICE_NAME%/swagger
/etc/%SERVICE_NAME%/app.conf
/etc/%SERVICE_NAME%/gitlog
/etc/%SERVICE_NAME%/microsoft.ttf
/etc/%SERVICE_NAME%/mplus-1p-bold.ttf
/usr/lib/systemd/system/%SERVICE_NAME%.service

