added my scripts and added them to the install script

linux-gnome
Adriel Sand 2022-01-17 11:43:02 -03:00
parent e9f8fd33f5
commit 27abe57d70
14 changed files with 742 additions and 1 deletions

View File

@ -6,5 +6,5 @@ tar -xvf .config/nvim.tar.xz
mv nvim .config/nvim mv nvim .config/nvim
cd $HOME cd $HOME
cp -rf "$current_dir"/{.config,.local} . cp -rf "$current_dir"/{.config,.local,scripts} .
cp -rf "$current_dir"/{.nvimrc} . cp -rf "$current_dir"/{.nvimrc} .

View File

@ -0,0 +1,3 @@
#!/bin/bash
sleep 2
albert

View File

@ -0,0 +1,26 @@
#!/bin/bash
c_wksp=$(( $(wmctrl -d | grep '*' | cut --delimiter=' ' -f1) + 1 ))
case $c_wksp in
'1')
brave
;;
'2')
alacritty
;;
'3')
schildichat-desktop
;;
'4')
vlc
;;
'5')
nautilus
;;
'6')
spotify
;;
*)
echo "What was that?"
;;
esac

View File

@ -0,0 +1,135 @@
#!/bin/bash
# ---Clearing Variables to Default---
var_wheel=""
# ---Questions---
read -p 'Hostname: ' var_hostname
read -p 'Root password: ' var_password
read -p 'User name: ' var_user_name
read -p "User ($var_user_name) password: " var_user_password
read -p "Would you like the user \"$var_user_name\" to be a super user? (type \'wheel\' to say yes) " var_user_wheel
if [[ $var_user_wheel = "wheel" ]]
then
var_wheel="-aG wheel"
else
var_wheel=" "
fi
echo
echo
echo 'Starting to install...'
echo
echo
echo
sleep 1
# ---Execution---
ln -sf /usr/share/zoneinfo/America/Buenos_Aires /etc/localtime
hwclock --systohc
timedatectl set-ntp true
sed -i 's/#en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen
locale-gen
echo 'LANG=en_US.UTF-8' >> /etc/locale.conf
echo "$var_hostname" >> /etc/hostname
echo '127.0.0.1 localhost' >> /etc/hosts
echo '::1 localhost' >> /etc/hosts
echo "127.0.0.1 $var_hostname.localdomain $var_hostname" >> /etc/hosts
echo
echo
echo 'Doing btrfs stuff and encryption...'
echo
echo
echo
sleep 1
# ---[Btrfs and encryption]---
sed -i 's/MODULES=(/MODULES=(btrfs/' /etc/mkinitcpio.conf
var_hooks_line="$(grep 'HOOKS=(' /etc/mkinitcpio.conf | grep -v '# HOOKS')"
var_hooks_replace="$(grep 'HOOKS=(' /etc/mkinitcpio.conf | grep -v '# HOOKS' | sed 's/filesystems/encrypt filesystems/')"
sed -i "s/$var_hooks_line/$var_hooks_replace/" /etc/mkinitcpio.conf
mkinitcpio -p linux
echo
echo
echo 'Doing user stuff...'
echo
echo
echo
sleep 1
# ---[Users]---
useradd -m "$var_user_name"
echo "$var_user_name:$var_user_password" | chpasswd
echo "root:$var_password" | chpasswd
sed -i 's/# %wheel ALL=(ALL) ALL/%wheel ALL=(ALL) ALL/' /etc/sudoers
if [[ $var_wheel = "-aG wheel" ]]
then
usermod $var_wheel $var_user_name
fi
echo
echo
echo 'Installing packages...'
echo
echo
echo
sleep 1
# ---[Packages]---
pacman -S networkmanager gnome gdm gnome-tweaks alacritty fish exa vlc git base-devel adobe-source-sans-fonts
mkdir /root/arch-custom-install
cd /root/arch-custom-install
git clone https://gitlab.com/thebiblelover7/prebuilt-packages
cd prebuilt-packages
for i in $(ls -1)
do
pacman -U $i
done
paru -S brave-bin logseq-desktop-bin slack-desktop schildichat-desktop-bin whitesur-icon-theme whitesur-gtk-theme gnome-shell-extension-pop-shell-git cursor-theme-macos-big-sur
echo
echo
echo 'Installing configs...'
echo
echo
echo
sleep 1
# ---[Configs]---
cd /home/$var_user_name
git clone https://gitlab.com/thebiblelover7/dotfiles
cd dotfiles
./install.sh
chown -R $var_user_name:$var_user_name /home/$var_user_name
chsh -s /bin/fish $var_user_name
cd
# pacman color and parallel downloads
# change dotfiles to have the plain background, and to have the right theme
# albert
echo
echo
echo 'Enabling services to start on boot...'
echo
echo
echo
sleep 1
# ---[Services]
systemctl enable NetworkManager
systemctl enable bluetooth
systemctl enable gdm
#systemctl enable cups.service

View File

@ -0,0 +1,74 @@
#!/bin/bash
# |||||- Pre-Configurations -|||||
diselect() {
PS3='Please enter your choice: '
select opt in "${options[@]}"
do
case $opt in
1|"${options[0]}")
${option_c[0]}
break
;;
2|"${options[1]}")
${option_c[1]}
break
;;
3|"${options[2]}")
${option_c[2]}
break
;;
4|"${options[3]}")
${option_c[3]}
break
;;
5|"${options[4]}")
${option_c[4]}
break
;;
*) echo "invalid option, try again" ;;
esac
done
}
# |||||- Functions -|||||
check_internet() {
ping -c 2 archlinux.org && check_intenet_state=true || check_intenet_state=false
if [[ $check_intenet_state = false ]]
then
echo "No internet.. Exiting..."
exit 2
fi
}
update_time() {
timedatectl set-ntp true
}
dialog_partition_disks() {
options=("cfdisk" "fdisk" "I already partitioned my disks")
option_c=("fun_cfdisk" "fun_fdisk" "echo")
diselect
}
dialog_drive_list() {
echo "Please enter your drive to be partitioned in the format '/dev/sda'"
read -p "-> " var_drive
}
fun_cfdisk() {
dialog_drive_list
cfdisk $var_drive
}
# |||||- Execution -|||||
check_internet
dialog_partition_disks

View File

@ -0,0 +1,4 @@
#!/bin/bash
nvim $HOME/scripts/npad
cp $HOME/scripts/npad $HOME/clonenbuild/npad/npad

66
scripts/net_test 100755
View File

@ -0,0 +1,66 @@
#!/bin/bash
out_ip="1.1.1.1"
out_fallback_ip="8.8.8.8"
out_domain="archlinux.org"
out_fallback_domain="google.com"
go_again=false
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m' # No Color
out_ipf() {
echo -e '\033[1m[..] Checking if I can reach the outside internet...'
ping -c 2 $out_ip &> /dev/null
if [[ $(echo $?) = 0 ]]
then
out_ipw=true
echo -e "\033[1m[$GREEN✓$NC] Outside Internet is working\033[0m"
notify-send -t 1000 -i network-wireless 'Outside Internet is working!' -u critical
else
out_ipw=false
echo -e "$RED\033[1m[❌] Outside Internet is not accesible\033[0m$NC"
fi
}
out_domainf() {
echo -e '\033[1m[..] Checking if I can reach DNS...'
nslookup $out_domain &> /dev/null
if [[ $(echo $?) = 0 ]]
then
out_domainw=true
echo -e "\033[1m[$GREEN✓$NC] DNS is working\033[0m"
notify-send -t 1000 -i network-wireless 'DNS is working!' -u critical
else
out_domainw=false
echo -e "$RED\033[1m[❌] DNS is not accesible\033[0m$NC"
fi
}
check_go(){
if [[ $out_ipw ]]
then
true
else
go_again=true
fi
if [[ $out_domainw ]]
then
echo Done!
else
go_again=true
fi
}
go_again=true
while [[ $go_again ]]
do
out_ipf
out_domainf
check_go
sleep $1
done

View File

@ -0,0 +1,8 @@
#/bin/bash
if [[ $(gsettings get org.gnome.settings-daemon.plugins.color night-light-enabled) = "true" ]]
then
gsettings set org.gnome.settings-daemon.plugins.color night-light-enabled false
else
gsettings set org.gnome.settings-daemon.plugins.color night-light-enabled true
fi

174
scripts/npad 100755
View File

@ -0,0 +1,174 @@
#!/bin/bash
npad_config_dir=$HOME/.config/npad
npad_config_file_path=$npad_config_dir/npad.conf
npad_config_exists_out=$(cat $npad_config_file_path &> /dev/null)
npad_config_exists=$?
npad_default_notes_dir=$HOME/Npad
npad_default_note_num=1
npad_default_editor=$EDITOR
npad_default_note_extension=".md"
note_num=$npad_default_note_num
bold_on="setterm --bold on"
bold_off="setterm --bold off"
make_default_config() {
mkdir -p $npad_config_dir || exit 2
echo "npad_notes_dir=$npad_default_notes_dir" > $npad_config_file_path
echo "note_num=$npad_default_note_num" >> $npad_config_file_path
echo "npad_note_extension=$npad_default_note_extension" >> $npad_config_file_path
echo "npad_editor=$npad_default_editor" >> $npad_config_file_path
mkdir -p $npad_default_notes_dir || exit 2
}
make_config_file() {
mkdir -p $npad_config_dir || exit 2
echo "npad_notes_dir=$npad_notes_dir" > $npad_config_file_path
echo "note_num=$note_num" >> $npad_config_file_path
echo "npad_note_extension=$npad_note_extension" >> $npad_config_file_path
echo "npad_editor=$npad_editor" >> $npad_config_file_path
mkdir -p $npad_notes_dir || exit 2
}
make_config_dialog() {
$bold_on && echo "Would you like to change the default notes directory? $npad_default_notes_dir"
echo "[y,N]" && $bold_off
read change_notes_dir
if [[ $change_notes_dir = "y" || $change_notes_dir = "Y" ]]
then
$bold_on && echo "Enter absolute directory of stored files e.g. /home/$(whoami)/notes" && $bold_off
read npad_notes_dir_input
npad_notes_dir=$npad_notes_dir_input
make_config_file
else
npad_notes_dir=$npad_default_notes_dir
make_config_file
fi
mkdir -p $npad_notes_dir || exit 2
$bold_on && echo "Would you like to change the current editor ($EDITOR)?"
echo "[y,N]" && $bold_off
read change_editor
if [[ $change_editor = "y" || $change_editor = "Y" ]]
then
$bold_on && echo "Enter the command used to run the editor (e.g. 'nano', 'vi', 'micro')" && $bold_off
read npad_editor_input
npad_editor=$npad_editor_input
make_config_file
else
npad_editor=$npad_default_editor
make_config_file
fi
$bold_on && echo "Would you like to change the current file extension for the notes ($npad_default_note_extension)?"
echo "[y,N]" && $bold_off
read change_note_extension
if [[ $change_note_extension = "y" || $change_note_extension = "Y" ]]
then
$bold_on && echo "Enter the file extension desired (e.g. '.md', '.txt')" && $bold_off
read npad_note_extension_input
npad_note_extension="$npad_note_extension_input"
make_config_file
else
npad_note_extension=$npad_default_note_extension
make_config_file
fi
source $npad_config_file_path
}
update_note_num() {
if [[ $(cat $npad_notes_dir/$note_num$npad_note_extension &> /dev/null && echo $?) = 0 ]]
then
note_num=$(($note_num + 1))
fi
make_config_file
}
new_note() {
$npad_editor $npad_notes_dir/$note_num$npad_note_extension
update_note_num
}
open_note(){
$npad_editor $npad_notes_dir/$note_num$npad_note_extension
}
get_entries() {
ls -1 $npad_notes_dir | while read note
do
$bold_on && echo "$note" && $bold_off
cat -n $npad_notes_dir/$note | while read line
do
line_num=$(echo $line | cut -d ' ' -f1)
new_line=$(echo $line | sed "s/$line_num //g")
# line_num=$(echo "$line" | cut --delimiter=' ' -f1)
if [[ $line_num -lt 5 ]]
then
# echo $line_num
echo "$new_line"
# echo $line | sed "s/$line_num //"
fi
done
echo
echo
done
# for i in $notes_list
# do
# echo "$i"
# sleep 2
# for line in $(cat -n $npad_notes_dir/$i)
# do
# if [[ $(echo $line | cut --delimiter=' ' -f1) < 5 ]]
# then
# echo $line
# fi
# done
# done
}
if [[ $npad_config_exists = 1 ]] # 1 means not true in this case (exit code)
then
make_default_config
echo "npad Copyright (C) 2021 Adriel Sand
This program comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions. See https://gitlab.com/thebiblelover7/npad for more details."
$bold_on
echo "Would you like to change the defaults?"
echo "[y,N]" && $bold_off
read change_defaults
if [[ $change_defaults = "y" || $change_defaults = "Y" ]]
then
make_config_dialog
else
make_default_config
fi
source $npad_config_file_path || exit 2
else
source $npad_config_file_path || exit 2
fi
case $1 in
'list' | '-l' | '--list')
get_entries
;;
*)
note_num=$1
note_exists=$(cat $npad_notes_dir/$note_num$npad_note_extension &> /dev/null && echo $?)
if [[ $note_exists = 0 ]]
then
open_note
else
source $npad_config_file_path || exit 2
new_note
fi
;;
esac

View File

@ -0,0 +1,4 @@
#!/bin/bash
sleep 0.05
/home/adriel/scripts/npad

23
scripts/projman 100755
View File

@ -0,0 +1,23 @@
#!/bin/bash
project_dir=$HOME/Videos/Projects
proj_name=$1
mkproj(){
mkdir -p $project_dir/$proj_name
}
openproj(){
cd $project_dir/$proj_name
tmux
}
case $1 in
'--help' | '-h' | 'help')
echo "HELP!"
;;
* )
echo $proj_name
mkproj
openproj
;;
esac

21
scripts/social 100755
View File

@ -0,0 +1,21 @@
#!/bin/bash
choice=$(echo "Schildichat
Element
Signal
Telegram" | rofi -dmenu -i)
case $choice in
'Schildichat')
schildichat-desktop
;;
'Element')
element-desktop
;;
'Signal')
signal-desktop
;;
'Telegram')
telegram-desktop
;;
esac

3
scripts/ssh-into 100755
View File

@ -0,0 +1,3 @@
#!/bin/bash
ssher=$(wofi --dmenu -i < $HOME/.config/ssh-into); terminator -e "ssh $ssher"

200
scripts/write-write 100755
View File

@ -0,0 +1,200 @@
#!/bin/bash
sleep 0.2
write_config_dir=$HOME/.config/write
write_config_file_path=$write_config_dir/write.conf
write_config_exists_out=$(cat $write_config_file_path &> /dev/null)
write_config_exists=$?
write_default_notes_dir=$HOME/Write-Write
write_default_note_num=1
write_default_editor=$EDITOR
write_default_note_extension=".md"
logseq_page_path="$HOME/Nextcloud/Notes/Logseq/pages/write-write.md"
note_num=$write_default_note_num
bold_on="setterm --bold on"
bold_off="setterm --bold off"
make_default_config() {
mkdir -p $write_config_dir || exit 2
echo "write_notes_dir=$write_default_notes_dir" > $write_config_file_path
echo "note_num=$write_default_note_num" >> $write_config_file_path
echo "write_note_extension=$write_default_note_extension" >> $write_config_file_path
echo "write_editor=$write_default_editor" >> $write_config_file_path
mkdir -p $write_default_notes_dir || exit 2
}
make_config_file() {
mkdir -p $write_config_dir || exit 2
echo "write_notes_dir=$write_notes_dir" > $write_config_file_path
echo "note_num=$note_num" >> $write_config_file_path
echo "write_note_extension=$write_note_extension" >> $write_config_file_path
echo "write_editor=$write_editor" >> $write_config_file_path
mkdir -p $write_notes_dir || exit 2
}
make_config_dialog() {
$bold_on && echo "Would you like to change the default notes directory? $write_default_notes_dir"
echo "[y,N]" && $bold_off
read change_notes_dir
if [[ $change_notes_dir = "y" || $change_notes_dir = "Y" ]]
then
$bold_on && echo "Enter absolute directory of stored files e.g. /home/$(whoami)/notes" && $bold_off
read write_notes_dir_input
write_notes_dir=$write_notes_dir_input
make_config_file
else
write_notes_dir=$write_default_notes_dir
make_config_file
fi
mkdir -p $write_notes_dir || exit 2
$bold_on && echo "Would you like to change the current editor ($EDITOR)?"
echo "[y,N]" && $bold_off
read change_editor
if [[ $change_editor = "y" || $change_editor = "Y" ]]
then
$bold_on && echo "Enter the command used to run the editor (e.g. 'nano', 'vi', 'micro')" && $bold_off
read write_editor_input
write_editor=$write_editor_input
make_config_file
else
write_editor=$write_default_editor
make_config_file
fi
$bold_on && echo "Would you like to change the current file extension for the notes ($write_default_note_extension)?"
echo "[y,N]" && $bold_off
read change_note_extension
if [[ $change_note_extension = "y" || $change_note_extension = "Y" ]]
then
$bold_on && echo "Enter the file extension desired (e.g. '.md', '.txt')" && $bold_off
read write_note_extension_input
write_note_extension="$write_note_extension_input"
make_config_file
else
write_note_extension=$write_default_note_extension
make_config_file
fi
source $write_config_file_path
}
append_note_logseq() {
echo "" >> $logseq_page_path
echo "# $note_num$write_note_extension" >> $logseq_page_path
# echo " -" >> $logseq_page_path
cat $write_notes_dir/$note_num$write_note_extension >> $logseq_page_path
echo "" >> $logseq_page_path
}
check_note_diff() {
diff_state=$(diff $write_notes_dir/$note_num$write_note_extension $write_notes_dir/$note_num$write_note_extension.previous &> /dev/null && echo $?)
}
update_note_num() {
note_exists=$(cat $write_notes_dir/$note_num$write_note_extension &> /dev/null && echo $?)
if [[ $note_exists = 0 ]]
then
note_num=$(($note_num + 1))
fi
make_config_file
}
new_note() {
$write_editor $write_notes_dir/$note_num$write_note_extension
note_exists=$(cat $write_notes_dir/$note_num$write_note_extension &> /dev/null && echo $?)
if [[ $note_exists = 0 ]]
then
append_note_logseq
fi
update_note_num
}
open_note(){
cp $write_notes_dir/$note_num$write_note_extension $write_notes_dir/$note_num$write_note_extension.previous
$write_editor $write_notes_dir/$note_num$write_note_extension
check_note_diff
if [[ $diff_state = 1 ]]
then
replace_note_logseq
fi
}
get_entries() {
ls -1 $write_notes_dir | while read note
do
$bold_on && echo "$note" && $bold_off
cat -n $write_notes_dir/$note | while read line
do
line_num=$(echo $line | cut -d ' ' -f1)
new_line=$(echo $line | sed "s/$line_num //g")
# line_num=$(echo "$line" | cut --delimiter=' ' -f1)
if [[ $line_num -lt 5 ]]
then
# echo $line_num
echo "$new_line"
# echo $line | sed "s/$line_num //"
fi
done
echo
echo
done
# for i in $notes_list
# do
# echo "$i"
# sleep 2
# for line in $(cat -n $write_notes_dir/$i)
# do
# if [[ $(echo $line | cut --delimiter=' ' -f1) < 5 ]]
# then
# echo $line
# fi
# done
# done
}
if [[ $write_config_exists = 1 ]] # 1 means not true in this case (exit code)
then
make_default_config
echo "write-write Copyright (C) 2021 Adriel Sand
This program comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions. See https://gitlab.com/thebiblelover7/npad for more details."
$bold_on
echo "Would you like to change the defaults?"
echo "[y,N]" && $bold_off
read change_defaults
if [[ $change_defaults = "y" || $change_defaults = "Y" ]]
then
make_config_dialog
else
make_default_config
fi
source $write_config_file_path || exit 2
else
source $write_config_file_path || exit 2
fi
case $1 in
'list' | '-l' | '--list')
get_entries
;;
*)
note_num=$1
note_exists=$(cat $write_notes_dir/$note_num$write_note_extension &> /dev/null && echo $?)
if [[ $note_exists = 0 ]]
then
open_note
else
source $write_config_file_path || exit 2
new_note
fi
;;
esac