File opsi-gel.spec of Package opsi-gel

%global __os_install_post %{nil}
Summary: opsi-gel
Name: opsi-gel
Version: 6.11
Release: 1
Group: Productivity/Networking/opsi
License: Apache-2.0
URL: https://www.opsi.org
Vendor: uib GmbH <info@uib.de>
Packager: uib GmbH <info@uib.de>
Source: opsi-gel_6.11-1.tar.gz
BuildRoot: %{_tmppath}/opsi-gel-6.11-1-build
Source1: opsi-gel.rpmlintrc
BuildRequires: systemd
AutoReqProv: no

%description
Gel for opsi

%global debug_package %{nil}
%clean

%prep

%setup -n opsi-gel-6.11

%define _build_id_links none
%build

%install
>INSTALLED_FILES
tftpboot_dir="/tftpboot"
if [ -n "%{?suse_version}" ]; then
   tftpboot_dir="/var/lib/tftpboot"
fi
sys_arch_alt="unset"
if [ "%{_arch}" = "x86_64" ]; then
   sys_arch="amd64"
   sys_arch_alt="x64"
elif [ "%{_arch}" = "i386" ]; then
   sys_arch="i586"
elif [ "%{_arch}" = "i386" ]; then
   sys_arch="i586"
elif [ "%{_arch}" = "aarch64" ]; then
   sys_arch="arm64"
elif [ "%{_arch}" = "noarch" ]; then
   sys_arch="all"
fi
for rootfs in rootfs rootfs-${sys_arch} rootfs-${sys_arch_alt}; do
   if [ -d ${rootfs} ]; then
      find  ${rootfs} -type d -print0 | while read -d $'\0' file; do
         dst=$(echo $file | sed s"#^${rootfs}##;s#^/tftpboot#${tftpboot_dir}#")
         [ "$dst" == "" ] && continue
         mkdir -p "${RPM_BUILD_ROOT}${dst}"
         [ "$dst" == "/usr/bin" -o "$dst" == "/usr/lib" ] && continue
         echo "%dir \"${dst}\"" >>INSTALLED_FILES
      done
      find ${rootfs} -not -type d -print0 | while read -d $'\0' file; do
         dst=$(echo $file | sed s"#^${rootfs}##;s#^/tftpboot#${tftpboot_dir}#")
         cp -a "$file" "${RPM_BUILD_ROOT}${dst}"
         if [[ $dst == /etc/logrotate.d/* ]]; then
            echo "%config \"${dst}\"" >>INSTALLED_FILES
         elif [[ $dst == /etc/* ]]; then
            echo "%config(noreplace) \"${dst}\"" >>INSTALLED_FILES
         else
            echo "\"${dst}\"" >>INSTALLED_FILES
         fi
      done
   fi
done
mkdir -p %{buildroot}%{_unitdir}
for unit in systemd_units/*; do
   install -D -m 0644 $unit %{buildroot}%{_unitdir}/
   echo "\"%{_unitdir}/$(basename $unit)\"" >>INSTALLED_FILES
done
INSTALLED_FILES="$(echo $INSTALLED_FILES | tr " " "\n" | sort -u)"
cat INSTALLED_FILES

%files -f INSTALLED_FILES
%defattr(-,root,root)

%pre 
#!/bin/bash -e
if ! getent group "opsi-gel" > /dev/null; then
  groupadd --system opsi-gel
fi
if ! getent passwd "opsi-gel" > /dev/null; then
  useradd --gid opsi-gel --home-dir /var/lib/opsi-gel --shell /bin/bash --system --comment 'Gel Server for opsi' opsi-gel
fi


%post 
#!/bin/bash -e
[ -z "${_EDGEDB_INSTALL_SKIP_BOOTSTRAP}" ] && [ -d /run/systemd/system ] && systemctl daemon-reload || true


%systemd_post %{name}.service

%systemd_preun %{name}.service

%systemd_postun_with_restart %{name}.service

%changelog
* Fri Sep 26 2025 Jan Schneider <j.schneider@uib.de> 6.11-1
- Changed: No public changes
openSUSE Build Service is sponsored by