summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2017-04-03 21:03:17 -0400
committerDave Reisner <dreisner@archlinux.org>2017-04-03 21:03:17 -0400
commit4dc530e07ebf0c64666ce902edbc85de4fa8d0e8 (patch)
treee9e38ec539b0b80780b04d6cb6ae67c3889a35ba
parent8036060e1f0f738d4b1c9e7491085fd5adeb41a2 (diff)
downloadasp32-4dc530e07ebf0c64666ce902edbc85de4fa8d0e8.tar.xz
lazily initialize ASPROOT if it doesn't yet exist
-rw-r--r--asp.in18
1 files 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