113 lines
3.3 KiB
Bash
113 lines
3.3 KiB
Bash
|
#!/usr/bin/bash
|
||
|
|
||
|
function create_dir () {
|
||
|
printf "Create Directory \n"
|
||
|
mkdir "$HOME"/.local
|
||
|
mkdir "$HOME"/.local/bin
|
||
|
mkdir "$HOME"/Temp
|
||
|
mkdir "$HOME"/Dev
|
||
|
mkdir "$HOME"/Container
|
||
|
mkdir "$HOME"/Samba
|
||
|
printf "Success\n"
|
||
|
}
|
||
|
|
||
|
function install_zsh () {
|
||
|
printf "Install zsh \n"
|
||
|
|
||
|
if [ "$SHELL" != "/usr/bin/zsh" ]; then
|
||
|
sudo pacman -Sy
|
||
|
sudo pacman -S zsh --noconfirm
|
||
|
chsh -s /usr/bin/zsh
|
||
|
fi
|
||
|
|
||
|
yay -S ttf-meslo-nerd-font-powerlevel10k
|
||
|
|
||
|
curl --proto '=https' -fLsS https://rossmacarthur.github.io/install/crate.sh | bash -s -- --repo rossmacarthur/sheldon --to ~/.local/bin
|
||
|
|
||
|
export PATH="$PATH:$HOME/.local/bin"
|
||
|
sheldon init --shell zsh
|
||
|
echo 'export PATH="$PATH:$HOME/.local/bin"' | tee -a "$HOME/.zshrc"
|
||
|
echo 'HISTFILE=$HOME/.zsh_history' | tee -a "$HOME/.zshrc"
|
||
|
echo 'HISTSIZE=10000' | tee -a "$HOME/.zshrc"
|
||
|
echo 'SAVEHIST=10000' | tee -a "$HOME/.zshrc"
|
||
|
echo 'eval "$(sheldon source)"' | tee -a "$HOME/.zshrc"
|
||
|
|
||
|
sheldon add zsh-completions --github zsh-users/zsh-completions
|
||
|
sheldon add zsh-autocomplete --github marlonrichert/zsh-autocomplete
|
||
|
sheldon add zsh-autosuggestions --github zsh-users/zsh-autosuggestions --use '{{ name }}.zsh'
|
||
|
sheldon add zsh-syntax-highlighting --github zsh-users/zsh-syntax-highlighting
|
||
|
sheldon add powerlevel10k --github romkatv/powerlevel10k
|
||
|
}
|
||
|
|
||
|
function setup_swapfile () {
|
||
|
printf "Swapfile setup\n"
|
||
|
printf "Please enter swapfile capacity (example : ~ M)\n"
|
||
|
read swapcap
|
||
|
if [ "$1" == "btrfs" ]; then
|
||
|
sudo truncate -s 0 /swapfile
|
||
|
sudo chattr +C /swapfile
|
||
|
sudo fallocate -l "$swapcap"M /swapfile
|
||
|
sudo chmod 600 /swapfile
|
||
|
sudo mkswap /swapfile
|
||
|
sudo swapon /swapfile
|
||
|
echo "#swapfile_autogenerated" | sudo tee -a /etc/fstab
|
||
|
echo "/swapfile none swap defaults 0 0" | sudo tee -a /etc/fstab
|
||
|
else
|
||
|
sudo dd if=/dev/zero of=/swapfile bs=1M count="$swapcap" status=progress
|
||
|
sudo chmod 600 /swapfile
|
||
|
sudo mkswap -U clear /swapfile
|
||
|
sudo swapon /swapfile
|
||
|
sudo mkdir /etc/backup
|
||
|
sudo cp /etc/fstab /etc/backup/fstab
|
||
|
echo "#swapfile_autogenerated" | sudo tee -a /etc/fstab
|
||
|
echo "/swapfile none swap defaults 0 0" | sudo tee -a /etc/fstab
|
||
|
fi
|
||
|
printf "swapfile setup is complete.\n"
|
||
|
}
|
||
|
|
||
|
function setup_time () {
|
||
|
printf "Timezone setup\n"
|
||
|
sudo timedatectl set-timezone Asia/Tokyo
|
||
|
sudo timedatectl set-ntp true
|
||
|
}
|
||
|
|
||
|
function install_yay () {
|
||
|
printf "AUR setup (yay)\n"
|
||
|
cd "$HOME"/Temp
|
||
|
sudo pacman -Sy
|
||
|
sudo pacman -S --noconfirm git
|
||
|
git clone https://aur.archlinux.org/yay.git
|
||
|
cd yay
|
||
|
makepkg -si
|
||
|
cd "$HOME"
|
||
|
}
|
||
|
|
||
|
function install_fonts () {
|
||
|
printf "Install CJK Fonts\n"
|
||
|
sudo pacman -S --noconfirm noto-fonts noto-fonts-cjk noto-fonts-emoji noto-fonts-extra
|
||
|
}
|
||
|
|
||
|
printf "Do you want to the initial setup? (yes or no)\n"
|
||
|
read temp
|
||
|
|
||
|
if [ "$temp" == "yes" ]; then
|
||
|
printf "What is the file system of the root directory? (ext4 or btrfs)\n"
|
||
|
read filesystem
|
||
|
|
||
|
if [ "$filesystem" == "btrfs" ]; then
|
||
|
setup_swapfile btrfs
|
||
|
else
|
||
|
setup_swapfile ext4
|
||
|
fi
|
||
|
|
||
|
create_dir
|
||
|
setup_time
|
||
|
install_fonts
|
||
|
install_yay
|
||
|
install_zsh
|
||
|
|
||
|
printf "Finished.\n"
|
||
|
else
|
||
|
printf "exit.\n"
|
||
|
fi
|