[scripts] rework remaster_generic_inner_chroot_script_after.sh code

This commit is contained in:
Fabio Erculiani 2012-01-21 13:41:50 +01:00
parent 078b85402e
commit 8ed46d7c0a

View File

@ -2,8 +2,9 @@
# do not remove these
/usr/sbin/env-update
source /etc/profile
. /etc/profile
basic_environment_setup() {
eselect opengl set xorg-x11 &> /dev/null
# automatically start xdm
@ -23,13 +24,12 @@ fi
rc-update del music boot
rc-update add music default
rc-update del sabayon-mce default
rc-update add nfsmount default
# Always startup this
rc-update add virtualbox-guest-additions boot
}
remove_desktop_files() {
rm /etc/skel/Desktop/WorldOfGooDemo-world-of-goo-demo.desktop
@ -47,26 +47,6 @@ setup_sabayon_mce() {
# sabayon_setup_live_user "sabayonmce"
}
nspluginwrapper_autoinstall() {
if [ -x /usr/bin/nspluginwrapper ]; then
echo "Auto installing 32bit ns plugins..."
nspluginwrapper -a -i
ls /usr/lib/nsbrowser/plugins
# Remove wrappers if equivalent 64-bit plugins exist
# TODO: May be better to patch nspluginwrapper so it doesn't create
# duplicate wrappers in the first place...
local DIR64="/usr/lib/nsbrowser/plugins/"
for f in "${DIR64}"/npwrapper.*.so; do
local PLUGIN=${f##*/npwrapper.}
if [[ -f ${DIR64}/${PLUGIN} ]]; then
echo " Removing duplicate wrapper for native 64-bit ${PLUGIN}"
nspluginwrapper -r "${f}"
fi
done
fi
}
switch_kernel() {
local from_kernel="${1}"
local to_kernel="${2}"
@ -175,104 +155,7 @@ setup_gnome_shell_extensions() {
done
}
if [ "$1" = "lxde" ]; then
setup_networkmanager
# Fix ~/.dmrc to have it load LXDE
echo "[Desktop]" > /etc/skel/.dmrc
echo "Session=LXDE" >> /etc/skel/.dmrc
remove_desktop_files
setup_displaymanager
# properly tweak lxde autostart tweak, adding --desktop option
sed -i 's/pcmanfm -d/pcmanfm -d --desktop/g' /etc/xdg/lxsession/LXDE/autostart
remove_mozilla_skel_cruft
setup_cpufrequtils
has_proprietary_drivers && setup_proprietary_gfx_drivers || setup_oss_gfx_drivers
elif [ "$1" = "e17" ]; then
setup_networkmanager
# Fix ~/.dmrc to have it load E17
echo "[Desktop]" > /etc/skel/.dmrc
echo "Session=enlightenment" >> /etc/skel/.dmrc
remove_desktop_files
# E17 spin has chromium installed
setup_displaymanager
# Not using lxdm for now
# TODO: improve the lines below
# Make sure enlightenment is selected in lxdm
# sed -i '/lxdm-greeter-gtk/ a\\nlast_session=enlightenment.desktop\nlast_lang=' /etc/lxdm/lxdm.conf
# Fix ~/.gtkrc-2.0 for some nice icons in gtk
echo 'gtk-icon-theme-name="Tango" gtk-theme-name="Xfce"' | tr " " "\n" > /etc/skel/.gtkrc-2.0
remove_mozilla_skel_cruft
setup_cpufrequtils
has_proprietary_drivers && setup_proprietary_gfx_drivers || setup_oss_gfx_drivers
elif [ "$1" = "xfce" ]; then
setup_networkmanager
# Fix ~/.dmrc to have it load Xfce
echo "[Desktop]" > /etc/skel/.dmrc
echo "Session=xfce" >> /etc/skel/.dmrc
remove_desktop_files
remove_mozilla_skel_cruft
setup_cpufrequtils
setup_displaymanager
has_proprietary_drivers && setup_proprietary_gfx_drivers || setup_oss_gfx_drivers
elif [ "$1" = "fluxbox" ]; then
setup_networkmanager
# Fix ~/.dmrc to have it load Fluxbox
echo "[Desktop]" > /etc/skel/.dmrc
echo "Session=fluxbox" >> /etc/skel/.dmrc
remove_desktop_files
setup_displaymanager
remove_mozilla_skel_cruft
setup_cpufrequtils
has_proprietary_drivers && setup_proprietary_gfx_drivers || setup_oss_gfx_drivers
elif [ "$1" = "gnome" ]; then
setup_networkmanager
# Fix ~/.dmrc to have it load GNOME or Cinnamon
echo "[Desktop]" > /etc/skel/.dmrc
if [ -f "/usr/share/xsessions/cinnamon.desktop" ]; then
echo "Session=cinnamon" >> /etc/skel/.dmrc
else
echo "Session=gnome" >> /etc/skel/.dmrc
setup_gnome_shell_extensions
fi
rc-update del system-tools-backends boot
rc-update add system-tools-backends default
setup_displaymanager
setup_sabayon_mce
has_proprietary_drivers && setup_proprietary_gfx_drivers || setup_oss_gfx_drivers
elif [ "$1" = "xfceforensic" ]; then
setup_networkmanager
# Fix ~/.dmrc to have it load Xfce
echo "[Desktop]" > /etc/skel/.dmrc
echo "Session=xfce" >> /etc/skel/.dmrc
remove_desktop_files
setup_cpufrequtils
setup_displaymanager
remove_mozilla_skel_cruft
xfceforensic_remove_skel_stuff
has_proprietary_drivers && setup_proprietary_gfx_drivers || setup_oss_gfx_drivers
elif [ "$1" = "kde" ]; then
setup_networkmanager
# Fix ~/.dmrc to have it load KDE
echo "[Desktop]" > /etc/skel/.dmrc
echo "Session=KDE-4" >> /etc/skel/.dmrc
setup_displaymanager
setup_sabayon_mce
setup_cpufrequtils
has_proprietary_drivers && setup_proprietary_gfx_drivers || setup_oss_gfx_drivers
elif [ "$1" = "awesome" ]; then
setup_networkmanager
# Fix ~/.dmrc to have it load Awesome
echo "[Desktop]" > /etc/skel/.dmrc
echo "Session=awesome" >> /etc/skel/.dmrc
# Disabled for now, maybe next round
# switch_kernel "sys-kernel/linux-sabayon" "sys-kernel/linux-fusion"
remove_desktop_files
setup_displaymanager
remove_mozilla_skel_cruft
setup_cpufrequtils
has_proprietary_drivers && setup_proprietary_gfx_drivers || setup_oss_gfx_drivers
fi
setup_fonts() {
# Cause some rendering glitches on vbox as of 2011-10-02
# 10-autohint.conf
# 10-no-sub-pixel.conf
@ -281,7 +164,6 @@ fi
# 10-sub-pixel-vbgr.conf
# 10-sub-pixel-vrgb.conf
# 10-unhinted.conf
FONTCONFIG_ENABLE="
20-unhint-small-dejavu-sans.conf
20-unhint-small-dejavu-sans-mono.conf
@ -290,7 +172,6 @@ FONTCONFIG_ENABLE="
57-dejavu-sans.conf
57-dejavu-sans-mono.conf
57-dejavu-serif.conf"
for fc_en in ${FONTCONFIG_ENABLE}; do
if [ -f "/etc/fonts/conf.avail/${fc_en}" ]; then
# beautify font rendering
@ -299,7 +180,9 @@ for fc_en in ${FONTCONFIG_ENABLE}; do
echo "ouch, /etc/fonts/conf.avail/${fc_en} is not available" >&2
fi
done
}
setup_misc_stuff() {
# Setup SAMBA config file
if [ -f /etc/samba/smb.conf.default ]; then
cp -p /etc/samba/smb.conf.default /etc/samba/smb.conf
@ -323,36 +206,24 @@ rm -f /usr/share/applications/gnome-system-log.desktop
rm -f /usr/share/autostart/wicd-tray.desktop /etc/xdg/autostart/wicd-tray.desktop
# EXPERIMENTAL, clean icon cache files
for file in `find /usr/share/icons -name "icon-theme.cache"`; do
for file in $(find /usr/share/icons -name "icon-theme.cache"); do
rm $file
done
# Fixup nsplugins
# we have new Flash, don't need it anymore
# nspluginwrapper_autoinstall
# Update package list
equo query list installed -qv > /etc/sabayon-pkglist
# Setup basic GTK theme for root user
if [ ! -f "/root/.gtkrc-2.0" ]; then
echo "include \"/usr/share/themes/Clearlooks/gtk-2.0/gtkrc\"" > /root/.gtkrc-2.0
fi
# Regenerate Fluxbox menu
if [ -x "/usr/bin/fluxbox-generate_menu" ]; then
fluxbox-generate_menu -o /etc/skel/.fluxbox/menu
fi
}
layman -d sabayon
rm -rf /var/lib/layman/sabayon
layman -d sabayon-distro
rm -rf /var/lib/layman/sabayon-distro
setup_installed_packages() {
# Update package list
equo query list installed -qv > /etc/sabayon-pkglist
echo -5 | equo conf update
mount -t proc proc /proc
/lib/rc/bin/rc-depend -u
echo "Vacuum cleaning client db"
rm /var/lib/entropy/client/database/*/sabayonlinux.org -rf
@ -368,21 +239,169 @@ done
# cleanup log dir
rm /var/lib/entropy/logs -rf
rm -rf /var/lib/entropy/*cache*
# remove entropy pid file
rm -f /var/run/entropy/entropy.lock
}
setup_portage() {
layman -d sabayon
rm -rf /var/lib/layman/sabayon
layman -d sabayon-distro
rm -rf /var/lib/layman/sabayon-distro
emaint --fix world
}
setup_startup_caches() {
mount -t proc proc /proc
/lib/rc/bin/rc-depend -u
# Generate openrc cache
touch /lib/rc/init.d/softlevel
/etc/init.d/savecache start
/etc/init.d/savecache zap
ldconfig
ldconfig
umount /proc
}
emaint --fix world
prepare_lxde() {
setup_networkmanager
# Fix ~/.dmrc to have it load LXDE
echo "[Desktop]" > /etc/skel/.dmrc
echo "Session=LXDE" >> /etc/skel/.dmrc
remove_desktop_files
setup_displaymanager
# properly tweak lxde autostart tweak, adding --desktop option
sed -i 's/pcmanfm -d/pcmanfm -d --desktop/g' /etc/xdg/lxsession/LXDE/autostart
remove_mozilla_skel_cruft
setup_cpufrequtils
has_proprietary_drivers && setup_proprietary_gfx_drivers || setup_oss_gfx_drivers
}
rm -rf /var/lib/entropy/*cache*
prepare_e17() {
setup_networkmanager
# Fix ~/.dmrc to have it load E17
echo "[Desktop]" > /etc/skel/.dmrc
echo "Session=enlightenment" >> /etc/skel/.dmrc
remove_desktop_files
# E17 spin has chromium installed
setup_displaymanager
# Not using lxdm for now
# TODO: improve the lines below
# Make sure enlightenment is selected in lxdm
# sed -i '/lxdm-greeter-gtk/ a\\nlast_session=enlightenment.desktop\nlast_lang=' /etc/lxdm/lxdm.conf
# Fix ~/.gtkrc-2.0 for some nice icons in gtk
echo 'gtk-icon-theme-name="Tango" gtk-theme-name="Xfce"' | tr " " "\n" > /etc/skel/.gtkrc-2.0
remove_mozilla_skel_cruft
setup_cpufrequtils
has_proprietary_drivers && setup_proprietary_gfx_drivers || setup_oss_gfx_drivers
}
# remove entropy pid file
rm -f /var/run/entropy/entropy.lock
prepare_xfce() {
setup_networkmanager
# Fix ~/.dmrc to have it load Xfce
echo "[Desktop]" > /etc/skel/.dmrc
echo "Session=xfce" >> /etc/skel/.dmrc
remove_desktop_files
remove_mozilla_skel_cruft
setup_cpufrequtils
setup_displaymanager
has_proprietary_drivers && setup_proprietary_gfx_drivers || setup_oss_gfx_drivers
}
prepare_fluxbox() {
setup_networkmanager
# Fix ~/.dmrc to have it load Fluxbox
echo "[Desktop]" > /etc/skel/.dmrc
echo "Session=fluxbox" >> /etc/skel/.dmrc
remove_desktop_files
setup_displaymanager
remove_mozilla_skel_cruft
setup_cpufrequtils
has_proprietary_drivers && setup_proprietary_gfx_drivers || setup_oss_gfx_drivers
}
prepare_gnome() {
setup_networkmanager
# Fix ~/.dmrc to have it load GNOME or Cinnamon
echo "[Desktop]" > /etc/skel/.dmrc
if [ -f "/usr/share/xsessions/cinnamon.desktop" ]; then
echo "Session=cinnamon" >> /etc/skel/.dmrc
else
echo "Session=gnome" >> /etc/skel/.dmrc
setup_gnome_shell_extensions
fi
rc-update del system-tools-backends boot
rc-update add system-tools-backends default
setup_displaymanager
setup_sabayon_mce
has_proprietary_drivers && setup_proprietary_gfx_drivers || setup_oss_gfx_drivers
}
prepare_xfceforensic() {
setup_networkmanager
# Fix ~/.dmrc to have it load Xfce
echo "[Desktop]" > /etc/skel/.dmrc
echo "Session=xfce" >> /etc/skel/.dmrc
remove_desktop_files
setup_cpufrequtils
setup_displaymanager
remove_mozilla_skel_cruft
xfceforensic_remove_skel_stuff
has_proprietary_drivers && setup_proprietary_gfx_drivers || setup_oss_gfx_drivers
}
prepare_kde() {
setup_networkmanager
# Fix ~/.dmrc to have it load KDE
echo "[Desktop]" > /etc/skel/.dmrc
echo "Session=KDE-4" >> /etc/skel/.dmrc
setup_displaymanager
setup_sabayon_mce
setup_cpufrequtils
has_proprietary_drivers && setup_proprietary_gfx_drivers || setup_oss_gfx_drivers
}
prepare_awesome() {
setup_networkmanager
# Fix ~/.dmrc to have it load Awesome
echo "[Desktop]" > /etc/skel/.dmrc
echo "Session=awesome" >> /etc/skel/.dmrc
remove_desktop_files
setup_displaymanager
remove_mozilla_skel_cruft
setup_cpufrequtils
has_proprietary_drivers && setup_proprietary_gfx_drivers || setup_oss_gfx_drivers
}
prepare_system() {
if [ "$1" = "lxde" ]; then
prepare_lxde
elif [ "$1" = "e17" ]; then
prepare_e17
elif [ "$1" = "xfce" ]; then
prepare_xfce
elif [ "$1" = "fluxbox" ]; then
prepare_fluxbox
elif [ "$1" = "gnome" ]; then
prepare_gnome
elif [ "$1" = "xfceforensic" ]; then
prepare_xfceforensic
elif [ "$1" = "kde" ]; then
prepare_kde
elif [ "$1" = "awesome" ]; then
prepare_awesome
fi
}
basic_environment_setup
setup_fonts
# setup Desktop Environment, might add packages
prepare_system
# These have to run after prepare_system
setup_misc_stuff
setup_installed_packages
setup_portage
setup_startup_caches
exit 0