diff --git a/0007-restore-env-after-selinux-status-changes.patch b/0007-restore-env-after-selinux-status-changes.patch new file mode 100644 index 0000000..857d6ff --- /dev/null +++ b/0007-restore-env-after-selinux-status-changes.patch @@ -0,0 +1,156 @@ +From 48c8515627514e7d3556ae315cdb9db009b23f9b Mon Sep 17 00:00:00 2001 +From: xyn-coder +Date: Tue, 15 Mar 2022 15:21:51 +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 100644 isomaker/env_record.sh + create mode 100644 isomaker/env_restore.sh + +diff --git a/isomaker/env_record.sh b/isomaker/env_record.sh +new file mode 100644 +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 100644 +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 9135b39..5e956c7 100644 +--- 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 c5d85fb..9fa8e08 100644 +--- 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_oe_main() + return 0 + } + ++env_record ++ + mk_oe_main "$@" +-if [ $? -ne 0 ]; then ++main_ret="$?" ++ ++env_restore ++ ++if [ "$main_ret" -ne 0 ]; then + echo "make iso failed" + exit 1 + fi +-- +2.27.0 + diff --git a/oemaker.spec b/oemaker.spec index 49b859e..3ec7ce1 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.3 -Release: 3 +Release: 4 BuildRoot: %{_tmppath}/%{name} Source: https://gitee.com/openeuler/oemaker/repository/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz @@ -30,6 +30,7 @@ Patch0003: 0003-change-for-edge-computing.patch Patch0004: 0004-bugfix-I3OGUT.patch Patch0005: 0005-add-fpi_tail-param-for-grub.patch Patch0006: 0006-support-usb-flash-drive-mode.patch +Patch0007: 0007-restore-env-after-selinux-status-changes.patch %description a building tool for DVD ISO making and ISO cutting @@ -75,6 +76,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/ @@ -131,6 +134,11 @@ rm -rf %{buildroot} rm -rf $RPM_BUILD_DIR/%{name} %changelog +* Tue Mar 15 2022 xiangyuning - 2.0.3-4 +- ID:NA +- SUG:NA +- DESC: restore env after selinux status changes + * Mon Feb 14 2022 wangchong <952173335@qq.com> - 2.0.3-3 - ID:NA - SUG:NA