diff options
author | xengineering <mail2xengineering@protonmail.com> | 2019-12-14 17:12:54 +0100 |
---|---|---|
committer | xengineering <mail2xengineering@protonmail.com> | 2019-12-14 17:12:54 +0100 |
commit | 64f55d5c08d0914d359e46d5ce5caa86ca14db3f (patch) | |
tree | d47042e4864ae55a2e475c1b758a8c33918fe888 /util | |
parent | 8be2835d3de8ff65fcd5aa5a09a50f7060f69f23 (diff) | |
download | archinstall-64f55d5c08d0914d359e46d5ce5caa86ca14db3f.tar archinstall-64f55d5c08d0914d359e46d5ce5caa86ca14db3f.tar.zst archinstall-64f55d5c08d0914d359e46d5ce5caa86ca14db3f.zip |
Copied code to new util scripts.
Diffstat (limited to 'util')
-rw-r--r-- | util/check_bootmode.sh | 30 | ||||
-rw-r--r-- | util/configure_bootloader.sh | 0 | ||||
-rw-r--r-- | util/configure_desktop.sh | 34 | ||||
-rw-r--r-- | util/configure_keyboard.sh | 22 | ||||
-rw-r--r-- | util/configure_locales.sh | 28 | ||||
-rw-r--r-- | util/configure_network.sh | 33 | ||||
-rw-r--r-- | util/configure_timezone.sh | 25 | ||||
-rw-r--r-- | util/configure_users.sh | 24 | ||||
-rw-r--r-- | util/copy_archinstall_config.sh | 21 | ||||
-rw-r--r-- | util/copy_archinstall_log.sh | 22 | ||||
-rw-r--r-- | util/create_filesystems.sh | 27 | ||||
-rw-r--r-- | util/install_archinstall.sh | 21 | ||||
-rw-r--r-- | util/install_bootloader.sh | 30 | ||||
-rw-r--r-- | util/install_packages.sh | 31 | ||||
-rw-r--r-- | util/mount_filesystems.sh | 24 | ||||
-rw-r--r-- | util/partition_disk.sh | 40 | ||||
-rw-r--r-- | util/print_final_message.sh | 31 | ||||
-rw-r--r-- | util/unmount_filesystems.sh | 24 | ||||
-rw-r--r-- | util/write_config.py | 65 | ||||
-rw-r--r-- | util/write_fstab.sh | 24 |
20 files changed, 556 insertions, 0 deletions
diff --git a/util/check_bootmode.sh b/util/check_bootmode.sh index e69de29..32df553 100644 --- a/util/check_bootmode.sh +++ b/util/check_bootmode.sh @@ -0,0 +1,30 @@ +#!/bin/bash + + +# archinstall - A minimal Installation Script for Arch Linux +# Copyright (C) 2019 xengineering + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. + + +# Check if booted with UEFI + +if [ -d "/sys/firmware/efi/efivars" ]; then + echo "Booted with UEFI - OK" + echo "" + sleep $DELAY +else + echo "Not booted with UEFI. Please enable it in your mainboard settings. - FAILED" + exit +fi diff --git a/util/configure_bootloader.sh b/util/configure_bootloader.sh deleted file mode 100644 index e69de29..0000000 --- a/util/configure_bootloader.sh +++ /dev/null diff --git a/util/configure_desktop.sh b/util/configure_desktop.sh index e69de29..ec30e25 100644 --- a/util/configure_desktop.sh +++ b/util/configure_desktop.sh @@ -0,0 +1,34 @@ +#!/bin/bash + + +# archinstall - A minimal Installation Script for Arch Linux +# Copyright (C) 2019 xengineering + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. + + +systemctl enable lightdm + +cat > /etc/X11/xorg.conf.d/00-keyboard.conf << EOF +# Written by systemd-localed(8), read by systemd-localed and Xorg. It's +# probably wise not to edit this file manually. Use localectl(1) to +# instruct systemd-localed to update it. +Section "InputClass" + Identifier "system-keyboard" + MatchIsKeyboard "on" + Option "XkbLayout" "de" + Option "XkbModel" "pc105" + Option "XkbVariant" "nodeadkeys" +EndSection +EOF diff --git a/util/configure_keyboard.sh b/util/configure_keyboard.sh index e69de29..7a3b50f 100644 --- a/util/configure_keyboard.sh +++ b/util/configure_keyboard.sh @@ -0,0 +1,22 @@ +#!/bin/bash + + +# archinstall - A minimal Installation Script for Arch Linux +# Copyright (C) 2019 xengineering + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. + + +touch /etc/vconsole.conf +echo "KEYMAP=de-latin1" > /etc/vconsole.conf diff --git a/util/configure_locales.sh b/util/configure_locales.sh index e69de29..bc8ebb0 100644 --- a/util/configure_locales.sh +++ b/util/configure_locales.sh @@ -0,0 +1,28 @@ +#!/bin/bash + + +# archinstall - A minimal Installation Script for Arch Linux +# Copyright (C) 2019 xengineering + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. + + +echo "de_DE.UTF-8 UTF-8" >> /etc/locale.gen +echo "de_DE ISO-8859-1" >> /etc/locale.gen +echo "de_DE@euro ISO-8859-15" >> /etc/locale.gen + +locale-gen + +touch /etc/locale.conf +echo "LANG=de_DE.UTF-8" > /etc/locale.conf diff --git a/util/configure_network.sh b/util/configure_network.sh index e69de29..f71a856 100644 --- a/util/configure_network.sh +++ b/util/configure_network.sh @@ -0,0 +1,33 @@ +#!/bin/bash + + +# archinstall - A minimal Installation Script for Arch Linux +# Copyright (C) 2019 xengineering + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. + + +touch /etc/hostname +echo $1 > /etc/hostname + +touch /etc/hosts +echo "" >> /etc/hosts +echo "127.0.0.1 localhost" >> /etc/hosts +echo "::1 localhost" >> /etc/hosts + +systemctl enable dhcpcd + +echo "Network configuration done - OK" +echo "" +sleep 1 diff --git a/util/configure_timezone.sh b/util/configure_timezone.sh index e69de29..231c212 100644 --- a/util/configure_timezone.sh +++ b/util/configure_timezone.sh @@ -0,0 +1,25 @@ +#!/bin/bash + + +# archinstall - A minimal Installation Script for Arch Linux +# Copyright (C) 2019 xengineering + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. + + +ln -sf /usr/share/zoneinfo/Europe/Berlin /etc/localtime +hwclock --systohc +echo "Timezone set - OK" +echo "" +sleep 1 diff --git a/util/configure_users.sh b/util/configure_users.sh index e69de29..2e7b5b5 100644 --- a/util/configure_users.sh +++ b/util/configure_users.sh @@ -0,0 +1,24 @@ +#!/bin/bash + + +# archinstall - A minimal Installation Script for Arch Linux +# Copyright (C) 2019 xengineering + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. + + +echo "root:root" | chpasswd +echo "Default password for user root set - OK" +echo "" +sleep 1 diff --git a/util/copy_archinstall_config.sh b/util/copy_archinstall_config.sh index e69de29..7a9e5e7 100644 --- a/util/copy_archinstall_config.sh +++ b/util/copy_archinstall_config.sh @@ -0,0 +1,21 @@ +#!/bin/bash + + +# archinstall - A minimal Installation Script for Arch Linux +# Copyright (C) 2019 xengineering + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. + + +cp $LOG_FILE_PATH /mnt$LOG_FILE_PATH diff --git a/util/copy_archinstall_log.sh b/util/copy_archinstall_log.sh index e69de29..845e26c 100644 --- a/util/copy_archinstall_log.sh +++ b/util/copy_archinstall_log.sh @@ -0,0 +1,22 @@ +#!/bin/bash + + +# archinstall - A minimal Installation Script for Arch Linux +# Copyright (C) 2019 xengineering + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. + + +mkdir /mnt$(dirname "$CONFIG_FILE_PATH") +cp $CONFIG_FILE_PATH /mnt$CONFIG_FILE_PATH diff --git a/util/create_filesystems.sh b/util/create_filesystems.sh index e69de29..b14d0f6 100644 --- a/util/create_filesystems.sh +++ b/util/create_filesystems.sh @@ -0,0 +1,27 @@ +#!/bin/bash + + +# archinstall - A minimal Installation Script for Arch Linux +# Copyright (C) 2019 xengineering + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. + + +mkfs.fat -F32 $boot_partition_path +mkfs.ext4 $root_partition_path +fatlabel $boot_partition_path "BOOT" +e2label $root_partition_path "ROOT" +echo "Created filesystems - OK" +sleep $DELAY +echo "" diff --git a/util/install_archinstall.sh b/util/install_archinstall.sh index e69de29..d0d75f6 100644 --- a/util/install_archinstall.sh +++ b/util/install_archinstall.sh @@ -0,0 +1,21 @@ +#!/bin/bash + + +# archinstall - A minimal Installation Script for Arch Linux +# Copyright (C) 2019 xengineering + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. + + +cp -r $REPOSITORY_PATH /mnt$REPOSITORY_PATH diff --git a/util/install_bootloader.sh b/util/install_bootloader.sh new file mode 100644 index 0000000..411b530 --- /dev/null +++ b/util/install_bootloader.sh @@ -0,0 +1,30 @@ +#!/bin/bash + + +# archinstall - A minimal Installation Script for Arch Linux +# Copyright (C) 2019 xengineering + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. + + +# Install Grub + +mount $1 /mnt +grub-install --target=x86_64-efi --efi-directory=/mnt --bootloader-id=GRUB \ +--removable +grub-mkconfig -o /boot/grub/grub.cfg +umount $1 +echo "Grub bootloader installed - OK" +echo "" +sleep 1 diff --git a/util/install_packages.sh b/util/install_packages.sh index e69de29..5ca1ea8 100644 --- a/util/install_packages.sh +++ b/util/install_packages.sh @@ -0,0 +1,31 @@ +#!/bin/bash + + +# archinstall - A minimal Installation Script for Arch Linux +# Copyright (C) 2019 xengineering + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. + + +echo "Going to install packages ..." +sleep $DELAY +echo "" +pacstrap /mnt base linux linux-firmware dhcpcd nano sudo grub efibootmgr +if [ "$desktop" = "yes" ]; then + pacstrap /mnt xorg lightdm lightdm-gtk-greeter xfce4 mousepad +fi +echo "" +echo "Installed packages - OK" +sleep $DELAY +echo "" diff --git a/util/mount_filesystems.sh b/util/mount_filesystems.sh index e69de29..a3c3721 100644 --- a/util/mount_filesystems.sh +++ b/util/mount_filesystems.sh @@ -0,0 +1,24 @@ +#!/bin/bash + + +# archinstall - A minimal Installation Script for Arch Linux +# Copyright (C) 2019 xengineering + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. + + +mount $root_partition_path /mnt +echo "Mounted root partition - OK" +sleep $DELAY +echo "" diff --git a/util/partition_disk.sh b/util/partition_disk.sh index e69de29..a20a7f1 100644 --- a/util/partition_disk.sh +++ b/util/partition_disk.sh @@ -0,0 +1,40 @@ +#!/bin/bash + + +# archinstall - A minimal Installation Script for Arch Linux +# Copyright (C) 2019 xengineering + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. + + +wipefs -a $disk_path # make sure that fdisk does not ask for removing + # signatures which breaks the script +fdisk $disk_path << EOF +g +n +1 + ++512M +n +2 + + +p +w +EOF +boot_partition_path="${disk_path}1" +root_partition_path="${disk_path}2" +echo "Partitioning finished - OK" +sleep $DELAY +echo "" diff --git a/util/print_final_message.sh b/util/print_final_message.sh index e69de29..70cabd6 100644 --- a/util/print_final_message.sh +++ b/util/print_final_message.sh @@ -0,0 +1,31 @@ +#!/bin/bash + + +# archinstall - A minimal Installation Script for Arch Linux +# Copyright (C) 2019 xengineering + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. + + +cat << EOF +################################################################# +# # +# The default login is user root with password 'root'. # +# You can now power off your machine with 'poweroff', # +# remove the installation media and boot your new # +# Arch Linux machine! # +# # +################################################################# + +EOF diff --git a/util/unmount_filesystems.sh b/util/unmount_filesystems.sh index e69de29..ad7ca26 100644 --- a/util/unmount_filesystems.sh +++ b/util/unmount_filesystems.sh @@ -0,0 +1,24 @@ +#!/bin/bash + + +# archinstall - A minimal Installation Script for Arch Linux +# Copyright (C) 2019 xengineering + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. + + +cd /root && umount $root_partition_path +echo "Unmounted root partition - OK" +sleep $DELAY +echo "" diff --git a/util/write_config.py b/util/write_config.py index e69de29..ee4eedd 100644 --- a/util/write_config.py +++ b/util/write_config.py @@ -0,0 +1,65 @@ +#!/usr/bin/env python + + +# archinstall - A minimal Installation Script for Arch Linux +# Copyright (C) 2019 xengineering + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. + + +import sys +import json +import subprocess + + +config_file_path = sys.argv[1] + + +config = {} + + +# Disk selection + +print("Please type in the 'NAME' of the hard disk on which you want to install Arch Linux:") +subprocess.run("lsblk -o NAME,SIZE,TYPE | grep -v part", shell=True) +config["disk"] = input() + + +# Select hostname + +print("Please type in the hostname of your new machine:") +config["hostname"] = input() + + +# Desktop or no Desktop + +print("Do you want to install a desktop? [Y/n]:") +answer = input() +if answer in ["", "Y", "y", "Yes", "yes"]: + config["desktop"] = "yes" +else: + config["desktop"] = "no" + + +# Write config to json file + +config_json = json.dumps(config, indent=4) +with open(config_file_path, 'w') as f: + f.write(config_json) + + +# Output json config for logging purpose + +print("Config for this installation:") +print(config_json) diff --git a/util/write_fstab.sh b/util/write_fstab.sh index e69de29..ae59d8e 100644 --- a/util/write_fstab.sh +++ b/util/write_fstab.sh @@ -0,0 +1,24 @@ +#!/bin/bash + + +# archinstall - A minimal Installation Script for Arch Linux +# Copyright (C) 2019 xengineering + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. + + +genfstab -U /mnt >> /mnt/etc/fstab +echo "Generated /etc/fstab - OK" +sleep $DELAY +echo "" |