From 4dc530e07ebf0c64666ce902edbc85de4fa8d0e8 Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Mon, 3 Apr 2017 21:03:17 -0400 Subject: lazily initialize ASPROOT if it doesn't yet exist --- asp.in | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/asp.in b/asp.in index 41b3877..5bb9c90 100644 --- a/asp.in +++ b/asp.in @@ -120,14 +120,23 @@ update_packages() { initialize() { local remote + umask 0022 + startdir=$PWD + + if [[ ! -d $ASPROOT ]]; then + log_info 'Initializing ASPROOT in %s' "$ASPROOT" + mkdir -p "$ASPROOT" + fi + + cd "$ASPROOT" || log_fatal "ASPROOT ($ASPROOT) does not exist!" + [[ -d $ASPCACHE ]] || mkdir -p "$ASPCACHE" [[ -f .asp ]] && return 0 - git init || return 1 - + git init -q || return 1 for remote in "${ARCH_GIT_REPOS[@]}"; do - git remote add "$remote" git://git.archlinux.org/svntogit/"$remote".git + git remote add "$remote" "git://git.archlinux.org/svntogit/$remote.git" done touch .asp @@ -324,9 +333,6 @@ dispatch_action() { esac } -umask 0022 -startdir=$PWD -cd "$ASPROOT" || log_fatal "ASPROOT ($ASPROOT) does not exist!" initialize while getopts ':a:fhV' flag; do -- cgit v1.2.3-70-g09d2