mirror of
https://github.com/erenfro/gen2stage4.git
synced 2024-11-13 18:58:57 -05:00
Enable portage repositories to be included, by default, but allow quick exclusion with -p
This commit is contained in:
parent
b2a7748c0d
commit
8d23244e75
1 changed files with 15 additions and 7 deletions
22
gen2stage4
22
gen2stage4
|
@ -26,6 +26,7 @@ done
|
|||
optExcludeBoot=false
|
||||
optExcludeConfidential=false
|
||||
optExcludeLost=true
|
||||
optExcludePortage=false
|
||||
optQuiet=false
|
||||
optUserExclude=()
|
||||
optUserInclude=()
|
||||
|
@ -43,6 +44,7 @@ function showHelp() {
|
|||
echo "Options:"
|
||||
echo " -b excludes boot directory"
|
||||
echo " -c excludes some confidential files (currently only .bash_history and connman network lists)"
|
||||
echo " -p excludes portage repositories"
|
||||
echo " -k separately save current kernel modules and src (creates smaller targetArchives and saves decompression time)"
|
||||
echo " -l includes lost+found directory"
|
||||
echo " -q activates quiet mode (no confirmation)"
|
||||
|
@ -79,7 +81,7 @@ function errorMsg() {
|
|||
# reads options:
|
||||
tarArgs=()
|
||||
while [[ $# -gt 0 ]]; do
|
||||
while getopts ":t:C:e:i:skqcblh" flag; do
|
||||
while getopts ":t:C:e:i:skqcbplh" flag; do
|
||||
case "$flag" in
|
||||
t) targetPath="$OPTARG";;
|
||||
s) targetPath="/";;
|
||||
|
@ -88,6 +90,7 @@ while [[ $# -gt 0 ]]; do
|
|||
k) optSeperateKernel=true;;
|
||||
c) optExcludeConfidential=true;;
|
||||
b) optExcludeBoot=true;;
|
||||
p) optExcludePortage=true;;
|
||||
l) optExcludeLost=false;;
|
||||
e) optUserExclude+=("${OPTARG}");;
|
||||
i) optUserInclude+=("$OPTARG");;
|
||||
|
@ -183,11 +186,14 @@ tarExcludes=(
|
|||
|
||||
tarExcludesPortage=(
|
||||
"var/db/repos/*/*"
|
||||
"var/cache/distfiles/*"
|
||||
"var/cache/binpkgs/*"
|
||||
"usr/portage/*"
|
||||
)
|
||||
|
||||
if $optExcludePortage; then
|
||||
tarExcludesPortage+=("var/db/repos/*/*")
|
||||
fi
|
||||
|
||||
tarIncludes=(
|
||||
"dev/console"
|
||||
"dev/null"
|
||||
|
@ -199,11 +205,13 @@ tarIncludes=("${tarIncludes[@]/#/"$targetPath"}")
|
|||
if [[ "$targetPath" == '/' ]]; then
|
||||
tarExcludes+=("$(realpath "${stage4Filename}")*")
|
||||
if command -v portageq &>/dev/null; then
|
||||
portageRepos=$(portageq get_repos /)
|
||||
for i in ${portageRepos}; do
|
||||
repoPath=$(portageq get_repo_path / "${i}")
|
||||
tarExcludes+=("${repoPath}/*")
|
||||
done
|
||||
if $optExcludePortage; then
|
||||
portageRepos=$(portageq get_repos /)
|
||||
for i in ${portageRepos}; do
|
||||
repoPath=$(portageq get_repo_path / "${i}")
|
||||
tarExcludes+=("${repoPath}/*")
|
||||
done
|
||||
fi
|
||||
tarExcludes+=("$(portageq distdir)/*")
|
||||
tarExcludes+=("$(portageq pkgdir)/*")
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue