diff --git a/README.md b/README.md index 6422cdf..d96316a 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ at `/var/lib/dotfiles`. To setup the dotfiles: 1. `git clone https://github.com/hakoerber/dotfiles.git ~/dotfiles` -2. `cd ~/dotfiles && ./bootstrap.sh` +2. `cd ~/dotfiles && ./install.sh` # Partial application diff --git a/bootstrap.sh b/bootstrap.sh deleted file mode 100755 index fe51426..0000000 --- a/bootstrap.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env bash -# -# Makes sure the dotfiles directory is in /var/lib/dotfiles and then calls -# install.sh - -set -o errexit -set -o nounset - -DOTDIR="/var/lib/dotfiles" - -_SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" - -if [[ "$(readlink "${_SCRIPT_DIR}")" != "${DOTDIR}" ]] ; then - if [[ -e "${DOTDIR}" ]] ; then - 2>&1 printf "${DOTDIR} already exists. This seems unsafe.\n" - exit 1 - fi - printf "Moving directory to $DOTDIR ...\n" - sudo="" - if (( $(id -u ) != 0 )) ; then - sudo=sudo - fi - $sudo mv --no-target-directory "${_SCRIPT_DIR}" "${DOTDIR}" - printf "Done\n" -else - printf "Already working in ${DOTDIR}, nothing to do\n" -fi - -cd "${DOTDIR}" && ./install.sh diff --git a/install.sh b/install.sh index ce8a4cd..a78a793 100755 --- a/install.sh +++ b/install.sh @@ -8,6 +8,27 @@ set -o errexit set -o nounset +DOTDIR="/var/lib/dotfiles" +_SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" + +if [[ "$(readlink "${_SCRIPT_DIR}")" != "${DOTDIR}" ]] ; then + if [[ -e "${DOTDIR}" ]] ; then + 2>&1 printf "${DOTDIR} already exists. This seems unsafe.\n" + exit 1 + fi + printf "Moving directory to $DOTDIR ...\n" + sudo="" + if (( $(id -u ) != 0 )) ; then + sudo=sudo + fi + $sudo mv --no-target-directory "${_SCRIPT_DIR}" "${DOTDIR}" + printf "Done\n" +else + printf "Already working in ${DOTDIR}, nothing to do\n" +fi + +cd "${DOTDIR}" + os_release_file=/etc/os-release if [[ ! -e "${os_release_file}" ]] ; then 2>&1 printf "Could not find ${os_release_file}, exiting" diff --git a/install_scripts/ares-bootstrap.sh b/install_scripts/ares-bootstrap.sh index 4d1f958..5b24cad 100755 --- a/install_scripts/ares-bootstrap.sh +++ b/install_scripts/ares-bootstrap.sh @@ -13,7 +13,7 @@ git clone --recursive https://code.hkoerber.de/hannes/dotfiles.git mv /root/dotfiles /mnt/root/dotfiles cat << EOF > /mnt/root/.bashrc set -o errexit -/root/dotfiles/bootstrap.sh +/root/dotfiles/install.sh rm /root/.bashrc reboot EOF diff --git a/test-in-docker.sh b/test-in-docker.sh index f751197..1fe9f27 100755 --- a/test-in-docker.sh +++ b/test-in-docker.sh @@ -26,7 +26,7 @@ docker run -ti --rm -v ${tmpdir}/dotfiles.tar.gz:/tmp/dotfiles.tar.gz:ro --hostn pacman -Syu --noconfirm python3 cd $(mktemp -d) tar xf /tmp/dotfiles.tar.gz -C . - ANSIBLE_EXTRA_ARGS="-e manage_services=false" ./bootstrap.sh + ANSIBLE_EXTRA_ARGS="-e manage_services=false" ./install.sh read -p "Done, [return] to continue " ' @@ -36,5 +36,5 @@ docker run -ti --rm -v ${tmpdir}/dotfiles.tar.gz:/tmp/dotfiles.tar.gz:ro --hostn cd $(mktemp -d) tar xf /tmp/dotfiles.tar.gz -C . - ANSIBLE_EXTRA_ARGS="-e manage_services=false" ./bootstrap.sh + ANSIBLE_EXTRA_ARGS="-e manage_services=false" ./install.sh '