diff options
author | Dave Reisner <dreisner@archlinux.org> | 2017-04-03 21:03:17 -0400 |
---|---|---|
committer | Dave Reisner <dreisner@archlinux.org> | 2017-04-03 21:03:17 -0400 |
commit | 4dc530e07ebf0c64666ce902edbc85de4fa8d0e8 (patch) | |
tree | e9e38ec539b0b80780b04d6cb6ae67c3889a35ba | |
parent | 8036060e1f0f738d4b1c9e7491085fd5adeb41a2 (diff) | |
download | asp32-4dc530e07ebf0c64666ce902edbc85de4fa8d0e8.tar.xz |
lazily initialize ASPROOT if it doesn't yet exist
-rw-r--r-- | asp.in | 18 |
1 files changed, 12 insertions, 6 deletions
@@ -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 |