.
This commit is contained in:
6
bash.d/20-asdf-vm.sh
Normal file
6
bash.d/20-asdf-vm.sh
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if test -d ~/.asdf; then
|
||||||
|
source $HOME/.asdf/asdf.sh
|
||||||
|
source $HOME/.asdf/completions/asdf.bash
|
||||||
|
fi
|
||||||
2
dotfiles/.config/starship.toml
Normal file
2
dotfiles/.config/starship.toml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
[elixir]
|
||||||
|
disabled=true
|
||||||
13
setup.d/00-bash.sh
Normal file
13
setup.d/00-bash.sh
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [[ $SHELL =~ "bash" ]]; then
|
||||||
|
SIGIL="# Managed by dotfiles"
|
||||||
|
|
||||||
|
if ! grep "$SIGIL" ~/.bashrc > /dev/null; then
|
||||||
|
(
|
||||||
|
echo "$SIGIL"
|
||||||
|
echo "for f in $DOTFILES/bash.d/*.sh; do source \"\$f\"; done"
|
||||||
|
echo "unset f"
|
||||||
|
) >> ~/.bashrc
|
||||||
|
fi
|
||||||
|
fi
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
if ! test -x /usr/local/bin/starship; then
|
if ! test -x /usr/local/bin/starship; then
|
||||||
curl -fsSL https://starship.rs/install.sh | bash
|
curl -fsSL https://starship.rs/install.sh | bash
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! grep starship ~/.bashrc > /dev/null; then
|
if ! grep starship ~/.bashrc > /dev/null; then
|
||||||
|
|||||||
8
setup.d/20-asdf-vm.sh
Normal file
8
setup.d/20-asdf-vm.sh
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if ! test -d ~/.asdf; then
|
||||||
|
echo "Cloning asdf-vm"
|
||||||
|
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.8.0
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
68
setup.sh
68
setup.sh
@@ -9,41 +9,47 @@ function finish {
|
|||||||
|
|
||||||
trap finish EXIT
|
trap finish EXIT
|
||||||
|
|
||||||
|
function overlay {
|
||||||
|
local source="$1"
|
||||||
|
local prefix="$2"
|
||||||
|
|
||||||
|
cd "$source" || exit;
|
||||||
|
|
||||||
|
find . -maxdepth 1 -type f -printf "%f\0" | while IFS= read -r -d $'\0' P; do
|
||||||
|
local target="${prefix}/${P}"
|
||||||
|
local backup="${prefix}/${P}.orig.${timestamp}"
|
||||||
|
# echo "$PWD/$P" "->" "$target"
|
||||||
|
|
||||||
|
# skip existing links
|
||||||
|
if [ -h "$target" ]; then continue; fi
|
||||||
|
|
||||||
|
|
||||||
|
# move existing dir out of the way
|
||||||
|
if [ -e "$target" ]; then
|
||||||
|
if [ -e "$backup" ]; then
|
||||||
|
echo "want to override $target but backup exists"
|
||||||
|
continue;
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -n "Backup ${P}"
|
||||||
|
mv -v "$target" "$backup"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# create link
|
||||||
|
ln -v -s "$PWD/$P" "$target"
|
||||||
|
|
||||||
|
# ensure permissions
|
||||||
|
chmod -R o-rwx,g-rwx "$target"
|
||||||
|
done
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
# From aaronjensen/dotfiles
|
# From aaronjensen/dotfiles
|
||||||
DOTFILES=$( cd "$(dirname "${BASH_SOURCE[0]}")" && pwd || return)
|
DOTFILES=$( cd "$(dirname "${BASH_SOURCE[0]}")" && pwd || return)
|
||||||
|
|
||||||
cd "$DOTFILES/dotfiles" || exit;
|
overlay "$DOTFILES/dotfiles" "$HOME"
|
||||||
|
overlay "$DOTFILES/dotfiles/.config" "$HOME/.config"
|
||||||
find . -maxdepth 1 -type f -printf "%f\0" | while IFS= read -r -d $'\0' P; do
|
|
||||||
target="${HOME}/${P}"
|
|
||||||
backup="${HOME}/${P}.orig.${timestamp}"
|
|
||||||
|
|
||||||
# skip existing links
|
|
||||||
if [ -h "$target" ]; then continue; fi
|
|
||||||
|
|
||||||
# move existing dir out of the way
|
|
||||||
if [ -e "$target" ]; then
|
|
||||||
if [ -e "$backup" ]; then
|
|
||||||
echo "want to override $target but backup exists"
|
|
||||||
continue;
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo -n "Backup ${P}"
|
|
||||||
mv -v "$target" "$backup"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# create link
|
|
||||||
ln -v -s "$PWD/$P" "$target"
|
|
||||||
|
|
||||||
# ensure permissions
|
|
||||||
chmod -R o-rwx,g-rwx "$target"
|
|
||||||
done
|
|
||||||
|
|
||||||
# shellcheck source=/dev/null
|
# shellcheck source=/dev/null
|
||||||
for f in "$DOTFILES/setup.d/"*.sh; do source "$f"; done
|
for f in "$DOTFILES/setup.d/"*.sh; do source "$f"; done
|
||||||
unset f;
|
unset f;
|
||||||
|
|
||||||
(
|
|
||||||
echo "for f in $DOTFILES/bash.d/*.sh; do source \"\$f\"; done"
|
|
||||||
echo "unset f"
|
|
||||||
) >> ~/.bashrc
|
|
||||||
|
|||||||
Reference in New Issue
Block a user