Rename bootstrap directory

Renamed bootstrap directory to _bootstrap to conform to default ignore
pattern of autostow.sh, and make it visually clear that this is a
special directory, not one used for the dotfiles itself.
This commit is contained in:
Marty Oehme 2020-01-30 13:29:03 +01:00
parent 9932202704
commit 68b0219354
4 changed files with 2 additions and 2 deletions

View file

@ -1,129 +0,0 @@
#!/usr/bin/env bash
#
# autostow.sh
#
# Stow automatic symlinking script
#
# Invokes stow for every folder within this repository, and that's it.
ignore="${AUTOSTOW_IGNORED_DIRS:-"bootstrap:assets"}"
main() {
case "$1" in
-s | --stow)
have_stow
stow_dirs
exit 0
;;
-d | --delete)
have_stow
unstow_dirs
exit 0
;;
-n | --dry-run)
have_stow
dryrun
exit 0
;;
-v | --version)
printf "System bootstrap script.\n\n©Marty Oehme\n\nVersion: 0.2.1\n"
;;
-h | --help | *)
usage
exit 0
;;
esac
shift
}
stow_dirs() {
printf "Creating dotfile symlinks .................................................\n"
for d in */; do
if is_ignored "$d"; then
printf "ignoring %s\n" "$d"
continue
fi
printf "stowing %s\n" "$d"
stow -S -t ~ "$d"
done
printf "Done creating symlinks ....................................................\n"
}
unstow_dirs() {
printf "Removing dotfile symlinks .................................................\n"
for d in */; do
if is_ignored "$d"; then
printf "ignoring %s\n" "$d"
continue
fi
printf "unstowing %s\n" "$d"
stow -D -t ~ "$d"
done
printf "Done removing symlinks ....................................................\n"
}
dryrun() {
printf "Printing processed directories ............................................\n"
for d in */; do
if is_ignored "$d"; then
printf "ignoring %s\n" "$d"
continue
fi
printf "processing %s\n" "$d"
done
printf "Done printing directories .................................................\n"
}
is_ignored() {
IFS=":"
for ign in $ignore; do
# it is either passed in through our environment variable
if [ "$ign" = "$1" ] || [ "$ign/" = "$1" ]; then
return 0
fi
done
# or it starts with a _ which is ignored by default (that's the regex).
# (using herestring to avoid cat>grep)
if grep -q -e '^_[[:alnum:]]\{1,\}' <<<"$1"; then return 0; fi
return 1
}
have_stow() {
if ! type stow >/dev/null 2>&1; then
printf "GNU stow needs to be installed for this script to function. Please install stow through your package manager.\n"
exit 1
fi
}
usage() {
printf "%s\n" \
"" \
" autostow.sh - Automatically stow your dotfiles." \
" Uses GNU stow to set up automatic links to any dotfiles in subdirectories of this directory." \
"" \
" Usage: stow.sh -dhsn" \
"" \
" Options:" \
"" \
" -h | --help Print out this help." \
"" \
" -s | --stow Install dotfiles, by symlinking any directory found next to stow.sh using GNU stow." \
"" \
" -d | --delete Remove dotfiles, by unlinking any directory found next to stow.sh using GNU stow." \
"" \
" -n | --dry-run Do not invoke any operation but print out directories affected, simulating a dry-run." \
"" \
" Note, by default any directory starting with an underscore _directoryname will be ignored." \
" Additional folders to ignore can be set through the environment variable AUTOSTOW_IGNORED_DIRS " \
" using a colon-separated string: AUTOSTOW_IGNORED_DIRS=\"directories:to:ignore\" " \
"" \
""
}
main "$@"

View file

@ -1,92 +0,0 @@
#!/bin/bash
#
# Simple app bootstrapping script
#=== main function ============================================================
# NAME: main
# DESCRIPTION: Display usage information for this script.
# PARAMETERS: see usage function
#==============================================================================
packages="${BOOTSTRAP_PACKAGES:-packages.csv}"
main() {
local cmd=""
local ret=0
case "$1" in
-v | --version)
printf "Package bootstrap script.\n\n©Marty Oehme\n\nVersion: 0.3\n"
;;
-h | --help)
printf "Usage: install [-f|--force][-v|--version][-h|--help]\n\n-f Do not ask for any confirmations but force update and installation.\n"
;;
-f | --force)
install true
;;
*)
install false
;;
esac
shift
$cmd "$@"
ret=$((ret + $?))
exit $ret
}
install_yay() {
# check for existing yay installation
if type yay >/dev/null 2>&1; then
echo "Existing yay installation found ..........................................."
return
fi
# use tmp dir to make yay
target=$(mktemp -d)
git clone https://aur.archlinux.org/yay.git "$target"
cd "$target" || exit
makepkg -si
}
update_repos() {
unattended="$1"
if "$unattended"; then
yay -Sqyy --noconfirm
else
yay -Syy
fi
}
install_packages() {
unattended="$1"
if "$unattended"; then
yay -Squ --noconfirm --needed - <"$packages"
else
yay -Su --needed - <"$packages"
fi
}
check_consent() {
echo "This will take a while and install many packages. Proceed [y/N]?"
read -r yes
if [[ "$yes" != y* ]]; then
echo "Exiting."
exit
fi
}
install() {
unattended=$1
echo "Beginning package bootstrap ..............................................."
if ! "$unattended"; then
check_consent
fi
echo "Installing yay ............................................................"
install_yay
echo "Installing apps ..........................................................."
update_repos "$unattended"
install_packages "$unattended"
echo "Done ......................................................................"
}
main "$@"

View file

@ -1,122 +0,0 @@
alacritty
atool
anki
bash
bibtool
bison
bzip2
dhcpcd
dialog
docker
dunst
exa
fasd
feh
flashfocus-git
fzf
gawk
git
git-lfs
glow
gnome-keyring
gopass
grep
gzip
haveged
htop
hugo
i3-gaps
i3lock
jabref-latest
jpdftweak
keybase-bin
less
libnotify
libtool
littler
logrotate
lynx
mosh
mpv
nano
neovim
nerd-fonts-fira-code
nerd-fonts-iosevka
nextcloud-client
ntfs-3g
ntp
openssh
os-prober
pacman
pandoc
pandoc-citeproc
picom
playerctl
polybar
powertop
pulseaudio
pulseaudio-alsa
pulsemixer
python-pip
python-pybtex
python-pynvim
qutebrowser
r
redshift
ripgrep
rng-tools
rofi
rofi-calc
rofi-dmenu
rofi-greenclip
rofimoji
rtv
scrot
sed
sshfs
stow
surfraw
sxhkd
tar
texinfo
texlive-bibtexextra
texlive-core
texlive-fontsextra
texlive-formatsextra
texlive-games
texlive-humanities
texlive-latexextra
texlive-music
texlive-pictures
texlive-pstricks
texlive-publishers
texlive-science
tmux
tomb
topgrade
ttf-comic-neue
ttf-heuristica
ttf-signika
unclutter
unrar
unzip
vagrant
vifm
virtualbox
wget
which
xcape
xclip
xdg-user-dirs
xdotool
xorg-server
xorg-xev
xorg-xinit
xorg-xinput
xorg-xrandr
yarn
yay
youtube-dl
zathura
zathura-pdf-mupdf
zsh
1 alacritty
2 atool
3 anki
4 bash
5 bibtool
6 bison
7 bzip2
8 dhcpcd
9 dialog
10 docker
11 dunst
12 exa
13 fasd
14 feh
15 flashfocus-git
16 fzf
17 gawk
18 git
19 git-lfs
20 glow
21 gnome-keyring
22 gopass
23 grep
24 gzip
25 haveged
26 htop
27 hugo
28 i3-gaps
29 i3lock
30 jabref-latest
31 jpdftweak
32 keybase-bin
33 less
34 libnotify
35 libtool
36 littler
37 logrotate
38 lynx
39 mosh
40 mpv
41 nano
42 neovim
43 nerd-fonts-fira-code
44 nerd-fonts-iosevka
45 nextcloud-client
46 ntfs-3g
47 ntp
48 openssh
49 os-prober
50 pacman
51 pandoc
52 pandoc-citeproc
53 picom
54 playerctl
55 polybar
56 powertop
57 pulseaudio
58 pulseaudio-alsa
59 pulsemixer
60 python-pip
61 python-pybtex
62 python-pynvim
63 qutebrowser
64 r
65 redshift
66 ripgrep
67 rng-tools
68 rofi
69 rofi-calc
70 rofi-dmenu
71 rofi-greenclip
72 rofimoji
73 rtv
74 scrot
75 sed
76 sshfs
77 stow
78 surfraw
79 sxhkd
80 tar
81 texinfo
82 texlive-bibtexextra
83 texlive-core
84 texlive-fontsextra
85 texlive-formatsextra
86 texlive-games
87 texlive-humanities
88 texlive-latexextra
89 texlive-music
90 texlive-pictures
91 texlive-pstricks
92 texlive-publishers
93 texlive-science
94 tmux
95 tomb
96 topgrade
97 ttf-comic-neue
98 ttf-heuristica
99 ttf-signika
100 unclutter
101 unrar
102 unzip
103 vagrant
104 vifm
105 virtualbox
106 wget
107 which
108 xcape
109 xclip
110 xdg-user-dirs
111 xdotool
112 xorg-server
113 xorg-xev
114 xorg-xinit
115 xorg-xinput
116 xorg-xrandr
117 yarn
118 yay
119 youtube-dl
120 zathura
121 zathura-pdf-mupdf
122 zsh