diff --git a/0006-restore-env-after-selinux-status-changes.patch b/0006-restore-env-after-selinux-status-changes.patch new file mode 100644 index 0000000000000000000000000000000000000000..04f8f275f6185d2df0b0b3bfc7dd52ccded6b1d0 --- /dev/null +++ b/0006-restore-env-after-selinux-status-changes.patch @@ -0,0 +1,156 @@ +From 49ca6e3a1d13529baef3202b93ef4e5b905ed22f Mon Sep 17 00:00:00 2001 +From: xyn-coder +Date: Wed, 16 Mar 2022 09:24:40 +0800 +Subject: [PATCH] restore env after selinux status changes + +--- + isomaker/env_record.sh | 49 +++++++++++++++++++++++++++++++++++++++++ + isomaker/env_restore.sh | 30 +++++++++++++++++++++++++ + isomaker/img_repo.sh | 3 +++ + isomaker/oemaker.sh | 9 +++++++- + 4 files changed, 90 insertions(+), 1 deletion(-) + create mode 100755 isomaker/env_record.sh + create mode 100755 isomaker/env_restore.sh + +diff --git a/isomaker/env_record.sh b/isomaker/env_record.sh +new file mode 100755 +index 0000000..e52495b +--- /dev/null ++++ b/isomaker/env_record.sh +@@ -0,0 +1,49 @@ ++:<> /etc/profile ++ fi ++ ++ echo "the current env has been recorded. " ++ echo "If oemaker run failed, run the following cmd restore current env" ++ echo "sh ${CPATH}/env_restore.sh" ++} ++ ++ ++function env_restore() ++{ ++ sh "${CPATH}"/env_restore.sh ++} +diff --git a/isomaker/env_restore.sh b/isomaker/env_restore.sh +new file mode 100755 +index 0000000..15f6311 +--- /dev/null ++++ b/isomaker/env_restore.sh +@@ -0,0 +1,30 @@ ++:<> /dev/null ++ if [ "$SELINUX_FLAG" -eq 0 ] || [ "$SELINUX_FLAG" -eq 1 ]; then ++ setenforce "${SELINUX_FLAG}" ++ else ++ echo "/etc/profile have no value: SELINUX_FLAG" ++ fi ++} ++ ++env_restore +diff --git a/isomaker/img_repo.sh b/isomaker/img_repo.sh +index cfb35f8..85a9efe 100755 +--- a/isomaker/img_repo.sh ++++ b/isomaker/img_repo.sh +@@ -35,12 +35,15 @@ function create_install_img() + else + vertmp=${VERSION} + fi ++ ++ set +e + lorax --isfinal -p "${PRODUCT}" -v "${vertmp}" -r "${RELEASE}" -t "${VARIANT}" --sharedir 80-openeuler --rootfs-size=4 --buildarch="$ARCH" $(cat yumrepo.file) --nomacboot --noupgrade "${BUILD}"/iso > lorax.logfile 2>&1 + + if [ $? != 0 ] ; then + cat lorax.logfile + exit 1 + fi ++ set -e + } + + function create_repos() +diff --git a/isomaker/oemaker.sh b/isomaker/oemaker.sh +index 37196e5..3150713 100755 +--- a/isomaker/oemaker.sh ++++ b/isomaker/oemaker.sh +@@ -29,6 +29,7 @@ source "${CPATH}"/iso.sh + source "${CPATH}"/rpm.sh + source "${CPATH}"/img_repo.sh + source "${CPATH}"/make_debug.sh ++source "${CPATH}"/env_record.sh + + function mkclean() + { +@@ -156,8 +157,14 @@ function mk_euleros_main() + return 0 + } + ++env_record ++ + mk_euleros_main "$@" +-if [ $? -ne 0 ]; then ++main_ret="$?" ++ ++env_restore ++ ++if [ "$main_ret" -ne 0 ]; then + echo "make iso failed" + exit 1 + fi +-- +2.33.0 + diff --git a/oemaker.spec b/oemaker.spec index 8d329a1a3e6c7000286a9f687f590debe1700c49..8268083a8c0048b3e154a9d5ed4915a0caea40a3 100644 --- a/oemaker.spec +++ b/oemaker.spec @@ -11,7 +11,7 @@ Summary: a duilding tool for DVD ISO making and ISO cutting License: Mulan PSL v2 Group: System/Management Version: 2.0.0 -Release: 19 +Release: 20 BuildRoot: %{_tmppath}/%{name} Source: https://gitee.com/openeuler/oemaker/repository/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz @@ -29,6 +29,7 @@ Patch0002: 0002-bugfix-I3QY98.patch Patch0003: 0003-change-for-edge-computing.patch Patch0004: 0004-bugfix-I3OGUT.patch Patch0005: 0005-support-usb-flash-drive-mode.patch +Patch0006: 0006-restore-env-after-selinux-status-changes.patch %description a building tool for DVD ISO making and ISO cutting @@ -74,6 +75,8 @@ install -m 700 %{name}/isomaker/img_repo.sh %{buildroot}/opt/oemaker/img_repo.sh install -m 700 %{name}/isomaker/init.sh %{buildroot}/opt/oemaker/init.sh install -m 700 %{name}/isomaker/iso.sh %{buildroot}/opt/oemaker/iso.sh install -m 700 %{name}/isomaker/rpm.sh %{buildroot}/opt/oemaker/rpm.sh +install -m 700 %{name}/isomaker/env_record.sh %{buildroot}/opt/oemaker/env_record.sh +install -m 700 %{name}/isomaker/env_restore.sh %{buildroot}/opt/oemaker/env_restore.sh install -m 400 %{name}/isomaker/config/rpmlist.xml %{buildroot}/opt/oemaker/config/rpmlist.xml install -m 400 %{name}/isomaker/config/x86_64/* %{buildroot}/opt/oemaker/config/x86_64/ install -m 400 %{name}/isomaker/config/aarch64/* %{buildroot}/opt/oemaker/config/aarch64/ @@ -130,6 +133,11 @@ rm -rf %{buildroot} rm -rf $RPM_BUILD_DIR/%{name} %changelog +* Wed Mar 16 2022 xiangyuning - 2.0.0-20 +- ID:NA +- SUG:NA +- DESC: restore env after selinux status changes + * Wed Feb 23 2022 imxcc - 2.0.0-19 - ID:NA - SUG:NA