From 97a2d2414a7f9d4abce3a40320fe9e0883155884 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sun, 7 Apr 2013 16:00:03 +0200 Subject: mkarchroot: Fix creation of btrfs snapshot and remove force option --- bash_completion.in | 2 +- mkarchroot.in | 20 +++++++------------- zsh_completion.in | 1 - 3 files changed, 8 insertions(+), 15 deletions(-) diff --git a/bash_completion.in b/bash_completion.in index cd959fc..9395d3a 100644 --- a/bash_completion.in +++ b/bash_completion.in @@ -53,7 +53,7 @@ _mkarchroot() { case $cur in -*) - COMPREPLY=( $( compgen -W '-C -M -c -f -h -n -r -u' -- "$cur" ) ) + COMPREPLY=( $( compgen -W '-C -M -c -h -n -r -u' -- "$cur" ) ) ;; *) _filedir diff --git a/mkarchroot.in b/mkarchroot.in index 6598089..5c1298b 100644 --- a/mkarchroot.in +++ b/mkarchroot.in @@ -12,7 +12,6 @@ m4_include(lib/common.sh) CHROOT_VERSION='v3' -FORCE='n' RUN='' NOCOPY='n' @@ -26,7 +25,6 @@ usage() { echo ' options:' echo ' -r Run "app" within the context of the chroot' echo ' -u Update the chroot via pacman' - echo ' -f Force overwrite of files in the working-dir' echo ' -C Location of a pacman config file' echo ' -M Location of a makepkg config file' echo ' -n Do not copy config files into the chroot' @@ -39,7 +37,6 @@ while getopts 'r:ufnhC:M:c:' arg; do case "${arg}" in r) RUN="$OPTARG" ;; u) RUN='pacman -Syu --noconfirm' ;; - f) FORCE='y' ;; C) pac_conf="$OPTARG" ;; M) makepkg_conf="$OPTARG" ;; n) NOCOPY='y' ;; @@ -152,18 +149,18 @@ if [[ -n $RUN ]]; then # }}} else # {{{ build chroot - if [[ -e $working_dir && $FORCE = 'n' ]]; then - die "Working directory '${working_dir}' already exists - try using -f" + if [[ -e $working_dir ]]; then + die "Working directory '${working_dir}' already exists" fi - if [[ ! -d "${working_dir}" ]]; then - mkdir -p "${working_dir}" - fi + mkdir -p "${working_dir}" if [[ "$(stat -f -c %T "${working_dir}")" == btrfs ]]; then - if { type -P btrfs && btrfs subvolume create "${working_dir}"; } &>/dev/null; then - chmod 0755 "${working_dir}" + rmdir "${working_dir}" + if ! btrfs subvolume create "${working_dir}"; then + die "Couldn't create subvolume for '${working_dir}'" fi + chmod 0755 "${working_dir}" fi chroot_lock @@ -173,9 +170,6 @@ else pacargs+=("--config=${pac_conf}") fi - if [[ $FORCE = 'y' ]]; then - pacargs+=("--force") - fi if ! pacstrap -GMcd "${working_dir}" "${pacargs[@]}" "$@"; then die 'Failed to install all packages' fi diff --git a/zsh_completion.in b/zsh_completion.in index 727112a..c3abdfd 100644 --- a/zsh_completion.in +++ b/zsh_completion.in @@ -42,7 +42,6 @@ _makechrootpkg_args=( _mkarchroot_args=( '-r[Run a program within the context of the chroot]:app' '-u[Update the chroot via pacman]' - '-f[Force overwrite of files in the working-dir]' '-C[Location of a pacman config file]:pacman_config:_files' '-M[Location of a makepkg config file]:makepkg_config:_files' '-n[Do not copy config files into the chroot]' -- cgit v1.2.3-70-g09d2 From 93d735981b0c5fba039db0f1cb73fc8c1ea3ea1c Mon Sep 17 00:00:00 2001 From: Sébastien Luttringer Date: Thu, 14 Mar 2013 03:55:40 +0100 Subject: makechrootpkg: Add option to build in temp chroot MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add option -T to build in a temporary chroot. This apply to any kind of filesytem and allow to easily parrallelize builds. This patch also simplify how $default_copy and $copy are defined. Signed-off-by: Sébastien Luttringer Signed-off-by: Pierre Schmitz --- makechrootpkg.in | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/makechrootpkg.in b/makechrootpkg.in index e7e5f21..7796298 100644 --- a/makechrootpkg.in +++ b/makechrootpkg.in @@ -19,14 +19,15 @@ clean_first=false install_pkg= add_to_db=false run_namcap=false +temp_chroot=false chrootdir= passeddir= declare -a install_pkgs declare -i ret=0 -default_copy=$USER -[[ -n $SUDO_USER ]] && default_copy=$SUDO_USER -[[ -z $default_copy || $default_copy = root ]] && default_copy=copy +copy=$USER +[[ -n $SUDO_USER ]] && copy=$SUDO_USER +[[ -z "$copy" || $copy = root ]] && copy=copy src_owner=${SUDO_USER:-$USER} usage() { @@ -55,13 +56,14 @@ usage() { echo '-r The chroot dir to use' echo '-I Install a package into the working copy of the chroot' echo '-l The directory to use as the working copy of the chroot' - echo ' Useful for maintaining multiple copies.' - echo " Default: $default_copy" + echo ' Useful for maintaining multiple copies' + echo " Default: $copy" echo '-n Run namcap on the package' + echo '-T Build in a temporary directory' exit 1 } -while getopts 'hcudr:I:l:n' arg; do +while getopts 'hcudr:I:l:nT' arg; do case "$arg" in h) usage ;; c) clean_first=true ;; @@ -71,6 +73,7 @@ while getopts 'hcudr:I:l:n' arg; do I) install_pkgs+=("$OPTARG") ;; l) copy="$OPTARG" ;; n) run_namcap=true; makepkg_args="$makepkg_args -i" ;; + T) temp_chroot=true; copy+="-$RANDOM" ;; *) makepkg_args="$makepkg_args -$arg $OPTARG" ;; esac done @@ -81,7 +84,6 @@ chrootdir=$(readlink -e "$passeddir") if [[ ${copy:0:1} = / ]]; then copydir=$copy else - [[ -z $copy ]] && copy=$default_copy copydir="$chrootdir/$copy" fi @@ -314,6 +316,21 @@ for f in "$copydir"/srcdest/*; do mv "$f" "$SRCDEST" done -if (( ret != 0 )); then +if $temp_chroot; then + stat_busy "Removing temporary directoy [$copy]" + if [[ "$chroottype" == btrfs ]]; then + btrfs subvolume delete "$copydir" >/dev/null || + die "Unable to delete subvolume $copydir" + else + # avoid change of filesystem in case of an umount failure + rm --recursive --force --one-file-system "$copydir" || + die "Unable to delete $copydir" + fi + # remove lock file + rm --force "$copydir.lock" + stat_done +elif (( ret != 0 )); then die "Build failed, check $copydir/build" +else + true fi -- cgit v1.2.3-70-g09d2 From 6e086f0e703194fcefe0040e2b5e967fa5ab307f Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Mon, 8 Apr 2013 18:09:19 +0200 Subject: Prepare release --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index acae452..3bb6464 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -V=20130406 +V=20130408 PREFIX = /usr/local -- cgit v1.2.3-70-g09d2