#!/bin/bash # # Run this script with argument pointing to root of newly installed # fedora before you boot to the firstboot screen. # tmpfile=/tmp/zeroboot$$ export tmpfile trap "rm -f $tmpfile" EXIT if [ $# -ne 1 ] then echo Must be run with single arg giving path to root of new fedora 1>&2 exit 2 fi fedroot="$1" if [ -d "$fedroot" ] then : else echo "$fedroot" is not a directory 1>&2 exit 2 fi # Disable annoying boot animation which hides anything that might go wrong. # As long as we are editing kernel command line, disable selinux as well. # files="$fedroot/boot/grub2/grub.cfg $fedroot/etc/default/grub" for file in $files do echo Fix "$file" rhgb, selinux if [ -f "$file" ] then cp -f $file $file.zeroboot rm -f "$tmpfile" sed -e 's/ rhgb / selinux=0 /' \ < "$file" \ > "$tmpfile" if cmp -s "$tmpfile" "$file" then : else cp -f "$tmpfile" "$file" fi rm -f "$tmpfile" else echo Missing "$file" 1>&2 fi done # We disabled selinux on kernel boot, now use belt and suspenders # and disable it in the config file as well. # file="$fedroot/etc/selinux/config" echo Fix "$file", disable selinux if [ -f "$file" ] then cp -f $file $file.zeroboot rm -f "$tmpfile" sed -e 's/SELINUX=enforcing/SELINUX=disabled/' \ < "$file" \ > "$tmpfile" if cmp -s "$tmpfile" "$file" then : else cp -f "$tmpfile" "$file" fi rm -f "$tmpfile" else echo Missing "$file" 1>&2 fi # Setup the system to use KDM rather than GDM as the login manager. # (KDM can be configured, GDM cannot). # file="$fedroot/etc/sysconfig/desktop" echo Setup "$file" for KDM login cp -f /etc/sysconfig/desktop "$file" # Disable some annoying things that can be disabled by fiddling # environment variables early in the X login process. # file="$fedroot/etc/X11/xinit/xinitrc.d/00-aaa-me-first.sh" echo Setup "$file" disable input methods and gvfs cp -f /etc/X11/xinit/xinitrc.d/00-aaa-me-first.sh "$file" # Run the scripts that use xinput to adjust buttons and # wot-not on mice when I login. # file="$fedroot/etc/X11/xinit/xinitrc.d/99-temp.sh" echo Setup "$file" for xinput adjustments cat > "$file" <<'EOF' #!/bin/bash /zooty/home/tom/scripts/xinput-mouse-settings /zooty/home/tom/scripts/mini-mouse EOF chmod 755 "$file" # Setup udev rules to prevent my backup disks from showing # up in every file browser and being automounted in every # gnome session # file="$fedroot/etc/udev/rules.d/99-zzz-local.rules" echo Setup "$file" disable annoying automount cp -f /etc/udev/rules.d/99-zzz-local.rules "$file" # Address space randomization loads shared libraries at random # locations. The prelinker wastes near infinite amounts of # resources adjusting shared libraries to load at fixed locations # where they don't conflict. Having both active is utterly # lunatic, so disable the prelinker (which has never managed # to save as much time as it wastes anyway). # file="$fedroot/etc/sysconfig/prelink" echo Fix "$file", disable prelinking if [ -f "$file" ] then cp -f $file $file.zeroboot rm -f "$tmpfile" sed -e 's/PRELINKING=yes/PRELINKING=no/' \ < "$file" \ > "$tmpfile" if cmp -s "$tmpfile" "$file" then : else cp -f "$tmpfile" "$file" fi rm -f "$tmpfile" else echo Missing "$file" 1>&2 fi # Copy in double sized console font so I can see characters on # the screen (may not need this soon - this may have made it # into the official packages). # file="$fedroot/lib/kbd/consolefonts/latarcyrheb-sun32.psfu.gz" echo Setup "$file" for bigger font cp -f /lib/kbd/consolefonts/latarcyrheb-sun32.psfu.gz "$file" # Set the default console font to use the larger font. # file="$fedroot/etc/sysconfig/i18n" echo Fix "$file", default to bigger font if [ -f "$file" ] then rm -f "$tmpfile" sed -e 's/latarcyrheb-sun16/latarcyrheb-sun32/' \ < "$file" \ > "$tmpfile" if cmp -s "$tmpfile" "$file" then : else cp -f "$tmpfile" "$file" fi rm -f "$tmpfile" else echo Missing "$file" 1>&2 fi # Copy the old ssh host keys to the new partition so I still # look like the same machine. # dir="$fedroot/etc/ssh" echo Fix "$dir" ssh keys if [ -d "$dir" ] then cp -f /etc/ssh/*key* "$dir" else echo Missing "$dir" 1>&2 fi