first commit

This commit is contained in:
coolnsx
2023-03-07 00:58:36 +05:30
commit b19236cf47
4 changed files with 129 additions and 0 deletions

7
readme.md Normal file
View File

@@ -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..

55
setup_scripts Executable file
View File

@@ -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

31
setwall Executable file
View File

@@ -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

36
uefi Executable file
View File

@@ -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