configure-bashrc.sh
configure-dnf.sh
configure-git.sh
configure-gnome.sh
configure-grub.sh
configure-repositories.sh
install-packages.sh
Last active
June 6, 2022 20:48
-
-
Save askmrsinh/7147265a6cf13b0d670aad8d57ba2025 to your computer and use it in GitHub Desktop.
Post-installation scripts.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "Show terminal color support" | |
echo -e "\n\033[4;31mLight Colors\033[0m \t\t\033[1;4;31mDark Colors\033[0m" | |
echo -e "\e[0;30;47m Black \e[0m 0;30m \t\e[1;30;40m Dark Gray \e[0m 1;30m" | |
echo -e "\e[0;31;47m Red \e[0m 0;31m \t\e[1;31;40m Dark Red \e[0m 1;31m" | |
echo -e "\e[0;32;47m Green \e[0m 0;32m \t\e[1;32;40m Dark Green \e[0m 1;32m" | |
echo -e "\e[0;33;47m Brown \e[0m 0;33m \t\e[1;33;40m Yellow \e[0m 1;33m" | |
echo -e "\e[0;34;47m Blue \e[0m 0;34m \t\e[1;34;40m Dark Blue \e[0m 1;34m" | |
echo -e "\e[0;35;47m Magenta \e[0m 0;35m \t\e[1;35;40m DarkMagenta\e[0m 1;35m" | |
echo -e "\e[0;36;47m Cyan \e[0m 0;36m \t\e[1;36;40m Dark Cyan \e[0m 1;36m" | |
echo -e "\e[0;37;47m LightGray\e[0m 0;37m \t\e[1;37;40m White \e[0m 1;37m" | |
for i in {0..255}; do | |
printf "\x1b[38;5;${i}mcolour${i}\x1b[0m\n" | |
done | |
# Install Tmux, Powerline ect | |
sudo dnf install -y tmux | |
sudo dnf install -y powerline tmux-powerline vim-powerline | |
sudo dnf install -y vim-nerdtree | |
# poerline custom configuration dependencies | |
# https://powerline.readthedocs.io/en/master/configuration/segments/common.html#powerline.segments.common.sys.cpu_load_percent | |
sudo dnf install -y python3-psutil | |
# Configure Powerline | |
#cp -a /etc/xdg/powerline/ ~/.config/ | |
sudo wget "https://www.dropbox.com/s/cvuk90dhsnq86b9/powerline.tar.xz?dl=0" -O ~/powerline.tar.xz | |
sudo tar xfz ~/powerline.tar.xz -C ~/.config | |
rm -rf ~/powerline.tar.gz | |
# Configure Tmux | |
cat << EOT > ~/.tmux.conf | |
bind r source-file ~/.tmux.conf \; display-message "Config reloaded." | |
source "/usr/share/tmux/powerline.conf" | |
#set -g mode-mouse on | |
#set -g mouse-resize-pane on | |
#set -g mouse-select-pane on | |
#set -g mouse-select-window on | |
set -g default-terminal 'screen-256color' | |
set -g terminal-overrides 'xterm*:smcup@:rmcup@' | |
set-option -g allow-rename off | |
bind h split-window -h | |
bind v split-window -v | |
unbind '"' | |
unbind % | |
EOT | |
cat << 'EOT' > ~/.vimrc | |
" Custom | |
"silent !mkdir -p ~/.vim/{backup,swap,undo} > /dev/null 2>&1 | |
" Persist backups for each write | |
"set backup | |
"set backupdir=~/.vim/backup// | |
"set writebackup | |
"set backupcopy=yes | |
"au BufWritePre * let &bex = '@' . strftime("%s") | |
" Protect changes between writes | |
"set swapfile | |
"set directory=~/.vim/swap// | |
" Persist the undo tree | |
"set undofile | |
"set undodir=~/.vim/undo// | |
python3 from powerline.vim import setup as powerline_setup | |
python3 powerline_setup() | |
python3 del powerline_setup | |
" Always display the statusline in all windows | |
set laststatus=2 | |
" Always display the tabline, even if there is only one tab | |
set showtabline=2 | |
" Hide the default mode text (e.g. -- INSERT -- below the statusline) | |
set noshowmode | |
set t_Co=256 | |
EOT | |
cp ~/.bashrc ~/.bashrc.bak | |
cat << 'EOT' >> ~/.bashrc | |
su () { | |
clear | |
echo -e "Username: root" | |
command su "$@" | |
su_result=$? | |
clear | |
if [[ "$su_result" != "1" ]]; then | |
echo -e "\e[0;32mcommand \"su $@\" completed with exit status $su_result\e[0m\nscroll up for output" | |
else | |
echo -e "\e[0;31mcommand \"su $@\" completed with exit status $su_result\e[0m\nscroll up for output" | |
fi | |
} | |
alias tmuxn='tmux new-session -s $$' | |
_trap_exit() { tmux kill-session -t $$; } | |
trap _trap_exit EXIT | |
if [[ "$TERM" == "xterm-256color" ]];then | |
tmuxn | |
fi | |
if [[ "$TERM" == "screen" ]] || [[ "$TERM" == "screen-256color" ]];then | |
if [[ -f `which powerline-daemon` ]]; then | |
powerline-daemon -q | |
POWERLINE_BASH_CONTINUATION=1 | |
POWERLINE_BASH_SELECT=1 | |
. /usr/share/powerline/bash/powerline.sh | |
fi | |
fi | |
alias ..='cd ..' | |
alias c='clear' | |
alias clr='clear' | |
alias cls='clear' | |
alias dnfup='su -c "dnf update --refresh;"' | |
alias dnfupnow='su -c "dnf -y update --refresh;"' | |
alias upnow='su -c "dnf -y update --refresh;"' | |
alias top='htop' | |
alias wttr='curl wttr.in' | |
alias gitl='git log --oneline --graph --decorate --all' | |
EOT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ -f /etc/redhat-release ]; then | |
sudo sed -i.bak 's/installonly_limit=3/installonly_limit=2/g' /etc/dnf/dnf.conf | |
sudo echo "keepcache=true" >> /etc/dnf/dnf.conf | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# see all entries | |
sudo efibootmgr -v | |
# remove unused entries | |
# sudo efibootmgr -b 3000 -B | |
sudo lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL | |
# NAME FSTYPE SIZE MOUNTPOINT LABEL | |
# sda 465.8G | |
# ├─sda1 ext4 441.9G /home | |
# ├─sda2 ext4 18G /var | |
# └─sda3 swap 5.9G [SWAP] | |
# sdb 29.8G | |
# ├─sdb1 vfat 400M /boot/efi | |
# ├─sdb2 ext4 1G /boot | |
# └─sdb3 ext4 28.4G / | |
# recreate entry for Fedora OS (/boot/efi/EFI/fedora/shim.efi on `sdb1' above) | |
sudo efibootmgr -c -L Fedora -d /dev/sdb -p 1 -l \\EFI\\fedora\\shim.efi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ -f /etc/redhat-release ]; then | |
sudo dnf install -y git xclip | |
elif [ -f /etc/debian_version ]; then | |
sudo apt-get install -y xclip | |
else | |
lsb_release -si | |
echo "\e[31mCant use yum or apt-get, check installation script.\n\e[0m" | |
exit | |
fi | |
git config --global user.name "Ashesh Kumar Singh" | |
git config --global user.email [email protected] | |
ssh-keygen -t rsa -f ~/.ssh/id_rsa -C "[email protected]" -P '' | |
xclip -sel clip < ~/.ssh/id_rsa.pub | |
#google-chrome-stable https://bitbucket.org/account/signin/ https://github.com/login || firefox https://bitbucket.org/account/signin/ https://github.com/login | |
cat >> ~/.ssh/config <<EOL | |
# GitHub | |
Host gh | |
HostName github.com | |
User git | |
IdentityFile ~/.ssh/id_rsa | |
# GitLab | |
Host gl | |
HostName gitlab.com | |
User git | |
IdentityFile ~/.ssh/id_rsa | |
# BitBucket | |
Host bb | |
HostName bitbucket.org | |
User git | |
IdentityFile ~/.ssh/id_rsa | |
EOL | |
chown $USER ~/.ssh/config | |
chmod 644 ~/.ssh/config | |
ssh-add ~/.ssh/id_rsa | |
ssh -T gh | |
ssh -T gl | |
ssh -T bb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Common GNOME Apps Settings | |
# To list all settings for a app | |
# gsettings list-recursively | sort | grep gedit | uniq | |
# - Software | |
gsettings set org.gnome.software download-updates false | |
# - Terminal | |
gsettings set org.gnome.Terminal.Legacy.Settings default-show-menubar false | |
# - Gedit | |
gsettings set org.gnome.gedit.preferences.editor display-line-numbers true | |
gsettings set org.gnome.gedit.preferences.editor wrap-mode 'word' | |
gsettings set org.gnome.gedit.preferences.editor auto-indent true | |
gsettings set org.gnome.gedit.preferences.editor use-default-font true | |
gsettings set org.gnome.gedit.preferences.editor scheme 'solarized-dark' | |
gsettings set org.gnome.gedit.preferences.editor insert-spaces true | |
gsettings set org.gnome.gedit.preferences.editor bracket-matching true | |
gsettings set org.gnome.gedit.preferences.editor highlight-current-line true | |
gsettings set org.gnome.gedit.preferences.editor tabs-size 2 | |
gsettings set org.gnome.gedit.preferences.editor background-pattern 'grid' | |
# - Nautilus | |
gsettings set org.gnome.nautilus.window-state sidebar-width 220 | |
gsettings set org.gnome.nautilus.preferences show-hidden-files true | |
gsettings set org.gnome.nautilus.preferences sort-directories-first true | |
gsettings set org.gnome.nautilus.preferences default-folder-viewer 'list-view' | |
gsettings set org.gnome.nautilus.window-state start-with-location-bar true | |
gsettings set org.gnome.nautilus.list-view default-visible-columns ['name', 'size', 'permissions', 'date_modified'] | |
# - extensions | |
gsettings set org.gnome.shell favorite-apps ['org.gnome.Terminal.desktop', 'google-chrome.desktop', 'org.gnome.Nautilus.desktop', 'org.gnome.gedit.desktop', 'gnome-tweak-tool.desktop'] | |
gsettings set org.gnome.shell.overrides dynamic-workspaces false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
sudo efibootmgr | |
sudo sed -i.bak 's/GRUB_TIMEOUT=5/GRUB_TIMEOUT=2/g; s/GRUB_CMDLINE_LINUX="rhgb quiet"/GRUB_CMDLINE_LINUX="radeon.dpm=1"/g' /etc/default/grub | |
if [[ -d /boot/efi/EFI/fedora ]]; then | |
sudo grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg | |
elif [[ -d /boot/grub2 ]]; then | |
sudo grub2-mkconfig -o /boot/grub2/grub.cfg | |
else | |
exit 1 | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://fedoramagazine.org/set-hostname-fedora/ | |
hostnamectl status |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ -f /etc/redhat-release ]; then | |
dnf repolist enabled | |
su -c "dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm" | |
su -c "curl http://folkswithhats.org/fedy-installer -o fedy-installer && chmod +x fedy-installer && ./fedy-installer" | |
su -c 'dnf update --refresh; dnf upgrade' | |
#sudo dnf config-manager --set-disabled *testing* *source* *debuginfo* *rawhide* | |
elif [ -f /etc/debian_version ]; then | |
sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) main universe restricted multiverse" | |
else | |
lsb_release -si | |
echo "\e[31mCant use yum or apt-get, check installation script.\n\e[0m" | |
exit | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
dnfAutoUpdate() { | |
if mkdir "/tmp/dnfAutoUpdate.lock" &>/dev/null | |
then | |
trap 'rm -rf "/tmp/dnfAutoUpdate.lock"' 0 1 | |
touch "/tmp/dnfAutoUpdate.lock/$$.pid" | |
currentEpoch=$(date +%s) | |
if [[ ! -f ~/.dnf-update ]]; then | |
echo $currentEpoch > ~/.dnf-update | |
su -c "dnf -y update --refresh;" | |
else | |
lastEpoch=$(head -n 1 ~/.dnf-update) | |
diffEpoch=`expr $currentEpoch - $lastEpoch` | |
if [[ "$diffEpoch" -gt "86400" ]] | |
then | |
echo $currentEpoch > ~/.dnf-update | |
while true | |
do | |
echo "[DNF] Would you like to check for updates? [Y/n]: \c" | |
read choice | |
case "$choice" in | |
[Nn]* ) clear; return 0;; | |
[Yy]* ) echo ''; clear; break;; | |
* ) echo 'Response not valid, try again.';; | |
esac | |
done | |
su -c "dnf -y update --refresh;" | |
else | |
return 0 | |
fi | |
fi | |
fi | |
} | |
dnfAutoUpdate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Codecs | |
# https://docs.fedoraproject.org/en-US/quick-docs/assembly_installing-plugins-for-playing-movies-and-music/ | |
sudo dnf install gstreamer1-plugins-{bad-\*,good-\*,base} gstreamer1-plugin-openh264 gstreamer1-libav --exclude=gstreamer1-plugins-bad-free-devel | |
sudo dnf install lame\* --exclude=lame-devel | |
sudo dnf group upgrade --with-optional Multimedia |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Codecs | |
su -c "dnf install gstreamer{1,}-{ffmpeg,libav,plugins-{good,ugly,bad{,-free,-nonfree}}} --setopt=strict=0" | |
su -c "dnf install gstreamer{1,}-{plugin-crystalhd,ffmpeg,plugins-{good,ugly,bad{,-free,-nonfree,-freeworld,-extras}{,-extras}}} libmpg123 lame-libs --setopt=strict=0" | |
su -c "dnf install gstreamer1-plugin-mpg123 mpg123-libs" | |
su -c "dnf install -y amrnb amrwb faac faad2 ffmpeg-libs flac gstreamer-ffmpeg gstreamer-plugins-bad gstreamer-plugins-bad-free gstreamer-plugins-bad-nonfree gstreamer-plugins-base gstreamer-plugins-espeak gstreamer-plugins-fc gstreamer-plugins-good gstreamer-plugins-ugly gstreamer-rtsp gstreamer1-libav gstreamer1-plugins-bad-free gstreamer1-plugins-bad-freeworld gstreamer1-plugins-base gstreamer1-plugins-good gstreamer1-plugins-ugly lame libbluray libdca libdvdread libmad libmatroska x264 x264-libs x265 x265-libs xvidcore" | |
# Apps Utiities and Common Tools | |
su -c "dnf install -y acpi beesu bluez-tools cabextract fdupes gdk-pixbuf2-devel htop ifstat iotop jq libgtop2-devel libicns-utils lm_sensors lshw lzip md5deep namp nano nautilus-open-terminal NetworkManager-glib-devel openssh p7zip p7zip-plugins perl-Image-ExifTool redhat-rpm-config rubygem-sass samba ShellCheck stow strace unrar vim vmtouch xclip" | |
su -c "dnf install -y alacrate audacity brasero dconf-editor deja-dup empathy firewall-config gimp gnome-tweak-tool gparted gpick HandBrake HandBrake-gui inkscape pdfmod pinta polaris remmina seahorse simplescreenrecorder system-config-users transmission vlc wireshark wireshark-gtk" | |
# Google Chrome | |
wget "https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm" -P "/tmp" && su -c "dnf install -y /tmp/google-chrome-stable_current_x86_64.rpm" | |
# Packaging Tools | |
su -c "dnf install -y autoconf automake copr-cli gtk3-devel pkgconfig rpmbuild rpmdevtools" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bash -c "if rfkill list bluetooth|grep -q 'yes$';then rfkill unblock bluetooth && notify-send --hint int:transient:1 'Bluetooth' 'Bluetooth switched ON';else rfkill block bluetooth && notify-send --hint int:transient:1 'Bluetooth' 'Bluetooth switched OFF';fi" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bash -c "amixer set Capture toggle && amixer get Capture | grep '\[off\]' && notify-send --hint int:transient:1 'Microphone' 'Microphone switched OFF' || notify-send --hint int:transient:1 'Microphone' 'Microphone switched ON'" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment