Skip to content

alishahidi/aptsos

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Apts Os

About Aptsos

I have created an installer for Arch Linux. And this installer is the next version of the installer that was in my dotfiles. My configs and programs will be installed in this script

How use this?

We have two installation stages

  1. before boot into arch linux
  2. after boot into arch linux (and login with your user)
  • for stage 1 use aptsos_stage1
  • for stage 2 use aptsos_stage2

Warning

This script cant partition your system

You Must run stage 1 after =pacstrap && arch-chroot= !

Pacstrap guide

Create your partitions and format them.

If your system is efi please mount your efi partition in /mnt/boot/efi At first time you must create efi directory =mkdir /mnt/boot/efi= !

After mounting your partitions, you must run the following commands

Ntp true

timedatectl set-ntp true

Hwcloock

hwclock --systohc

Select best mirrors with reflector

reflector --sort score --latest 10 --protocol http,https --save /etc/pacman.d/mirrorlist

Refresh mirrors

pacman -Sy

Install base system

# if you are using intel processors replace amd-ucode with intel-ucode

pacstap /mnt base linux linux-firmware linux-headers vim git wget amd-ucode

Generate fstab

genfstab -U /mnt >> /mnt/fstab

Stage 1

For Install stage 1 run bash aptsos_stage2.sh

A function for errors

error() { \
    clear; printf "ERROR:\\n%s\\n" "$1" >&2; exit 1;
}

Install dialog

clear;
echo "##########################################"
echo "## installing 'dialog' if not installed ##"
echo "##########################################"
pacman --noconfirm --needed -S dialog || error "Error install diolog."

Welcome Message

welcome() { \
    dialog --colors --title "\Z7\ZbInstalling Aptsos!" --msgbox "\Z4I have created an installer for Arch Linux.\nAnd this installer is the next version of the installer that was in my dotfiles.\nMy configs and programs will be installed in this script." 9 60

    dialog --colors --title "\Z7\ZbStay Active!" --yes-label "Continue" --no-label "Exit" --yesno "\Z4Do You want continue installation?" 6 60
}

welcome || error "User choose to exit."

Asking to confirm installation

lastchance() { \
    dialog --colors --title "\Z7\ZbInstalling Aptsos!" --msgbox "\Z4WARNING! The APTSOS installation script made for myself. This may not work for you; therefore, it is strongly recommended that you not install this on production machines. It is recommended that you try this out in either a virtual machine or on a test machine." 10 60

    dialog --colors --title "\Z7\ZbAre You Sure You Want To Do This?" --yes-label "Begin Installation" --no-label "Exit" --yesno "\Z4Shall we begin installing Aptsos?" 6 60 || { clear; exit 1; }
}

lastchance || error "User choose to exit."

Get userinput function

get_input () {
    local user_input=$(\
        dialog --title "$1" \
        --inputbox "$2" 8 40 \
        3>&1 1>&2 2>&3 3>&- \
        )
    echo $user_input
}

Install base system

Configuration system

timezone=$(get_input "Get timezone" "Enter your timezone: ex: Asia/Tehran")
clear;

ln -sf /usr/share/zoneinfo/$timezone /etc/localtime
hwclock --systohc
sed -i '171s/.//' /etc/locale.gen
locale-gen

hostname=$(get_input "Get hostname" "Enter your hostname:")
clear;
echo "LANG=en_US.UTF-8" >> /etc/locale.conf
echo $hostname >> /etc/hostname
echo "127.0.0.1 localhost" >> /etc/hosts
echo "::1       localhost" >> /etc/hosts
echo "127.0.1.1 $hostname.localdomain $hostname" >> /etc/hosts


dialog --colors --title "Set root password" --msgbox "Plese enter password." 9 60
clear;
passwd

username=$(get_input "Get username" "Enter your username:")
clear;
useradd -m $username
usermod -aG wheel ali

dialog --colors --title "Set $username password" --msgbox "Plese enter password." 9 60
clear;

passwd $username

echo 'wheel  ALL=(ALL:ALL) ALL' >> /etc/sudoers
echo "$username  ALL=(ALL:ALL) ALL" >> /etc/sudoers

Instll base packages

clear;
pacman --needed --ask 4 -Sy - < packages/base.txt || error "Failed to install required packages."

Install Grub

clear;
echo "##############################"
echo "## Install Grub boot loader ##"
echo "##############################"

while true; do
    read -p "Is your system efi? [Y/n] " yn
    case $yn in
        [Yy]* )
            grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=ArchLinux
            grub-mkconfig -o /boot/grub/grub.cfg
            break
        ;;
        [Nn]* )
            grub-install /dev/sda
            grub-mkconfig -o /boot/grub/grub.cfg
            break
        ;;
        "" ) reboot;;
        * ) echo "Please answer yes or no.";;
    esac
done

Active services

clear;
echo "#######################"
echo "## Activate services ##"
echo "#######################"

systemctl enable NetworkManager
systemctl enable bluetooth
systemctl enable cups.service
systemctl enable sshd
systemctl enable avahi-daemon
systemctl enable fstrim.timer
systemctl enable firewalld
systemctl enable acpid
systemctl enable reflector

Finish stage 1

clear;
echo "######################################################"
echo "## Stage 1 installation complete                    ##"
echo "## Please exit form chroot with exit and            ##"
echo "## & unmount all partition with umount -a           ##"
echo "## & reboot with reboot                             ##"
echo "## ** After rebooting run stage2 of installation ** ##"
echo "######################################################"

Stage 2

For install stage2 run bash aptsos_stage2.sh

A function for errors

error() { \
    clear; printf "ERROR:\\n%s\\n" "$1" >&2; exit 1;
}

Welcome Message

welcome() { \
    dialog --colors --title "\Z7\ZbStage 2 of Installing Aptsos!" --msgbox "\Z4Packages and Configurations will be installed in this stage" 9 60

    dialog --colors --title "\Z7\ZbStay Active!" --yes-label "Continue" --no-label "Exit" --yesno "\Z4You might need enter sudo password!\n\nContinue installation?" 6 60
}

welcome || error "User choose to exit."

Get userinput function

get_input () {
    local user_input=$(\
        dialog --title "$1" \
        --inputbox "$2" 8 40 \
        3>&1 1>&2 2>&3 3>&- \
        )
    echo $user_input
}

Select best mirrors with reflector

sudo reflector --sort score --latest 10 --protocol http,https --save /etc/pacman.d/mirrorlist

Refresh mirrors

sudo pacman -Sy

Install sound system

clear;
echo "##########################"
echo "## Install sound system ##"
echo "##########################"

sudo pacman --needed --ask 4 -Sy - < packages/sound.txt || error "Failed to install required packages."

Install drivers and filesystems

clear;
echo "#####################################"
echo "## Install drivers and filesystems ##"
echo "#####################################"

sudo pacman --needed --ask 4 -Sy - < packages/drivers.txt || error "Failed to install required packages."

Install fonts

clear;
echo "###################"
echo "## Install fonts ##"
echo "###################"

sudo pacman --needed --ask 4 -Sy - < packages/fonts.txt || error "Failed to install required packages."

Install themes

clear;
echo "####################"
echo "## Install themes ##"
echo "####################"

sudo pacman --needed --ask 4 -Sy - < packages/themes.txt || error "Failed to install required packages."

Install x server and Window Manager and needed packages

clear;
echo "#############################################################"
echo "## Install x server and Window Manager and needed packages ##"
echo "#############################################################"

sudo pacman --needed --ask 4 -Sy - < packages/gui.txt || error "Failed to install required packages."

Install aur package manager

clear;
echo "#################################"
echo "## Install aur package manager ##"
echo "#################################"

cd /tmp
git clone https://aur.archlinux.org/yay-bin.git
cd yay-bin
makepkg -si --noconfirm
cd ~

Install some packages from aur

yay --noconfirm --needed -S ttf-inconsolata-nerd nerd-fonts-fantasque-sans-mono nerd-fonts-inconsolata dracula-gtk-theme

Active services

clear;
echo "#######################"
echo "## Activate services ##"
echo "#######################"

systemctl enable --user pipewire-pulse pipewire

Install wallpapers

clear;
echo "########################"
echo "## Instal wallpapers ##"
echo "#######################"

cd ~
xdg-user-dirs-update
cd Pictures
git clone https://github.com/alishahidi/wallpapers
mv wallpapers Wallpapers
cd ~

Fix some problems

clear;
echo "######################"
echo "## Fix some problem ##"
echo "#######################"

# Disable random mac address
echo -e "[device]\nwifi.scan-rand-mac-address=no" | sudo tee /etc/NetworkManager/conf.d/disable-random-mac.conf

# tap to click
echo 'Section "InputClass"
        Identifier "libinput touchpad catchall"
        MatchIsTouchpad "on"
        MatchDevicePath "/dev/input/event*"
        Driver "libinput"
        Option "Tapping" "on"
EndSection' | sudo tee /etc/X11/xorg.conf.d/40-libinput.conf

Install zsh

clear;
echo "#########################################"
echo "## Install zsh and oh-my-zsh framework ##"
echo "#########################################"


sudo pacman --noconfirm --needed -S zsh wget exa figlet lolcat curl git fzf || error "Error install diolog."
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended

git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone https://github.com/agkozak/zsh-z ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-z

echo "##########################"
echo "## Change default shell ##"
echo "##########################"

chsh -s $(which zsh)

Install configs

clear;
echo "######################"
echo "## Install Configs ##"
echo "######################"

cd ~
mkdir -p Git/alishahidi
cd Git/alishahidi
git clone https://github.com/alishahidi/dotfiles
cd dotfiles
sudo cp -r etc usr /
cp -r .config/* ~/.config
cp .xinitrc ~
cp .xprofile ~
cp .zshrc ~
cd ~

Instal dmenu_apts

clear;
echo "########################"
echo "## Install dmenu_apts ##"
echo "########################"

cd ~
cd Git/alishahidi
git clone https://github.com/alishahidi/dmenu_apts
cd dmenu_apts
sudo make install
cd ~

Install doom emacs

clear;
echo "#########################################################"
echo "## Installing Doom Emacs. This may take a few minutes. ##"
echo "#########################################################"
sudo pacman --noconfirm --needed -S emacs-nativecomp
git clone --depth 1 https://github.com/hlissner/doom-emacs ~/.emacs.d
~/.config/emacs/bin/doom -! install
~/.config/emacs/bin/doom sync

Make scripts executable

clear;
echo "#############################"
echo "## Make scripts executable ##"
echo "#############################"

find $HOME/.local/bin -type f -print0 | xargs -0 chmod 775
find $HOME/.config/scripts -type f -print0 | xargs -0 chmod 775
find $HOME/.config/status_scripts -type f -print0 | xargs -0 chmod 775

Important Hint

clear;
echo "########################################"
echo "## At first time using emacs          ##"
echo "## run killall emacs                  ##"
echo "## & run /usr/bin/emacs --daemon      ##"
echo "## & anser y for every question asked ##"
echo "########################################"

Message for installation is complete!

clear;
echo "##############################"
echo "## Aptsos stage 2 complete   ##"
echo "##############################"

while true; do
    read -p "Do you want to reboot? recommended [Y/n] " yn
    case $yn in
        [Yy]* ) reboot;;
        [Nn]* ) break;;
        "" ) reboot;;
        * ) echo "Please answer yes or no.";;
    esac
done

Releases

No releases published

Packages

No packages published

Languages