From 4fd2faee2009877ab7d1acb8436795ff53032ac4 Mon Sep 17 00:00:00 2001 From: Reinaldy Rafli Date: Sun, 15 Aug 2021 22:51:24 +0700 Subject: [PATCH] migrating to debian was a pain in the ass --- bash/.bash_logout | 0 bash/.bashrc | 3 ++- bash/.profile | 0 bin/gitlogpro | 3 +++ bin/node-update | 2 +- scripts/clojure.sh | 27 +++++++++++++++++++++ scripts/go.sh | 12 +++++---- scripts/java.sh | 22 +++++++++++++++++ scripts/julia.sh | 6 ++--- scripts/lolcode.sh | 9 ++++--- scripts/lua.sh | 28 +++++++++++++++++++++ scripts/micro.sh | 17 +++++++------ scripts/neofetch.sh | 28 --------------------- scripts/neovim.sh | 5 ++-- scripts/node.sh | 5 ++-- scripts/python.sh | 35 +++++++++++++++++++++++++++ scripts/rust.sh | 2 +- scripts/utils.sh | 42 ++++++++++++++++++++++++++++---- setup.sh | 59 +++++++++++++++++++++++++++++++++------------ 19 files changed, 230 insertions(+), 75 deletions(-) mode change 100755 => 100644 bash/.bash_logout mode change 100755 => 100644 bash/.bashrc mode change 100755 => 100644 bash/.profile create mode 100755 bin/gitlogpro create mode 100755 scripts/clojure.sh create mode 100755 scripts/java.sh create mode 100755 scripts/lua.sh delete mode 100755 scripts/neofetch.sh diff --git a/bash/.bash_logout b/bash/.bash_logout old mode 100755 new mode 100644 diff --git a/bash/.bashrc b/bash/.bashrc old mode 100755 new mode 100644 index 755ffb3..4a84e8e --- a/bash/.bashrc +++ b/bash/.bashrc @@ -117,7 +117,7 @@ if ! shopt -oq posix; then fi # fnm -export PATH=$ME/.fnm:/opt/python/3.9.5/bin:$ME/.fly/bin:$ME/go/bin:$ME/dotfiles/bin:$PATH +export PATH=$ME/.fnm:/opt/julia/bin:/opt/python/3.9.6/bin:/opt/java/bin:$ME/.fly/bin:$ME/go/bin:$DOTFILES_PATH/bin:$PATH eval "`fnm env`" export LIBGL_ALWAYS_INDIRECT=1 @@ -128,3 +128,4 @@ sudo /etc/init.d/dbus start &> /dev/null . "$HOME/.cargo/env" export EDITOR="micro" +export DOTFILES_PATH=/home/reinaldy/.dotfiles diff --git a/bash/.profile b/bash/.profile old mode 100755 new mode 100644 diff --git a/bin/gitlogpro b/bin/gitlogpro new file mode 100755 index 0000000..10800dd --- /dev/null +++ b/bin/gitlogpro @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +git log --color --decorate --all --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit diff --git a/bin/node-update b/bin/node-update index 7fd8431..cecaa40 100755 --- a/bin/node-update +++ b/bin/node-update @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash fnm uninstall 14 fnm uninstall 16 diff --git a/scripts/clojure.sh b/scripts/clojure.sh new file mode 100755 index 0000000..025e608 --- /dev/null +++ b/scripts/clojure.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +function install () { + sudo ~ + curl -O https://download.clojure.org/install/linux-install-1.10.3.943.sh + chmod +x linux-install-1.10.3.943.sh + sudo ./linux-install-1.10.3.943.sh + + wget https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein + sudo chmod +x lein + sudo mv lein /usr/bin + + sudo lein + + sudo rm linux-install-1.10.3.943.sh +} + +if [ "$1" == "install" ]; then + if test ! $(which java); then + ./java.sh install + fi + install +elif [ "$1" == "uninstall" ] || [ "$1" == "remove" ]; then + uninstall +else + echo "please specify args with install or uninstall" +fi \ No newline at end of file diff --git a/scripts/go.sh b/scripts/go.sh index 9322f77..64e573e 100755 --- a/scripts/go.sh +++ b/scripts/go.sh @@ -1,15 +1,17 @@ -#!/bin/bash +#!/usr/bin/env bash -VERSION="1.16.6" +VERSION="1.16.7" function install () { echo "installing go" + sudo ~ wget https://golang.org/dl/go$VERSION.linux-amd64.tar.gz sudo rm -rf /usr/local/go sudo tar -C /usr/local -xzf go$VERSION.linux-amd64.tar.gz - rm go$VERSION.linux-amd64.tar.gz - sudo rm $HOME/.config/go/env - ln -s $HOME/dotfiles/go/env $HOME/.config/go/env + sudo rm go$VERSION.linux-amd64.tar.gz + sudo rm $HOME/.config/go + sudo mkdir $HOME/.config/go + sudo ln -s ${DOTFILES_PATH}/go/env $HOME/.config/go/env } function uninstall () { diff --git a/scripts/java.sh b/scripts/java.sh new file mode 100755 index 0000000..bbf9ac1 --- /dev/null +++ b/scripts/java.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +VERSION="16.0.2" + +function install () { + cd ~ + wget https://download.java.net/java/GA/jdk${VERSION}/d4a915d82b4c4fbb9bde534da945d746/7/GPL/openjdk-${VERSION}_linux-x64_bin.tar.gz + wget https://download.java.net/java/GA/jdk${VERSION}/d4a915d82b4c4fbb9bde534da945d746/7/GPL/openjdk-${VERSION}_linux-x64_bin.tar.gz.sha256 + sha256sum openjdk-${VERSION}_linux-x64_bin.tar.gz + sudo tar xvf openjdk-${VERSION}_linux-x64_bin.tar.gz + sudo mv jdk-$VERSION /opt/java + sudo rm openjdk-${VERSION}_linux-x64_bin.tar.gz + sudo rm openjdk-${VERSION}_linux-x64_bin.tar.gz.sha256 +} + +if [ "$1" == "install" ]; then + install +# elif [ "$1" == "uninstall" ] || [ "$1" == "remove" ]; then +# uninstall +else + echo "please specify args with install or uninstall" +fi diff --git a/scripts/julia.sh b/scripts/julia.sh index 0cf367d..fbf8093 100755 --- a/scripts/julia.sh +++ b/scripts/julia.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash MINOR="1.6" VERSION="1.6.2" @@ -8,9 +8,9 @@ function install () { cd ~ wget https://julialang-s3.julialang.org/bin/linux/x64/$MINOR/julia-$VERSION-linux-x86_64.tar.gz tar zxvf julia-$VERSION-linux-x86_64.tar.gz - mv julia-$VERSION julia + sudo mv julia-$VERSION julia sudo mv julia /opt/julia - rm julia-$VERSION-linux-x86_64.tar.gz + sudo rm julia-$VERSION-linux-x86_64.tar.gz } function uninstall () { diff --git a/scripts/lolcode.sh b/scripts/lolcode.sh index 1bfe574..2aa82dd 100755 --- a/scripts/lolcode.sh +++ b/scripts/lolcode.sh @@ -1,13 +1,14 @@ -#!/bin/bash +#!/usr/bin/env bash function install () { + cd ~ git clone https://github.com/justinmeza/lci.git cd lci cmake . - make + sudo make sudo make install - cd .. - rm -rf lci + cd ~ + sudo rm -rf lci } function uninstall () { diff --git a/scripts/lua.sh b/scripts/lua.sh new file mode 100755 index 0000000..b439b0a --- /dev/null +++ b/scripts/lua.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash + +VERSION="5.4.3" + +function install () { + cd ~ + wget https://www.lua.org/ftp/lua-$VERSION.tar.gz + sudo tar zxf lua-$VERSION.tar.gz + cd lua-$VERSION + make + sudo make install + cd ~ + sudo rm -rf lua-$VERSION + sudo rm lua-$VERSION.tar.gz +} + +function uninstall () { + sudo rm -rf /usr/local/bin/lua + sudo rm -rf /usr/local/lib/lua +} + +if [ "$1" == "install" ]; then + install +elif [ "$1" == "uninstall" ] || [ "$1" == "remove" ]; then + uninstall +else + echo "please specify args with install or uninstall" +fi \ No newline at end of file diff --git a/scripts/micro.sh b/scripts/micro.sh index 23ca0bb..df6eeb6 100755 --- a/scripts/micro.sh +++ b/scripts/micro.sh @@ -1,16 +1,19 @@ -#!/bin/bash +#!/usr/bin/env bash function install () { curl https://getmic.ro | bash sudo mv micro /usr/bin - ln -s $HOME/dotfiles/micro/settings.json $HOME/.config/micro/settings.json - ln -s $HOME/dotfiles/micro/bindings.json $HOME/.config/micro/bindings.json - mkdir ~/.config/micro/colorschemes - ln -s $HOME/dotfiles/micro/colorschemes/night-owl.micro $HOME/.config/micro/colorschemes/night-owl.micro - ln -s $HOME/dotfiles/micro/colorschemes/light-owl.micro $HOME/.config/micro/colorschemes/light-owl.micro + sudo rm $HOME/.config/micro/settings.json + sudo rm $HOME/.config/micro/bindings.json + sudo ln -s ${DOTFILES_PATH}/micro/settings.json $HOME/.config/micro/settings.json + sudo ln -s ${DOTFILES_PATH}/micro/bindings.json $HOME/.config/micro/bindings.json + sudo mkdir $HOME/.config/micro/colorschemes + sudo ln -s ${DOTFILES_PATH}/micro/colorschemes/night-owl.micro $HOME/.config/micro/colorschemes/night-owl.micro + sudo ln -s ${DOTFILES_PATH}/micro/colorschemes/light-owl.micro $HOME/.config/micro/colorschemes/light-owl.micro micro -plugin install editorconfig micro -plugin install filemanager micro -plugin install go + micro -plugin install wakatime } function uninstall () { @@ -23,4 +26,4 @@ elif [ "$1" == "uninstall" ] || [ "$1" == "remove" ]; then uninstall else echo "please specify args with install or uninstall" -fi \ No newline at end of file +fi diff --git a/scripts/neofetch.sh b/scripts/neofetch.sh deleted file mode 100755 index cce22d0..0000000 --- a/scripts/neofetch.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - -VERSION="7.1.0" - -function install () { - sudo apt install -y w3m - wget https://github.com/dylanaraps/neofetch/archive/refs/tags/${VERSION}.zip - unzip ${VERSION}.zip - rm $VERSION.zip - cd neofetch-$VERSION - sudo make install - cd .. - rm -rf neofetch-$VERSION - sudo rm $HOME/.config/neofetch/config.conf - ln -s $HOME/dotfiles/neofetch/config.conf $HOME/.config/neofetch/config.conf -} - -function uninstall () { - sudo rm -rf /usr/bin/neofetch -} - -if [ "$1" == "install" ]; then - install -elif [ "$1" == "uninstall" ] || [ "$1" == "remove" ]; then - uninstall -else - echo "please specify args with install or uninstall" -fi \ No newline at end of file diff --git a/scripts/neovim.sh b/scripts/neovim.sh index e219358..0e1e765 100755 --- a/scripts/neovim.sh +++ b/scripts/neovim.sh @@ -1,8 +1,9 @@ -#!/bin/bash +#!/usr/bin/env bash VERSION="v0.5.0" function install () { + cd ~ wget https://github.com/neovim/neovim/releases/download/$VERSION/nvim.appimage wget https://github.com/neovim/neovim/releases/download/$VERSION/nvim.appimage.sha256sum sha256sum nvim.appimage @@ -15,7 +16,7 @@ function install () { sudo rm -rf nvim.appimage sudo rm -rf squashfs-root mkdir $HOME/.config/nvim - ln -s $HOME/dotfiles/nvim/init.vim $HOME/.config/nvim/init.vim + ln -s ${DOTFILES_PATH}/nvim/init.vim $HOME/.config/nvim/init.vim } function uninstall () { diff --git a/scripts/node.sh b/scripts/node.sh index e4da013..71b9aff 100755 --- a/scripts/node.sh +++ b/scripts/node.sh @@ -1,10 +1,9 @@ -#!/bin/bash +#!/usr/bin/env bash function install () { echo "installing node js" curl -fsSL https://fnm.vercel.app/install | bash -s -- --skip-shell - $ME/.fnm/fnm fnm install lts - npm i -g yarn pnpm npm-check-updates np add-gitignore commitizen + node-update } function uninstall () { diff --git a/scripts/python.sh b/scripts/python.sh index e69de29..2acf982 100755 --- a/scripts/python.sh +++ b/scripts/python.sh @@ -0,0 +1,35 @@ +#!/usr/bin/env bash + +VERSION="3.9.6" + +function install () { + cd ~ + curl -O https://www.python.org/ftp/python/$VERSION/Python-$VERSION.tgz + sudo tar -xvzf Python-${VERSION}.tgz + cd Python-${VERSION} + ./configure \ + --prefix=/opt/python/${VERSION} \ + --enable-shared \ + --enable-ipv6 \ + LDFLAGS=-Wl,-rpath=/opt/python/${VERSION}/lib,--disable-new-dtags + make + sudo make install + + cd ~ + curl -O https://bootstrap.pypa.io/get-pip.py + sudo /opt/python/${VERSION}/bin/python3 get-pip.py + + sudo rm Python-$VERSION.tgz + sudo rm -rf Python-$VERSION + sudo rm get-pip.py + + /opt/python/${VERSION}/bin/python3 --version +} + +if [ "$1" == "install" ]; then + install +# elif [ "$1" == "uninstall" ]; then +# uninstall +else + echo "Only install and uninstall" +fi \ No newline at end of file diff --git a/scripts/rust.sh b/scripts/rust.sh index f2b43fd..eba3741 100755 --- a/scripts/rust.sh +++ b/scripts/rust.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash function install () { curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh diff --git a/scripts/utils.sh b/scripts/utils.sh index e2e5e1c..73d792d 100755 --- a/scripts/utils.sh +++ b/scripts/utils.sh @@ -1,19 +1,45 @@ -#!/bin/bash +#!/usr/bin/env bash function install_exa () { EXA_VERSION="0.10.1" + cd ~ wget https://github.com/ogham/exa/releases/download/v$EXA_VERSION/exa-linux-x86_64-v$EXA_VERSION.zip unzip exa-linux-x86_64-v$EXA_VERSION.zip -d exa sudo mv exa/bin/exa /usr/local/bin/exa - rm exa-linux-x86_64-v$EXA_VERSION.zip - rm -rf exa + sudo rm exa-linux-x86_64-v$EXA_VERSION.zip + sudo rm -rf exa } function install_bat () { BAT_VERSION="0.18.2" + cd ~ wget https://github.com/sharkdp/bat/releases/download/v${BAT_VERSION}/bat_${BAT_VERSION}_amd64.deb sudo dpkg -i bat_0.18.2_amd64.deb - rm bat_${BAT_VERSION}_amd64.deb + sudo rm bat_${BAT_VERSION}_amd64.deb +} + +function install_curlie () { + CURLIE_VERSION="1.6.0" + cd ~ + wget https://github.com/rs/curlie/releases/download/v${CURLIE_VERSION}/curlie_${CURLIE_VERSION}_linux_amd64.tar.gz + sudo tar -zxvf curlie_${CURLIE_VERSION}_linux_amd64.tar.gz curlie + sudo mv curlie /usr/local/bin/ + sudo rm curlie_${CURLIE_VERSION}_linux_amd64.tar.gz +} + +function install_neofetch () { + NEOFETCH_VERSION="7.1.0" + cd ~ + wget https://github.com/dylanaraps/neofetch/archive/refs/tags/$NEOFETCH_VERSION.tar.gz + sudo tar -zxvf $NEOFETCH_VERSION.tar.gz + cd neofetch-$NEOFETCH_VERSION + sudo make install + cd ~ + sudo rm -rf $HOME/.config/neofetch + sudo mkdir $HOME/.config/neofetch + sudo ln -s ${DOTFILES_PATH}/neofetch/config.conf $HOME/.config/neofetch/config.conf + sudo rm $NEOFETCH_VERSION.tar.gz + sudo rm -rf neofetch-$NEOFETCH_VERSION } if [ "$1" == "install" ]; then @@ -21,12 +47,18 @@ if [ "$1" == "install" ]; then install_bat elif [ "$2" == "exa" ]; then install_exa + elif [ "$2" == "curlie" ]; then + install_curlie + elif [ "$2" == "neofetch" ]; then + install_neofetch else install_exa install_bat + install_curlie + install_neofetch fi elif [ "$1" == "uninstall" ] || [ "$1" == "remove" ]; then uninstall else echo "please specify args with install or uninstall" -fi \ No newline at end of file +fi diff --git a/setup.sh b/setup.sh index a5750d3..16cb445 100755 --- a/setup.sh +++ b/setup.sh @@ -1,29 +1,58 @@ -#!/bin/bash +#!/usr/bin/env bash ME="/home/$(whoami)" CFG="${ME}/.config" DOTFILES="${ME}/dotfiles" BINDIR="${ME}/dotfiles/bin" +sudo -v + echo "I'm assuming you're doing a fresh install. Send a SIGTERM anytime you like." -sudo apt install -y curl wget openssl tar unzip git -sudo apt-get install editorconfig +# Set dotfiles path +DOTFILES_PATH=$(pwd) + +function set_symlink () { + sudo rm $HOME/.bashrc + sudo ln -s ${DOTFILES_PATH}/bash/.bashrc $HOME/.bashrc + echo "export DOTFILES_PATH=$(pwd)" >> $HOME/.bashrc + sudo rm $HOME/.bash_logout + sudo ln -s ${DOTFILES_PATH}/bash/.bash_logout $HOME/.bash_logout + sudo rm $HOME/.profile + sudo ln -s ${DOTFILES_PATH}/bash/.profile $HOME/.profile + sudo rm $HOME/.gitconfig + sudo ln -s ${DOTFILES_PATH}/git/.gitconfig $HOME/.gitconfig + sudo rm $HOME/.czcrc + sudo ln -s ${DOTFILES_PATH}/git/.czrc $HOME/.czrc +} + +if [[ $(cat /etc/issue) = *"Ubuntu"* ]]; then + sudo apt update + sudo apt upgrade + sudo apt install -y curl wget openssl tar unzip git rlwrap editorconfig gpg build-essential libffi-dev libgdbm-dev libsqlite3-dev libssl-dev zlib1g-dev + set_symlink +elif [[ $(cat /etc/issue) = *"Debian"* ]]; then + sudo apt-get update + sudo apt-get upgrade + sudo apt-get install -y curl wget openssl tar unzip git rlwrap editorconfig gpg build-essential libffi-dev libgdbm-dev libsqlite3-dev libssl-dev zlib1g-dev + set_symlink +else + echo "you will need to install curl, wget, openssl, gpg, and other stuff yourself" +fi sudo chmod -R 755 ./scripts +sudo chmod -R 755 ./bin -if test ! $(which fnm); then - ./scripts/node.sh install -fi +./scripts/python.sh install -if test ! $(which go); then - ./scripts/go.sh install -fi +./scripts/node.sh install -if test ! $(which julia); then - ./scripts/julia.sh install -fi +./scripts/go.sh install -if test ! $(which nvim); then - ./scripts/neovim.sh install -fi \ No newline at end of file +./scripts/julia.sh install + +./scripts/rust.sh install + +./scripts/micro.sh install + +./scripts/utils.sh install