# Calculate ini(update.rev)<59 run=/bin/bash merge=sys-apps/openrc,app-emulation/virtualbox-modules

#-ini(update.rev,59)-#

#?cl_chroot_status==off#
MODDIR=/etc/modules-load.d
# backup modules autoload configuration
cp /etc/conf.d/modules /etc/conf.d/modules.old
# get cpufreq kernel modules names
FREQ_MODULES="$(ls -1 $(find /lib/modules/$(uname -r) -name cpufreq) | tr "\n" " " | sed 's/.ko /|/g' | sed 's/|$//' )"
# migrate user modules
if sed -nr 's/^modules[^"]+="([^"]+)"/\1/;T;s/ /\n/g;p;' /etc/conf.d/modules | sort | uniq | 
	grep -qvP "$FREQ_MODULES"; then
	# create autoload directory
	[[ -e $MODDIR ]] || mkdir $MODDIR
	sed -nr 's/^modules[^"]+="([^"]+)"/\1/;T;s/ /\n/g;p;' /etc/conf.d/modules | sort | uniq | 
		grep -vP "$FREQ_MODULES" >$MODDIR/migrate.conf
fi

rm -f /etc/init.d/calculate-builder
#cl_chroot_status#
true
