diff options
| author | Mitchell Riedstra <mitch@riedstra.dev> | 2025-07-03 21:51:49 -0400 |
|---|---|---|
| committer | Mitchell Riedstra <mitch@riedstra.dev> | 2025-07-03 21:52:03 -0400 |
| commit | f8d380472d95099e67c37f72d2d8c7590546a536 (patch) | |
| tree | 6d63a6138ad4dc4b7fe091e63144804b5b2f318c /distro | |
| parent | 1ce931c98c5a8528c2e4cdb53dd16b15e37a278d (diff) | |
| download | dotfiles-f8d380472d95099e67c37f72d2d8c7590546a536.tar.gz dotfiles-f8d380472d95099e67c37f72d2d8c7590546a536.tar.xz | |
Add inital script for setting up Devuan
Diffstat (limited to 'distro')
| -rw-r--r-- | distro/devuan.sh | 200 |
1 files changed, 200 insertions, 0 deletions
diff --git a/distro/devuan.sh b/distro/devuan.sh new file mode 100644 index 0000000..eb5a951 --- /dev/null +++ b/distro/devuan.sh @@ -0,0 +1,200 @@ +#!/bin/sh +# distro/devuan.sh +echo "This script is designed to be run twice, once as root ( e.g. 'su -' )" +echo "Then again as your normal user without sudo, it will call sudo as needed" +if [ "$(id -u)" -eq 0 ] ; then + if ! grep -q 'EDITOR=' ~/.bashrc ; then + echo "EDITOR=vi" >> ~/.bashrc + fi + echo '%sudo ALL=(ALL:ALL) ALL' > /etc/sudoers.d/sudo_enable + printf "Enter username to add to sudo group (enter to skip): " + read -r _un + if ! [ -z "$_un" ] ; then + gpasswd -a "$_un" sudo + else + echo skipping... + fi + touch /etc/.sudo_configured + echo "now run as a regular user" + exit 0 +else + if ! [ -r /etc/.sudo_configured ] ; then + echo "Run as root first, then as a regular user" + exit 1 + fi +fi +set -ex + +codedir="$HOME/scm/pub" +nvimdir="${codedir}/neovim-nvim" +_nvim_msg=0 +okshdir="${codedir}/ibara-oksh" + +dwmdir="${codedir}/x/dwm" +dwmStdir="${codedir}/x/st" +dwmDmenudir="${codedir}/x/dmenu" +dwmSesdir="${codedir}/x/session" + +BRAVE="${BRAVE:-yes}" +NVIM="${NVIM:-yes}" +OKSH="${OKSH:-yes}" +PACKAGES="${PACKAGES:-yes}" +FONTS="${FONTS:-yes}" +DWM="${DWM:-no}" + +if [ "$PACKAGES" = yes ] ; then +# Get rid of the CDROM source, lol +sudo sed -i '/cdrom:/d' /etc/apt/sources.list + +sudo apt update + +sudo apt install -y git curl \ + tmux \ + htop \ + neofetch \ + oathtool \ + pavucontrol \ + scdaemon \ + vim \ + evemu-tools \ + evtest \ + libarchive-tools \ + evolution \ + gimp \ + git-lfs \ + ncdu \ + nload \ + pv \ + pwgen \ + ripgrep \ + wireguard-tools \ + zstd \ + dunst \ + xclip \ + restic \ + tree \ + + +fi + +if [ "$NVIM" = yes ] ; then + sudo apt build-dep -y neovim + + if ! [ -d "$nvimdir" ] ; then + git clone https://github.com/neovim/neovim "$nvimdir" + fi + cd "$nvimdir" + git fetch --tags + git checkout v0.11.2 + rm -rf build || echo "" + make CMAKE_EXTRA_FLAGS="-DCMAKE_INSTALL_PREFIX=$HOME/.local" -j"$(nproc)" + make install + cd - + + _paq_dir="${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/pack/paqs/start/paq-nvim + if ! [ -d "$_paq_dir" ] ; then + git clone --depth=1 https://github.com/savq/paq-nvim.git "$_paq_dir" + _nvim_msg=1 + fi +fi + +if [ "$OKSH" = yes ] ; then + if ! [ -d "$okshdir" ] ; then + git clone https://github.com/ibara/oksh "$okshdir" + fi + cd "$okshdir" + git checkout oksh-7.6 + ./configure + make + sudo make install + cd - + + if ! grep /usr/local/bin/oksh /etc/shells ; then + sudo sh -c 'echo /usr/local/bin/oksh >> /etc/shells' + fi + + if ! grep -qF 'export ENV=$HOME/.kshrc' ~/.profile; then + echo 'export ENV=$HOME/.kshrc' >> ~/.profile + fi + + set +x + if ! grep ^$(id -un) /etc/passwd | grep /usr/local/bin/oksh ; then + printf "Change shell to oksh? [y]es/[n]o: " + read -r resp + if [ "$resp" = "y" ] ; then + chsh -s /usr/local/bin/oksh + fi + fi + set -x + + +fi + +if [ "$BRAVE" = yes ] ; then +sudo curl -fsSLo /usr/share/keyrings/brave-browser-archive-keyring.gpg \ + https://brave-browser-apt-release.s3.brave.com/brave-browser-archive-keyring.gpg + +sudo curl -fsSLo /etc/apt/sources.list.d/brave-browser-release.sources \ + https://brave-browser-apt-release.s3.brave.com/brave-browser.sources + +sudo apt update + +sudo apt install -y brave-browser + +fi + +if [ "$FONTS" = yes ] ; then + if ! [ -d ~/.fonts ]; then + git clone https://git.riedstra.dev/mitch/fonts ~/.fonts + fi + sudo rm /etc/fonts/conf.d/70-no-bitmaps.conf || echo "" +fi + +if [ "$DWM" = yes ] ; then + sudo apt -y install compton + sudo apt -y build-dep dwm st + + if ! [ -d "$dwmdir" ] ; then + git clone https://git.riedstra.dev/x/dwm "$dwmdir" + fi + cd "$dwmdir" + make + sudo make clean install + cd - + + if ! [ -d "$dwmStdir" ] ; then + git clone https://git.riedstra.dev/x/st "$dwmStdir" + fi + cd "$dwmStdir" + make + sudo make clean install + cd - + + if ! [ -d "$dwmDmenudir" ] ; then + git clone https://git.riedstra.dev/x/dmenu "$dwmDmenudir" + fi + cd "$dwmDmenudir" + make + sudo make clean install + cd - + + if ! [ -d "$dwmSesdir" ] ; then + git clone https://git.riedstra.dev/x/session "$dwmSesdir" + fi + cd "$dwmSesdir" + sudo make install + cd - + + if ! [ -f ~/.xinitrc ] ; then +cat > ~/.xinitrc <<EOF +export ENV=\$HOME/.kshrc +dwm +EOF + chmod +x ~/.xinitrc + fi + +fi + +if [ $_nvim_msg -eq 1 ] ; then + printf "\033[1;31m%s\033[0m\n" "You will need to run ':PacSync' in neovim" +fi |
