From b19236cf472f73156682c1263cf9ddf8517ba7e2 Mon Sep 17 00:00:00 2001 From: coolnsx Date: Tue, 7 Mar 2023 00:58:36 +0530 Subject: [PATCH] first commit --- readme.md | 7 +++++++ setup_scripts | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++ setwall | 31 +++++++++++++++++++++++++++++ uefi | 36 +++++++++++++++++++++++++++++++++ 4 files changed, 129 insertions(+) create mode 100644 readme.md create mode 100755 setup_scripts create mode 100755 setwall create mode 100755 uefi diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..06da52f --- /dev/null +++ b/readme.md @@ -0,0 +1,7 @@ +# resources + +- This repo contains all the installation scripts of other repos to streamline the installation of repos present on this github account + +### install_scripts + +- This script is used to clone and configure repos_scripts repo present on this Github user to save time, as this only clones the repo in case of normal desktop.. but In case of termux it would delete and override your home directory.. diff --git a/setup_scripts b/setup_scripts new file mode 100755 index 0000000..f4c92c3 --- /dev/null +++ b/setup_scripts @@ -0,0 +1,55 @@ +#!/bin/sh + +die() { + printf "\33[2K\r\033[1;31m%s\033[0m\n" "$*" >&2 + exit 1 +} + + +trap "exit 1" INT HUP + +#check your os +case $(uname -o) in + *ndroid*) #termux + install_dir="$HOME" + pkg_mgr="pkg in" + pkg_upd="pkg up -y" + pkg_spec="openssl-tool" + cd .. + rm -rdf "$HOME" + gh_user="https://github.com/" + ;; + *) #arch linux + pkg_mgr="doas pacman -S --needed" + pkg_upd="doas pacman -Syyu" + pkg_spec="mpv bemenu-wayland" + command -v doas >/dev/null || die "Please install doas!!!" + gh_user="git@github.com:" + ;; +esac + +#installing git +$pkg_mgr git + +#cloning repo +git clone ${gh_user}coolnsx/repos_scripts $install_dir + +#updating system +$pkg_upd + +#installing common pkgs +$pkg_mgr aria2 fzf ffmpeg python python-pip ncurses starship + +#installing os-specific pkgs +$pkg_mgr $pkg_spec + +if [ -n "$install_dir" ]; then + cd "$install_dir" || exit 1 + mkdir ".shortcuts" + cp ./* ".shortcuts/" + touch .hushlogin + mkdir ".config" + git clone "https://github.com/zsh-users/zsh-syntax-highlighting" "$install_dir/.config/zsh-syntax" + curl -s "https://raw.githubusercontent.com/CoolnsX/hyprdots/master/.zshrc" | sed '$d' > "$install_dir/.zshrc" + printf 'source $HOME/.config/zsh-syntax/zsh-syntax-highlighting.zsh' >> .zshrc +fi diff --git a/setwall b/setwall new file mode 100755 index 0000000..4a38b32 --- /dev/null +++ b/setwall @@ -0,0 +1,31 @@ +#!/bin/sh + +notify-send "Initiating wallpaper changing process" -r 2 +old="C01D41" +oldimg="/home/tanveer/wall/018.png" +img=$(nsxiv -t ~/wall/ -o) +[ -z "$img" ] && notify-send "Process aborted !!" -u critical -r 2 && exit 0 + +notify-send "Extracting Accent color.." -r 2 +accent=$(convert $img +dither -scale 25% -colors 10 -unique-colors txt: | tail -2 | head -1 | sed -nE 's/.* #([^ ]*).*/\1/p' | cut -c1-6) + +[ -z "$accent" ] && exit 0 +notify-send "Setting wallpaper.." -r 2 +xwallpaper --stretch "$img" & +notify-send "Tweaking system.." -r 2 +bspc config focused_border_color "#$accent" +notify-send "making changes permanent.." -r 2 +sed -i "s/$old/$accent/g" $HOME/.config/dunst/dunstrc +sed -i "s/$old/$accent/g" $HOME/.config/bspwm/bspwmrc +sed -i "s/$old/$accent/g" $HOME/.config/sxhkd/sxhkdrc +sed -i "s/$old/$accent/g" $HOME/repos_scripts/setwall +doas sed -i "s/$old/$accent/g" /usr/share/themes/Materia-dark-compact/gtk-3.0/gtk.css +doas sed -i "s/$old/$accent/g" /usr/share/themes/Materia-dark-compact/gtk-2.0/gtkrc +sed -i "s_${oldimg}_${img}_g" $HOME/.config/bspwm/bspwmrc +sed -i "s_${oldimg}_${img}_g" $HOME/repos_scripts/setwall +killall dunst +pkill -USR1 -x sxhkd +notify-send "generating terminal colorscheme.." -r 2 +$HOME/coolterm/run -t 'xres' "$img" +xrdb -merge -I$HOME ~/.Xresources +notify-send "Everything Done!!" -r 2 diff --git a/uefi b/uefi new file mode 100755 index 0000000..6570b96 --- /dev/null +++ b/uefi @@ -0,0 +1,36 @@ +#!/bin/sh + +#extracting info from drives +data=$(mount -l | sed -nE 's|([^ ]*) on \/boot.*|\1|p') + +#extracting drive name +drive=$(printf '%s' "$data" | sed -nE 's|(.*nvme.*)p[0-9]*$|\1|p;s|(.*[s|v]d[a-z])[0-9]*$|\1|p') + +#extracting efi partition +efi_part_no=$(printf '%s' "$data" | sed -nE 's/.*([0-9])$/\1/p') + +#extracting root partition +root_part=$(sed -nE 's|^([^#][^ ]*).*/ .*|\1|p' /etc/fstab | tr -d '\t') + +#extracting ur OS name from os-release +os_name=$(sed -nE 's/^NAME="([^"]*)"/\1/p' /etc/os-release) + +#checking for swap(this is currently not called in final command as not most people use hibernate..) +lsblk | grep -q 'SWAP' && swap="resume=$(blkid | sed -nE 's/.*(UUID[^ ]*).*swap.*/\1/p' | sed 's/"//g') " + +#checking for ucode in ur /boot +ls /boot/ | grep -q 'ucode' && ucode=" initrd=\\$(find /boot/ | sed -nE 's|.*/(.*code.*)|\1|p')" + +#fetching kernels list in /boot +kernel=$(ls /boot/ | sed -nE 's|(vmlinuz-.*)|\1|p') + +#iterating kernel +for i in $kernel;do + kernel_ver=$(printf '%s' "$i" | sed -nE 's/vmlinuz-(.*)/\1/p') + grep -q 'Arch Linux' /etc/os-release && initrd=$(ls /boot/ | sed -nE "s|(init.*$kernel_ver\.img)|\1|p") || initrd=$(ls /boot/ | sed -nE "s|(init.*$kernel_ver.*)|\1|p") + [ -z "$initrd" ] && continue + printf "\n\033[1;35mKernel : \033[1;32m%s\n" "$(printf "%s" "$i" | sed -nE 's/vmlinuz-(.*)/\1/p')" + command="efibootmgr --create --disk $drive --part $efi_part_no --label '${os_name}' --loader /$i --unicode 'root=$root_part rw initrd=\\${initrd}${ucode}'" + + printf "\033[1;36m%s\n" "$command" +done