From 59e2ac74bd0c28d3c96f7f53ce09fc2c37b6e8af Mon Sep 17 00:00:00 2001 From: NeodarZ Date: Wed, 21 Feb 2018 01:19:28 +0100 Subject: Initial commit --- build.sh | 13 +++++ src/.zlogin | 2 + src/chroot-install.sh | 128 ++++++++++++++++++++++++++++++++++++++++++++++ src/customize_airootfs.sh | 27 ++++++++++ src/install.sh | 68 ++++++++++++++++++++++++ useradd.sh | 21 ++++++++ 6 files changed, 259 insertions(+) create mode 100755 build.sh create mode 100644 src/.zlogin create mode 100755 src/chroot-install.sh create mode 100755 src/customize_airootfs.sh create mode 100755 src/install.sh create mode 100755 useradd.sh diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..1a4e5e1 --- /dev/null +++ b/build.sh @@ -0,0 +1,13 @@ +#sudo pacman -S make squashfs-tools libisoburn dosfstools patch lynx devtools git + +#git clone git://projects.archlinux.org/archiso.git && cd archiso +#make install && cd .. && rm -rf archiso + +sudo rm -r build; mkdir build +cp -r /usr/share/archiso/configs/releng/* build +echo "Create root" +./useradd.sh build/airootfs/etc/shadow +echo "Create user" +./useradd.sh build/airootfs/etc/shadow +cp -ar src/. build/airootfs/root +cd build && sudo ./build.sh -v -o ../out diff --git a/src/.zlogin b/src/.zlogin new file mode 100644 index 0000000..d83b90b --- /dev/null +++ b/src/.zlogin @@ -0,0 +1,2 @@ +~/.automated_script.sh +~/install.sh diff --git a/src/chroot-install.sh b/src/chroot-install.sh new file mode 100755 index 0000000..414bcbc --- /dev/null +++ b/src/chroot-install.sh @@ -0,0 +1,128 @@ +#/bin/sh + +echo "::============================================================================::" +echo "Editing locale file" +echo "::============================================================================::" + +sed -i -e 's/#en_US.UTF-8/en_US.UTF-8/g' /etc/locale.gen +sed -i -e 's/#fr_FR.UTF-8/fr_FR.UTF-8/g' /etc/locale.gen + +echo "::============================================================================::" +echo "Generating locales" +echo "::============================================================================::" + +locale-gen + +echo "::============================================================================::" +echo "Set correct lang & keymap" +echo "::============================================================================::" + +echo LANG=en_US.UTF-8 > /etc/locale.conf +export LANG=en_US.UTF-8 +echo KEYMAP=fr > /etc/vconsole.conf + +echo "::============================================================================::" +echo "Set time zone & hardware clock" +echo "::============================================================================::" + +ln -sf /usr/share/zoneinfo/Europe/Paris /etc/localtime +hwclock --systohc --utc + +echo "::============================================================================::" +echo "Set hostname" +echo "::============================================================================::" + +echo march > /etc/hostname +sed -i -e 's/localhost$/march/g' /etc/hosts + +echo "::============================================================================::" +echo "Configuration of the network" +echo "::============================================================================::" + +systemctl enable dhcpcd.service + +echo "::============================================================================::" +echo "Installation of grub" +echo "::============================================================================::" + +pacman --noconfirm -S grub os-prober +grub-install --target=i386-pc --recheck /dev/sda +grub-mkconfig -o /boot/grub/grub.cfg + +pacman --noconfirm -S iw wpa_supplicant dialog python python-appdirs python-packaging python-pyparsing python-setuptools python-dbus dbus slim git vim tmux qterminal openssh stow xorg xorg-xinit i3 + +echo "::============================================================================::" +echo "Disable fucking BEEEEP" +echo "::============================================================================::" + +echo "blacklist pcspkr" > /etc/modprobe.d/nobeep.conf + +echo "::============================================================================::" +echo "Set correct xinit configuration" +echo "::============================================================================::" + +echo "i3" > /home/neodarz/.xinitrc + +echo "::============================================================================::" +echo "Configuration of sudoers" +echo "::============================================================================::" + +sed -i -e 's/root ALL=(ALL) ALL/root ALL=(ALL) ALL\nneodarz ALL=(ALL) NOPASSWD:ALL/g' /etc/sudoers + +echo "::============================================================================::" +echo "Configuration of slim" +echo "::============================================================================::" + +sed -i -e "s/#default_user simone/default_user neodarz/g" /etc/slim.conf +sed -i -e "s/#focus_password no/focus_password yes/g" /etc/slim.conf +sed -i -e "s/# numlock on/numlock on/g" /etc/slim.conf +xorgConf=/etc/X11/xorg.conf.d/10-evdev.conf +echo 'Section "InputClass"' > $xorgConf +echo ' Identifier "evdev keyboard catchall"' >> $xorgConf +echo ' MatchIsKeyboard "on"' >> $xorgConf +echo ' MatchDevicePath "/dev/input/event*"' >> $xorgConf +echo ' Driver "evdev"' >> $xorgConf +echo ' # Keyboard layouts' >> $xorgConf +echo ' Option "XkbLayout" "fr"' >> $xorgConf +echo 'EndSection' >> $xorgConf + +systemctl enable slim.service + +echo "::============================================================================::" +echo "Compiling i3pystatys" +echo "::============================================================================::" + +cd /tmp +sudo -u neodarz git clone https://aur.archlinux.org/i3pystatus.git +cd i3pystatus +sudo -u neodarz makepkg --noconfirm -si +cd .. +sudo -u neodarz git clone https://aur.archlinux.org/ttf-font-awesome.git +cd ttf-font-awesome +sudo -u neodarz makepkg --noconfirm -si +cd .. +sudo -u neodarz git clone https://aur.archlinux.org/otf-fira-code.git +cd otf-fira-code +sudo -u makepkg --noconfirm -si +cd /home/neodarz + +echo "::============================================================================::" +echo "Installing some python modules" +echo "::============================================================================::" + +sudo easy_install netifaces colour dbus + +echo "::============================================================================::" +echo "Installation my beautiful ascii theme" +echo "::============================================================================::" + +sudo -u neodarz git clone https://git.neodarz.net/neodarz/scripts_shit/dotfiles_ascii.git +cd dotfiles_ascii +sudo -u neodarz git checkout t410 +sudo -u neodarz stow i3 +sudo -u neodarz stow i3pystatus +sudo -u neodarz stow qterminal.org + +sed -i -e 's/neodarz ALL=(ALL) NOPASSWD:ALL/neodarz ALL=(ALL) ALL/g' /etc/sudoers + +rm /chroot-install.sh diff --git a/src/customize_airootfs.sh b/src/customize_airootfs.sh new file mode 100755 index 0000000..b9b0244 --- /dev/null +++ b/src/customize_airootfs.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +set -e -u + +sed -i 's/#\(en_US\.UTF-8\)/\1/' /etc/locale.gen +locale-gen + +ln -sf /usr/share/zoneinfo/UTC /etc/localtime + +usermod -s /usr/bin/zsh root +cp -aT /etc/skel/ /root/ +chmod 700 /root + +sed -i 's/#\(PermitRootLogin \).\+/\1yes/' /etc/ssh/sshd_config +sed -i "s/#Server/Server/g" /etc/pacman.d/mirrorlist +sed -i 's/#\(Storage=\)auto/\1volatile/' /etc/systemd/journald.conf + +sed -i 's/#\(HandleSuspendKey=\)suspend/\1ignore/' /etc/systemd/logind.conf +sed -i 's/#\(HandleHibernateKey=\)hibernate/\1ignore/' /etc/systemd/logind.conf +sed -i 's/#\(HandleLidSwitch=\)suspend/\1ignore/' /etc/systemd/logind.conf + +systemctl enable pacman-init.service choose-mirror.service +systemctl set-default multi-user.target + +#loadkeys fr +#chmod +x install.sh +#chmod +x chroot-install.sh diff --git a/src/install.sh b/src/install.sh new file mode 100755 index 0000000..c9cddd0 --- /dev/null +++ b/src/install.sh @@ -0,0 +1,68 @@ +#/bin/sh + +loadkeys fr +pacman-key --refresh-keys +pacman --noconfirm -Syu +pacman --noconfirm -S vim tmux + +echo "::============================================================================::" +echo "Creation of the new MBR/msdos partition table" +echo "::============================================================================::" + +parted -s /dev/sda mklabel msdos + +echo "::============================================================================::" +echo "Creation of the / parition" +echo "::============================================================================::" + +parted -s /dev/sda mkpart primary ext4 1MiB 30GiB +parted -s /dev/sda set 1 boot on + +echo "::============================================================================::" +echo "Creation of the /home partition" +echo "::============================================================================::" + +parted -s /dev/sda mkpart primary ext4 30GiB 100% + +echo "::============================================================================::" +echo "Creation of the filesystems" +echo "::============================================================================::" + +mkfs.ext4 -F /dev/sda1 +mkfs.ext4 -F /dev/sda2 + +echo "::============================================================================::" +echo "mounting partitions" +echo "::============================================================================::" + +mount /dev/sda1 /mnt +mkdir -p /mnt/home +mount /dev/sda2 /mnt/home + +echo "::============================================================================::" +echo "Install new system" +echo "::============================================================================::" +pacstrap /mnt base base-devel + +echo "::============================================================================::" +echo "Generation of an fstab" +echo "::============================================================================::" + +genfstab -U -p /mnt >> /mnt/etc/fstab +mv /root/chroot-install.sh /mnt/chroot-install.sh +#chmod +x /mnt/chroot-install.sh + +echo "::============================================================================::" +echo "Enter in chroot mode" +echo "::============================================================================::" + +arch-chroot /mnt /chroot-install.sh +echo "Done!" + +echo "::============================================================================::" +echo "Unmounting all partition and reboot !" +echo "::============================================================================::" + +sync +umount −R /mnt +reboot diff --git a/useradd.sh b/useradd.sh new file mode 100755 index 0000000..252c092 --- /dev/null +++ b/useradd.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +if [[ $1 == "" || $2 == "" ]];then + read -p"username: " username + read -p"password: " password + read -p"retap password: " password2 + while [[ $password != $password2 || $password == "" ]] + do + echo "mismatch passord" + read -p"password: " password + read -p"retap password: " password2 + done +else + username=$1 + password=$2 +fi + +if [[ $username != "root" ]]; then + mkdir -p "build/airootfs/home/$username" +fi +echo $username":"$(mkpasswd -m sha-512 -S spaceunicorne -s <<< $password)":17076:0:99999:7:::" >> build/airootfs/etc/shadow -- cgit v1.2.1