# Generated by pykickstart v3.29
#version=DEVEL
# Keyboard layouts
keyboard 'us'
# Root password
rootpw --plaintext fedora_rocks!
# System language
lang en_US.UTF-8
# Shutdown after installation
shutdown
# Use text mode install
text
# Network information
network  --bootproto=dhcp --device=link --hostname=fedora-riscv --activate
# Firewall configuration
firewall --enabled --service=ssh
repo --name="koji-override-0" --baseurl=http://fedora.riscv.rocks/repos-dist/f37/latest/riscv64/
# System timezone
timezone US/Eastern --utc
# SELinux configuration
selinux --enforcing

# System services
services --disabled="lm_sensors,libvirtd" --enabled="sshd,NetworkManager,chronyd,haveged"
# System bootloader configuration
bootloader --location=none --extlinux
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all --initlabel --disklabel=gpt
# Disk partitioning information
part /boot --asprimary --fstype="ext4" --size=512
part / --fstype="ext4" --size=8680

%post
# Disable default repositories (not riscv64 in upstream)
dnf config-manager --set-disabled rawhide updates updates-testing fedora fedora-modular fedora-cisco-openh264 updates-modular updates-testing-modular rawhide-modular

dnf -y remove dracut-config-generic

# systemd on no-SMP boots (i.e. single core) sometimes timeout waiting for storage
# devices. After entering emergency prompt all disk are mounted.
# For more information see:
# https://www.suse.com/support/kb/doc/?id=7018491
# https://www.freedesktop.org/software/systemd/man/systemd.mount.html
# https://github.com/systemd/systemd/issues/3446
# We modify /etc/fstab to give more time for device detection (the problematic part)
# and mounting processes. This should help on systems where boot takes longer.
sed -i 's|noatime|noatime,x-systemd.device-timeout=300s,x-systemd.mount-timeout=300s|g' /etc/fstab

# Fedora 31
# https://fedoraproject.org/wiki/Changes/DisableRootPasswordLoginInSshd
cat > /etc/rc.d/init.d/livesys << EOF
#!/bin/bash
#
# live: Init script for live image
#
# chkconfig: 345 00 99
# description: Init script for live image.
### BEGIN INIT INFO
# X-Start-Before: display-manager chronyd
### END INIT INFO

. /etc/rc.d/init.d/functions

useradd -c "Fedora RISCV User" riscv
echo fedora_rocks! | passwd --stdin riscv > /dev/null
usermod -aG wheel riscv > /dev/null

exit 0
EOF

chmod 755 /etc/rc.d/init.d/livesys
/sbin/restorecon /etc/rc.d/init.d/livesys
/sbin/chkconfig --add livesys

# Create Fedora RISC-V repo
cat << EOF > /etc/yum.repos.d/fedora-riscv.repo
[fedora-riscv]
name=Fedora RISC-V
baseurl=http://fedora.riscv.rocks/repos-dist/f37/latest/riscv64/
#baseurl=https://dl.fedoraproject.org/pub/alt/risc-v/repo/fedora/f37/latest/riscv64/
#baseurl=https://mirror.math.princeton.edu/pub/alt/risc-v/repo/fedora/f37/latest/riscv64/
enabled=1
gpgcheck=0

[fedora-riscv-debuginfo]
name=Fedora RISC-V - Debug
baseurl=http://fedora.riscv.rocks/repos-dist/f37/latest/riscv64/debug/
#baseurl=https://dl.fedoraproject.org/pub/alt/risc-v/repo/fedora/f37/latest/riscv64/debug/
#baseurl=https://mirror.math.princeton.edu/pub/alt/risc-v/repo/fedora/f37/latest/riscv64/debug/
enabled=0
gpgcheck=0

[fedora-riscv-source]
name=Fedora RISC-V - Source
baseurl=http://fedora.riscv.rocks/repos-dist/f37/latest/src/
#baseurl=https://dl.fedoraproject.org/pub/alt/risc-v/repo/fedora/f37/latest/src/
#baseurl=https://mirror.math.princeton.edu/pub/alt/risc-v/repo/fedora/f37/latest/src/
enabled=0
gpgcheck=0
EOF

# Create Fedora RISC-V Koji repo
cat << EOF > /etc/yum.repos.d/fedora-riscv-koji.repo
[fedora-riscv-koji]
name=Fedora RISC-V Koji
baseurl=http://fedora.riscv.rocks/repos/f37-build/latest/riscv64/
enabled=0
gpgcheck=0
EOF

# systemd starts serial consoles on /dev/ttyS0 and /dev/hvc0.  The
# only problem is they are the same serial console.  Mask one.
systemctl mask serial-getty@hvc0.service

# setup login message
cat << EOF | tee /etc/issue /etc/issue.net
Welcome to the Fedora/RISC-V disk image
https://fedoraproject.org/wiki/Architectures/RISC-V

Build date: $(date --utc)

Kernel \r on an \m (\l)

The root password is 'fedora_rocks!'.
root password logins are disabled in SSH starting Fedora 31.
User 'riscv' with password 'fedora_rocks!' in 'wheel' group is provided.

To install new packages use 'dnf install ...'

To upgrade disk image use 'dnf upgrade --best'

If DNS isn’t working, try editing ‘/etc/yum.repos.d/fedora-riscv.repo’.

For updates and latest information read:
https://fedoraproject.org/wiki/Architectures/RISC-V

Fedora/RISC-V
-------------
Koji:               http://fedora.riscv.rocks/koji/
SCM:                http://fedora.riscv.rocks:3000/
Distribution rep.:  http://fedora.riscv.rocks/repos-dist/
Koji internal rep.: http://fedora.riscv.rocks/repos/
EOF

# Remove machine-id on pre generated images
rm -f /etc/machine-id
touch /etc/machine-id

# remove random seed, the newly installed instance should make it's own
rm -f /var/lib/systemd/random-seed

# Note that running rpm recreates the rpm db files which aren't needed or wanted
rm -f /var/lib/rpm/__db*

# The enp1s0 interface is a left over from the imagefactory install, clean this up
rm -f /etc/NetworkManager/system-connections/*.nmconnection

releasever=$(rpm --eval '%{fedora}')
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-primary
echo "Packages within this disk image"
rpm -qa --qf '%{size}\t%{name}-%{version}-%{release}.%{arch}\n' |sort -rn

%end

%packages
@base-x
@buildsys-build
@c-development
@core
@development-tools
@hardware-support
@rpm-development-tools
NetworkManager-tui
ack
acpica-tools
alsa-lib-devel
appliance-tools
aria2
audit
audit-libs-devel
autoconf
autoconf-archive
automake
awesome
axel
bash-completion
bc
bind-utils
binwalk
bison
bloaty
bmap-tools
bpftool
breezy
brotli-devel
btrfs-progs
bzip2-devel
cheat
chkconfig
chrony
cloud-utils-growpart
cmake
colordiff
compsize
coreutils
cowsay
cpp
cups-devel
dblatex
dbus-devel
ddrescue
dejagnu
dejavu-fonts-all
dejavu-lgc-sans-fonts
dejavu-lgc-sans-mono-fonts
dejavu-lgc-serif-fonts
dejavu-sans-fonts
dejavu-sans-mono-fonts
dejavu-serif-fonts
dillo
dkms
dnscrypt-proxy
docbook5-style-xsl
dos2unix
dosfstools
dracut-config-generic
dtc
dwarves
e2fsprogs
elfutils
elfutils-devel
elinks
emacs
entr
epiphany
ethtool
evemu
execstack
expat-devel
expect
extlinux-bootloader
extra-cmake-modules
f2fs-tools
fakechroot
fedpkg
file-devel
fio
flashrom
flex
fluxbox
fontconfig-devel
fpaste
freetype-devel
fuse-sshfs
fwts
gcc
gcc-c++
gcc-gdb-plugin
gcc-gdc
gcc-gfortran
gcc-gnat
gcc-go
gcc-plugin-devel
gd-devel
gdb
gdisk
gettext
gettext-devel
git
glances
glib
glib-devel
glib2
glib2-devel
glibc-all-langpacks
glibc-langpack-en
glibc-static
gnulib-devel
gnutls-utils
golang
golang-bin
golang-src
gparted
grubby-deprecated
guestfs-tools
haveged
hdparm
hexedit
hostname
htop
i2c-tools
i2c-tools-perl
i3
ima-evm-utils-devel
incron
info
initscripts
inxi
iperf3
iptables-services
isl-devel
isomd5sum
iw
jfsutils
jq
json-c-devel
kernel
kernel-core
kernel-devel
kernel-modules
kernel-modules-extra
kernel-tools
koji-builder
koji-builder-plugin-rpmautospec
koji-builder-plugins
kpartx
lftp
libX11-devel
libXext-devel
libXi-devel
libXrandr-devel
libXrender-devel
libXt-devel
libXtst-devel
libacl-devel
libarchive-devel
libatomic
libatomic-static
libattr-devel
libbabeltrace-devel
libbsd-devel
libcap-devel
libcap-ng-devel
libdb-devel
libdwarf-devel
libgcc
libgfortran
libgfortran-static
libgnat
libgnat-devel
libgnat-static
libgo
libgo-devel
libgo-static
libgomp
libgphobos
libgphobos-static
libgpiod
libgpiod-c++
libgpiod-devel
libgpiod-utils
libi2c
libi2c-devel
libicu-devel
libnghttp2-devel
libpng-devel
libselinux-devel
libstdc++
libstdc++-devel
libstdc++-static
libtool
libuser-devel
libutempter-devel
libuv-devel
libzstd-devel
linux-firmware
livecd-tools
lsof
lua-devel
lynx
m4
mailx
mc
memtester
mercurial
meson
midori
moreutils
mtd-utils
mtr
mutt
nano
nbd
nbdkit
ncdu
ncurses-devel
neofetch
neovim
net-tools
nfs-utils
ninja-build
nnn
ntfsprogs
nvme-cli
openrdate
opensbi-unstable
openssh
openssh-server
openssl
openssl-devel
pam-devel
parted
patchutils
pax-utils
pciutils
pcmanfm
pcre2-devel
perf
perl
perl-devel
perl-generators
pesign
policycoreutils
policycoreutils-python-utils
popt-devel
prettyping
pv
pycdio
pykickstart
python-imgcreate-sysdeps
python3-devel
python3-i2c-tools
python3-imgcreate
python3-isomd5sum
python3-kickstart
python3-langtable
python3-libgpiod
python3-ordered-set
python3-perf
python3-psutil
python3-pyelftools
python3-pyparted
python3-rpmautospec
python3-sphinx
qemu-guest-agent
qemu-img
readline-devel
realtime-tests
rpkg
rpm-devel
rpmautospec
rpmautospec-rpm-macros
rpmdevtools
rsync
screen
selinux-policy
selinux-policy-targeted
setools-console
setroubleshoot-server
sharutils
source-highlight-devel
spi-tools
strace
stress-ng
sway
sysfsutils
sysstat
systemd-devel
systemd-udev
tcsh
texinfo
texinfo-tex
texlive-collection-latex
texlive-collection-latexrecommended
the_silver_searcher
tig
tldr
tmux
traceroute
uboot-images-riscv64
uboot-tools
udftools
usbutils
util-linux
vim
vim-common
vim-minimal
watchdog
wget
xfsprogs
xterm
xz
xz-devel
zlib-devel
zlib-static
zsh
zstd
-dracut-config-rescue
-grubby

%end