stuff
This commit is contained in:
parent
661be1811b
commit
adf4cf3e0e
18 changed files with 0 additions and 289 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,2 +0,0 @@
|
|||
.idea/
|
||||
.dotfiles/
|
10
README.md
10
README.md
|
@ -1,10 +0,0 @@
|
|||
# Dotfiles
|
||||
|
||||
## `distros/`
|
||||
This directory is meant to setup the distro to the liking of the user.
|
||||
### `distros/*/root`
|
||||
Contains files to overlay over the executing system.
|
||||
### `distro/*/sys-scripts`
|
||||
scripts that are ran as `root`
|
||||
### `distro/*/user-scripts`
|
||||
scripts that are ran as the user
|
|
@ -1 +0,0 @@
|
|||
doas
|
|
@ -1,20 +0,0 @@
|
|||
cmd="apk"
|
||||
while getopts "icru" opt; do
|
||||
case $opt in
|
||||
i)
|
||||
cmd="$cmd add"
|
||||
;;
|
||||
u)
|
||||
cmd="$cmd add"
|
||||
;;
|
||||
r)
|
||||
cmd="$cmd del"
|
||||
;;
|
||||
c)
|
||||
cmd="$cmd info -q"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND-1))
|
||||
|
||||
$cmd $@
|
|
@ -1 +0,0 @@
|
|||
permit persit wheel
|
|
@ -1,5 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# removes sudo
|
||||
|
||||
apk del sudo
|
|
@ -1,4 +0,0 @@
|
|||
neofetch
|
||||
git
|
||||
vim
|
||||
sudo
|
|
@ -1,4 +0,0 @@
|
|||
root ALL=(ALL:ALL) ALL
|
||||
%wheel ALL=(ALL:ALL) ALL
|
||||
%root ALL=(ALL:ALL) NOPASSWD: ALL
|
||||
@includedir /etc/sudoers.d
|
|
@ -1,2 +0,0 @@
|
|||
reflector # for scripts/00-reflector.sh
|
||||
alacritty # favourite terminal emulator
|
|
@ -1,22 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
cmd="pacman --noconfirm"
|
||||
while getopts "icru" opt; do
|
||||
case $opt in
|
||||
i)
|
||||
cmd="$cmd -S"
|
||||
;;
|
||||
u)
|
||||
cmd="$cmd -Syyu"
|
||||
;;
|
||||
r)
|
||||
cmd="$cmd -R"
|
||||
;;
|
||||
c)
|
||||
cmd="$cmd -Q"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND-1))
|
||||
|
||||
$cmd $@
|
|
@ -1,31 +0,0 @@
|
|||
[options]
|
||||
HoldPkg = pacman glibc yay
|
||||
Architecture = auto
|
||||
|
||||
Color
|
||||
CheckSpace
|
||||
ParallelDownloads = 5
|
||||
|
||||
SigLevel = Required DatabaseOptional
|
||||
LocalFileSigLevel = Optional
|
||||
|
||||
#[testing]
|
||||
#Include = /etc/pacman.d/mirrorlist
|
||||
|
||||
[core]
|
||||
Include = /etc/pacman.d/mirrorlist
|
||||
|
||||
[extra]
|
||||
Include = /etc/pacman.d/mirrorlist
|
||||
|
||||
#[community-testing]
|
||||
#Include = /etc/pacman.d/mirrorlist
|
||||
|
||||
[community]
|
||||
Include = /etc/pacman.d/mirrorlist
|
||||
|
||||
#[multilib-testing]
|
||||
#Include = /etc/pacman.d/mirrorlist
|
||||
|
||||
[multilib]
|
||||
Include = /etc/pacman.d/mirrorlist
|
|
@ -1,12 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Sets up fast mirrors on arch
|
||||
|
||||
if ! pacman -Q reflector; then
|
||||
echo "reflector was not installed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak
|
||||
reflector -c NL -f 10 --threads 4 --save /etc/pacman.d/mirrorlist
|
||||
echo "Server = arch.neo.faulty.nl/$repo/os/$arch" >> /etc/pacman.d/mirrorlist
|
|
@ -1,13 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Installs yay.
|
||||
|
||||
[ "$UID" = "0" ] || exit 0
|
||||
|
||||
yaytmpdir=$(mktemp -d)
|
||||
|
||||
git clone https://aur.archlinux.org/yay $yaytmpdir
|
||||
oldpwd=$(pwd)
|
||||
cd $yaytmpdir
|
||||
makepkg -si
|
||||
cd $oldpwd
|
|
@ -1,10 +0,0 @@
|
|||
bell:
|
||||
animation: 'Ease'
|
||||
duration: 50
|
||||
color: '#555555'
|
||||
cursor:
|
||||
style:
|
||||
shape: 'Block'
|
||||
blinking: 'On'
|
||||
blink_interval: 500
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
set number
|
||||
set relativenumber
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
mkdir .dotfiles &>/dev/null
|
||||
|
||||
for item in ${@:-update install_package_list run_system_scripts run_user_scripts link_home overlay}; do
|
||||
echo "executed_step:$item" >> .dotfiles/pending_sync
|
||||
done
|
132
sync.sh
132
sync.sh
|
@ -1,132 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
osreleaseprop() {
|
||||
cat /etc/os-release | grep -e "^$1=" | sed 's/ID=//'
|
||||
}
|
||||
|
||||
elevated() {
|
||||
s=${SUDO:-sudo}
|
||||
if [ ! "$s" = "none" ]; then
|
||||
if ! command -v $s &> /dev/null; then
|
||||
echo "command \"$s\" not found"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
s=""
|
||||
fi
|
||||
$s $@
|
||||
}
|
||||
|
||||
DISTRO=$(osreleaseprop ID)
|
||||
if [ ! -d "distros/$DISTRO" ]; then
|
||||
echo "$DISTRO is not supported."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
pm() {
|
||||
elevated "sh distros/$DISTRO/pm.sh $@"
|
||||
}
|
||||
|
||||
install_package_list() {
|
||||
pkgs=""
|
||||
[ -f "distros/${1:-$DISTRO}/package.list" ] || return 1
|
||||
for pkg in $(cat distros/${1:-$DISTRO}/package.list | sed 's/#.*$//'); do
|
||||
pkgs="$pkgs $pkg"
|
||||
done
|
||||
pm -i $pkgs
|
||||
}
|
||||
|
||||
run_scripts() {
|
||||
cmd=$1
|
||||
shift
|
||||
case $cmd in
|
||||
sys)
|
||||
dir="distros/${1:-$DISTRO}/sys-scripts"
|
||||
[ -d "$dir" ] || return
|
||||
for s in $(ls $dir); do
|
||||
echo "# running $dir/$s..."
|
||||
elevated sh $dir/$s || exit 1
|
||||
done
|
||||
;;
|
||||
user)
|
||||
dir="distros/${1:-$DISTRO}/user-scripts"
|
||||
[ -d "$dir" ] || return
|
||||
for s in $(ls $dir); do
|
||||
echo "# running $dir/$s..."
|
||||
sh $dir/$s || exit 1
|
||||
done
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
overlay() {
|
||||
[ -d "distros/${1:-$DISTRO}/root" ] || return 0
|
||||
elevated cp -r distros/${1:-$DISTRO}/root /
|
||||
}
|
||||
|
||||
__step_update() {
|
||||
echo "# updating system..."
|
||||
pm -u
|
||||
}
|
||||
|
||||
__step_install_package_list() {
|
||||
echo "# installing package lists..."
|
||||
install_package_list any
|
||||
install_package_list
|
||||
}
|
||||
|
||||
__step_run_system_scripts() {
|
||||
echo "# running system scripts..."
|
||||
run_scripts sys any
|
||||
run_scripts sys
|
||||
}
|
||||
|
||||
__step_run_user_scripts() {
|
||||
echo "# running user scripts..."
|
||||
run_scripts user any
|
||||
run_scripts user
|
||||
}
|
||||
|
||||
__step_overlay() {
|
||||
echo "# overlaying root directories..."
|
||||
overlay any
|
||||
overlay
|
||||
}
|
||||
|
||||
__step_link_home() {
|
||||
echo "# linking all home files..."
|
||||
trackingfile=".dotfiles/$(git rev-parse HEAD)-links"
|
||||
for item in $(find ./home -type f); do
|
||||
path=$(echo $item | sed "s/\.\/home//")
|
||||
[ -z "$path" ] && continue
|
||||
grep -q "$path" $trackingfile &> /dev/null && continue
|
||||
path="$HOME$path"
|
||||
mkdir -p $(dirname $path) &> /dev/null
|
||||
ln $item $path && echo "$path" >> $trackingfile
|
||||
done
|
||||
}
|
||||
|
||||
step() {
|
||||
if ! grep -q "executed_step:$1" .dotfiles/pending_sync &> /dev/null; then
|
||||
$(printf "__step_%s" "$1")
|
||||
echo "executed_step:$1" >> .dotfiles/pending_sync
|
||||
fi
|
||||
}
|
||||
|
||||
mkdir -p .dotfiles &> /dev/null
|
||||
touch .dotfiles/pending_sync
|
||||
|
||||
if [ -n "$1" ]; then
|
||||
step $1
|
||||
else
|
||||
echo "started_sync:$(date)" >> .dotfiles/log
|
||||
step update
|
||||
step install_package_list
|
||||
step run_system_scripts
|
||||
step run_user_scripts
|
||||
step link_home
|
||||
step overlay
|
||||
echo "finished_sync:$(date)" >> .dotfiles/log
|
||||
fi
|
||||
|
||||
unlink .dotfiles/pending_sync
|
10
unlink.sh
10
unlink.sh
|
@ -1,10 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
for linkfile in ${@:-$(find .dotfiles -type f -name *-links)}; do
|
||||
echo "# processing linkfile $linkfile..."
|
||||
for link in $(cat $linkfile); do
|
||||
echo "# unlinking $link..."
|
||||
unlink $link
|
||||
done
|
||||
rm -rf $linkfile
|
||||
done
|
Loading…
Reference in a new issue