You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
calculate-utils-2.2-install/data/calculate

86 lines
1.6 KiB

#!/sbin/runscript
depend() {
need localmount root fsck modules
before keymaps consolefont dbus
use swap hostname
}
check_install_ability()
{
local pkg=$1
FETCHCOMMAND=false DISTDIR=/usr/portage/distfiles emerge -fq $pkg &>/dev/null
}
is_already_install()
{
local pkg=$1
local category=`echo $pkg | cut -d\/ -f1`
local pkg=`echo $pkg | cut -d\/ -f2`
local categoryPath=/var/db/pkg/${category}
[[ -e $categoryPath ]] && ls $categoryPath | grep -q "^$pkg"
}
install_pkg()
{
local pkg=$1
ebegin "Installing $pkg"
FETCHCOMMAND=false DISTDIR=/usr/portage/distfiles emerge $pkg &>/dev/null
}
variable_value()
{
local varname=$1
cl-install -v --filter $varname |
awk "{ if (\$1 == \"$varname\") print \$3 }"
}
install_video_driver()
{
ebegin "Checking video drivers"
case `variable_value os_install_x11_video_drv` in
fglrx)
local drv="x11-drivers/ati-drivers"
;;
nvidia)
local nvidiamask=`variable_value os_nvidia_mask`
[[ -n $nvidiamask ]] && \
echo $nvidiamask >/etc/portage/package.mask/nvidia
local drv="x11-drivers/nvidia-drivers"
;;
*)
true
;;
esac
if [[ -n $drv ]]
then
if ! is_already_install $drv
then
check_install_ability $drv && install_pkg $drv
fi
eend $?
else
eend 0
fi
}
start() {
install_video_driver
LANG=C /usr/bin/cl-install --live
/usr/sbin/env-update
source /etc/profile
/sbin/update-modules
/sbin/rc-update --update
return 0
}
stop() {
local roottype=`variable_value os_root_type`
if [[ $roottype == "hdd" ]] && rc-config list boot | grep -q calculate
then
rc-update del calculate boot
fi
}