local/bin/homeinit: Replace COMMAND by INPATH
parent
7c6c47b1e4
commit
f1ff9a7460
|
@ -1,12 +1,12 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
# TODO: Make "command -v " wrapper with support for multiple arguments.
|
|
||||||
# TODO: Create a separate profile in /tmp to install gnupg, git, etc. then delete it when it's over.
|
# TODO: Create a separate profile in /tmp to install gnupg, git, etc. then delete it when it's over.
|
||||||
# TODO: Run guix pull if OPT_UPDATE and if guix chekout is more than some days old, as specified by an environment variable.
|
|
||||||
# TODO: Guix pull on commit specified in package-lists/guix-version?
|
|
||||||
# TODO: On foreign distro, use local package manager to install Guix. (Start with pacman.)
|
|
||||||
# TODO: Test if TTY and set pinentry appropriately without clobbering
|
# TODO: Test if TTY and set pinentry appropriately without clobbering
|
||||||
# ~/.gnupg/gpg-agent.conf
|
# ~/.gnupg/gpg-agent.conf
|
||||||
|
# TODO: Run guix pull if OPT_UPDATE and if guix chekout is more than some days old, as specified by an environment variable.
|
||||||
|
|
||||||
|
# TODO: Guix pull on commit specified in package-lists/guix-version?
|
||||||
|
# TODO: On foreign distro, use local package manager to install Guix. (Start with pacman.)
|
||||||
# TODO: Make functions to make it easier to re-order calls?
|
# TODO: Make functions to make it easier to re-order calls?
|
||||||
|
|
||||||
HTTPS_ROOT=https://gitlab.com/
|
HTTPS_ROOT=https://gitlab.com/
|
||||||
|
@ -76,14 +76,23 @@ lnn() { # $1=TARGET $2=LINK|FOLDER
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inpath() {
|
||||||
|
for i; do
|
||||||
|
if ! command -v "$i" >/dev/null 2>&1; then
|
||||||
|
return false
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
#
|
#
|
||||||
|
|
||||||
section "Initial packages"
|
section "Initial packages"
|
||||||
if command -v guix >/dev/null 2>&1; then
|
if inpath guix; then
|
||||||
## TODO: Should openssh be an input of Git?
|
## TODO: Should openssh be an input of Git?
|
||||||
guix package --install openssh gnupg git stow password-store
|
guix package --install openssh gnupg git stow password-store
|
||||||
elif command -v pacman >/dev/null 2>&1; then
|
elif inpath pacman; then
|
||||||
sudo pacman --noconfirm -S --needed openssh gnupg git stow password-store
|
sudo pacman --noconfirm -S --needed openssh gnupg git stow password-store
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -131,25 +140,25 @@ stow -v . || exit 1
|
||||||
popd
|
popd
|
||||||
|
|
||||||
section "System packages"
|
section "System packages"
|
||||||
if command -v guix >/dev/null 2>&1; then
|
if inpath guix; then
|
||||||
## TODO: The manifest will uninstall other unspecified packages. Is this
|
## TODO: The manifest will uninstall other unspecified packages. Is this
|
||||||
## really what we want?
|
## really what we want?
|
||||||
export GUIX_PACKAGE_PATH=$HOME/.guix-packages
|
export GUIX_PACKAGE_PATH=$HOME/.guix-packages
|
||||||
guix package --manifest=$HOME/.package-lists/guix-manifest.scm --keep-failed
|
guix package --manifest=$HOME/.package-lists/guix-manifest.scm --keep-failed
|
||||||
elif command -v pacman >/dev/null 2>&1; then
|
elif inpath pacman; then
|
||||||
pacman_list=""
|
pacman_list=""
|
||||||
if [ -f ~/.package-lists/arch-official ]; then
|
if [ -f ~/.package-lists/arch-official ]; then
|
||||||
pacman_list="$(cat ~/.package-lists/arch-official)"
|
pacman_list="$(cat ~/.package-lists/arch-official)"
|
||||||
fi
|
fi
|
||||||
sudo pacman --noconfirm -S --needed base base-devel $pacman_list
|
sudo pacman --noconfirm -S --needed base base-devel $pacman_list
|
||||||
if ! command -v cower >/dev/null 2>&1; then
|
if ! inpath cower; then
|
||||||
mkdir -p /tmp/cower
|
mkdir -p /tmp/cower
|
||||||
pushd /tmp/cower
|
pushd /tmp/cower
|
||||||
curl https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=cower > PKGBUILD
|
curl https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=cower > PKGBUILD
|
||||||
makepkg --noconfirm -si
|
makepkg --noconfirm -si
|
||||||
popd
|
popd
|
||||||
fi
|
fi
|
||||||
if ! command -v pacaur >/dev/null 2>&1; then
|
if ! inpath pacaur; then
|
||||||
mkdir -p /tmp
|
mkdir -p /tmp
|
||||||
cower -d pacaur
|
cower -d pacaur
|
||||||
pushd /tmp/pacaur
|
pushd /tmp/pacaur
|
||||||
|
@ -166,15 +175,14 @@ elif command -v pacman >/dev/null 2>&1; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
section "Bookmarks"
|
section "Bookmarks"
|
||||||
if command -v qutebrowser >/dev/null 2>&1; then
|
if inpath qutebrowser; then
|
||||||
mkdir -pv "$XDG_CONFIG_HOME/qutebrowser/bookmarks"
|
mkdir -pv "$XDG_CONFIG_HOME/qutebrowser/bookmarks"
|
||||||
lnn "$SOURCEDIR/bookmarks/bookmarks" "$XDG_CONFIG_HOME/qutebrowser/bookmarks/urls"
|
lnn "$SOURCEDIR/bookmarks/bookmarks" "$XDG_CONFIG_HOME/qutebrowser/bookmarks/urls"
|
||||||
lnn "$SOURCEDIR/bookmarks/quickmarks" "$XDG_CONFIG_HOME/qutebrowser/"
|
lnn "$SOURCEDIR/bookmarks/quickmarks" "$XDG_CONFIG_HOME/qutebrowser/"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
section "Emacs"
|
section "Emacs"
|
||||||
if ! command -v emacs >/dev/null 2>&1 || \
|
if ! inpath emacs; then
|
||||||
[ $(emacs --quick --batch --eval '(message "%s" emacs-major-version)' 2>&1) -lt $EMACS_MIN_VERSION ]; then
|
|
||||||
message "Emacs: Installing latest development version"
|
message "Emacs: Installing latest development version"
|
||||||
pushd "$HOME/projects"
|
pushd "$HOME/projects"
|
||||||
[ -e emacs ] || git clone https://git.savannah.gnu.org/git/emacs.git
|
[ -e emacs ] || git clone https://git.savannah.gnu.org/git/emacs.git
|
||||||
|
@ -204,10 +212,10 @@ if ! command -v emacs >/dev/null 2>&1 || \
|
||||||
popd
|
popd
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if command -v emacs >/dev/null 2>&1; then
|
if inpath emacs; then
|
||||||
message "Emacs cache folder"
|
message "Emacs cache folder"
|
||||||
mkdir -pv "$HOME/.cache/emacs/"
|
mkdir -pv "$HOME/.cache/emacs/"
|
||||||
if ! command -v guix >/dev/null 2>&1; then
|
if ! inpath guix; then
|
||||||
if $OPT_UPDATE; then
|
if $OPT_UPDATE; then
|
||||||
message "Emacs ELPA packages"
|
message "Emacs ELPA packages"
|
||||||
yes | emacs --batch -l ~/.emacs.d/init.el --eval '(progn (package-refresh-contents) (package-install-selected-packages))'
|
yes | emacs --batch -l ~/.emacs.d/init.el --eval '(progn (package-refresh-contents) (package-install-selected-packages))'
|
||||||
|
|
Loading…
Reference in New Issue