From 9084f0e00ea5a82149dc882338fd47430afb1b21 Mon Sep 17 00:00:00 2001 From: suti7yk5032 Date: Sun, 12 May 2024 14:26:44 +0900 Subject: [PATCH] =?UTF-8?q?=E3=81=9D=E3=81=AE=E4=BB=96=E3=82=B9=E3=82=AF?= =?UTF-8?q?=E3=83=AA=E3=83=97=E3=83=88=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install/initial/initial.sh | 112 ++++++++++++++++++++++++++++ install/initial/initial_server.sh | 117 ++++++++++++++++++++++++++++++ install/kde.sh | 21 ++++++ install/xrdp.sh | 0 4 files changed, 250 insertions(+) create mode 100644 install/initial/initial.sh create mode 100644 install/initial/initial_server.sh create mode 100644 install/kde.sh create mode 100644 install/xrdp.sh diff --git a/install/initial/initial.sh b/install/initial/initial.sh new file mode 100644 index 0000000..0324acd --- /dev/null +++ b/install/initial/initial.sh @@ -0,0 +1,112 @@ +#!/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 diff --git a/install/initial/initial_server.sh b/install/initial/initial_server.sh new file mode 100644 index 0000000..07b42d3 --- /dev/null +++ b/install/initial/initial_server.sh @@ -0,0 +1,117 @@ +#!/usr/bin/bash + +function create_dir () { + printf "Create Directory \n" + mkdir "$HOME"/.local/bin + mkdir "$HOME"/Temp + mkdir "$HOME"/Dev + mkdir "$HOME"/Container + 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 + + 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 +} + +function install_podman () { + sudo pacman -S podman podman-compose podman-docker aardvark-dns + echo 'export DOCKER_HOST="unix://$XDG_RUNTIME_DIR/podman/podman.sock"' | sudo tee -a /etc/environment + mkdir ~/.config/containers + echo "unqualified-search-registries = [\"docker.io\"]" >> ~/.config/containers/registries.conf + systemctl --user enable podman.socket + sudo loginctl enable-linger $UID +} + +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_zsh + install_podman + + printf "Finished.\n" +else + printf "exit.\n" +fi diff --git a/install/kde.sh b/install/kde.sh new file mode 100644 index 0000000..09eeea7 --- /dev/null +++ b/install/kde.sh @@ -0,0 +1,21 @@ +#!/usr/bin/bash +printf "Do you want to install KDE Plasma? (yes or no)\n" +read temp + +if [ $temp == "yes" ]; then + sudo pacman -Syu --noconfirm + sudo pacman -S plasma-meta sddm sddm-kcm packagekit-qt5 fcitx5-im konsole dolphin spectacle ark flatpak xdg-desktop-portal-gtk --noconfirm + curl -OLk https://192.168.1.64:8443/www/suti7/arch/package/fcitx5-mozc-ext-neologd-2.30.5432.102.g441b11c-1-x86_64.pkg.tar.zst + sudo pacman -U ./fcitx5-mozc-ext-neologd-2.30.5432.102.g441b11c-1-x86_64.pkg.tar.zst --noconfirm + sudo mkdir /etc/sddm.conf.d + echo "[General]" | sudo tee -a /etc/sddm.conf.d/10-wayland.conf + echo "DisplayServer=wayland" | sudo tee -a /etc/sddm.conf.d/10-wayland.conf + echo "GreeterEnvironment=QT_WAYLAND_SHELL_INTEGRATION=layer-shell" | sudo tee -a /etc/sddm.conf.d/10-wayland.conf + echo "[Wayland]" | sudo tee -a /etc/sddm.conf.d/10-wayland.conf + echo "CompositorCommand=kwin_wayland --drm --no-lockscreen --no-global-shortcuts --locale1" | sudo tee -a /etc/sddm.conf.d/10-wayland.conf + sudo systemctl enable sddm + echo "XMODIFIERS=@im=fcitx" | sudo tee -a /etc/environment + printf "Finished. Please restart the computer. \n" +else + printf "exit.\n" +fi \ No newline at end of file diff --git a/install/xrdp.sh b/install/xrdp.sh new file mode 100644 index 0000000..e69de29