forked from mirrored-repos/manjaro-tools
rm useless code
This commit is contained in:
parent
74765564e7
commit
10acda52c8
2 changed files with 67 additions and 77 deletions
|
@ -73,13 +73,11 @@ else
|
|||
fi
|
||||
|
||||
clean_first=false
|
||||
clean_rundir=false
|
||||
namcap=false
|
||||
sign=false
|
||||
verbose=false
|
||||
nosystemd=false
|
||||
pretend=false
|
||||
is_profile=false
|
||||
clean_rundir=false
|
||||
repo=false
|
||||
|
||||
base_packages=('base-devel')
|
||||
|
@ -98,10 +96,9 @@ usage() {
|
|||
echo " -r <dir> Chroots directory [default: ${chroots}]"
|
||||
echo ' -c Clean chroot and pkg cache'
|
||||
echo ' -n Run namcap check'
|
||||
echo ' -q Pretend build'
|
||||
echo ' -w Wipe clean pkgbuild directory'
|
||||
echo ' -y Add packages to repo'
|
||||
echo ' -v Verbose'
|
||||
echo ' -q Query settings and pretend build'
|
||||
echo ' -x Use classic chroot instead of systemd-nspawn'
|
||||
echo ' Useful for testing if systemd is running to bypass autodetection'
|
||||
echo ' -h This help'
|
||||
|
@ -110,7 +107,7 @@ usage() {
|
|||
exit 1
|
||||
}
|
||||
|
||||
opts='p:a:b:r:cnvxqwyh'
|
||||
opts='p:a:b:r:cnxqwyh'
|
||||
|
||||
while getopts "${opts}" arg; do
|
||||
case "${arg}" in
|
||||
|
@ -120,9 +117,8 @@ while getopts "${opts}" arg; do
|
|||
r) chroots="$OPTARG" ;;
|
||||
c) clean_first=true ;;
|
||||
n) namcap=true;;
|
||||
v) verbose=true ;;
|
||||
x) nosystemd=true ;;
|
||||
q) pretend=true; verbose=true ;;
|
||||
q) pretend=true ;;
|
||||
w) clean_rundir=true ;;
|
||||
y) repo=true ;;
|
||||
h) usage ;;
|
||||
|
@ -155,64 +151,16 @@ mkchrootpkg_args+=(-b ${branch} -r ${chrootdir})
|
|||
|
||||
makepkg_args+=("${*:$OPTIND}")
|
||||
|
||||
if ${verbose};then
|
||||
msg "OPTARGS:"
|
||||
msg2 "arch: $arch"
|
||||
msg2 "branch: $branch"
|
||||
msg2 "chroots: $chroots"
|
||||
|
||||
msg "PATHS:"
|
||||
msg2 "chrootdir: $chrootdir"
|
||||
msg2 "profiledir: $profiledir"
|
||||
msg2 "pacman_conf: ${pacman_conf}"
|
||||
msg2 "makepkg_conf: $makepkg_conf"
|
||||
|
||||
msg "mkchroot:"
|
||||
msg2 "args: ${mkchroot_args[*]}"
|
||||
msg "makechrootpkg:"
|
||||
msg2 "args: ${mkchrootpkg_args[*]}"
|
||||
msg "makepkg:"
|
||||
msg2 "args: ${makepkg_args[*]}"
|
||||
|
||||
msg "FLAGS:"
|
||||
msg2 "clean_first: $clean_first"
|
||||
msg2 "namcap: ${namcap}"
|
||||
msg2 "nosystemd: $nosystemd"
|
||||
msg2 "clean_rundir: $clean_rundir"
|
||||
msg2 "repo: ${repo}"
|
||||
|
||||
msg "PKG:"
|
||||
msg2 "base_packages: ${base_packages[*]}"
|
||||
msg2 "pkgdir: ${pkgdir}"
|
||||
msg2 "PKGDEST: ${PKGDEST}"
|
||||
msg2 "repodir: ${repodir}"
|
||||
|
||||
fi
|
||||
|
||||
if ${clean_rundir}; then
|
||||
if ${pretend};then
|
||||
msg "Files to be cleaned ${rundir} ..."
|
||||
git clean -dfxn
|
||||
else
|
||||
msg "Cleaning ${rundir} ..."
|
||||
if ${verbose};then
|
||||
git clean -dfx
|
||||
else
|
||||
git clean -dfxq
|
||||
fi
|
||||
fi
|
||||
git_clean
|
||||
fi
|
||||
|
||||
if [[ $EUID != 0 ]]; then
|
||||
die 'This script must be run as root.'
|
||||
else
|
||||
if ${pretend};then
|
||||
run_pretend $@
|
||||
else
|
||||
run $@
|
||||
run $@
|
||||
|
||||
if ${repo}; then
|
||||
repo_create
|
||||
fi
|
||||
if ${repo}; then
|
||||
repo_create
|
||||
fi
|
||||
fi
|
||||
|
|
|
@ -392,6 +392,20 @@ clean_pkg_cache(){
|
|||
rm $1/*.${ext}
|
||||
}
|
||||
|
||||
git_clean(){
|
||||
if ${pretend};then
|
||||
msg "Files to be cleaned ${rundir} ..."
|
||||
git clean -dfxn
|
||||
else
|
||||
msg "Cleaning ${rundir} ..."
|
||||
if ${verbose};then
|
||||
git clean -dfx
|
||||
else
|
||||
git clean -dfxq
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
chroot_create(){
|
||||
mkdir -p "${chrootdir}"
|
||||
setarch ${arch} \
|
||||
|
@ -436,7 +450,7 @@ chroot_build_set(){
|
|||
fi
|
||||
pacman -U $temp*${arch}*pkg*z -r ${chrootdir}/$(get_user) --noconfirm
|
||||
fi
|
||||
mv_pkg ${profile}
|
||||
mv_pkg $pkg
|
||||
cd ..
|
||||
done
|
||||
msg "Finished building profile: [${profile}]"
|
||||
|
@ -451,11 +465,31 @@ chroot_build(){
|
|||
cd ..
|
||||
}
|
||||
|
||||
display_build_set(){
|
||||
display_settings(){
|
||||
msg "OPTARGS:"
|
||||
msg2 "arch: $arch"
|
||||
msg2 "branch: $branch"
|
||||
msg2 "chroots: $chroots"
|
||||
|
||||
msg "PATHS:"
|
||||
msg2 "chrootdir: $chrootdir"
|
||||
msg2 "profiledir: $profiledir"
|
||||
msg2 "pacman_conf: ${pacman_conf}"
|
||||
msg2 "makepkg_conf: $makepkg_conf"
|
||||
msg2 "pkgdir: ${pkgdir}"
|
||||
msg2 "PKGDEST: ${PKGDEST}"
|
||||
msg2 "repodir: ${repodir}"
|
||||
|
||||
if ${clean_first};then
|
||||
msg "PKG:"
|
||||
msg2 "base_packages: ${base_packages[*]}"
|
||||
fi
|
||||
|
||||
msg "SETS:"
|
||||
msg2 "profiles: $profiles"
|
||||
msg2 "profile: $profile"
|
||||
msg2 "profiles: ${profiles}"
|
||||
msg2 "profile: ${profile}"
|
||||
msg2 "is_profile: ${is_profile}"
|
||||
|
||||
if ${is_profile};then
|
||||
msg "These packages will be built:"
|
||||
local temp=$(cat ${profiledir}/${profile}.set)
|
||||
|
@ -468,25 +502,33 @@ display_build_set(){
|
|||
fi
|
||||
}
|
||||
|
||||
run_pretend(){
|
||||
eval "case ${profile} in
|
||||
$profiles) is_profile=true ;;
|
||||
*) is_profile=false ;;
|
||||
esac"
|
||||
display_build_set
|
||||
exit 1
|
||||
}
|
||||
|
||||
run(){
|
||||
eval "case ${profile} in
|
||||
$profiles) is_profile=true; display_build_set && chroot_build_set ;;
|
||||
*) display_build_set && chroot_build ;;
|
||||
$profiles)
|
||||
is_profile=true
|
||||
if ${pretend}; then
|
||||
display_settings
|
||||
exit 1
|
||||
else
|
||||
display_settings
|
||||
chroot_build_set
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
if ${pretend}; then
|
||||
display_settings
|
||||
exit 1
|
||||
else
|
||||
display_settings
|
||||
chroot_build
|
||||
fi
|
||||
;;
|
||||
esac"
|
||||
}
|
||||
|
||||
mv_pkg(){
|
||||
msg2 "Moving ${profile} to ${pkgdir}"
|
||||
mv ${profile}*.${ext} ${pkgdir}
|
||||
msg2 "Moving $1 to ${pkgdir}"
|
||||
mv *.${ext} ${pkgdir}/
|
||||
}
|
||||
|
||||
repo_create(){
|
||||
|
|
Loading…
Reference in a new issue