diff --git a/epkg-0.1.0.tar.gz b/epkg-0.1.0.tar.gz deleted file mode 100644 index b648f50170659230a8a7459b4805b92bd0293ec8..0000000000000000000000000000000000000000 Binary files a/epkg-0.1.0.tar.gz and /dev/null differ diff --git a/epkg-0.2.0.tar.gz b/epkg-0.2.0.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..fb719f59ad7ee010667f00fcbb2cea008ea3f228 Binary files /dev/null and b/epkg-0.2.0.tar.gz differ diff --git a/epkg.spec b/epkg.spec index e6adaff4c52545adaf5ee9e0be9e788981cfe8a3..cec3cdc3e872c1ce630301d2f1cfbbebcf5702dd 100644 --- a/epkg.spec +++ b/epkg.spec @@ -1,6 +1,6 @@ Name: epkg -Version: 0.1.0 -Release: 1 +Version: 0.2.0 +Release: 5 Summary: A new type of software package License: MulanPSL-2.0+ URL: https://gitee.com/openeuler/epkg @@ -17,8 +17,14 @@ Requires: coreutils, tar %description epkg is a new type of software package format developed by the openEuler community. It supports multiple environments and versions, addressing software package compatibility issues. -%global epkg_cache /opt/epkg/cache -%global epkg_common /opt/epkg/users/public/envs/common/ +# Global path definitions +%global opt_epkg /opt/epkg +%global cache_root %{opt_epkg}/cache +%global store_root %{opt_epkg}/store +%global common_root %{opt_epkg}/users/public/envs/common +%global pkg_cache %{opt_epkg}/cache/packages +%global channel_cache %{opt_epkg}/cache/channel +%global rc_path /etc/profile.d/epkg.sh %prep %setup -q -b 0 -n %{name}-%{version} @@ -26,23 +32,88 @@ epkg is a new type of software package format developed by the openEuler communi %install rm -rf %{buildroot} -mkdir -p %{buildroot}%{epkg_cache} -mv %{_builddir}/%{name}-%{version}/ %{buildroot}%{epkg_cache}/epkg-manager/ -mv %{_builddir}/rootfs/epkg-%{_arch} %{buildroot}%{epkg_cache}/ -mv %{_builddir}/rootfs/epkg-rootfs-%{_arch}.tar.gz %{buildroot}%{epkg_cache}/ -mv %{_builddir}/rootfs/epkg-helper-%{_arch} %{buildroot}%{epkg_cache}/ -mv %{_builddir}/rootfs/epkg-hash-%{_arch} %{buildroot}%{epkg_cache}/ -mv %{_builddir}/rootfs/elf-loader-%{_arch} %{buildroot}%{epkg_cache}/ + +# create directory structure +mkdir -p %{buildroot}%{cache_root} +mkdir -p %{buildroot}%{pkg_cache} +mkdir -p %{buildroot}%{channel_cache} +mkdir -p %{buildroot}%{store_root} +mkdir -p %{buildroot}%{common_root}/profile-1/usr/{app-bin,bin,sbin,lib,lib64} +mkdir -p %{buildroot}%{common_root}/profile-1/etc/epkg +cd %{buildroot}%{common_root}/profile-1 +ln -sT usr/bin bin +ln -sT usr/sbin sbin +ln -sT usr/lib lib +ln -sT usr/lib64 lib64 +cd %{buildroot}%{common_root}/ +ln -sT profile-1 profile-current + +# mv to cache +mv %{_builddir}/%{name}-%{version}/ %{buildroot}%{cache_root}/epkg-manager/ +mv %{_builddir}/rootfs/epkg-%{_arch} %{buildroot}%{cache_root}/ +mv %{_builddir}/rootfs/epkg-rootfs-%{_arch}.tar.gz %{buildroot}%{cache_root}/ +mv %{_builddir}/rootfs/epkg-helper-%{_arch} %{buildroot}%{cache_root}/ +mv %{_builddir}/rootfs/epkg-hash-%{_arch} %{buildroot}%{cache_root}/ +mv %{_builddir}/rootfs/elf-loader-%{_arch} %{buildroot}%{cache_root}/ + +# unpack +cp -a %{buildroot}%{cache_root}/epkg-manager/bin %{buildroot}%{common_root}/profile-1/usr/ +cp -a %{buildroot}%{cache_root}/epkg-manager/lib/epkg %{buildroot}%{common_root}/profile-1/usr/lib/ +cp %{buildroot}%{cache_root}/epkg-manager/channel.json %{buildroot}%{common_root}/profile-1/etc/epkg/ +cp %{buildroot}%{cache_root}/epkg-manager/channel/openEuler-24.03-LTS-channel.yaml %{buildroot}%{common_root}/profile-1/etc/epkg/channel.yaml +cp -a %{buildroot}%{cache_root}/epkg-manager/build %{buildroot}%{opt_epkg}/ +cp %{buildroot}%{cache_root}/epkg-%{_arch} %{buildroot}%{common_root}/profile-1/usr/bin/epkg +cp %{buildroot}%{cache_root}/epkg-hash-%{_arch} %{buildroot}%{common_root}/profile-1/usr/bin/epkg-hash +cp %{buildroot}%{cache_root}/elf-loader-%{_arch} %{buildroot}%{common_root}/profile-1/usr/bin/elf-loader +cp %{buildroot}%{cache_root}/epkg-helper-%{_arch} %{buildroot}%{common_root}/profile-1/usr/bin/epkg-helper + +# chmod +chmod -R 755 %{buildroot}%{opt_epkg} +chmod 4755 %{buildroot}%{common_root}/profile-1/usr/bin/epkg +chmod 4755 %{buildroot}%{common_root}/profile-1/usr/bin/epkg-helper %post -sh %{epkg_cache}/epkg-manager/bin/rpm-installer.sh +# Add epkg environment configuration to system profile +mkdir -p $(dirname %{rc_path}) +cat << EOF >> %{rc_path} + +# epkg begin +source %{common_root}/profile-current/usr/lib/epkg/epkg-rc.sh +# epkg end +EOF %postun -sh %{epkg_common}/profile-1/usr/bin/epkg-uninstaller.sh +# Remove epkg directories +rm -rf %{opt_epkg} +rm -rf %{rc_path} + +# Get all users including root +all_users=$(getent passwd | awk -F: '$3 >= 1000 {print $1 ":" $6}') +all_users=$(echo "$all_users" | grep -v '^nobody:') +all_users="$all_users root:/root" + +for t_user in $all_users; do + IFS=':' read -r user home <<< "$t_user" + if [ -d "$home/.epkg/" ]; then + rm -rf "$home/.epkg/" + fi + if [ -d "$home/.cache/epkg/" ]; then + rm -rf "$home/.cache/epkg/" + fi + if [ -f "$home/.bashrc" ]; then + if grep -q '# epkg begin' "$home/.bashrc" && grep -q '# epkg end' "$home/.bashrc"; then + sed -i '/# epkg begin/,/# epkg end/d' "$home/.bashrc" + fi + fi +done %files -%{epkg_cache}/ +%{opt_epkg}/ %changelog +* Fri Mar 7 2025 rkingkoyo - 0.2.0-5 +- Update version to 0.2.0 +- update epkg.spec + * Tue Feb 25 2025 rkingkoyo - 0.1.0-1 - Initial package release \ No newline at end of file diff --git a/rootfs.tar.gz b/rootfs.tar.gz index 48f9a9c1a09efa90b7a688feb41efde664627734..fe274ba79075d16d35578e4bfa5da55ffe0dfcdc 100644 Binary files a/rootfs.tar.gz and b/rootfs.tar.gz differ