Merge install and bootstrap step into one
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
29
bootstrap.sh
29
bootstrap.sh
@@ -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
|
||||
21
install.sh
21
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"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
'
|
||||
|
||||
Reference in New Issue
Block a user