#!/bin/sh

ARCH=uname -m
USR=whoami

ssh -t ed25519

su
echo /etc/doas.conf > permit nopass keepenv :wheel
exit

doas sv enable ssh
doas sv start ssh

doas xbps-install -Su
doas xbps-install zsh curl rsync gnupg tmux svn lf fzf neovim tor i2pd w3m lynx claws-mail dino fcitx5-gtk fcitx5-gtk+2 fcitx5-gtk+3 fcitx5-gtk4 fcitx5-qt fcitx5-qt5 fcitx5-qt6 fcitx5-configtool fcitx5-mozc fcitx5-table-other opendoas plasma-desktop arc-theme arc-icon-theme git st gimp kdenlive libreoffice libreoffice-i18n-ja

mkdir -p /home/${USR}/.config /home/${USR}/.local/{share,bin}
doas curl -O /usr/bin https://076.moe/repo/bin/odl/0.3.0/linux/${ARCH}/odl
doas chmod +x /usr/bin/odl

doas odl -o /usr/bin https://076.moe/repo/bin/farfetch/0.3.0/linux/${ARCH}/farfetch
doas odl -o /usr/bin https://076.moe/repo/bin/sp/1.5.0/linux/${ARCH}/sp
doas odl -o /usr/bin https://076.moe/repo/bin/simpas/1.1.0/linux/${ARCH}/simpas
doas odl -o /usr/bin https://076.moe/repo/bin/txtconv/1.0.0/linux/${ARCH}/adda
doas odl -o /usr/bin https://076.moe/repo/bin/txtconv/1.0.0/linux/${ARCH}/uddu
doas odl -o /usr/bin https://076.moe/repo/bin/txtconv/1.0.0/linux/${ARCH}/uaau
doas odl -o /usr/bin https://076.moe/repo/bin/um/0.1.0/linux/${ARCH}/um
doas odl -o /usr/bin https://076.moe/repo/bin/uw/1.0.1/linux/${ARCH}/uw
doas odl -o /usr/bin/norikae https://076.moe/repo/bin/norikae-1.0.0-linux-${ARCH}
doas chmod +x /usr/bin/{sp,simpas,adda,uddu,uaau,um,norikae}

doas odl -o /usr/share/man/man1 https://076.moe/repo/man/byobu/byobu.1
doas odl -o /usr/share/man/man1 https://076.moe/repo/man/uw/1.0.1/uw.1
doas odl -o /usr/share/man/man1 https://076.moe/repo/man/farfetch/farfetch.1
doas odl -o /usr/share/man/man1 https://076.moe/repo/man/farfetch/farfetch-en.1
doas odl -o /usr/share/man/man5 https://076.moe/repo/man/farfetch/farfetch.conf.5
doas odl -o /usr/share/man/man5 https://076.moe/repo/man/farfetch/farfetch.conf-en.5
doas odl -o /usr/share/man/man1/norikae.1 https://076.moe/repo/man/norikae/norikae-1.1.0.1
doas odl -o /usr/share/man/man1 https://076.moe/repo/man/odl/0.3.1/odl.1
doas odl -o /usr/share/man/man1 https://076.moe/repo/man/sp/1.5.0/sp-en.1
doas odl -o /usr/share/man/man1 https://076.moe/repo/man/sp/1.5.0/sp-jp.1
doas odl -o /usr/share/man/man1 https://076.moe/repo/man/txtconv/1.0.0/adda.1
doas odl -o /usr/share/man/man1 https://076.moe/repo/man/txtconv/1.0.0/uaau.1
doas odl -o /usr/share/man/man1 https://076.moe/repo/man/txtconv/1.0.0/uddu.1
doas chmod +x /usr/share/man/man1/{byobu,farfetch,farfetch-en,adda,uaau,uddu,norikae,odl,sp-en,sp-ja}.1
doas chmod +x /usr/share/man/man5/farfetch.conf{,-en}.5

touch /home/${USR}/.config/sp.conf
touch /home/${USR}/.config/farfetch.conf

odl https://076.moe/repo/src/byobu/byobu-5.3.tar.gz
tar zxfv byobu-5.3.tar.gz
cd byobu-5.3
doas make

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
mv /home/${USR}/.oh-my-zsh /home/${USR}/.local/share/oh-my-zsh
odl -o /home/${USR} https://076.moe/repo/rice/unix/.zshrc
odl -o /home/${USR} https://076.moe/repo/rice/unix/.zprofile
mkdir -p /home/${USR}/.config/nvim
odl -o /home/${USR}/.config/nvim https://076.moe/repo/rice/unix/.config/nvim/init.lua
odl -o /home/${USR}/.local/bin https://076.moe/repo/rice/unix/.local/bin/getsystem
odl -o /home/${USR}/.local/share/oh-my-zsh/themes https://076.moe/repo/rice/unix/.local/share/oh-my-zsh/themes/loli.zsh-theme
odl -o /home/${USR}/.local/share/oh-my-zsh/plugins https://076.moe/repo/rice/unix/.local/share/oh-my-zsh/plugins/svn/svn.plugin.zsh
odl -o /home/${USR}/.local/share/oh-my-zsh/plugins https://076.moe/repo/rice/unix/.local/share/oh-my-zsh/plugins/mercurial/mercurial.plugin.zsh

odl -o /home/${USR}/.config/byobu/color.tmux https://076.moe/repo/rice/unix/.config/byobu/color-void.tmux

doas chsh -s /usr/bin/zsh ${USR}

byobu
