2018-01-30 11:34:07 +01:00
preinstall :
# switch to hardened, build hardened toolchain, rebuild everything
mkdir -p $( CHROOT) /etc/portage/profile
echo "-hardened" >> $( CHROOT) /etc/portage/profile/use.mask
$( inroot) $( EMERGE) $( USEPKG) --oneshot gcc
$( inroot) $( EMERGE) $( USEPKG) --oneshot binutils virtual/libc
-$( gcc_config)
$( inroot) $( EMERGE) $( USEPKG) --emptytree @world
$( inroot) bash -c 'yes YES | etc-update --automode -9'
2020-06-15 19:08:18 +02:00
postinstall : base /timesyncd .conf base /firstboot .start
2018-01-30 11:34:07 +01:00
# Konfigurationen anpassen
2020-06-15 19:08:18 +02:00
cp base/timesyncd.conf $( CHROOT) /etc/systemd/timesyncd.conf
2018-09-08 18:44:08 +02:00
mkdir -p $( CHROOT) /etc/local.d
2020-06-15 19:08:18 +02:00
cp base/firstboot.start $( CHROOT) /etc/local.d/firstboot.start
2018-01-30 11:34:07 +01:00
touch $( CHROOT) /firstboot
sed -i 's/# %wheel ALL=(ALL) ALL/%wheel ALL=(ALL) ALL/' $( CHROOT) /etc/sudoers
2020-04-11 12:21:08 +02:00
sed -i 's#^auth.*$$#auth [success=2 default=ignore] pam_ssh_agent_auth.so file=~/.ssh/authorized_keys\nauth include system-auth#' $( CHROOT) /etc/pam.d/sudo
echo "Defaults env_keep += SSH_AUTH_SOCK" > $( CHROOT) /etc/sudoers.d/ssh_auth_sock
$( inroot) useradd -m -G users,wheel -s /bin/bash --comment= "virtual appliance admin" --uid 2000 admin
2018-01-30 11:34:07 +01:00
$( inroot) passwd -d admin; $( inroot) passwd -e admin
2020-06-15 19:08:18 +02:00
$( inroot) systemctl enable tmux@root.service
cp base/tmux.conf $( CHROOT) /root/.tmux.conf
2018-01-30 11:34:07 +01:00
# Beispiel feste IP-Adresse
2020-06-15 19:08:18 +02:00
cp base/00-eth0.network $( CHROOT) /00-eth0.network.example
2018-01-30 11:34:07 +01:00
2019-07-07 13:41:16 +02:00
# MariaDB-Konfiguration ($$, weil make ein $ entfernt)
2020-06-15 19:08:18 +02:00
sed -i " s/^character-set-server.* $$ /character-set-server = utf8mb4/ " $( CHROOT) /etc/mysql/mariadb.d/50-distro-server.cnf
sed -iE 's/^\(log-bin\)/#\1/' $( CHROOT) /etc/mysql/mariadb.d/50-distro-server.cnf
echo >> $( CHROOT) /etc/mysql/mariadb.d/50-distro-server.cnf
echo "# innodb tuning" >> $( CHROOT) /etc/mysql/mariadb.d/50-distro-server.cnf
echo "innodb_buffer_pool_size = 2G" >> $( CHROOT) /etc/mysql/mariadb.d/50-distro-server.cnf
echo "innodb_strict_mode = OFF" >> $( CHROOT) /etc/mysql/mariadb.d/50-distro-server.cnf
2018-01-30 11:34:07 +01:00
cp mariadb/my.cnf.root $( CHROOT) /root/.my.cnf
chmod 0600 $( CHROOT) /root/.my.cnf
rm -rf $( CHROOT) /var/lib/mysql/*
$( inroot) bash -c 'yes gentoo | emerge --config dev-db/mariadb'
# Apache-/PHP-Konfiguration
2018-10-08 19:49:20 +02:00
patch $( CHROOT) /etc/php/apache2-*/php.ini < php/php.ini-opcache.diff
2018-01-30 11:34:07 +01:00
find $( CHROOT) /etc/php/apache2-*/ -iname php.ini -print | xargs \s ed -i \
-e 's:.*date.timezone =.*:date.timezone = Europe/Berlin:' \
-e 's:.*max_execution_time =.*:max_execution_time = 3600:' \
-e 's:.*max_input_time =.*:max_input_time = 3600:' \
-e 's:.*post_max_size =.*:post_max_size = 8G:' \
-e 's:.*upload_max_filesize =*.:upload_max_filesize = 8G:' \
-e 's:.*always_populate_raw_post_data =.*:always_populate_raw_post_data = -1:'
$( inroot) systemctl enable apache2
clean :