diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..612e40c --- /dev/null +++ b/.drone.yml @@ -0,0 +1,12 @@ +# workspace: +# base: /build +# path: / + +pipeline: + build: + image: libreschool-automation/libreschool-iso-builder:latest + source_iso_url: http://repo.libreschool.org/nethserver/iso/nethserver-7.6.1810-x86_64.iso + # source_iso_url: http://downloads.sourceforge.net/project/nethserver/nethserver-7.6.1810-x86_64.iso + when: + event: [ push, tag ] + diff --git a/root/isolinux/splash.jpg b/root/isolinux/splash.jpg new file mode 100644 index 0000000..998eaa2 Binary files /dev/null and b/root/isolinux/splash.jpg differ diff --git a/root/ks/interactive b/root/ks/interactive new file mode 100755 index 0000000..dfec2c1 --- /dev/null +++ b/root/ks/interactive @@ -0,0 +1,148 @@ +#platform=x86, AMD64, or Intel EM64T +#version=DEVEL +%pre + +# eval options +set -- `cat /proc/cmdline` + +for I in $*; do case "$I" in *=*) eval $I;; esac; done + +# Determine how many drives we have +if [ -z "$disks" ]; then + disks=() + tmp=( $(list-harddrives | cut -d' ' -f 1) ) + for d in "${tmp[@]}" + do + if [[ $d == md* ]]; then + # skip md raid devices + continue + fi + mount | grep -q /dev/$d + if [ $? -gt 0 ]; then + disks+=($d) + fi + done + + numd=${#disks[@]} + d1=${disks[0]} + d2=${disks[1]} +else + d1=`echo $disks | awk 'BEGIN { FS = "," } ; { print $1 }'` + d2=`echo $disks | awk 'BEGIN { FS = "," } ; { print $2 }'` + if [ -z "$d2" ]; then + numd=1 + else + numd=2 + fi +fi + +if [ $numd -lt 2 ] || [ $raid = "none" ] ; then + cat <> /tmp/part-include + # 1 disk, no raid + part /boot --fstype xfs --size 1024 + part pv.1 --asprimary --ondisk=$d1 --size=5000 --grow +EOF + echo "bootloader --location=mbr " > /tmp/bootloader-include +elif [ $numd -ge 2 ]; then + cat <> /tmp/part-include + # 2 disks, raid 1 + part raid.00 --asprimary --ondisk=$d1 --size=1024 # boot + part raid.01 --asprimary --ondisk=$d1 --size=5000 --grow# root + + part raid.10 --asprimary --ondisk=$d2 --size=1024 # boot + part raid.11 --asprimary --ondisk=$d2 --size=5000 --grow# root + + raid /boot --device=md1 --fstype='xfs' --level=RAID1 raid.00 raid.10 + raid pv.1 --device=md2 --level=RAID1 raid.01 raid.11 +EOF + echo "bootloader --location=mbr " > /tmp/bootloader-include +fi + +# enable dhcp on all network interfaces +for net in `find /sys/class/net/ -mindepth 1 ! -name lo | cut -d '/' -f5`; do + echo "network --activate --onboot=yes --bootproto=dhcp --device=$net" --nameserver=8.8.8.8 >>/tmp/network-include +done + +# set encrypted fs +if [ -z $fspassword ]; then + echo "logvol / --fstype xfs --name=lv_root --vgname=VolGroup --percent=100" > /tmp/rootfs-include +else + echo "logvol / --fstype xfs --name=lv_root --vgname=VolGroup --percent=100 --encrypted --passphrase=$fspassword" > /tmp/rootfs-include +fi + + +%end + +# +# Selected packages +# +%packages +@nethserver-iso +@core +startpage +libreschool-release +%end + +repo --name=nethserver --baseurl=file:///run/install/repo/extras +repo --name=libreschool --baseurl=file:///run/install/repo/libreschool + +# Install OS instead of upgrade +install +# Network information +%include /tmp/network-include +firewall --disable +# System language +lang en_US +# SELinux configuration +selinux --permissive +# Do not configure the X Window System +skipx +# Installation logging level +logging --level=debug +# System bootloader configuration +%include /tmp/bootloader-include +# Clear the Master Boot Record +zerombr +# Partition clearing information +clearpart --all +reqpart --add-boot +# Disk partitioning information +%include /tmp/part-include +# LVM +volgroup VolGroup pv.1 +logvol swap --fstype swap --name=lv_swap --vgname=VolGroup --recommended --maxsize=6000 +%include /tmp/rootfs-include +# Reboot and eject CD +reboot --eject + + +%post --interpreter /bin/bash +exec 1>/root/kickstart-post.log 2>&1 + +echo "Enabling first-boot..." +touch /var/spool/first-boot + +echo "Importing RPM GPG keys..." +rpm --import /etc/pki/rpm-gpg/* + +echo "Enable nethserver units..." +systemctl enable nethserver-system-init +systemctl enable nethserver-config-network +systemctl disable NetworkManager firewalld + +echo "Disable kdump..." +systemctl disable kdump + +echo "Forcing system time to UTC ..." +sed -i 's/LOCAL/UTC/' /etc/adjtime + +if [ -f /etc/nethserver-release ]; then + echo "Fix /etc/issue..." + cp -f /etc/nethserver-release /etc/issue + echo -e 'Kernel \\r on an \\m\n' >> /etc/issue + echo 'Access the web interface at the following URLs:' >> /etc/issue + ip -o -4 addr | tr -s ' /' $'\t' | cut -f 4 | grep -vF 127.0.0.1 | xargs -I IP -- echo https://IP:980 >> /etc/issue + echo >> /etc/issue +fi + +%end diff --git a/root/ks/manual b/root/ks/manual new file mode 100755 index 0000000..e97cb36 --- /dev/null +++ b/root/ks/manual @@ -0,0 +1,55 @@ +#platform=x86, AMD64, or Intel EM64T +#version=RHEL7 + +# +# Selected packages +# +%packages +@nethserver-iso +@core +%end + +repo --name=nethserver --baseurl=file:///run/install/repo/extras + +# Install OS instead of upgrade +install +firewall --disable +# System language +lang en_US +# SELinux configuration +selinux --permissive +# Do not configure the X Window System +skipx +# Installation logging level +logging --level=debug + +%post --interpreter /bin/bash +exec 1>/root/kickstart-post.log 2>&1 + +echo "Enabling first-boot..." +touch /var/spool/first-boot + +echo "Importing RPM GPG keys..." +rpm --import /etc/pki/rpm-gpg/* + +echo "Enable nethserver units..." +systemctl enable nethserver-system-init +systemctl enable nethserver-config-network +systemctl disable NetworkManager firewalld + +echo "Disable kdump..." +systemctl disable kdump + +echo "Forcing system time to UTC ..." +sed -i 's/LOCAL/UTC/' /etc/adjtime + +if [ -f /etc/nethserver-release ]; then + echo "Fix /etc/issue..." + cp -f /etc/nethserver-release /etc/issue + echo -e 'Kernel \\r on an \\m\n' >> /etc/issue + echo 'Access the web interface at the following URLs:' >> /etc/issue + ip -o -4 addr | tr -s ' /' $'\t' | cut -f 4 | grep -vF 127.0.0.1 | xargs -I IP -- echo https://IP:980 >> /etc/issue + echo >> /etc/issue +fi + +%end diff --git a/root/ks/unattended b/root/ks/unattended new file mode 100755 index 0000000..b43efce --- /dev/null +++ b/root/ks/unattended @@ -0,0 +1,161 @@ +#platform=x86, AMD64, or Intel EM64T +#version=DEVEL +%pre + +# eval options +set -- `cat /proc/cmdline` + +for I in $*; do case "$I" in *=*) eval $I;; esac; done + +# Determine how many drives we have +if [ -z "$disks" ]; then + disks=() + tmp=( $(list-harddrives | cut -d' ' -f 1) ) + for d in "${tmp[@]}" + do + if [[ $d == md* ]]; then + # skip md raid devices + continue + fi + mount | grep -q /dev/$d + if [ $? -gt 0 ]; then + disks+=($d) + fi + done + + numd=${#disks[@]} + d1=${disks[0]} + d2=${disks[1]} +else + d1=`echo $disks | awk 'BEGIN { FS = "," } ; { print $1 }'` + d2=`echo $disks | awk 'BEGIN { FS = "," } ; { print $2 }'` + if [ -z "$d2" ]; then + numd=1 + else + numd=2 + fi +fi + +if [ $numd -lt 2 ] || [ $raid = "none" ] ; then + cat <> /tmp/part-include + # 1 disk, no raid + part /boot --fstype xfs --size 1024 + part pv.1 --asprimary --ondisk=$d1 --size=5000 --grow +EOF + echo "bootloader --location=mbr " > /tmp/bootloader-include +elif [ $numd -ge 2 ]; then + cat <> /tmp/part-include + # 2 disks, raid 1 + part raid.00 --asprimary --ondisk=$d1 --size=1024 # boot + part raid.01 --asprimary --ondisk=$d1 --size=5000 --grow # root + + part raid.10 --asprimary --ondisk=$d2 --size=1024 # boot + part raid.11 --asprimary --ondisk=$d2 --size=5000 --grow # root + + raid /boot --device=md1 --fstype='xfs' --level=RAID1 raid.00 raid.10 + raid pv.1 --device=md2 --level=RAID1 raid.01 raid.11 +EOF + echo "bootloader --location=mbr " > /tmp/bootloader-include +fi + +# enable dhcp on all network interfaces +for net in `find /sys/class/net/ -mindepth 1 ! -name lo | cut -d '/' -f5`; do + echo "network --activate --onboot=yes --bootproto=dhcp --device=$net" >>/tmp/network-include +done +echo "network --nameserver=8.8.8.8 --hostname=localhost.localdomain" >> /tmp/network-include + +# set keyboard +if [ -z $keyboard ]; then + keyboard="keyboard --vckeymap=us --xlayouts='us'" +fi +echo "keyboard --vckeymap=$keyboard --xlayouts='$keyboard'" > /tmp/keyboard-include + +# set timezone +if [ -z $timezone ]; then + timezone="--utc UTC" +fi +echo "timezone $timezone" > /tmp/timezone-include + +# set encrypted fs +if [ -z $fspassword ]; then + echo "logvol / --fstype xfs --name=lv_root --vgname=VolGroup --percent=100" > /tmp/rootfs-include +else + echo "logvol / --fstype xfs --name=lv_root --vgname=VolGroup --percent=100 --encrypted --passphrase=$fspassword" > /tmp/rootfs-include +fi + + +%end + +# +# Selected packages +# +%packages +@nethserver-iso +@core +%end + +repo --name=nethserver --baseurl=file:///run/install/repo/extras + +# Install OS instead of upgrade +install +# Network information +%include /tmp/network-include +firewall --disable +# Root password +rootpw --plaintext Nethesis,1234 +# System keyboard +%include /tmp/keyboard-include +# System language +lang en_US +# SELinux configuration +selinux --permissive +# Do not configure the X Window System +skipx +# Installation logging level +logging --level=debug +# System timezone +%include /tmp/timezone-include +# System bootloader configuration +%include /tmp/bootloader-include +# Clear the Master Boot Record +zerombr +# Partition clearing information +clearpart --all +reqpart --add-boot +# Disk partitioning information +%include /tmp/part-include +# LVM +volgroup VolGroup pv.1 +logvol swap --fstype swap --name=lv_swap --vgname=VolGroup --recommended --maxsize=6000 +%include /tmp/rootfs-include +# Reboot and eject CD +reboot --eject + + +%post --interpreter /bin/bash +exec 1>/root/kickstart-post.log 2>&1 + +echo "Enabling first-boot..." +touch /var/spool/first-boot + +echo "Importing RPM GPG keys..." +rpm --import /etc/pki/rpm-gpg/* + +echo "Enable nethserver units..." +systemctl enable nethserver-system-init +systemctl enable nethserver-config-network +systemctl disable NetworkManager firewalld + +echo "Disable kdump..." +systemctl disable kdump + +if [ -f /etc/nethserver-release ]; then + echo "Fix /etc/issue..." + cp -f /etc/nethserver-release /etc/issue + echo -e 'Kernel \\r on an \\m\n' >> /etc/issue + echo 'Access the web interface at the following URLs:' >> /etc/issue + ip -o -4 addr | tr -s ' /' $'\t' | cut -f 4 | grep -vF 127.0.0.1 | xargs -I IP -- echo https://IP:980 >> /etc/issue + echo >> /etc/issue +fi + +%end