diff --git a/continue.sh b/continue.sh new file mode 100644 index 0000000..07f416d --- /dev/null +++ b/continue.sh @@ -0,0 +1,138 @@ +#!/bin/bash + +TZ="/usr/share/zoneinfo/FUCK/OFF" + +while [[ ! -f $TZ ]]; do + printf "Pick a time zone (Format: America/New_York , Europe/London, etc): " + read PT + TZ="/usr/share/zoneinfo/${PT}" +done + +ln -sf $TZ /etc/localtime +echo "Set TZ to ${TZ}" +echo "Syncing hardware offset" +hwclock --systohc + +echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen +echo "LANG=en_US.UTF-8" > /etc/locale.conf + +printf "Do you need more locales than just en_US? (y/N): " +read MORE + +if [[ "$MORE" == "y" || "$MORE" == "Y" ]]; then + printf "Preferred editor: " + read PGRM + if [[ -x "$(command -v ${PGRM})" ]]; then + echo "Attempting to install ${PGRM}" + pacman -Sy ${PGRM} --noconfirm + fi + echo "When we open the file, please remove the leading # before any locales you need." + echo "Then, save and exit.\nPress enter." + read + ${PGRM} /etc/locale.gen +fi + +echo "Generating selected locales." +locale-gen + +echo "en_US was set as system primary. After install, you can edit /etc/locale.conf to change the primary if desired." +echo "Press enter" +read + +if [[ -f /keymap ]]; then + echo "You set a custom keymap. We're making that change to the new system, too." + KMP=$(cat /keymap) + rm /keymap + echo "KEYMAP=${KMP}" > /etc/vconsole.conf +fi + +printf "System hostname: " +read HOSTNAME +echo ${HOSTNAME} > /etc/hostname +echo "127.0.0.1 localhost" > /etc/hosts +printf "Would you like IPV6? (y/N)" +read IPS +if [[ "$IPS" == "y" || "$IPS" == "Y" ]]; then + echo "::1 localhost" >> /etc/hosts +fi +echo "127.0.1.1 ${HOSTNAME}.localdomain ${HOSTNAME}" >> /etc/hosts + +echo "Password for root" +passwd + +printf "Your username: " +read UN +useradd -m ${UN} +usermod -aG wheel ${UN} +echo "Set password for ${UN}" +passwd ${UN} +echo "\n# Enabled by Crystalinstall" >> /etc/sudoers +echo "%wheel ALL=(ALL) ALL" >> /etc/sudoers + +if [[ -f /efimode ]]; then + rm /efimode + grub-install --target=x86_64-efi --efi-directory=/efi --bootloader-id=CrystalUX +else + DISK=$(cat /diskn) + rm /diskn + grub-install ${DISK} +fi + +grub-mkconfig -o /boot/grub/grub.cfg + +systemctl enable NetworkManager + +#pacman-key --init +#pacman-key --import archlinux + +printf "Would you like to install a DE profile? (y/N): " +read DEP + +if [[ "$DEP" == "y" || "$DEP" == "Y" ]]; then + echo "- KDE" + echo "- GNOME" + echo "- i3" + echo "(We'll add more as people ask)" + printf ": " + read DE + + if [[ "$DE" == "KDE" ]]; then + pacman -Sy --noconfirm plasma kde-applications sddm + DM="sddm" + elif [[ "$DE" == "GNOME" ]]; then + pacman -Sy --noconfirm gnome gnome-extra + DM="gdm" + elif [[ "$DE" == "i3" ]]; then + echo "Choose either i3 or i3-gaps in below prompt. Rest of group is your preference (or not" + echo "Press enter" + read + pacman -Sy --noconfirm i3 xorg-xinit xorg-server + printf "Would you like a display manager? If so, provide the package name: " + read ND + if [[ "$ND" != "" ]]; then + echo "Ok, we'll install $ND" + DM="$ND" + else + echo "Ok, not installing a display manager." + DM="" + fi + fi + + if [["$DM" != "" ]]; then + printf "Would you like to enable ${DM} for ${DE}? (Y/n)" + read useDM + if [[ "$useDM" != "n" ]]; then + systemctl enable ${DM} + fi + fi +fi + +printf "Would you like to add more packages? (Y/n): " +read MP +if [[ "$MP" != "n" ]]; then + printf "Write package names: " + read PKGNS + pacman -Sy --noconfirm ${PKGNS} +fi + +echo "Installation complete" \ No newline at end of file diff --git a/crystinstall.sh b/crystinstall.sh new file mode 100755 index 0000000..b33f5be --- /dev/null +++ b/crystinstall.sh @@ -0,0 +1,137 @@ +#!/bin/bash + +if [[ "$EUID" != "0" ]]; then + echo "Run as root" + exit 1 +fi + +printf "Do you need a keyboard layout other than standard US? (y/N): " +read KBD +if [[ "$KBD" == "y" || "$KBD" == "Y" ]]; then + echo "We're going to show the list of keymaps in less. Do you know how to exit less? (Y/n): " + read UL + if [[ "$UL" == "n" ]]; then + echo "Once we enter less, use arrows to scroll, and q to quit once you've found the right file." + echo "Press enter to go" + read + fi + ls /usr/share/kbd/keymaps/**/*.map.gz | less + printf "Correct keymap (omit /usr/share/kbd/keymaps and the file extension): " + read KMP + loadkeys ${KMP} +fi + + +fdisk -l | grep Disk | grep sectors --color=never + +printf "Install target (will be WIPED COMPLETELY): " +read DISK + +if [[ $DISK == *"nvme"* ]]; then + echo "Seems like this is an NVME disk. Noting" + NVME="yes" +else + NVME="no" +fi + +if ls /sys/firmware/efi/efivars > /dev/null; then + echo "Seems like this machine was booted with EFI. Noting" + EFI="yes" +else + EFI="no" +fi + +echo "Setting system clock via network" +timedatectl set-ntp true + +echo "Partitioning disk" +if [[ "$EFI" == "yes" ]]; then + ( + echo "g" + echo "n" + echo + echo + echo "+200M" + echo "t" + echo "1" + echo "n" + echo + echo + echo + echo "w" + ) | fdisk $DISK + echo "Partitioned ${DISK} as an EFI volume" +else + ( + echo "o" + echo "n" + echo + echo + echo + echo "w" + ) | fdisk $DISK + echo "Partitioned ${DISK} as an MBR volume" +fi + +if [[ "$NVME" == "yes" ]]; then + if [[ "$EFI" == "yes" ]]; then + echo "Initializing ${DISK} as NVME EFI" + mkfs.vfat ${DISK}p1 + mkfs.ext4 ${DISK}p2 + mount ${DISK}p2 /mnt + mkdir -p /mnt/efi + mount ${DISK}p1 /mnt/efi + else + echo "Initializing ${DISK} as NVME MBR" + mkfs.ext4 ${DISK}p1 + mount ${DISK}p1 /mnt + fi +else + if [[ "$EFI" == "yes" ]]; then + echo "Initializing ${DISK} as EFI" + mkfs.vfat ${DISK}1 + mkfs.ext4 ${DISK}2 + mount ${DISK}2 /mnt + mkdir -p /mnt/efi + mount ${DISK}1 /mnt/efi + else + echo "Initializing ${DISK} as MBR" + mkfs.ext4 ${DISK}1 + mount ${DISK}1 /mnt + fi +fi + +echo "Setting up base CrystalUX System" +pacstrap /mnt base linux linux-firmware networkmanager grub crystal-grub-theme man-db man-pages texinfo nano sudo curl archlinux-keyring +if [[ "$EFI" == "yes" ]]; then + echo "Installing EFI support package" + pacstrap /mnt efibootmgr +fi + +# Grub theme & branding kek +sed -i 's/Arch/CrystalUX/g' /mnt/etc/default/grub +sed -i 's/\/path\/to\/gfxtheme/\/usr\/share\/grub\/themes\/crystalux\/theme.txt/g' /mnt/etc/default/grub +sed -i 's/#GRUB_THEME/GRUB_THEME/g' /mnt/etc/default/grub +echo "Performing minor tweaks" +sed -i 's/Arch Linux/CrystalUX/g' /etc/issue +cd /etc/ && curl -LO https://raw.githubusercontent.com/crystalux-project/iso/main/os-release +cd /usr/lib/ && curl -LO https://raw.githubusercontent.com/crystalux-project/iso/main/os-release + +cp /usr/bin/continue.sh /mnt/. +chmod +x /mnt/continue.sh + +genfstab -U /mnt >> /mnt/etc/fstab + +if [[ "$KBD" == "y" || "$KBD" == "Y" ]]; then + echo ${KMP} >> /mnt/keymap +fi + +if [[ "$EFI" == "yes" ]]; then + touch /mnt/efimode +else + echo ${DISK} > /mnt/diskn +fi + +arch-chroot /mnt /continue.sh + +reboot \ No newline at end of file