index : devtools32 | |
Archlinux32 fork of devtools | gitolite user |
summaryrefslogtreecommitdiff |
author | Andreas Baumann <mail@andreasbaumann.cc> | 2024-08-16 08:06:08 +0200 |
---|---|---|
committer | Andreas Baumann <mail@andreasbaumann.cc> | 2024-08-16 08:06:08 +0200 |
commit | deffc1b87e86fffa8e4758a76a1912c6c8f69a85 (patch) | |
tree | 0f61a152c4c49d40de5042df2b25cdb8e0b0a82d /src/makechrootpkg.in | |
parent | 2994bca96781afd62104c1515532a9c479cb5bed (diff) | |
parent | 27eebe383d0b571c08cba991e4824768d7623602 (diff) |
-rw-r--r-- | src/makechrootpkg.in | 51 |
diff --git a/src/makechrootpkg.in b/src/makechrootpkg.in index 44b991b..30f78c8 100644 --- a/src/makechrootpkg.in +++ b/src/makechrootpkg.in @@ -38,6 +38,7 @@ inspect=never bindmounts_ro=() bindmounts_rw=() +bindmounts_tmpfs=() copy=$USER [[ -n ${SUDO_USER:-} ]] && copy=$SUDO_USER @@ -65,23 +66,24 @@ usage() { echo "Default makepkg args: ${default_makepkg_args[*]}" echo '' echo 'Flags:' - echo '-h This help' - echo '-c Clean the chroot before building' - echo '-d <dir> Bind directory into build chroot as read-write' - echo '-D <dir> Bind directory into build chroot as read-only' - echo '-u Update the working copy of the chroot before building' - echo ' This is useful for rebuilds without dirtying the pristine' - echo ' chroot' - echo '-r <dir> The chroot dir to use' - echo '-I <pkg> Install a package into the working copy of the chroot' - echo '-l <copy> The directory to use as the working copy of the chroot' - echo ' Useful for maintaining multiple copies' - echo " Default: $copy" - echo '-n Run namcap on the package' - echo '-C Run checkpkg on the package' - echo '-T Build in a temporary directory' - echo '-U Run makepkg as a specified user' - echo '-x <when> Inspect chroot after build (never, always, failure)' + echo '-h This help' + echo '-c Clean the chroot before building' + echo '-d <dir> Bind directory into build chroot as read-write' + echo '-D <dir> Bind directory into build chroot as read-only' + echo '-t <dir[:opts]> Mount a tmpfs at directory' + echo '-u Update the working copy of the chroot before building' + echo ' This is useful for rebuilds without dirtying the pristine' + echo ' chroot' + echo '-r <dir> The chroot dir to use' + echo '-I <pkg> Install a package into the working copy of the chroot' + echo '-l <copy> The directory to use as the working copy of the chroot' + echo ' Useful for maintaining multiple copies' + echo " Default: $copy" + echo '-n Run namcap on the package' + echo '-C Run checkpkg on the package' + echo '-T Build in a temporary directory' + echo '-U Run makepkg as a specified user' + echo '-x <when> Inspect chroot after build (never, always, failure)' exit 1 } @@ -148,8 +150,8 @@ install_packages() { pkgnames=("${install_pkgs[@]##*/}") cp -- "${install_pkgs[@]}" "$copydir/root/" - arch-nspawn "$copydir" "${bindmounts_ro[@]}" "${bindmounts_rw[@]}" \ - bash -c 'yes y | pacman -U -- "$@"' -bash "${pkgnames[@]/#//root/}" + arch-nspawn "$copydir" "${bindmounts_ro[@]}" "${bindmounts_rw[@]}" "${bindmounts_tmpfs[@]}" \ + pacman -U --noconfirm --ask=4 -- "${pkgnames[@]/#//root/}" ret=$? rm -- "${pkgnames[@]/#/$copydir/root/}" @@ -191,6 +193,11 @@ builduser ALL = NOPASSWD: /usr/bin/pacman EOF chmod 440 "$copydir/etc/sudoers.d/builduser-pacman" + cat > "$copydir/etc/gitconfig" <<EOF +[safe] + directory = * +EOF + # This is a little gross, but this way the script is recreated every time in the # working copy { @@ -295,11 +302,12 @@ move_products() { } # }}} -while getopts 'hcur:I:l:nCTD:d:U:x:' arg; do +while getopts 'hcur:I:l:nCTD:d:U:x:t:' arg; do case "$arg" in c) clean_first=1 ;; D) bindmounts_ro+=("--bind-ro=$OPTARG") ;; d) bindmounts_rw+=("--bind=$OPTARG") ;; + t) bindmounts_tmpfs+=("--tmpfs=$OPTARG") ;; u) update_first=1 ;; r) passeddir="$OPTARG" ;; I) install_pkgs+=("$OPTARG") ;; @@ -370,7 +378,7 @@ if [[ ! -d $copydir ]] || (( clean_first )); then fi (( update_first )) && arch-nspawn "$copydir" \ - "${bindmounts_ro[@]}" "${bindmounts_rw[@]}" \ + "${bindmounts_ro[@]}" "${bindmounts_rw[@]}" "${bindmounts_tmpfs[@]}" \ pacman -Syuu --noconfirm if [[ -n ${install_pkgs[*]:-} ]]; then @@ -395,6 +403,7 @@ nspawn_build_args=( --tmpfs="/tmp:${tmp_opts}" "${bindmounts_ro[@]}" "${bindmounts_rw[@]}" + "${bindmounts_tmpfs[@]}" ) if arch-nspawn "$copydir" \ |