Browse Source

alpine

master
Juni Kim 2 years ago
parent
commit
f6a3610f14
  1. 7
      Makefile
  2. 118
      install_alpine.sh

7
Makefile

@ -1,8 +1,11 @@
ubuntu:
docker run -it --rm -v $(CURDIR):/root/serverconfigs ubuntu /bin/bash
docker run -it --rm -v $(CURDIR):/root/sc ubuntu /bin/bash
#docker run -it -v $(pwd):/root/serverconfigs --rm ubuntu /bin/bash
fedora:
docker run -it --rm -v $(CURDIR):/root/serverconfigs fedora /bin/bash
docker run -it --rm -v $(CURDIR):/root/sc fedora /bin/bash
alpine:
docker run -it --rm -v $(CURDIR):/root/sc alpine /bin/ash
.PHONY: ubuntu fedora

118
install_alpine.sh

@ -0,0 +1,118 @@
#!/bin/sh
DIR="$(realpath "$(dirname "$0")")"
root_setup() {
# script must start at home directory
cd "$HOME" || exit 1;
usertest() {
if test "$(id -u)" -ne 0; then
echo "You must run this script as root.";
exit 1;
fi
}
createuser() {
printf 'full name: ' >&2
read -r NAME
printf 'login: ' >&2
read -r LOGIN
adduser -g "$NAME" "$LOGIN" || exit 1
adduser "$LOGIN" video || exit 1
adduser "$LOGIN" input || exit 1
adduser "$LOGIN" wheel || exit 1
adduser root wheel || exit 1
}
installdoas() {
apk add doas
echo "permit nopass :wheel" >> /etc/doas.d/doas.conf
}
usertest && createuser && installdoas
}
user_setup() {
cd "$HOME" || exit 1;
if ! (apk list | grep 'doas' 2>&1) > /dev/null; then
echo "doas is not installed.";
exit 1
fi
dev() {
echo "Developer tools..."
doas apk add git make python3 nodejs npm go cargo g++ gcc curl bash shadow || exit 1
}
sysinfo() {
echo "Dylan Araps scripts"
cd "$HOME" || exit 1;
mkdir -p repos
git clone https://github.com/dylanaraps/pfetch "$HOME/repos/pfetch"
git clone https://github.com/dylanaraps/neofetch "$HOME/repos/neofetch"
git clone https://github.com/dylanaraps/fff "$HOME/repos/fff"
cd "$HOME/repos/pfetch" || exit 1;
doas make install || exit 2;
cd "$HOME" || exit 1;
cd "$HOME/repos/neofetch" || exit 1;
doas make install || exit 2;
cd "$HOME" || exit 1;
cd "$HOME/repos/fff" || exit 1;
doas make install || exit 2;
cd "$HOME" || exit 1;
}
dotfiles() {
echo "Adding zsh and tmux configs"
# zsh plugins
doas apk add zsh tmux shellcheck fzf
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git "$HOME/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting"
# dotfiles
if ! test -d "$DIR/dots"; then
echo "$DIR/dots folder not found.";
exit 1;
fi
cp "$DIR/dots/zshrc" "$HOME/.zshrc"
cp "$DIR/dots/tmux.conf" "$HOME/.tmux.conf"
mkdir -p "$HOME/.local/bin" || exit 1
cp -r "$DIR/scripts/." "$HOME/.local/bin/" || exit 1
}
neovim() {
# install neovim
doas apk add neovim tree-sitter tree-sitter-cli
git clone --depth 1 https://github.com/wbthomason/packer.nvim ~/.local/share/nvim/site/pack/packer/start/packer.nvim || exit 1
git clone https://git.junickim.me/junikimm717/nvim2023 ~/.config/nvim || exit 1
nvim -c PackerSync -c 'sleep 10' -c qa --headless
echo "sleeping to compile"
nvim -c 'sleep 60' -c qa --headless
}
competitiveprogramming() {
echo "CP..."
git clone https://git.junickim.me/junikimm717/linuxcp "$HOME/cp"
go install git.junickim.me/junikimm717/cpgo@latest
}
(dev && sysinfo && dotfiles && neovim) || exit 1
}
if test $# -eq 0; then
echo "at least one argument: root or user" && exit 1
fi
case $1 in
root|r)
root_setup
;;
user|u)
user_setup
;;
*)
echo "Invalid option $1"
exit 1
;;
esac
Loading…
Cancel
Save