diff options
-rwxr-xr-x | include/bootstrap | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/include/bootstrap b/include/bootstrap index 880fa13..1f79eb0 100755 --- a/include/bootstrap +++ b/include/bootstrap @@ -7,20 +7,36 @@ setopt err_exit trap "print -P '\n%N:%i: bootstrap failed ($?)'" ZERR -typeset -i rcempty=0 +typeset -i rcempty=0 pkglist_cgi=0 typeset PKG_ROOT PKG_DIR default_path='~/packages' : ${XDG_CONFIG_HOME=$HOME/.config} +while [[ $1 == --* ]] { + case $1 in + --pkglist-cgi) + pkglist_cgi=1 + pkglist_cgi_url=$2 + shift + ;; + esac + shift +} + if [[ -n $1 ]] { PKG_ROOT=$1 PKG_DIR=${~${2-$default_path}} } else { cat <<- meow - Usage: ./bootstrap PKG_ROOT [PKG_DIR] + Usage: ./bootstrap [options] PKG_ROOT [PKG_DIR] PKG_ROOT is an URI, either of the form proto://host/path, or just /path Note: The path must be absolute, it may not contain a literal ~ PKG_DIR is the path where caretaker and all further packages will be installed, by default $default_path + + Options: + + --pkglist-cgi URL + Get the package list from URL - most useful with a git:// PKG_ROOT meow exit 100 } @@ -56,6 +72,25 @@ cat > $XDG_CONFIG_HOME/caretaker/caretaker.conf <<- flurbl PKG_ROOT='$PKG_ROOT' PKG_DIR="${PKG_DIR/$HOME/\$HOME}" flurbl +if ((pkglist_cgi)) { + if which curl &> /dev/null; then + getcmd='curl -s' + elif which wget &> /dev/null; then + getcmd='wget -q -O -' + else + print STDERR "Unable to find a proper download program, fix $PKG_DIR/.pkglist\n" + getcmd='echo fixme >&2; exit 1;' + fi + cat >> $XDG_CONFIG_HOME/caretaker/caretaker.conf <<-flurbl + PKGLIST_LOCAL=1 + PKGLIST_PATH=$PKG_DIR/.pkglist + flurbl + cat > $PKG_DIR/.pkglist <<-flurbl + #!/bin/sh + $getcmd $pkglist_cgi_url + flurbl + chmod +x $PKG_DIR/.pkglist +} echo 'Installing caretaker package' rehash |