From e7826e4107dc5b7e01b3b1337eaff4939d5229b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Walter=20H=C3=BCttenmeyer?= Date: Sun, 4 Aug 2019 12:38:45 +0200 Subject: [PATCH 1/3] add new portage paths added /var/db/repos/gentoo and /var/cache/distfiles to hard-coded list of excludes. Portage has moved (when?) according to https://wiki.gentoo.org/wiki//usr/portage --- mkstage4.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mkstage4.sh b/mkstage4.sh index d695c76..81fda1a 100755 --- a/mkstage4.sh +++ b/mkstage4.sh @@ -147,7 +147,9 @@ EXCLUDES="\ --exclude=${TARGET}var/lock/* \ --exclude=${TARGET}var/log/* \ --exclude=${TARGET}var/run/* \ ---exclude=${TARGET}var/lib/docker/*" +--exclude=${TARGET}var/lib/docker/* \ +--exclude=${TARGET}var/db/repos/gentoo/* \ +--exclude=${TARGET}var/cache/distfiles/*" EXCLUDES+=$USER_EXCL From ac688d0b970e28c9584cef8d72c678eeb5fff965 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Walter=20H=C3=BCttenmeyer?= Date: Sun, 4 Aug 2019 22:28:22 +0200 Subject: [PATCH 2/3] Added portageq logic Added portageq logic to detect where portage stores its tree and distfiles. If this fails, fall back to a default list declared in EXCLUDES_DEFAULT_PORTAGE --- mkstage4.sh | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/mkstage4.sh b/mkstage4.sh index 81fda1a..8c34f9e 100755 --- a/mkstage4.sh +++ b/mkstage4.sh @@ -16,6 +16,13 @@ USER_EXCL="" S_KERNEL=0 x86_64=0 PARALLEL=0 +HAS_PORTAGEQ=0 + +if [ `which portageq` ] +then + HAS_PORTAGEQ=1 +fi + if [ `getconf LONG_BIT` = "64" ] then x86_64=1 @@ -143,20 +150,30 @@ EXCLUDES="\ --exclude=${TARGET}run/* \ --exclude=${TARGET}sys/* \ --exclude=${TARGET}tmp/* \ ---exclude=${TARGET}usr/portage/* \ --exclude=${TARGET}var/lock/* \ --exclude=${TARGET}var/log/* \ --exclude=${TARGET}var/run/* \ ---exclude=${TARGET}var/lib/docker/* \ ---exclude=${TARGET}var/db/repos/gentoo/* \ ---exclude=${TARGET}var/cache/distfiles/*" +--exclude=${TARGET}var/lib/docker/* " +EXCLUDES_DEFAULT_PORTAGE="\ + --exclude=${TARGET}var/db/repos/gentoo/* \ + --exclude=${TARGET}var/cache/distfiles/* \ + --exclude=${TARGET}usr/portage/*" EXCLUDES+=$USER_EXCL if [ "$TARGET" == "/" ] then EXCLUDES+=" --exclude=${STAGE4_FILENAME#/}" + if [ ${HAS_PORTAGEQ} == 1 ] + then + EXCLUDES+=" --exclude=$(portageq get_repo_path / gentoo)/*" + EXCLUDES+=" --exclude=$(portageq distdir)/*" + else + EXCLUDES+="${EXCLUDES_DEFAULT_PORTAGE}" + fi +else + EXCLUDES+="${EXCLUDES_DEFAULT_PORTAGE}" fi if [ ${EXCLUDE_CONNMAN} -eq 1 ] From 50bcfbae559e2afc90d634fd7180af13929f8f6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Walter=20H=C3=BCttenmeyer?= Date: Thu, 22 Aug 2019 21:05:31 +0200 Subject: [PATCH 3/3] add check for failed user-excludes user-excludes are checked for their existance and in case they do not exist (typo) a warning message is displayed. --- mkstage4.sh | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/mkstage4.sh b/mkstage4.sh index 8c34f9e..30547e7 100755 --- a/mkstage4.sh +++ b/mkstage4.sh @@ -13,6 +13,7 @@ EXCLUDE_CONNMAN=0 EXCLUDE_LOST=0 QUIET=0 USER_EXCL="" +USER_EXCL_FAILED="" S_KERNEL=0 x86_64=0 PARALLEL=0 @@ -65,7 +66,12 @@ while getopts ':t:e:skqcblph' flag; do EXCLUDE_LOST=1 ;; e) - USER_EXCL+=" --exclude=${OPTARG}" + if [ -e ${OPTARG} ] + then + USER_EXCL+=" --exclude=${OPTARG}" + else + USER_EXCL_FAILED+="${OPTARG} " + fi ;; p) PARALLEL=1 @@ -206,6 +212,20 @@ else TAR_OPTIONS+=" -j" fi +if [ -n "$USER_EXCL_FAILED" ] +then + echo -e "\e[33;1mWARNING:\e[0;1m Following user-specified exclude object(s) were not found: \e[0m${USER_EXCL_FAILED}" + echo "Continue anyway?" + echo -n "Type \"yes\" to continue or anything else to quit: " + read AGREE_MISMATCH + if [ "$AGREE_MISMATCH" != "yes" ] + then + exit 0 + else + echo "" + fi +fi + # if not in quiet mode, this message will be displayed: if [ "$AGREE" != "yes" ] then