diff options
Diffstat (limited to 'abs/core-testing')
40 files changed, 2912 insertions, 408 deletions
diff --git a/abs/core-testing/LinHES-config-svn/PKGBUILD b/abs/core-testing/LinHES-config-svn/PKGBUILD index 2927a6e..32645a2 100755 --- a/abs/core-testing/LinHES-config-svn/PKGBUILD +++ b/abs/core-testing/LinHES-config-svn/PKGBUILD @@ -1,6 +1,6 @@ pkgname=LinHES-config-svn pkgver=1.0 -pkgrel=294 +pkgrel=299 conflicts=(MythVantage-config MythVantage-config-dev LinHES-config-dev ) pkgdesc="Install and configure your system" depends=(bc libstatgrab mysql-python expect curl dnsutils parted sg3_utils nmbscan system-templates ) diff --git a/abs/core-testing/LinHES-config-svn/install_db_chroot.sh b/abs/core-testing/LinHES-config-svn/install_db_chroot.sh index 1a0131e..808dbb9 100755 --- a/abs/core-testing/LinHES-config-svn/install_db_chroot.sh +++ b/abs/core-testing/LinHES-config-svn/install_db_chroot.sh @@ -6,58 +6,112 @@ myhost=$hostname hostname $myhost echo $myhost > /etc/hostname -echo "install_db_chroot hostname is $hostname" +echo "$0 hostname is $hostname" . $MV_ROOT/bin/install_functions.sh #myhost=`cat /etc/hostname` -#mount -t proc none /proc -pacman --noconfirm -Sf mysql -/etc/rc.d/mysqld - -status=1 -mysqlstatus=1 -while [ ! $status = 0 ] -do - /etc/rc.d/mysqld stop - sleep 1 - /etc/rc.d/mysqld start - mysqlstatus=$? - if [ $mysqlstatus = 0 ] - then - mysql -e "show databases;" - showstatus=$? - if [ $showstatus = 0 ] - then - pacman --noconfirm -R mythdb-initial - pacman --noconfirm -S mythdb-initial - $MV_ROOT/bin/restore_default_settings.sh -c load - DISPLAY=127.0.0.1:0 $MV_ROOT/bin/MythVantage -t restore,default_1 - $MV_ROOT/bin/restore_default_settings.sh -c restore -t syssettings - $MV_ROOT/bin/systemconfig.sh misc,hostype,this_is_install - - update_db_settings HostServiceMythWEB "1" - echo 'UseMythWEB="1"' >> /etc/systemconfig - - #update database to allow user jobs on this host. - $MV_ROOT/bin/restore_default_settings.sh -c USERJOBALLOW - $MV_ROOT/bin/restore_default_settings.sh -c ACCESSCONTROL - if [ -d /data/srv/mysql/mythconverg ] - #if [ -d /var/lib/mysql/mythconverg ] - then +# Before this script is called, the mysqld that facilitated the installation is killed. +# We need to make sure to stop and start the mysqld that will be used post-install so +# that the database can be initialized. + +/etc/rc.d/mysqld stop +killall -9 mysqld +/etc/rc.d/mysqld start +sleep 1 + +# Put a limit on how many times we try to (re-)start MySQL +success_test() { + # parameter: number of tries to start mysqld so far + PID=`pidof -o %PPID /usr/sbin/mysqld` + if [ -z "$PID" ]; then # mysqld isn't running + if [ $1 -gt 3 ]; then + echo "ERROR: Failed to start MySQL server in $1 attempts." + sleep 5 + exit 1 + else + echo "Tried $1 time(s) to start MySQL server." + return 1 + fi + else # mysqld is running + return 0 + fi + # should never get here + return 1 +} + +mysqld_tries=0 +# See if MySQL server is running; try several ways to start it if it's not. +while true; do + success_test $mysqld_tries + if [ $? -eq 0 ]; then + echo "MySQL server is running" + break + else + echo "MySQL server is not running. Trying to start it." + # Maybe it just needs to be started + sleep 1 + /etc/rc.d/mysqld start + mysqld_tries=$((mysqld_tries + 1)) + success_test $mysqld_tries + if [ $? -eq 0 ]; then + echo "MySQL server has been started" + break + else + echo "MySQL server may not be installed. Trying to install it." + # Maybe it's not installed; try (re-)installing it and starting it + sleep 1 + pacman --noconfirm -Sf mysql + sleep 1 + /etc/rc.d/mysqld start + mysqld_tries=$((mysqld_tries + 1)) + success_test $mysqld_tries + if [ $? -eq 0 ]; then + echo "MySQL server has been installed and started" + break + else + echo "MySQL server would not start, even after (re-)installing it." + fi + fi + fi +done + +# At this point, MySQL server should be up and running + +while true; do + mysql -e "show databases;" + + if [ $? -eq 0 ]; then + pacman --noconfirm -R mythdb-initial + pacman --noconfirm -S mythdb-initial + $MV_ROOT/bin/restore_default_settings.sh -c load + DISPLAY=127.0.0.1:0 $MV_ROOT/bin/MythVantage -t restore,default_1 + $MV_ROOT/bin/restore_default_settings.sh -c restore -t syssettings + $MV_ROOT/bin/systemconfig.sh misc,hostype,this_is_install + + update_db_settings HostServiceMythWEB "1" + echo 'UseMythWEB="1"' >> /etc/systemconfig + + #update database to allow user jobs on this host. + $MV_ROOT/bin/restore_default_settings.sh -c USERJOBALLOW + $MV_ROOT/bin/restore_default_settings.sh -c ACCESSCONTROL + #if [ -d /var/lib/mysql/mythconverg ] + if [ -d /data/srv/mysql/mythconverg ]; then # pacman --noconfirm -R webcalendar # pacman --noconfirm --nodeps -S webcalendar - status=0 - fi + break + else + echo "Failed to create mythconverg database. Will re-try." + sleep 1 + fi # if [ $SystemType = "Master_backend" ] # then # $MV_ROOT/bin/restore_default_settings.sh -c BECONFIG -s master -a $dbhost # fi - fi + else + echo "Failed to look for databases. Will re-try." + sleep 1 fi done /etc/rc.d/mysqld stop #umount /proc - - - diff --git a/abs/core-testing/LinHES-config-svn/install_functions.sh b/abs/core-testing/LinHES-config-svn/install_functions.sh index ddade6d..4f6f7ed 100755 --- a/abs/core-testing/LinHES-config-svn/install_functions.sh +++ b/abs/core-testing/LinHES-config-svn/install_functions.sh @@ -38,7 +38,7 @@ update_db_settings Theme "$pick" function splash_setup (){ echo $CMDLINE | grep -q splash=silent - if [ $? = 0 ] + if [ $? -eq 0 ] then update_db_settings Hostbootsplash 1 else @@ -61,7 +61,7 @@ function setupremote { update_db_settings HostRemoteType "$Remotetype" #special case for special remote echo "Starting with support for $Remotetype" - if [ x$Remotetype = "xdvico" ] + if [ "$Remotetype" == "dvico" ] then /usr/sbin/lircd -d /dev/usb/hiddev0 else @@ -79,7 +79,7 @@ echo "Scanning for Hauppauge receiver" for hpgid in `lspci -nm -d4444: |cut -d" " -f6- |tr -d '"'|tr " " :` do line=`grep $hpgid $TEMPLATES/remotes/i2c.id` - if [ $? = 0 ] + if [ $? -eq 0 ] then modprobe lirc_i2c FoundReceiverType=`echo "$line"|cut -d"|" -f2` @@ -102,7 +102,7 @@ while read line do USBID=`echo "$line"|cut -d"|" -f1` lsusb -d "$USBID" > /dev/null 2>/dev/null - if [ $? = 0 ] + if [ $? -eq 0 ] then Remotetype=`echo "$line"|cut -d"|" -f2` echo "Found $Remotetype" @@ -111,7 +111,7 @@ do break fi done <$BASE/$TEMPLATES/remotes/receiver_usb.id -if [ $found_remote = 1 ] +if [ $found_remote -eq 1 ] then scan_for_hpg_receiver fi @@ -125,7 +125,7 @@ fi function rest_of_network () { #netmask echo $CMDLINE | grep -q netmask - if [ $? = 0 ] + if [ $? -eq 0 ] then TEMPVAR=${CMDLINE#*netmask=} NETMASK=${TEMPVAR%% *} @@ -139,7 +139,7 @@ function rest_of_network () { fi #gateway echo $CMDLINE | grep -q gateway - if [ $? = 0 ] + if [ $? -eq 0 ] then TEMPVAR=${CMDLINE#*gateway=} GATEWAY=${TEMPVAR%% *} @@ -152,7 +152,7 @@ function rest_of_network () { #dns echo $CMDLINE | grep -q dns - if [ $? = 0 ] + if [ $? -eq 0 ] then TEMPVAR=${CMDLINE#*dns=} DNS=${TEMPVAR%% *} @@ -165,7 +165,7 @@ function rest_of_network () { function init_network { echo $CMDLINE |grep -q netdev - if [ $? = 0 ] + if [ $? -eq 0 ] then TEMPVAR=${CMDLINE#*netdev=} MYTHDEFAULT=${TEMPVAR%% *} @@ -176,7 +176,7 @@ function init_network { echo $CMDLINE | grep -q ip - if [ $? = 0 ] + if [ $? -eq 0 ] then update_db_settings HostDefaulteth0 0 update_db_settings HostDefault${MYTHDEFAULT} 1 @@ -187,7 +187,7 @@ function init_network { TEMPVAR=${CMDLINE#*ip=} IP=${TEMPVAR%% *} - if [ x$IP = xdhcp ] + if [ "$IP" == "dhcp" ] then /sbin/dhcpcd $MYTHDEFAULT update_db_settings HostUseDHCP${MYTHDEFAULT} 0 @@ -202,11 +202,11 @@ function init_network { function init_remote { echo $CMDLINE | grep -q remoteport - if [ $? = 0 ] + if [ $? -eq 0 ] then TEMPVAR=${CMDLINE#*remoteport=} REMOTEPORT=${TEMPVAR%% *} - if [ x"$ReceiverType" = "xSerial" ] + if [ "$ReceiverType" == "Serial" ] then if [ -e /dev/$REMOTEPORT ] then @@ -220,7 +220,7 @@ function init_remote { fi echo $CMDLINE | grep -q remote - if [ $? = 0 ] + if [ $? -eq 0 ] then TEMPVAR=${CMDLINE#*remote=} Remotetype=${TEMPVAR%% *} @@ -239,7 +239,7 @@ ROOT=$1 DATA=$2 SWAP=$3 -if [ ! x$SWAP = xNO ] +if [ "$SWAP" != "NO" ] then SWAPLINE=",$SWAP,S" MKSWAPCMD="mkswap /dev/${disk}2" @@ -248,7 +248,7 @@ if [ ! x$SWAP = xNO ] MKSWAPCMD="" fi -if [ x$DATA = xALL ] +if [ "$DATA" == "ALL" ] then DATALINE=",,," EXTRALINE="" @@ -315,7 +315,7 @@ unmount_it () { copy_it () { - if [ x$1 = xALL ] + if [ "$1" == "ALL" ] then echo "Transferring system" unsquashfs -f -d /$mountpoint /.livesys/medium/system.sqf @@ -403,7 +403,7 @@ function find_uuid() { get_grub_map() { - rm /tmp/dev.map + [ -e /tmp/dev.map ] && rm /tmp/dev.map /sbin/grub --no-floppy --device-map /tmp/dev.map <<EOF quit EOF @@ -422,17 +422,17 @@ mapdev() { fi for dev in $devs do - if [ "(" = $(echo $dev | cut -b1) ]; then + if [ "(" == $(echo $dev | cut -b1) ]; then grubdevice="$dev" else - if [ "$dev" = "$linuxdevice" ]; then + if [ "$dev" == "$linuxdevice" ]; then device_found=1 break fi fi done - if [ "$device_found" = "1" ]; then - if [ "$partition_flag" = "0" ]; then + if [ "$device_found" == "1" ]; then + if [ "$partition_flag" == "0" ]; then echo "$grubdevice" else grubdevice_stringlen=${#grubdevice} @@ -461,7 +461,7 @@ dogrub() { #/usr/sbin/xfs_freeze -f /$mountpoint > /dev/null 2>&1 echo "freezing xfs fs" /usr/sbin/xfs_freeze -f /$mountpoint - if [ $? = 0 ] + if [ $? -eq 0 ] then sleep 40 echo "unfreezing xfs" @@ -531,7 +531,7 @@ case $1 in create_fstab fi #was 5 - if [ x$3 = xUPGRADE ] + if [ "$3" == "UPGRADE" ] then if [ ! -f /tmp/etc/KnoppMyth-version ] then @@ -558,11 +558,11 @@ case $1 in SWAPUUID=$FOUNDUUID FOUNDUUID="" - if [ x$4 = x ] + if [ "$4" == "" ] then #upgrade find_uuid ${2}3 - elif [ x$5 = xFULL_INSTALL ] + elif [ "$5" == "FULL_INSTALL" ] then #install find_uuid ${2}3 @@ -585,7 +585,7 @@ case $1 in if [ -f /tmp/etc/fstab ] then grep -q /dev/vg /tmp/etc/fstab - if [ $? = 0 ] + if [ $? -eq 0 ] then grep /dev/vg /tmp/etc/fstab >> /$mountpoint/etc/fstab grep /dev/vg /tmp/etc/fstab | awk -v mount=$mountpoint ' { print "/" mount $2 }' |xargs mkdir diff --git a/abs/core-testing/LinHES-config-svn/install_proxy.sh b/abs/core-testing/LinHES-config-svn/install_proxy.sh index 3f626a1..32d01d7 100755 --- a/abs/core-testing/LinHES-config-svn/install_proxy.sh +++ b/abs/core-testing/LinHES-config-svn/install_proxy.sh @@ -174,7 +174,7 @@ full_install () { sleep 1 $run partition_it $disk $rootsize $datasize $swapsize - echo "Formating $disk" > /tmp/.install_state + echo "Formatting $disk" > /tmp/.install_state progress 2 sleep 1 $run format_it $disk $rootfs $datafs @@ -294,7 +294,7 @@ function upgrade () { if [ ! x$rootfs = "xDo_not_format" ] then - echo "Formating $disk" > /tmp/.install_state + echo "Formatting $disk" > /tmp/.install_state progress 2 sleep 1 $run format_it $disk $rootfs NO diff --git a/abs/core-testing/LinHES-config/install_db_chroot.sh b/abs/core-testing/LinHES-config/install_db_chroot.sh index 1a0131e..808dbb9 100755 --- a/abs/core-testing/LinHES-config/install_db_chroot.sh +++ b/abs/core-testing/LinHES-config/install_db_chroot.sh @@ -6,58 +6,112 @@ myhost=$hostname hostname $myhost echo $myhost > /etc/hostname -echo "install_db_chroot hostname is $hostname" +echo "$0 hostname is $hostname" . $MV_ROOT/bin/install_functions.sh #myhost=`cat /etc/hostname` -#mount -t proc none /proc -pacman --noconfirm -Sf mysql -/etc/rc.d/mysqld - -status=1 -mysqlstatus=1 -while [ ! $status = 0 ] -do - /etc/rc.d/mysqld stop - sleep 1 - /etc/rc.d/mysqld start - mysqlstatus=$? - if [ $mysqlstatus = 0 ] - then - mysql -e "show databases;" - showstatus=$? - if [ $showstatus = 0 ] - then - pacman --noconfirm -R mythdb-initial - pacman --noconfirm -S mythdb-initial - $MV_ROOT/bin/restore_default_settings.sh -c load - DISPLAY=127.0.0.1:0 $MV_ROOT/bin/MythVantage -t restore,default_1 - $MV_ROOT/bin/restore_default_settings.sh -c restore -t syssettings - $MV_ROOT/bin/systemconfig.sh misc,hostype,this_is_install - - update_db_settings HostServiceMythWEB "1" - echo 'UseMythWEB="1"' >> /etc/systemconfig - - #update database to allow user jobs on this host. - $MV_ROOT/bin/restore_default_settings.sh -c USERJOBALLOW - $MV_ROOT/bin/restore_default_settings.sh -c ACCESSCONTROL - if [ -d /data/srv/mysql/mythconverg ] - #if [ -d /var/lib/mysql/mythconverg ] - then +# Before this script is called, the mysqld that facilitated the installation is killed. +# We need to make sure to stop and start the mysqld that will be used post-install so +# that the database can be initialized. + +/etc/rc.d/mysqld stop +killall -9 mysqld +/etc/rc.d/mysqld start +sleep 1 + +# Put a limit on how many times we try to (re-)start MySQL +success_test() { + # parameter: number of tries to start mysqld so far + PID=`pidof -o %PPID /usr/sbin/mysqld` + if [ -z "$PID" ]; then # mysqld isn't running + if [ $1 -gt 3 ]; then + echo "ERROR: Failed to start MySQL server in $1 attempts." + sleep 5 + exit 1 + else + echo "Tried $1 time(s) to start MySQL server." + return 1 + fi + else # mysqld is running + return 0 + fi + # should never get here + return 1 +} + +mysqld_tries=0 +# See if MySQL server is running; try several ways to start it if it's not. +while true; do + success_test $mysqld_tries + if [ $? -eq 0 ]; then + echo "MySQL server is running" + break + else + echo "MySQL server is not running. Trying to start it." + # Maybe it just needs to be started + sleep 1 + /etc/rc.d/mysqld start + mysqld_tries=$((mysqld_tries + 1)) + success_test $mysqld_tries + if [ $? -eq 0 ]; then + echo "MySQL server has been started" + break + else + echo "MySQL server may not be installed. Trying to install it." + # Maybe it's not installed; try (re-)installing it and starting it + sleep 1 + pacman --noconfirm -Sf mysql + sleep 1 + /etc/rc.d/mysqld start + mysqld_tries=$((mysqld_tries + 1)) + success_test $mysqld_tries + if [ $? -eq 0 ]; then + echo "MySQL server has been installed and started" + break + else + echo "MySQL server would not start, even after (re-)installing it." + fi + fi + fi +done + +# At this point, MySQL server should be up and running + +while true; do + mysql -e "show databases;" + + if [ $? -eq 0 ]; then + pacman --noconfirm -R mythdb-initial + pacman --noconfirm -S mythdb-initial + $MV_ROOT/bin/restore_default_settings.sh -c load + DISPLAY=127.0.0.1:0 $MV_ROOT/bin/MythVantage -t restore,default_1 + $MV_ROOT/bin/restore_default_settings.sh -c restore -t syssettings + $MV_ROOT/bin/systemconfig.sh misc,hostype,this_is_install + + update_db_settings HostServiceMythWEB "1" + echo 'UseMythWEB="1"' >> /etc/systemconfig + + #update database to allow user jobs on this host. + $MV_ROOT/bin/restore_default_settings.sh -c USERJOBALLOW + $MV_ROOT/bin/restore_default_settings.sh -c ACCESSCONTROL + #if [ -d /var/lib/mysql/mythconverg ] + if [ -d /data/srv/mysql/mythconverg ]; then # pacman --noconfirm -R webcalendar # pacman --noconfirm --nodeps -S webcalendar - status=0 - fi + break + else + echo "Failed to create mythconverg database. Will re-try." + sleep 1 + fi # if [ $SystemType = "Master_backend" ] # then # $MV_ROOT/bin/restore_default_settings.sh -c BECONFIG -s master -a $dbhost # fi - fi + else + echo "Failed to look for databases. Will re-try." + sleep 1 fi done /etc/rc.d/mysqld stop #umount /proc - - - diff --git a/abs/core-testing/LinHES-config/install_functions.sh b/abs/core-testing/LinHES-config/install_functions.sh index ce9a057..9f38384 100755 --- a/abs/core-testing/LinHES-config/install_functions.sh +++ b/abs/core-testing/LinHES-config/install_functions.sh @@ -38,7 +38,7 @@ update_db_settings Theme "$pick" function parse_cmdline_2_db(){ echo $CMDLINE | grep -q displayres - if [ $? = 0 ] + if [ $? -eq 0 ] then TEMPVAR=${CMDLINE#*displayres=} update_db_settings HostXres $TEMPVAR @@ -49,7 +49,7 @@ function parse_cmdline_2_db(){ function bootsplash_setup (){ echo $CMDLINE | grep -q splash=silent - if [ $? = 0 ] + if [ $? -eq 0 ] then update_db_settings Hostbootsplash 1 else @@ -72,7 +72,7 @@ function setupremote { update_db_settings HostRemoteType "$Remotetype" #special case for special remote printhl "Starting with support for $Remotetype" - if [ x$Remotetype = "xdvico" ] + if [ "$Remotetype" == "dvico" ] then /usr/sbin/lircd -d /dev/usb/hiddev0 else @@ -90,7 +90,7 @@ printhl " Scanning for Hauppauge receiver" for hpgid in `lspci -nm -d4444: |cut -d" " -f6- |tr -d '"'|tr " " :` do line=`grep $hpgid $TEMPLATES/remotes/i2c.id` - if [ $? = 0 ] + if [ $? -eq 0 ] then modprobe lirc_i2c FoundReceiverType=`echo "$line"|cut -d"|" -f2` @@ -131,7 +131,7 @@ while read line do USBID=`echo "$line"|cut -d"|" -f1` lsusb -d "$USBID" > /dev/null 2>/dev/null - if [ $? = 0 ] + if [ $? -eq 0 ] then Remotetype=`echo "$line"|cut -d"|" -f2` printhl "Found $Remotetype" @@ -140,7 +140,7 @@ do break fi done <$BASE/$TEMPLATES/remotes/receiver_usb.id -if [ $found_remote = 1 ] +if [ $found_remote -eq 1 ] then scan_for_hpg_receiver fi @@ -154,7 +154,7 @@ fi function rest_of_network () { #netmask echo $CMDLINE | grep -q netmask - if [ $? = 0 ] + if [ $? -eq 0 ] then TEMPVAR=${CMDLINE#*netmask=} NETMASK=${TEMPVAR%% *} @@ -168,7 +168,7 @@ function rest_of_network () { fi #gateway echo $CMDLINE | grep -q gateway - if [ $? = 0 ] + if [ $? -eq 0 ] then TEMPVAR=${CMDLINE#*gateway=} GATEWAY=${TEMPVAR%% *} @@ -180,7 +180,7 @@ function rest_of_network () { #dns echo $CMDLINE | grep -q dns - if [ $? = 0 ] + if [ $? -eq 0 ] then TEMPVAR=${CMDLINE#*dns=} DNS=${TEMPVAR%% *} @@ -193,7 +193,7 @@ function rest_of_network () { function init_network { echo $CMDLINE |grep -q netdev - if [ $? = 0 ] + if [ $? -eq 0 ] then TEMPVAR=${CMDLINE#*netdev=} MYTHDEFAULT=${TEMPVAR%% *} @@ -204,7 +204,7 @@ function init_network { echo $CMDLINE | grep -q ip - if [ $? = 0 ] + if [ $? -eq 0 ] then update_db_settings HostDefaulteth0 0 update_db_settings HostDefault${MYTHDEFAULT} 1 @@ -215,7 +215,7 @@ function init_network { TEMPVAR=${CMDLINE#*ip=} IP=${TEMPVAR%% *} - if [ x$IP = xdhcp ] + if [ "$IP" == "dhcp" ] then /sbin/dhcpcd $MYTHDEFAULT update_db_settings HostUseDHCP${MYTHDEFAULT} 0 @@ -230,7 +230,7 @@ function init_network { function init_remote { echo $CMDLINE | grep -q remoteport - if [ $? = 0 ] + if [ $? -eq 0 ] then TEMPVAR=${CMDLINE#*remoteport=} REMOTEPORT=${TEMPVAR%% *} @@ -248,7 +248,7 @@ function init_remote { fi echo $CMDLINE | grep -q remote - if [ $? = 0 ] + if [ $? -eq 0 ] then TEMPVAR=${CMDLINE#*remote=} Remotetype=${TEMPVAR%% *} @@ -267,7 +267,7 @@ ROOT=$1 DATA=$2 SWAP=$3 -if [ ! x$SWAP = xNO ] +if [ ! "$SWAP" == "NO" ] then SWAPLINE=",$SWAP,S" MKSWAPCMD="mkswap /dev/${disk}2" @@ -276,7 +276,7 @@ if [ ! x$SWAP = xNO ] MKSWAPCMD="" fi -if [ x$DATA = xALL ] +if [ "$DATA" == "ALL" ] then DATALINE=",,," EXTRALINE="" @@ -343,7 +343,7 @@ unmount_it () { copy_it () { - if [ x$1 = xALL ] + if [ "$1" == "ALL" ] then echo "Transferring system" unsquashfs -f -d /$mountpoint /.livesys/medium/system.sqf @@ -431,7 +431,7 @@ function find_uuid() { get_grub_map() { - rm /tmp/dev.map + [ -e /tmp/dev.map ] && rm /tmp/dev.map /sbin/grub --no-floppy --device-map /tmp/dev.map <<EOF quit EOF @@ -489,7 +489,7 @@ dogrub() { #/usr/sbin/xfs_freeze -f /$mountpoint > /dev/null 2>&1 echo "freezing xfs fs" /usr/sbin/xfs_freeze -f /$mountpoint - if [ $? = 0 ] + if [ $? -eq 0 ] then sleep 40 echo "unfreezing xfs" @@ -559,7 +559,7 @@ case $1 in create_fstab fi #was 5 - if [ x$3 = xUPGRADE ] + if [ "$3" == "UPGRADE" ] then if [ ! -f /tmp/etc/KnoppMyth-version ] then @@ -586,11 +586,11 @@ case $1 in SWAPUUID=$FOUNDUUID FOUNDUUID="" - if [ x$4 = x ] + if [ "$4" == "" ] then #upgrade find_uuid ${2}3 - elif [ x$5 = xFULL_INSTALL ] + elif [ "$5" == "FULL_INSTALL" ] then #install find_uuid ${2}3 @@ -613,7 +613,7 @@ case $1 in if [ -f /tmp/etc/fstab ] then grep -q /dev/vg /tmp/etc/fstab - if [ $? = 0 ] + if [ $? -eq 0 ] then grep /dev/vg /tmp/etc/fstab >> /$mountpoint/etc/fstab grep /dev/vg /tmp/etc/fstab | awk -v mount=$mountpoint ' { print "/" mount $2 }' |xargs mkdir diff --git a/abs/core-testing/LinHES-config/install_proxy.sh b/abs/core-testing/LinHES-config/install_proxy.sh index b9d6b67..4d158e7 100755 --- a/abs/core-testing/LinHES-config/install_proxy.sh +++ b/abs/core-testing/LinHES-config/install_proxy.sh @@ -17,155 +17,685 @@ run=$MV_ROOT/bin/install_functions.sh CMDLINE=$(cat /proc/cmdline) BACKUPFILE="/myth/backup/mythconverg.sql.gz" +#TEMPNET="Hostip"$default_interface +#eval MYTHIP=\$${TEMPNET} +function create_chroot_mnt_points() { + + echo "Creating directory for media in chroot" + mkdir -p $mountpoint/media/cdrom + mkdir -p $mountpoint/media/dvd + mkdir -p $mountpoint/mnt + +} +function cp_and_log () { + ls $1 >/dev/null 2>&1 + status=$? + if [ $status = 0 ] + then + echo "copying $1 to $2" + cp -rfp $1 $2 + else + echo "$1 is not present, skipping..." + fi + +} + +function mdadm_find () { + + PREFIX=$1 + if [ -e $PREFIX/etc/KnoppMyth-version ] + then + MDADM_CONF="/etc/mdadm/mdadm.conf" + else + MDADM_CONF="/etc/mdadm.conf" + fi + echo "Using $MDADM_CONF" +} progress () { - mypercent=`echo "$1" | cut -d. -f1` - if [ x$mypercent = x ] +mypercent=`echo "$1" | cut -d. -f1` +if [ x$mypercent = x ] +then +echo "" > /tmp/.install_percent +else +echo "${mypercent}% complete" > /tmp/.install_percent +fi + + +} + +function apply_new_auth () { +#check if file is present + if [ -f /root/myth_user_call.out ] + then + #read in file, running each command in chroot + exec 4</root/myth_user_call.out + while read LINE <&4 + do + if [ ! x"$LINE" = x ] + then + #run commands in chroot + chroot "$mountpoint" $MV_ROOT/bin/myth_user_call -i $LINE > /tmp/user_auth.update + fi + done + rm -f /root/myth_user_call.out + else + echo "No new password changes to apply" + fi +} + + +function backup_sql_check { + if [ -f ${mountpoint}${BACKUPFILE} ] + then + echo "found ${mountpoint}${BACKUPFILE} " + rc=0 + else + echo "did not find ${mountpoint}${BACKUPFILE} " + rc=1 + fi + return $rc +} + +function mdadm_assemble_all { + + mdadm_find /tmp + mdadm --assemble --scan -c /tmp${MDADM_CONF} + MDLIST=`grep ARRAY /tmp${MDADM_CONF}|tr -s [:space:]|cut -d" " -f2` + for array in $MDLIST + do + echo "assembling array $array" + mdadm --assemble -c /tmp${MDADM_CONF} $array + sleep 2 + fsck -p $array + done + +} + +function upgrade_mount_search { + + MYTH_P=`cat /tmp/etc/fstab |grep -E /myth[[:space:]] | awk ' {print $1 '} ` + umount $mountpoint/myth + + #should probably just mdadm all the time + echo $MYTH_P |grep -q \/md. + if [ $? = 0 ] then - echo "" > /tmp/.install_percent + mdadm_assemble_all + fi + + echo $MYTH_P |grep -q UUID + if [ $? = 0 ] + then + MUUID=`echo $MYTH_P|cut -d= -f2|tr -d \"` + echo blkid $MUUID + blkid -t UUID=$MUUID + if [ ! $? = 0 ] + then + echo "couldn't find $MUUID, starting md support" + mdadm_assemble_all + fi + mount -U $MUUID $mountpoint/myth + echo mount -U $MUUID $mountpoint/myth + MYTHMOUNT=`blkid -t UUID=$MUUID|cut -d: -f1` + MYTHMOUNT=`basename $MYTHMOUNT` + echo "MYTHMOUNT is $MYTHMOUNT" else - echo "${mypercent}% complete" > /tmp/.install_percent + mount $MYTH_P $mountpoint/myth + echo mount $MYTH_P $mountpoint/myth + MYTHMOUNT=`basename $MYTH_P` + echo "MYTHMOUNT is $MYTHMOUNT" + fi + sleep 2 + backup_sql_check + if [ $? = 1 ] + then + mkdir -p /new_boot/root/backup + if [ ! -e /tmp/mythconverg.sql.gz ] + then + echo "Couldn't find ANY database to restore, upgrade will continue but a new database will be installed." + else + cp_and_log /tmp/mythconverg.sql.gz /new_boot/root/backup/mythconverg.sql.gz + BACKUPFILE="/root/backup/mythconverg.sql.gz" + echo "setting BACKUPFILE to $BACKUPFILE" + fi fi + return 0 } +full_install () { + if [ -f /tmp/.this_is_upgrade ] + then + rm /tmp/.this_is_upgrade + fi + echo "Partitioning $disk" > /tmp/.install_state + progress 1 + sleep 1 + $run partition_it $disk $rootsize $datasize $swapsize + + echo "Formatting $disk" > /tmp/.install_state + progress 2 + sleep 1 + $run format_it $disk $rootfs $datafs + + echo "Preparing $disk" > /tmp/.install_state + progress 3 + sleep 1 + $run mount_it $disk + + startsize=`statgrab -M disk.|grep $disk.write_bytes|cut -d= -f 2|tr -d " "` + + echo "STARTSIZE=$startsize">/tmp/.startsize.io + echo "Creating $hostname" > /tmp/.install_state + + sleep 1 + $run copy_it $disk ALL + rm $mountpoint/etc/fstab + $run fstab_fix_it $disk $rootfs $datafs FULL_INSTALL + echo "Configuring system" > /tmp/.install_state + progress 100 + #progress 99 + sleep 1 + $run grub_it $disk + + + #echo "Configuring system" > /tmp/.install_state + #progress 100 + sleep 1 + cp_and_log /etc/systemconfig "$mountpoint"/etc + cp_and_log /root/xorg.conf.install "$mountpoint"/etc/X11/xorg.conf.install + #run save syssettings to save settings, then copy to new mountpoint + $MV_ROOT/bin/restore_default_settings.sh -c save -t syssettings -h $MVHOSTNAME -d localhost + SE=$TEMPLATES/settings/syssettings + mkdir -p ${mountpoint}$SE + #cp -rp $SE/* ${mountpoint}$SE/ + cp_and_log "$SE/*" "${mountpoint}$SE/" + chown root:mythtv "$mountpoint"/etc/systemconfig + chown -R mythtv:mythtv ${mountpoint}$SE + + chmod -R 775 ${mountpoint}$SE + chmod 775 "$mountpoint"/etc/systemconfig + mkdir -p "$mountpoint"/var/log/mythtv + chown mythtv "$mountpoint"/var/log/mythtv + #copy over any updates that might have occured + #cp -rp $MV_ROOT/bin/*.sh "$mountpoint"$MV_ROOT/bin/ + cp_and_log "$MV_ROOT/bin/*.sh" "$mountpoint"$MV_ROOT/bin/ + chmod -R 755 ${mountpoint}/root + create_chroot_mnt_points + cp_and_log /etc/mtab "$mountpoint"/etc/mtab + # cp_and_log /etc/hostname "$mountpoint"/etc/hostname + apply_new_auth + + + if [ $SystemType = "Master_backend" -o $SystemType = "Standalone" ] + then + #installing DB to local machine + #turn off old live database, so the chroot one can start + echo "---------------------CHROOT INSTALLDB-------------------------" + /etc/rc.d/mysqld stop + mount --bind /dev "$mountpoint/dev" + mount --bind /proc "$mountpoint/proc" + mount -t sysfs none $mountpoint/sys + chroot "$mountpoint" "$MV_ROOT/bin/install_db_chroot.sh" 2>&1 |tee /tmp/chrootdb.out + #chroot "$mountpoint" "$MV_ROOT/bin/install_db_chroot.sh" + chroot "$mountpoint" $MV_ROOT/bin/systemconfig.sh misc,hostype,network,advanced,user,this_is_install + echo "stopping mysql in chroot" + chroot "$mountpoint" /etc/rc.d/mysqld stop + kill_dhcp_chroot + sleep 2 + lsof |grep new_boot + umount -l "$mountpoint/dev" + umount -l "$mountpoint/proc" + umount -l "$mountpoint/sys" + + echo "---------------------END CHROOT INSTALLDB-------------------------" + /etc/rc.d/mysqld start + else + #update remotedb with this host settings + mount --bind /dev "$mountpoint/dev" + mount --bind /proc "$mountpoint/proc" + mount -t sysfs none $mountpoint/sys + chroot "$mountpoint" DISPLAY=127.0.0.1:0 /usr/local/bin/MythVantage -t restore,default_1 + chroot "$mountpoint" $MV_ROOT/bin/restore_default_settings.sh -c restore -t syssettings + if [ ! $? = 0 ] + then + touch $mountpoint/tmp/.dbsysfailed + chmod 777 $mountpoint/tmp/.dbsysfailed + else + #Run second time + chroot "$mountpoint" $MV_ROOT/bin/systemconfig.sh misc,hostype,network,advanced,user,this_is_install + chroot "$mountpoint" $MV_ROOT/bin/restore_default_settings.sh -c ACCESSCONTROL + umount -l "$mountpoint/dev" + umount -l "$mountpoint/proc" + umount -l "$mountpoint/sys" + fi + fi + chroot "$mountpoint" $MV_ROOT/bin/systemconfig.sh advanced,user + touch $mountpoint/home/mythtv/.configure && chmod 777 $mountpoint/home/mythtv/.configure + + echo "Done" > /tmp/.install_state + cp_and_log /tmp/mythvantage_install.log $mountpoint/var/log/ + $run umount_it $disk + +} + +function createsquashlist(){ +if [ -f $1 ] +then + rm -f +$1 +fi +for i in bin boot etc home lib opt root sbin usr var data +do +echo $i >> $1 +done + + +} + + + + +function upgrade () { + touch /tmp/.this_is_upgrade + + if [ ! x$rootfs = "xDo_not_format" ] + then + echo "Formatting + $disk" > /tmp/.install_state + progress 2 + sleep 1 + $run format_it $disk $rootfs NO + fi + echo "Preparing $disk" > /tmp/.install_state + progress 3 + sleep 1 + $run mount_it $disk + startsize=`statgrab -M disk.|grep $disk.write_bytes|cut -d= -f 2|tr -d " "` + echo "STARTSIZE=$startsize">/tmp/.startsize.io + echo "Upgrading $hostname" > /tmp/.install_state + sleep 1 + cp_and_log /tmp/etc /new_boot/etc.old + cp_and_log /tmp/oss /new_boot/var/lib/oss.old + + + SQUASHLIST="/tmp/.squashlist" + createsquashlist $SQUASHLIST + $run copy_it $disk $SQUASHLIST + #copy back ssh keys + +# cp_and_log -rp /data/var/cache/pacman/pkg/* /new_boot/data/var/cache/pacman/pkg/ + cp_and_log "/new_boot/etc.old/ssh/*.pub" /new_boot/etc/ssh/ + cp_and_log "/new_boot/etc.old/ssh/*.key" /new_boot/etc/ssh/ + cp_and_log "/new_boot/etc.old/ssh/*key" /new_boot/etc/ssh/ + mdadm_find /tmp + cp_and_log /tmp${MDADM_CONF} /new_boot/etc + #cp_and_log /new_boot/etc.old/mdadm/mdadm.conf /new_boot/etc/ + cp_and_log /new_boot/etc.old/asound.state /new_boot/etc/ + if [ ! -f /tmp/etc/KnoppMyth-version ] + then + #passwd/shadow/group + cp_and_log /new_boot/etc.old/passwd /new_boot/etc/ + cp_and_log /new_boot/etc.old/shadow /new_boot/etc/ + cp_and_log /new_boot/etc.old/group /new_boot/etc/ + fi + mkdir -p "$mountpoint"/var/log/mythtv + chown mythtv "$mountpoint"/var/log/mythtv + if [ x$rootfs = "xDo_not_format" ] + then + rootfs=`grep \/\ /tmp/etc/fstab |awk ' { print $3 } '` + fi + #this is here to copy in the systemconfig file as soon as possible. + cp_and_log /etc/systemconfig "$mountpoint"/etc/systemconfig + echo "Configuring system" > /tmp/.install_state + progress 100 + backup_sql_check + if [ $? = 1 ] + then + upgrade_mount_search + fi + echo $run fstab_fix_it $disk UPGRADE $MYTHMOUNT + $run fstab_fix_it $disk UPGRADE $MYTHMOUNT + create_chroot_mnt_points + + #echo "Writing boot sector" > /tmp/.install_state + #progress 99 + sleep 1 + $run grub_it $disk + #echo "Configuring system" > /tmp/.install_state + #progress 100 + sleep 1 + cp_and_log /etc/mtab "$mountpoint"/etc/mtab + cp_and_log /etc/systemconfig "$mountpoint"/etc + cp_and_log /root/xorg.conf.install "$mountpoint"/etc/X11/xorg.conf.install +#make sure mythconverg.sql.gz is present + #backup_sql_check + #if [ $? = 1 ] + #then + # upgrade_mount_search + #fi + echo $CMDLINE | grep -q clean_upgrade + status=$? + if [ -f /tmp/etc/KnoppMyth-version -o $status = 0 ] + then + #run save syssettings to save settings, then copy to new mountpoint + $MV_ROOT/bin/restore_default_settings.sh -c save -t syssettings -h $MVHOSTNAME -d localhost + SE=$TEMPLATES/settings/syssettings + mkdir -p ${mountpoint}$SE + #cp -rfp $SE/* ${mountpoint}$SE/ + cp_and_log "$SE/*" "${mountpoint}$SE/" + chown root:mythtv "$mountpoint"/etc/systemconfig + chown -R mythtv:mythtv ${mountpoint}$SE + chmod -R 775 ${mountpoint}$SE + if [ ! $status = 0 ] + then + touch $mountpoint/home/mythtv/.kmupgrade && chmod 777 $mountpoint/home/mythtv/.kmupgrade + fi + fi + + + + cp_and_log "$MV_ROOT/bin/*.sh" "$mountpoint"$MV_ROOT/bin/ + chmod -R 755 ${mountpoint}/root + chown root:mythtv "$mountpoint"/etc/systemconfig + chmod 775 "$mountpoint"/etc/systemconfig + #mount /proc and /dev + mount --bind /dev "$mountpoint/dev" + mount --bind /proc "$mountpoint/proc" + + chroot "$mountpoint" $MV_ROOT/bin/systemconfig.sh misc,hostype,network,advanced,user,this_is_install + #wrap this in a network check_network, no need to update the db if the import worked. + ##### do I need to start mysql? + /etc/rc.d/mysqld stop + if [ $SystemType = "Master_backend" -o $SystemType = "Standalone" ] + then + echo $CMDLINE | grep -q clean_upgrade + status=$? + if [ $status = 0 ] + then + #new db as part of clean upgrade + echo "--------------------------------" + echo "clean upgrade installing new database" + echo "--------------------------------" + chroot "$mountpoint" "$MV_ROOT/bin/install_db_chroot.sh" |tee /tmp/chrootdb.out + echo "############################################" + echo "End Installing new database/clean" + echo "############################################" + else + #proceed as normal + if [ -f "$mountpoint"/$BACKUPFILE ] + then + echo "--------------------------------" + echo "Restoring database with $BACKUPFILE" + echo "--------------------------------" + chroot "$mountpoint" "$MV_ROOT/bin/restore_km_db_chroot.sh" "$BACKUPFILE" |tee /tmp/chrootdb_km.out + echo "############################################" + echo "End Restoring database" + echo "############################################" + else + echo "--------------------------------" + echo "Couldn't find backup file, installing new database" + echo "--------------------------------" + touch /tmp/.upgrade_db_failed + chroot "$mountpoint" "$MV_ROOT/bin/install_db_chroot.sh" |tee /tmp/chrootdb.out + echo "############################################" + echo "End Installing new database" + echo "############################################" + fi + fi + fi + + if [ -f /tmp/etc/KnoppMyth-version ] + then + chroot "$mountpoint" $MV_ROOT/bin/restore_default_settings.sh -c restore -t hostsettings + #change permissions of /myth (only needed on km->linhes) + chown -R mythtv:mythtv $mountpoint/myth + chown -R root:root $mountpoint/myth/backup + else + chroot "$mountpoint" $MV_ROOT/bin/restore_default_settings.sh -c restore -t syssettings + fi + # + #Run second time + chroot "$mountpoint" $MV_ROOT/bin/systemconfig.sh misc,hostype,network,advanced,user,this_is_install + chroot "$mountpoint" $MV_ROOT/bin/systemconfig.sh advanced,this_is_install + echo "stopping mysql in chroot" + chroot "$mountpoint" /etc/rc.d/mysqld stop + apply_new_auth + kill_dhcp_chroot + umount -l "$mountpoint/dev" + umount -l "$mountpoint/proc" + + echo "Done" > /tmp/.install_state + cp_and_log /tmp/mythvantage_install.log $mountpoint/var/log/ + + $run umount_it $disk + /etc/rc.d/mysqld start +} + +function netboot-full_install () { + TEMPVAR=${CMDLINE#*nfsroot=} + NFSROOT=${TEMPVAR%% *} + NFSROOT=`echo $NFSROOT|cut -d: -f1` + MAC=`/sbin/ifconfig eth0|grep HWaddr| cut -d: -f2-|awk '{ print $3}'|tr : -` + URL="http://$NFSROOT:1337/diskless.py?HOSTNAME=$hostname&MAC=$MAC" + echo "calling $URL" + echo "Starting" > /tmp/.install_state + curl $URL + ${MV_ROOT}/bin/xconfig.sh +} + +# function killdhcp () { +# if [ -f /etc/dhcpc/dhcpcd-eth0.pid ] +# then +# pid=`cat /etc/dhcpc/dhcpcd-eth0.pid` +# kill -9 $pid +# rm -f /etc/dhcpc/dhcpcd-eth0.pid +# rm -f /var/run/dhcpcd* +# fi +# if [ -f /var/run/dhcpcd-eth0.pid ] +# then +# pid=`cat /var/run/dhcpcd-eth0.pid` +# kill -9 $pid +# rm -f /var/run/dhcpcd-eth0.pid* +# fi +# ip address flush dev eth0 +# } + + + +function SANE_SYSETTINGS () { +sed -e '/HOSTrootfstype/d' \ + -e '/HOSTrootfstype/d' \ + -e '/HOSTdatafstype/d' \ + -e '/HOSTOSsize/d' \ + -e '/HostUseALLdata/d' \ + -e '/HOSTDATAsize/d' \ + -e '/HOSTuprootfstype/d' \ + -e '/HostUseSWAP/d' \ + -e '/HOSTSWAPsize/d ' /tmp/templates/settings/syssettings/settings.txt > /tmp/settings.new + mv /tmp/settings.new /tmp/templates/settings/syssettings/settings.txt +} + case $1 in - full_install_it ) - mv_install.py --rootdisk=$disk --rootfs=$rootfs --rootsize=$rootsize --datafs=$datafs --datasize=$datasize --datadisk=$disk --swapsize=$swapsize -c full_install - ;; + full_install_it ) full_install ;; - NETBOOT) - echo "-----------------------------------------------------------------------3-----" - netboot-full_install - ;; + NETBOOT) +echo "-----------------------------------------------------------------------3-----" + netboot-full_install ;; + + find_update) + + #TRY TO mount first partition of drive + #copy /etc/systemconfig to live, import settings into db + #umount drive + echo $CMDLINE | grep -q clean_upgrade + if [ $? = 1 ] + then + $run mount_it $disk + [ -e "/new_boot/root/backup/mythconverg.sql.gz" ] && cp /new_boot/root/backup/mythconverg.sql.gz /tmp + + + if [ -f /new_boot/etc/systemconfig ] + then + ###########ADD templates + mkdir -p $TEMP_TEMPLATES + cp_and_log /new_boot/$TEMPLATES $TEMP_TEMPLATES + SANE_SYSETTINGS + cp_and_log $TEMP_TEMPLATES/settings $TEMPLATES/ + cp_and_log /new_boot/etc/systemconfig /etc/systemconfig + cp_and_log /new_boot/etc /tmp/etc + cp_and_log /new_boot/var/lib/oss /tmp/oss + [ -e /tmp/etc/mdadm.conf ] && cp_and_log /tmp/etc/mdadm.conf /etc/ - find_update) - mv_install.py --rootdisk=$disk -c find_upgrade + $MV_ROOT/bin/restore_default_settings.sh -c restore -t syssettings -h $MVHOSTNAME -d 127.0.0.1 + else + cp_and_log /new_boot/etc /tmp/etc + [ -e /tmp/etc/mdadm.conf ] && cp_and_log /tmp/etc/mdadm.conf /etc/ + #now we search for the timezone and try to update + TZREGION=`cat /tmp/etc/timezone | cut -d"/" -f1` + TZSUB=`cat /tmp/etc/timezone | cut -d"/" -f2 -` + + + if [ $TZREGION = $TZSUB ] + then + $run update_db_it HostTimeZoneRegion "$TZREGION" + else + $run update_db_it HostTimeZoneRegion "$TZREGION" + $run update_db_it HostTimeZoneRegion_$TZREGION "$TZSUB" + fi + fi + backup_sql_check + echo $? + upgrade_mount_search + echo $? + $run umount_it $disk + fi ;; - upgrade_it) - mv_install.py --rootdisk=$disk --rootfs=$rootfs -c upgrade + upgrade_it) + upgrade ;; + disk_model_it) + model="unknown" + size="xxx" + case $2 in - disk_model_it) - model="unknown" - size="xxx" - case $2 in - h* ) - model=`cat /proc/ide/$2/model` - ;; - s*) model=`sginfo /dev/$2|grep Product|awk ' { print $2 } '` - ;; - esac - size=`parted /dev/$2 print |grep Disk|awk ' { print $3 } ' ` - echo ""$model" $size " >/tmp/model + h* ) + model=`cat /proc/ide/$2/model` + ;; + s*) model=`sginfo /dev/$2|grep Product|awk ' { print $2 } '` + ;; + esac + size=`parted /dev/$2 print |grep Disk|awk ' { print $3 } ' ` + echo ""$model" $size " >/tmp/model ;; + network_check_it) + #Should never return from check_network + case $2 in + setup_network) + vnc_check + install_network_setup + ;; - network_check_it) - #Should never return from check_network - case $2 in - setup_network) - vnc_check - install_network_setup - ;; - - check_self) - myipdefault=`ifconfig | grep -C1 $default_interface| grep -v $default_interface | cut -d: -f2 | awk '{ print $1}'` - echo "network check myself" - ifconfig - ping -c 1 $myipdefault - if [ ! $? = 0 ] - then - exit 3 - #can't ping yourself - fi - ;; - check_gw) - #check gateway - echo "network check gateway" - /sbin/route -n - mygwdefault=`/sbin/route -n |grep $default_interface|grep UG|awk '{ print $2}'` - echo "Default gateway seems to be $mygwdefault" - if [ ! x$mygwdefault = x ] - then - sleep 2 - ping -c 5 $mygwdefault - if [ ! $? = 0 ] - then - exit 4 - fi - fi - ;; - check_ns) - #check nameserver - echo " network check nameserver" - mydns=`cat /etc/resolv.conf|grep nameserver|head -1|awk '{ print $2}'` - ping -c 1 $mydns - if [ ! $? = 0 ] - then - exit 5 - fi - ;; - check_names) - echo "network check resolve names" - host google.com - if [ ! $? = 0 ] - then - exit 6 - fi - ;; - host_names) - #if host is found, then check to see if it's online - #if hoip matchs my ip assume it's ok - echo "network check my hostname $hostname" - hout=`host $hostname|head -n1` - status=$? - hoip=`echo $hout|awk '{print $4}'` - if [ $hoip = found: ] - then - status=1 - fi - - unkownhost=`host unkown.linhes.org |head -n1 ` - unkownhostip=`echo $unkownhost |awk '{print $4}'` - - #found host, now grab the ip - if [ $status = 0 ] - then - hoip=`echo $hout|awk '{print $4}'` - /sbin/ifconfig -a |grep -q $hoip - if [ $? = 0 ] - then - echo "DNS ip matches on of my ips $hoip" - status=0 - else - if [ $unkownhostip = $hoip ] - then - echo "Bad DNS returning false hits" - echo "Assuming hostname is OK" - echo "DNS unknown: $unkownhostip" - echo " HOSTDNS: $hoip " - /sbin/ifconfig -a |grep "inet addr" - else - echo "IP in DNS but doesn't match mine, hostname is not safe to use" - echo "DNS:$hoip" - echo "HOST: " - /sbin/ifconfig -a |grep "inet addr" - status=7 + check_self) + myipdefault=`ifconfig | grep -C1 $default_interface| grep -v $default_interface | cut -d: -f2 | awk '{ print $1}'` + echo "network check myself" + ifconfig + ping -c 1 $myipdefault + if [ ! $? = 0 ] + then + exit 3 + #can't ping yourself + fi + ;; + check_gw) + #check gateway + echo "network check gateway" + /sbin/route -n + mygwdefault=`/sbin/route -n |grep $default_interface|grep UG|awk '{ print $2}'` + echo "Default gateway seems to be $mygwdefault" + if [ ! x$mygwdefault = x ] + then + sleep 2 + ping -c 5 $mygwdefault + if [ ! $? = 0 ] + then + exit 4 + fi + fi + ;; + check_ns) + #check nameserver + echo " network check nameserver" + mydns=`cat /etc/resolv.conf|grep nameserver|head -1|awk '{ print $2}'` + ping -c 1 $mydns + if [ ! $? = 0 ] + then + exit 5 + fi + ;; + check_names) + echo "network check resolve names" + host google.com + if [ ! $? = 0 ] + then + exit 6 + fi + ;; + host_names) + #if host is found, then check to see if it's online + #if hoip matchs my ip assume it's ok + echo "network check my hostname $hostname" + hout=`host $hostname|head -n1` + status=$? + hoip=`echo $hout|awk '{print $4}'` + if [ $hoip = found: ] + then + status=1 fi - fi - else - echo "Couldn't find hostname in DNS, must be safe to use" - status=0 - fi - exit $status - ;; - - esac - exit 0 - ;; - * ) + unkownhost=`host unkown.linhes.org |head -n1 ` + unkownhostip=`echo $unkownhost |awk '{print $4}'` + + #found host, now grab the ip + if [ $status = 0 ] + then + hoip=`echo $hout|awk '{print $4}'` + /sbin/ifconfig -a |grep -q $hoip + if [ $? = 0 ] + then + echo "DNS ip matches on of my ips $hoip" + status=0 + else + if [ $unkownhostip = $hoip ] + then + echo "Bad DNS returning false hits" + echo "Assuming hostname is OK" + echo "DNS unknown: $unkownhostip" + echo " HOSTDNS: $hoip " + /sbin/ifconfig -a |grep "inet addr" + else + echo "IP in DNS but doesn't match mine, hostname is not safe to use" + echo "DNS:$hoip" + echo "HOST: " + /sbin/ifconfig -a |grep "inet addr" + status=7 + fi + fi + else + echo "Couldn't find hostname in DNS, must be safe to use" + status=0 + fi + exit $status + ;; + + esac + exit 0 + ;; + + + * ) if [ -f /tmp/.install_state ] then state=`cat /tmp/.install_state` @@ -179,7 +709,7 @@ case $1 in if [ -f /tmp/.startsize.io ] then - . /tmp/.startsize.io + . /tmp/.startsize.io #finding the drive ddrive=`df | grep $mountpoint | head -n1 | awk -F/ ' { print $3 } ' | cut -d" " -f 1|cut -b1,2,3 ` used=`statgrab -M disk.|grep ${ddrive}.write_bytes|cut -d= -f 2|tr -d " "` @@ -201,11 +731,7 @@ case $1 in cond2=$(echo "$percent > 98" |bc ) if [ $cond2 -eq 1 ] then - percent=98 - fi - if [ x"${state}" = "xDone" ] - then - percent=100 + percent=98 fi cond3=$(echo "$percent < 3" |bc ) if [ $cond3 -eq 0 ] @@ -214,7 +740,7 @@ case $1 in fi fi fi - ;; + ;; esac diff --git a/abs/core-testing/LinHES-config/ir_config.sh b/abs/core-testing/LinHES-config/ir_config.sh index 69d8406..28134e2 100644 --- a/abs/core-testing/LinHES-config/ir_config.sh +++ b/abs/core-testing/LinHES-config/ir_config.sh @@ -2,8 +2,7 @@ function include_lirc () { config_file=$1 include_file=$2 grep -q ${include_file} ${config_file} - if [ $? = 0 ] - then + if [ "$?" == "0" ]; then echo ${include_file} already present else echo "include \"${include_file}\"" >> $config_file @@ -39,8 +38,7 @@ function setup_ir_remote { #make backup copy mv ${BASE}/etc/lircd.conf ${BASE}/etc/lircd.conf.`date +%Y-%m-%d-%H-%M` mv ${BASE}/etc/lircrc ${BASE}/etc/lircrc.`date +%Y-%m-%d-%H-%M` - if [ $HostBlasterType = pvr150 ] - then + if [ "$HostBlasterType" == "pvr150" ]; then Remotetype=hauppauge-blaster fi @@ -58,18 +56,15 @@ function setup_ir_remote { chmod 755 /etc/lircrc daemon_add="lircd $daemon_add" #standard location for mythtv lircrc - if [ ! -e /home/mythtv/.mythtv/lircrc ] - then - if [ ! -d /home/mythtv/.mythtv ] - then + if [ ! -e /home/mythtv/.mythtv/lircrc ]; then + if [ ! -d /home/mythtv/.mythtv ]; then mkdir /home/mythtv/.mythtv chown mythtv:mythtv /home/mythtv/.mythtv fi ln -s /etc/lircrc /home/mythtv/.mythtv/lircrc 2> /dev/null fi #standard location for lircrc - if [ ! -e /home/mythtv/.lircrc ] - then + if [ ! -e /home/mythtv/.lircrc ]; then ln -s /etc/lircrc /home/mythtv/.lircrc 2> /dev/null fi # echo "Sending hup to lircd" @@ -141,16 +136,14 @@ function setup_lcd () { x) echo "empty lcd" ;; *) echo "setup lcd" - if [ -f $TEMPLATES/LCD/$LCDtype/modules ] - then + if [ -f $TEMPLATES/LCD/$LCDtype/modules ]; then sed -i -e '/.*#LCD/d' ${BASE}/etc/modules.mythvantage cat $TEMPLATES/LCD/$LCDtype/modules >> ${BASE}/etc/modules.mythvantage #should also modprobe fi - if [ -f $TEMPLATES/LCD/$LCDtype/LCDd.conf ] - then + if [ -f $TEMPLATES/LCD/$LCDtype/LCDd.conf ]; then cp_and_log $TEMPLATES/LCD/$LCDtype/LCDd.conf /etc # install="lcdproc $install" daemon_add="lcdd $daemon_add" @@ -160,10 +153,8 @@ function setup_lcd () { fi #check if lirc capable,if so then call setupremote #if not in tinker mode check for remote - if [ ! x$Remotetype = xtinker ] - then - if [ -f $TEMPLATES/LCD/$LCDtype/lircrc ] - then + if [ "$Remotetype" != "tinker" ]; then + if [ -f $TEMPLATES/LCD/$LCDtype/lircrc ]; then cd $TEMPLATES/LCD/$LCDtype for i in lircd* do @@ -182,18 +173,15 @@ function setup_lcd () { } function setup_blaster_proto () { - if [ x$HostBlasterType = x ] - then + if [ "$HostBlasterType" == "" ]; then HostBlasterType = "crap" fi - if [ ! $HostBlasterType = pvr150 -a ! $HostBlasterType = None ] - then + if [[ ("$HostBlasterType" != "pvr150") && ("$HostBlasterType" != "None") ]]; then for i in `seq $Hostnumblaster` do TEMP=HostTransmitproto_$i eval proto=\$${TEMP} - if [ -f $TEMPLATES/transmit/${proto}/lircd.conf ] - then + if [ -f $TEMPLATES/transmit/${proto}/lircd.conf ]; then include_lirc ${BASE}/etc/lircd.conf $TEMPLATES/transmit/${proto}/lircd.conf fi done @@ -207,8 +195,7 @@ function setup_blaster_proto () { function setup_blaster_transmiter () { echo "setup_blaster_transmiter" #if it's Reciever type, then these modules have already been loaded. - if [ ! x$HostBlasterType = xReceiver ] - then + if [ "$HostBlasterType" != "Receiver" ]; then case $HostBlasterType in None) echo "no blaster" sed -i -e '/.*#blaster/d' ${BASE}/etc/modules.mythvantage @@ -235,8 +222,7 @@ function setup_blaster_transmiter () { } function setupir () { - if [ ! x$Remotetype = xtinker ] - then + if [ "$Remotetype" != "tinker" ]; then setup_ir_remote setup_ir_receiver unload_all_lirc diff --git a/abs/core-testing/aumix/PKGBUILD b/abs/core-testing/aumix/PKGBUILD index 560427f..09b525a 100644 --- a/abs/core-testing/aumix/PKGBUILD +++ b/abs/core-testing/aumix/PKGBUILD @@ -2,7 +2,7 @@ pkgname=aumix pkgver=2.8 -pkgrel=3 +pkgrel=4 pkgdesc="A color text mode sound mixer with GPM support" arch=('i686' 'x86_64') license=('GPL') diff --git a/abs/core-testing/avahi/PKGBUILD b/abs/core-testing/avahi/PKGBUILD index e068e17..c448d16 100644 --- a/abs/core-testing/avahi/PKGBUILD +++ b/abs/core-testing/avahi/PKGBUILD @@ -3,7 +3,7 @@ pkgname=avahi pkgver=0.6.24 -pkgrel=1 +pkgrel=2 pkgdesc="A multicast/unicast DNS-SD framework" arch=('i686' 'x86_64') url="http://www.avahi.org/" diff --git a/abs/core-testing/cdrkit/PKGBUILD b/abs/core-testing/cdrkit/PKGBUILD index 1f8bfa8..6de7150 100644 --- a/abs/core-testing/cdrkit/PKGBUILD +++ b/abs/core-testing/cdrkit/PKGBUILD @@ -3,7 +3,7 @@ pkgname=cdrkit pkgver=1.1.8 -pkgrel=1 +pkgrel=2 pkgdesc="Suite of programs for CD/DVD recording, ISO image creation, and audio CD extraction" arch=('i686' 'x86_64') url="http://cdrkit.org/" diff --git a/abs/core-testing/fbsplash/PKGBUILD b/abs/core-testing/fbsplash/PKGBUILD index 92a59ea..5d42484 100644 --- a/abs/core-testing/fbsplash/PKGBUILD +++ b/abs/core-testing/fbsplash/PKGBUILD @@ -2,7 +2,7 @@ pkgname=fbsplash pkgver=1.5.4.3 -pkgrel=13 +pkgrel=14 pkgdesc="A userspace implementation of a splash screen for Linux (formerly known as gensplash)" arch=('i686' 'x86_64') url="http://fbsplash.berlios.de" diff --git a/abs/core-testing/fbsplash/darch.tar.bz2 b/abs/core-testing/fbsplash/darch.tar.bz2 Binary files differnew file mode 100644 index 0000000..0faab98 --- /dev/null +++ b/abs/core-testing/fbsplash/darch.tar.bz2 diff --git a/abs/core-testing/fbsplash/fbsplash.inithooks b/abs/core-testing/fbsplash/fbsplash.inithooks index 0e8c60c..c396b92 100644 --- a/abs/core-testing/fbsplash/fbsplash.inithooks +++ b/abs/core-testing/fbsplash/fbsplash.inithooks @@ -28,14 +28,14 @@ stat_busy() { # Load variables # var_load STEP_NR MAX_STEPS RC_MULTI RC_SYSINIT RC_SHUTDOWN # Only update the splash progress if we're in sysinit, multi, or shutdown. # - if [[ ${SPLASH_RC_MULTI} == 1 || ${SPLASH_RC_SYSINIT} == 1 || ${SPLASH_RC_SHUTDOWN} == 1 ]]; then + if [[ "${SPLASH_RC_MULTI}" == "1" || "${SPLASH_RC_SYSINIT}" == "1" || "${SPLASH_RC_SHUTDOWN}" == "1" ]]; then ((SPLASH_STEP_NR++)) SPLASH_PROGRESS=$((100*${SPLASH_STEP_NR}/${SPLASH_MAX_STEPS})) SPLASH_CURRENT_PROGRESS=${SPLASH_PROGRESS} splash_update_progress ${SPLASH_PROGRESS} var_save STEP_NR CURRENT_PROGRESS fi - if [ ${SPLASH_RC_SHUTDOWN} == 1 ]; then + if [ "${SPLASH_RC_SHUTDOWN}" == "1" ]; then save_shutdown_steps fi @@ -57,7 +57,7 @@ start_daemon() { } # rc.sysinit # -if [ $CALLER == '/etc/rc.sysinit' ]; then +if [ "$CALLER" == '/etc/rc.sysinit' ]; then # echo "fbsplash: Setting up splash..." splash_cache_prep SPLASH_MAX_STEPS=$(load_boot_steps) @@ -69,14 +69,14 @@ if [ $CALLER == '/etc/rc.sysinit' ]; then fi # rc.multi # -if [ $CALLER == '/etc/rc.multi' ]; then +if [ "$CALLER" == '/etc/rc.multi' ]; then SPLASH_RC_MULTI=1 SPLASH_RC_SYSINIT=0 var_save RC_MULTI RC_SYSINIT fi # rc.shutdown # -if [ $CALLER == '/etc/rc.shutdown' ]; then +if [ "$CALLER" == '/etc/rc.shutdown' ]; then # echo "fbsplash: Setting up splash..." splash_cache_prep SPLASH_MAX_STEPS=$(load_shutdown_steps) diff --git a/abs/core-testing/libcap/PKGBUILD b/abs/core-testing/libcap/PKGBUILD index 8d09b19..a80dccf 100644 --- a/abs/core-testing/libcap/PKGBUILD +++ b/abs/core-testing/libcap/PKGBUILD @@ -1,20 +1,22 @@ -#$Id: PKGBUILD 8870 2008-08-16 22:39:56Z eric $ -# Maintainer: Arjan Timmerman <arjan@archlinux.org> +#$Id: PKGBUILD 29964 2009-03-15 02:32:04Z hugo $ +# Maintainer: Hugo Doria <hugo@archlinux.org> + pkgname=libcap -pkgver=1.10 -pkgrel=2 +pkgver=2.16 +pkgrel=3 pkgdesc="POSIX 1003.1e capabilities" -arch=(i686 x86_64) +arch=('i686' 'x86_64') url="http://www.kernel.org/pub/linux/libs/security/linux-privs/" -license="GPL" +license=('GPL') depends=('glibc') -source=(http://www.kernel.org/pub/linux/libs/security/linux-privs/kernel-2.4/${pkgname}-${pkgver}.tar.gz - libcap-1.10-debian.patch) -md5sums=('2c09eea823f67cfdde96177a959bc39b' 'ba642c86c4072917fcff77ec31411194') +source=(http://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/${pkgname}-${pkgver}.tar.gz) +md5sums=('9e075fda242c4070ba76407064c13302') build() { - cd ${startdir}/src/${pkgname}-${pkgver} - patch -Np1 -i ${startdir}/src/libcap-1.10-debian.patch || return 1 - make prefix=/usr DESTDIR=${startdir}/pkg install - rmdir ${startdir}/pkg/usr/share/man/man2 + cd ${srcdir}/${pkgname}-${pkgver} + sed -i -e "s|LIBDIR=\$(FAKEROOT)\$(lib_prefix)/\$(lib)|LIBDIR=\$(FAKEROOT)/\$(lib)|g" Make.Rules || return 1 + make prefix=/usr DESTDIR=${pkgdir} install + + rm ${pkgdir}/lib/*.a || return 1 + chmod 755 ${pkgdir}/lib/libcap.so.* || return 1 } diff --git a/abs/core-testing/local-website/PKGBUILD b/abs/core-testing/local-website/PKGBUILD index e02a757..6ce813c 100644 --- a/abs/core-testing/local-website/PKGBUILD +++ b/abs/core-testing/local-website/PKGBUILD @@ -1,6 +1,6 @@ pkgname=local-website pkgver=2 -pkgrel=6 +pkgrel=7 pkgdesc="Contents of http://localhost" arch=(i686 x86_64) license=('GPL') diff --git a/abs/core-testing/local-website/htdocs/fuppes.php b/abs/core-testing/local-website/htdocs/fuppes.php new file mode 100644 index 0000000..f082f31 --- /dev/null +++ b/abs/core-testing/local-website/htdocs/fuppes.php @@ -0,0 +1,4 @@ +<?php +$HTTP_HOST = getenv('HTTP_HOST'); +header("Location: http://$HTTP_HOST:81/"); +?> diff --git a/abs/core-testing/local-website/htdocs/index.html b/abs/core-testing/local-website/htdocs/index.html index 661f673..14d5c22 100644 --- a/abs/core-testing/local-website/htdocs/index.html +++ b/abs/core-testing/local-website/htdocs/index.html @@ -1,22 +1,39 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> + + <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"> + + <meta content="Cecil Watson" name="author"> + + + + <title>LinHES R6</title> <link href="KnoppMyth.css" rel="stylesheet" type="text/css"> </head> + + <body> <p align="center"><a href="http://www.mysettopbox.tv"> <img src="header.png" alt="Tux with a Remote" align="middle" border="0"></a> </p> + + + <table align="center" border="0" cellpadding="5"> <tbody> + <tr> + <td style="vertical-align: top;"> + <p class="headerimage" align="center"><b>The Linux Home Entertainment System Release 6</b></p> + <p><a href="mythweb/mythweb.php"><b>MythWeb</b></a>: <br> The MythWeb allows you to use a web page to control @@ -24,6 +41,7 @@ but it is dependent upon MythTV being installed and operational." </p> + <p><a href="remote/index.html"><b>MythTV Web Virtual Remote</b></a>: <br> A web based virtual remote control for MythTV. @@ -32,32 +50,38 @@ <b>Utilities/Setup -> Setup -> General -> Fourth Page</b>. </p> + <p><a href="mythtv-doc/mythtv-HOWTO.html"><b>MythTV Documentation</b></a>: <br> The MythTV Installation / User's Guide. </p> + <p><a href="mythtv-doc/keys.txt"><b>MythTV Keybindings</b></a>: <br> The keybindings for the normal MythTV interface. </p> + <p><a href="linhes.html"><b>LinHES</b></a>: <br> Describes how "The Project Leader" setup multiple systems to form a <b>Lin</b>ux <b>H</b>ome <b>E</b>ntertainment <b>S</b>ystem. </p> + <p><a href="folding@home/"><b>My Folding Status</b></a>: <br> Status of the folding@home work for the local user. </p> + <p><a href="http://fah-web.stanford.edu/cgi-bin/main.py?qtype=teampage&teamnum=50975"><b>Folding@home</b></a>: <br> KnoppMyth Team status for the folding@home effort. </p> + <p><a href="ipodfeed/"><b>iPod Feeds</b></a> <br> Transcodes ready for the ipod (if any).</p> @@ -67,62 +91,27 @@ FUPPES - Free UPnP Entertainment Service. A UPnP to be used inplace of the UPnP server that comes with MythTV. If the UPnP that comes with MythTV doesn't work for you, you can -try FUPPES. Edit <i>/etc/sv/mythtvbackend/run</i>, and add "<i>--noupnp</i>" -to the command line for <i>/usr/bin/mythbackend</i>. Then restart the -backend and start FUPPES.</p> - <p style="font-weight: bold;">sv restart mythtvbackend fuppes</p> - <p>If you want FUPPES to start on boot add a link to the - <i>/etc/sv/fuppes</i> directory under <i>/var/service</i>.</p> - <p><b>ln -s /etc/sv/fuppes /var/service</b></p> - <p></p> - - <p><a href="motion/index.html"><b>Motion</b></a>: <br> - - Motion is a software motion detector. The configuration file for - motion is <i>/etc/motion/motion.conf</i>. All you should have to do is edit - "videodevice" to point to your webcam or capture device. You'll also - need to change the IP in <i>/var/www/motion/index.html</i> to the IP of your - backend. - <br><br> - - As root: <b>sv start motion</b> will start motion. - To have it start automatically add a link to the - <i>/etc/sv/motion</i> directory under <i>/var/service</i>.</p> - <p><b>ln -s /etc/sv/motion /var/service</b></p> - <p>Images and video are stored in <i>/myth/motion</i>. - Symlinks to <i>/myth/gallery</i> and <i>/myth/video</i> exist. - <br><br> - - For further detail on configuring Motion, please read the - <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/MotionGuide">Motion Guide</a>. - - </p> - +try FUPPES. + <p><a href="rrd/index.html"><b>RRDTool</b></a>: <br> Hardware status graphs. </p> - <p><a href="vlc_control.php"><b>VLC HTTP Interface</b></a>: <br> - - Web interface for VideoLan Client. - </p> - - <b>Tip:</b> - If you seem to be stuck in a - loop when trying to select a video to stream from MythWeb - (MythStreamTV), go back to the main - <a href="mythweb/">MythWeb</a> page and select "StreamTV" again. - + <p><a href="javascript:void(0)"onclick="window.open('mythweb/data/mp3player.html','linkname','height=100, width=260,scrollbars=no')"><b>KnoppMyth Radio</b></a>: <br> Your music must be encoded as MP3 in MythMusic for this to work.</p> + </td> + </tr> + <tr> <td style="vertical-align: top;"></td> </tr> </tbody> + </table> </body> diff --git a/abs/core-testing/mplayer/PKGBUILD b/abs/core-testing/mplayer/PKGBUILD index a952464..09389a3 100644 --- a/abs/core-testing/mplayer/PKGBUILD +++ b/abs/core-testing/mplayer/PKGBUILD @@ -1,6 +1,6 @@ pkgname=mplayer pkgver=29134 -pkgrel=11 +pkgrel=12 pkgdesc="Famous multimedia player, dev. version, without its GUI" arch=('i686' 'x86_64') url="http://www.mplayerhq.hu/" diff --git a/abs/core-testing/mythtv/stable/mythweb/PKGBUILD b/abs/core-testing/mythtv/stable/mythweb/PKGBUILD index 768eba0..e601ae9 100644 --- a/abs/core-testing/mythtv/stable/mythweb/PKGBUILD +++ b/abs/core-testing/mythtv/stable/mythweb/PKGBUILD @@ -1,6 +1,6 @@ pkgname=mythweb pkgver=0.21 -pkgrel=13 +pkgrel=15 pkgdesc="Web interface for MythTV's backend" arch=('i686' 'x86_64') url="http://www.mythtv.org" @@ -23,14 +23,15 @@ build() { # tar -zxvf $startdir/patch/icons.tar.gz ### + # Workaround for LIGHTTPD bug in mythweb.pl (affects DB queries) + cd $startdir/src/mythplugins/$pkgname/ + patch -p0 < $startdir/patch/mythweb.pl.diff + cp -r $startdir/src/mythplugins/$pkgname/* $startdir/pkg/$DOCROOT # cp $startdir/src/mythplugins-$pkgver/$pkgname/data/.htaccess $startdir/pkg/$DOCROOT rm $startdir/pkg/srv/$DOCROOT/README chown -R http:users $startdir/pkg/$DOCROOT chmod g+rw $startdir/pkg/$DOCROOT/{image_cache,php_sessions,data} - - - } diff --git a/abs/core-testing/mythtv/stable/mythweb/patch/mythweb.pl.diff b/abs/core-testing/mythtv/stable/mythweb/patch/mythweb.pl.diff new file mode 100644 index 0000000..6dcbf99 --- /dev/null +++ b/abs/core-testing/mythtv/stable/mythweb/patch/mythweb.pl.diff @@ -0,0 +1,23 @@ +*** mythweb-unpatched.pl 2009-06-02 14:55:24.011861459 -0400 +--- mythweb.pl 2009-06-02 14:56:24.386441304 -0400 +*************** +*** 49,57 **** + + # Connect to the database + END { $dbh->disconnect() if ($dbh); } +! our $dbh = DBI->connect("dbi:mysql:database=$ENV{'db_name'}:host=$ENV{'db_server'}", +! $ENV{'db_login'}, +! $ENV{'db_password'}); + unless ($dbh) { + print header(), + "Cannot connect to database: $!\n\n"; +--- 49,57 ---- + + # Connect to the database + END { $dbh->disconnect() if ($dbh); } +! our $dbh = DBI->connect("dbi:mysql:database=$ENV{'DB_NAME'}:host=$ENV{'DB_SERVER'}", +! $ENV{'DB_LOGIN'}, +! $ENV{'DB_PASSWORD'}); + unless ($dbh) { + print header(), + "Cannot connect to database: $!\n\n"; diff --git a/abs/core-testing/nvidia-71xx-utils/PKGBUILD b/abs/core-testing/nvidia-71xx-utils/PKGBUILD new file mode 100644 index 0000000..9522ff8 --- /dev/null +++ b/abs/core-testing/nvidia-71xx-utils/PKGBUILD @@ -0,0 +1,63 @@ +# $Id: PKGBUILD 5949 2008-07-21 20:32:38Z thomas $ +# Maintainer: Tobias Powalowski <tpowa@archlinux.org> +# Contributor: James Rayner <iphitus@gmail.com> + +pkgname=nvidia-71xx-utils +pkgver=71.86.09 +pkgrel=1 +pkgdesc="NVIDIA legacy drivers utilities and libraries, 71xx branch." +arch=(i686 x86_64) +[ "$CARCH" = "i686" ] && ARCH=x86 +[ "$CARCH" = "x86_64" ] && ARCH=x86_64 +url="http://www.nvidia.com/" +depends=('xorg-server') +conflicts=('libgl' 'libgl-dri' 'ati-fglrx-utils' 'nvidia-utils' \ + 'nvidia-96xx-utils' 'nvidia-legacy-utils') +replaces=('nvidia-legacy-utils') +provides=('libgl') +license=('custom') +install=nvidia-71xx.install +source=(http://us.download.nvidia.com/XFree86/Linux-${ARCH}/${pkgver}/NVIDIA-Linux-${ARCH}-${pkgver}-pkg0.run \ + supported-cards.txt) +options=(docs !strip) +md5sums=('51ce70e2ba967a2bad1cf01ce25c7f76' + '6363d7e494d33729609540088e33e73f') +[ "$CARCH" = "x86_64" ] && md5sums=('205599549ddd6fadecfbc1adb090dfe2' + '6363d7e494d33729609540088e33e73f') + +build() +{ + # override nvida install routine and do it the long way. + cd $startdir/src/ + sh NVIDIA-Linux-${ARCH}-${pkgver}-pkg0.run --extract-only + cd NVIDIA-Linux-${ARCH}-${pkgver}-pkg0/usr/ + + mkdir -p $startdir/pkg/usr/{lib,bin,share/applications,share/pixmaps} + mkdir -p $startdir/pkg/usr/lib/xorg/modules/{extensions,drivers} + mkdir -p $startdir/pkg/usr/share/licenses/nvidia-71xx/ + + install lib/{libGLcore.so.${pkgver},libGL.so.${pkgver},tls/libnvidia-tls.so.${pkgver}} \ + $startdir/pkg/usr/lib/ || return 1 + install X11R6/lib/libXv* $startdir/pkg/usr/lib/ || return 1 + install -m644 share/applications/nvidia-settings.desktop $startdir/pkg/usr/share/applications/ || return 1 + # fix nvidia .desktop file + sed -e 's:__UTILS_PATH__:/usr/bin:' -e 's:__PIXMAP_PATH__:/usr/share/pixmaps:' -i $startdir/pkg/usr/share/applications/nvidia-settings.desktop + install -m644 share/pixmaps/nvidia-settings.png $startdir/pkg/usr/share/pixmaps/ || return 1 + install X11R6/lib/modules/drivers/nvidia_drv.so $startdir/pkg/usr/lib/xorg/modules/drivers || return 1 + install X11R6/lib/modules/extensions/libglx.so.$pkgver $startdir/pkg/usr/lib/xorg/modules/extensions || return 1 + install -m755 bin/nvidia-{settings,bug-report.sh} $startdir/pkg/usr/bin/ || return 1 + cd $startdir/pkg/usr/lib/ + ln -s /usr/lib/libGL.so.$pkgver libGL.so || return 1 + ln -s /usr/lib/libGL.so.$pkgver libGL.so.1 || return 1 + ln -s /usr/lib/libGLcore.so.$pkgver libGLcore.so.1 || return 1 + ln -s /usr/lib/libnvidia-tls.so.$pkgver libnvidia-tls.so.1 || return 1 + cd $startdir/pkg/usr/lib/xorg/modules/extensions + ln -s /usr/lib/xorg/modules/extensions/libglx.so.$pkgver libglx.so || return 1 + + install -m644 $startdir/src/NVIDIA-Linux-${ARCH}-${pkgver}-pkg0/LICENSE $startdir/pkg/usr/share/licenses/nvidia-71xx/ || return 1 + install -D -m644 $startdir/src/NVIDIA-Linux-${ARCH}-${pkgver}-pkg0/usr/share/doc/README $startdir/pkg/usr/share/doc/nvidia/README || return 1 + install -D -m644 $startdir/src/supported-cards.txt $startdir/pkg/usr/share/doc/nvidia/supported-cards.txt || return 1 + + find $startdir/pkg/usr -type d -exec chmod 755 {} \; + # phew :) +} diff --git a/abs/core-testing/nvidia-71xx-utils/nvidia-71xx.install b/abs/core-testing/nvidia-71xx-utils/nvidia-71xx.install new file mode 100644 index 0000000..cea8f32 --- /dev/null +++ b/abs/core-testing/nvidia-71xx-utils/nvidia-71xx.install @@ -0,0 +1,29 @@ +# arg 1: the new package version +post_install() { + + echo ------------------------------- + echo By using this package you accept the NVIDIA license, + echo which has been installed in /usr/share/licenses/nvidia-71xx/LICENSE + echo If you do not accept this license, you must remove the package immediately. + echo Dont forget to update your /etc/X11/xorg.conf + echo In order to use nvidia-settings, you need to install 'gtk2' package. + echo ------------------------------- + + ### removing outdated workaround + if grep 'create-nvidia-nodes.sh' /etc/modprobe.conf >/dev/null 2>&1; then + cat /etc/modprobe.conf | grep -v 'create-nvidia-nodes.sh' \ + >/tmp/.pacnvidia + mv /tmp/.pacnvidia /etc/modprobe.conf + chmod 644 etc/modprobe.conf + fi +} + +# arg 1: the new package version +# arg 2: the old package version +post_upgrade() { + post_install $1 +} + +op=$1 +shift +$op $* diff --git a/abs/core-testing/nvidia-71xx-utils/supported-cards.txt b/abs/core-testing/nvidia-71xx-utils/supported-cards.txt new file mode 100644 index 0000000..d4f26ea --- /dev/null +++ b/abs/core-testing/nvidia-71xx-utils/supported-cards.txt @@ -0,0 +1,236 @@ +Archlinux currently manages three branches of the NVIDIA binary driver: + +nvidia (latest nvidia release) +nvidia-96xx (96xx legacy branch) +nvidia-71xx (71xx legacy branch) + +This excerpt from the NVIDIA 1.0.9746 README lists the supported devices +for each of those: + +______________________________________________________________________________ + +Appendix A. Supported NVIDIA Graphics Chips +______________________________________________________________________________ + +For the most complete and accurate listing of supported GPUs, please see the +Supported Products List, available from the NVIDIA Linux x86 Graphics Driver +download page. Please go to http://www.nvidia.com/object/unix.html, follow the +Archive link under the Linux x86 heading, follow the link for the 1.0-9746 +driver, and then go to the Supported Products List. + + + NVIDIA chip name Device PCI ID + ---------------------------------- ---------------------------------- + GeForce 6800 Ultra 0x0040 + GeForce 6800 0x0041 + GeForce 6800 XE 0x0043 + GeForce 6800 XT 0x0044 + GeForce 6800 GT 0x0045 + GeForce 6800 GT 0x0046 + GeForce 6800 GS 0x0047 + GeForce 6800 XT 0x0048 + Quadro FX 4000 0x004E + GeForce 7800 GTX 0x0090 + GeForce 7800 GTX 0x0091 + GeForce 7800 GT 0x0092 + GeForce 7800 GS 0x0093 + GeForce Go 7800 0x0098 + GeForce Go 7800 GTX 0x0099 + Quadro FX 4500 0x009D + GeForce 6800 GS 0x00C0 + GeForce 6800 0x00C1 + GeForce 6800 LE 0x00C2 + GeForce 6800 XT 0x00C3 + GeForce Go 6800 0x00C8 + GeForce Go 6800 Ultra 0x00C9 + Quadro FX Go1400 0x00CC + Quadro FX 3450/4000 SDI 0x00CD + Quadro FX 1400 0x00CE + GeForce 6800 Ultra/GeForce 6800 0x00F0 + GeForce 6600 GT 0x00F1 + GeForce 6600 0x00F2 + GeForce 6200 0x00F3 + GeForce 6600 LE 0x00F4 + GeForce 7800 GS 0x00F5 + GeForce 6800 GS 0x00F6 + Quadro FX 3400/4400 0x00F8 + GeForce 6800 Ultra 0x00F9 + GeForce PCX 5750 0x00FA + GeForce PCX 5900 0x00FB + GeForce PCX 5300/Quadro FX 330 0x00FC + Quadro NVS 280 PCI-E/Quadro FX 330 0x00FD + Quadro FX 1300 0x00FE + GeForce PCX 4300 0x00FF + GeForce 6600 GT 0x0140 + GeForce 6600 0x0141 + GeForce 6600 LE 0x0142 + GeForce 6600 VE 0x0143 + GeForce Go 6600 0x0144 + GeForce 6610 XL 0x0145 + GeForce Go 6600 TE/6200 TE 0x0146 + GeForce 6700 XL 0x0147 + GeForce Go 6600 0x0148 + GeForce Go 6600 GT 0x0149 + Quadro NVS 440 0x014A + Quadro FX 550 0x014C + Quadro FX 540 0x014E + GeForce 6200 0x014F + GeForce 6500 0x0160 + GeForce 6200 TurboCache(TM) 0x0161 + GeForce 6200 LE 0x0163 + GeForce Go 6200 0x0164 + Quadro NVS 285 0x0165 + GeForce Go 6400 0x0166 + GeForce Go 6200 0x0167 + GeForce Go 6400 0x0168 + GeForce 8800 GTX 0x0191 + GeForce 8800 GTS 0x0193 + GeForce 7300 LE 0x01D1 + GeForce 7300 SE 0x01D3 + Quadro NVS 110M/GeForce Go 7300 0x01D7 + GeForce Go 7400 0x01D8 + Quadro NVS 110M 0x01DA + Quadro NVS 120M 0x01DB + Quadro FX 350M 0x01DC + Quadro FX 350 0x01DE + GeForce 7300 GS 0x01DF + GeForce 6800 0x0211 + GeForce 6800 LE 0x0212 + GeForce 6800 GT 0x0215 + GeForce 6800 XT 0x0218 + GeForce 6200 0x0221 + GeForce 6150 0x0240 + GeForce 6150 LE 0x0241 + GeForce 6100 0x0242 + GeForce Go 6100 0x0247 + GeForce 7900 GTX 0x0290 + GeForce 7900 GT/GTO 0x0291 + GeForce 7900 GS 0x0292 + GeForce 7950 GX2 0x0294 + GeForce Go 7900 GS 0x0298 + GeForce Go 7900 GTX 0x0299 + Quadro FX 2500M 0x029A + Quadro FX 1500M 0x029B + Quadro FX 5500 0x029C + Quadro FX 3500M 0x029D + Quadro FX 1500 0x029E + Quadro FX 4500 X2 0x029F + GeForce 7600 GS 0x02E1 + GeForce FX 5800 Ultra 0x0301 + GeForce FX 5800 0x0302 + Quadro FX 2000 0x0308 + Quadro FX 1000 0x0309 + GeForce FX 5600 Ultra 0x0311 + GeForce FX 5600 0x0312 + GeForce FX 5600XT 0x0314 + GeForce FX Go5600 0x031A + GeForce FX Go5650 0x031B + Quadro FX Go700 0x031C + GeForce FX 5200 0x0320 + GeForce FX 5200 Ultra 0x0321 + GeForce FX 5200 0x0322 + GeForce FX 5200LE 0x0323 + GeForce FX Go5200 0x0324 + GeForce FX Go5250 0x0325 + GeForce FX 5500 0x0326 + GeForce FX 5100 0x0327 + GeForce FX Go5200 32M/64M 0x0328 + Quadro NVS 55/280 PCI 0x032A + Quadro FX 500/FX 600 0x032B + GeForce FX Go53xx 0x032C + GeForce FX Go5100 0x032D + GeForce FX 5900 Ultra 0x0330 + GeForce FX 5900 0x0331 + GeForce FX 5900XT 0x0332 + GeForce FX 5950 Ultra 0x0333 + GeForce FX 5900ZT 0x0334 + Quadro FX 3000 0x0338 + Quadro FX 700 0x033F + GeForce FX 5700 Ultra 0x0341 + GeForce FX 5700 0x0342 + GeForce FX 5700LE 0x0343 + GeForce FX 5700VE 0x0344 + GeForce FX Go5700 0x0347 + GeForce FX Go5700 0x0348 + Quadro FX Go1000 0x034C + Quadro FX 1100 0x034E + GeForce 7600 GT 0x0391 + GeForce 7600 GS 0x0392 + GeForce 7300 GT 0x0393 + GeForce Go 7600 0x0398 + Quadro FX 560 0x039E + + +Below are the legacy GPUs that are no longer supported in the unified driver. +These GPUs will continue to be maintained through the special legacy NVIDIA +GPU driver releases. + +The 1.0-96xx driver supports the following set of GPUs: + + + NVIDIA chip name Device PCI ID + ---------------------------------- ---------------------------------- + GeForce2 MX/MX 400 0x0110 + GeForce2 MX 100/200 0x0111 + GeForce2 Go 0x0112 + Quadro2 MXR/EX/Go 0x0113 + GeForce4 MX 460 0x0170 + GeForce4 MX 440 0x0171 + GeForce4 MX 420 0x0172 + GeForce4 MX 440-SE 0x0173 + GeForce4 440 Go 0x0174 + GeForce4 420 Go 0x0175 + GeForce4 420 Go 32M 0x0176 + GeForce4 460 Go 0x0177 + Quadro4 550 XGL 0x0178 + GeForce4 440 Go 64M 0x0179 + Quadro NVS 0x017A + Quadro4 500 GoGL 0x017C + GeForce4 410 Go 16M 0x017D + GeForce4 MX 440 with AGP8X 0x0181 + GeForce4 MX 440SE with AGP8X 0x0182 + GeForce4 MX 420 with AGP8X 0x0183 + GeForce4 MX 4000 0x0185 + Quadro4 580 XGL 0x0188 + Quadro NVS 280 SD 0x018A + Quadro4 380 XGL 0x018B + Quadro NVS 50 PCI 0x018C + GeForce2 Integrated GPU 0x01A0 + GeForce4 MX Integrated GPU 0x01F0 + GeForce3 0x0200 + GeForce3 Ti 200 0x0201 + GeForce3 Ti 500 0x0202 + Quadro DCC 0x0203 + GeForce4 Ti 4600 0x0250 + GeForce4 Ti 4400 0x0251 + GeForce4 Ti 4200 0x0253 + Quadro4 900 XGL 0x0258 + Quadro4 750 XGL 0x0259 + Quadro4 700 XGL 0x025B + GeForce4 Ti 4800 0x0280 + GeForce4 Ti 4200 with AGP8X 0x0281 + GeForce4 Ti 4800 SE 0x0282 + GeForce4 4200 Go 0x0286 + Quadro4 980 XGL 0x0288 + Quadro4 780 XGL 0x0289 + Quadro4 700 GoGL 0x028C + + +The 1.0-71xx driver supports the following set of GPUs: + + + NVIDIA chip name Device PCI ID + ---------------------------------- ---------------------------------- + RIVA TNT 0x0020 + RIVA TNT2/TNT2 Pro 0x0028 + RIVA TNT2 Ultra 0x0029 + Vanta/Vanta LT 0x002C + RIVA TNT2 Model 64/Model 64 Pro 0x002D + Aladdin TNT2 0x00A0 + GeForce 256 0x0100 + GeForce DDR 0x0101 + Quadro 0x0103 + GeForce2 GTS/GeForce2 Pro 0x0150 + GeForce2 Ti 0x0151 + GeForce2 Ultra 0x0152 + Quadro2 Pro 0x0153 diff --git a/abs/core-testing/nvidia-71xx/NVIDIA_kernel-96.43.05-2290218.diff.txt b/abs/core-testing/nvidia-71xx/NVIDIA_kernel-96.43.05-2290218.diff.txt new file mode 100644 index 0000000..0dfcfd5 --- /dev/null +++ b/abs/core-testing/nvidia-71xx/NVIDIA_kernel-96.43.05-2290218.diff.txt @@ -0,0 +1,1471 @@ +diff -ru usr/src/nv/Makefile.kbuild usr/src/nv.2305230/Makefile.kbuild +--- usr/src/nv/Makefile.kbuild 2008-01-21 11:48:11.000000000 -0800 ++++ usr/src/nv.2305230/Makefile.kbuild 2008-03-18 12:55:25.461856977 -0700 +@@ -176,6 +176,7 @@ + vmap \ + signal_struct \ + agp_backend_acquire \ ++ set_pages_uc \ + change_page_attr \ + pci_get_class \ + sysctl_max_map_count \ +diff -ru usr/src/nv/conftest.sh usr/src/nv.2305230/conftest.sh +--- usr/src/nv/conftest.sh 2008-01-21 11:48:11.000000000 -0800 ++++ usr/src/nv.2305230/conftest.sh 2008-03-18 12:55:28.782046180 -0700 +@@ -100,6 +100,32 @@ + fi + ;; + ++ set_pages_uc) ++ # ++ # Determine if the set_pages_uc() function is present. ++ # ++ echo "#include <linux/autoconf.h> ++ #include <asm/cacheflush.h> ++ void conftest_set_pages_uc(void) { ++ set_pages_uc(); ++ }" > conftest$$.c ++ ++ $CC $CFLAGS -c conftest$$.c > /dev/null 2>&1 ++ rm -f conftest$$.c ++ ++ if [ -f conftest$$.o ]; then ++ rm -f conftest$$.o ++ echo "#undef NV_SET_PAGES_UC_PRESENT" >> conftest.h ++ return ++ else ++ echo "#ifdef NV_CHANGE_PAGE_ATTR_PRESENT" >> conftest.h ++ echo "#undef NV_CHANGE_PAGE_ATTR_PRESENT" >> conftest.h ++ echo "#endif" >> conftest.h ++ echo "#define NV_SET_PAGES_UC_PRESENT" >> conftest.h ++ return ++ fi ++ ;; ++ + change_page_attr) + # + # Determine if the change_page_attr() function is +@@ -124,7 +150,9 @@ + rm -f conftest$$.o + return + else ++ echo "#ifndef NV_SET_PAGES_UC_PRESENT" >> conftest.h + echo "#define NV_CHANGE_PAGE_ATTR_PRESENT" >> conftest.h ++ echo "#endif" >> conftest.h + return + fi + ;; +@@ -501,6 +529,8 @@ + return + fi + ++ rm -f conftest$$.o ++ + echo "#include <linux/autoconf.h> + #include <linux/interrupt.h> + irq_handler_t conftest_isr; +diff -ru usr/src/nv/nv-linux.h usr/src/nv.2305230/nv-linux.h +--- usr/src/nv/nv-linux.h 2008-01-21 11:48:11.000000000 -0800 ++++ usr/src/nv.2305230/nv-linux.h 2008-03-18 12:57:26.340745475 -0700 +@@ -19,8 +19,8 @@ + #include <linux/utsname.h> + + +-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 0) +-# error This driver does not support pre-2.4 kernels! ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 7) ++# error This driver does not support 2.4 kernels older than 2.4.7! + #elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0) + # define KERNEL_2_4 + #elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0) +@@ -51,6 +51,10 @@ + #include <linux/modversions.h> + #endif + ++#if defined(KERNEL_2_4) && !defined(EXPORT_SYMTAB) ++#define EXPORT_SYMTAB ++#endif ++ + #include <linux/kernel.h> + #include <linux/module.h> + +@@ -98,6 +102,7 @@ + + #include <linux/spinlock.h> + #include <asm/semaphore.h> ++#include <linux/completion.h> + #include <linux/highmem.h> + + #ifdef CONFIG_PROC_FS +@@ -118,8 +123,12 @@ + #endif + + #if defined(CONFIG_KGDB) ++#if defined(NV_OLD_MM_KGDB_BREAKPOINT_PRESENT) ++#include <asm/kgdb.h> ++#else + #include <linux/kgdb.h> + #endif ++#endif + + #if defined (CONFIG_AGP) || defined (CONFIG_AGP_MODULE) + #define AGPGART +@@ -516,19 +525,16 @@ + #define NV_KMEM_CACHE_ALLOC(ptr, kmem_cache, type) \ + { \ + (ptr) = kmem_cache_alloc(kmem_cache, GFP_KERNEL); \ +- KM_ALLOC_RECORD(ptr, sizeof(type), "km_cache_alloc"); \ + } + + #define NV_KMEM_CACHE_FREE(ptr, type, kmem_cache) \ + { \ +- KM_FREE_RECORD(ptr, sizeof(type), "km_cache_free"); \ + kmem_cache_free(kmem_cache, ptr); \ + } + +-#if defined(NV_SG_MAP_BUFFERS) /* Linux/x86-64, only */ + #if defined(NV_VMAP_PRESENT) + #if (NV_VMAP_ARGUMENT_COUNT == 2) +-#define NV_VMAP(ptr, pages, count, cached) \ ++#define NV_VMAP_KERNEL(ptr, pages, count, prot) \ + { \ + (ptr) = (unsigned long)vmap(pages, count); \ + VM_ALLOC_RECORD((void *)ptr, (count) * PAGE_SIZE, "vm_vmap"); \ +@@ -537,26 +543,35 @@ + #ifndef VM_MAP + #define VM_MAP 0 + #endif +-#define NV_VMAP(ptr, pages, count, cached) \ ++#define NV_VMAP_KERNEL(ptr, pages, count, prot) \ + { \ +- pgprot_t __prot = (cached) ? PAGE_KERNEL : PAGE_KERNEL_NOCACHE; \ +- (ptr) = (unsigned long)vmap(pages, count, VM_MAP, __prot); \ ++ (ptr) = (unsigned long)vmap(pages, count, VM_MAP, prot); \ + VM_ALLOC_RECORD((void *)ptr, (count) * PAGE_SIZE, "vm_vmap"); \ + } + #else + #error "NV_VMAP_ARGUMENT_COUNT value unrecognized!" + #endif + #else ++#if defined(NV_SG_MAP_BUFFERS) + #error "NV_VMAP() undefined (vmap() unavailable)!" ++#endif + #endif /* NV_VMAP_PRESENT */ + +-#define NV_VUNMAP(ptr, count) \ ++#define NV_VUNMAP_KERNEL(ptr, count) \ + { \ +- VM_FREE_RECORD((void *)ptr, (count) * PAGE_SIZE, "vm_vmap"); \ ++ VM_FREE_RECORD((void *)ptr, (count) * PAGE_SIZE, "vm_vunmap"); \ + vunmap((void *)(ptr)); \ + } + +-#endif /* NV_SG_MAP_BUFFERS */ ++#define NV_VMAP(addr, pages, count, cached) \ ++ { \ ++ pgprot_t __prot = (cached) ? PAGE_KERNEL : PAGE_KERNEL_NOCACHE; \ ++ void *__ptr = nv_vmap(pages, count, __prot); \ ++ (addr) = (unsigned long)__ptr; \ ++ } ++ ++#define NV_VUNMAP(addr, count) nv_vunmap((void *)addr, count) ++ + + #endif /* !defined NVWATCH */ + +@@ -764,9 +779,10 @@ + + #define NV_PGD_OFFSET(address, kernel, mm) \ + ({ \ ++ struct mm_struct *__mm = (mm); \ + pgd_t *__pgd; \ + if (!kernel) \ +- __pgd = pgd_offset(mm, address); \ ++ __pgd = pgd_offset(__mm, address); \ + else \ + __pgd = pgd_offset_k(address); \ + __pgd; \ +@@ -968,9 +984,7 @@ + #define NV_ALLOC_TYPE_PCI (1<<0) + #define NV_ALLOC_TYPE_AGP (1<<1) + #define NV_ALLOC_TYPE_CONTIG (1<<2) +-#define NV_ALLOC_TYPE_KERNEL (1<<3) +-#define NV_ALLOC_TYPE_VMALLOC (1<<4) +-#define NV_ALLOC_TYPE_VMAP (1<<5) ++#define NV_ALLOC_TYPE_VMAP (1<<3) + + #define NV_ALLOC_MAPPING_SHIFT 16 + #define NV_ALLOC_MAPPING(flags) (((flags)>>NV_ALLOC_MAPPING_SHIFT)&0xff) +@@ -980,7 +994,6 @@ + + #define NV_ALLOC_MAPPING_AGP(flags) ((flags) & NV_ALLOC_TYPE_AGP) + #define NV_ALLOC_MAPPING_CONTIG(flags) ((flags) & NV_ALLOC_TYPE_CONTIG) +-#define NV_ALLOC_MAPPING_VMALLOC(flags) ((flags) & NV_ALLOC_TYPE_VMALLOC) + #define NV_ALLOC_MAPPING_VMAP(flags) ((flags) & NV_ALLOC_TYPE_VMAP) + + static inline U032 nv_alloc_init_flags(int cached, int agp, int contig, int kernel) +@@ -988,12 +1001,7 @@ + U032 flags = NV_ALLOC_ENC_MAPPING(cached); + if (agp) flags |= NV_ALLOC_TYPE_AGP; + else flags |= NV_ALLOC_TYPE_PCI; +- if (kernel) flags |= NV_ALLOC_TYPE_KERNEL; +-#if defined(NV_SG_MAP_BUFFERS) + if (kernel && !contig) flags |= NV_ALLOC_TYPE_VMAP; +-#else +- if (kernel && !contig) flags |= NV_ALLOC_TYPE_VMALLOC; +-#endif + if (contig && !agp) flags |= NV_ALLOC_TYPE_CONTIG; + return flags; + } +@@ -1067,21 +1075,24 @@ + #define NV_ATOMIC_DEC_AND_TEST(data) atomic_dec_and_test(&(data)) + #define NV_ATOMIC_READ(data) atomic_read(&(data)) + ++extern int nv_update_memory_types; ++ + /* +- * a BUG() is triggered on early 2.6 x86_64 kernels. the underlying +- * problem actually exists on many architectures and kernels, but +- * these are the only kernels that check the condition and trigger +- * a BUG(). note that this is a problem of the core kernel, not an +- * nvidia bug (and can still be triggered by agpgart). let's avoid +- * change_page_attr on those kernels. ++ * Using change_page_attr() on early Linux/x86-64 2.6 kernels may ++ * result in a BUG() being triggered. The underlying problem ++ * actually exists on multiple architectures and kernels, but only ++ * the above check for the condition and trigger a BUG(). ++ * ++ * Note that this is a due to a bug in the Linux kernel, not an ++ * NVIDIA driver bug (it can also be triggered by AGPGART). ++ * ++ * We therefore need to determine at runtime if change_page_attr() ++ * can be used safely on these kernels. + */ +-#if defined(NV_CHANGE_PAGE_ATTR_PRESENT) +-extern int nv_use_cpa; +- +-#if defined(NVCPU_X86_64) && !defined(KERNEL_2_4) && \ +- (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 11)) +-#define NV_CHANGE_PAGE_ATTR_BUG_PRESENT 1 +-#endif ++#if defined(NV_CHANGE_PAGE_ATTR_PRESENT) && defined(NVCPU_X86_64) && \ ++ !defined(KERNEL_2_4) && \ ++ (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 11)) ++#define NV_CHANGE_PAGE_ATTR_BUG_PRESENT + #endif + + #if defined(NVCPU_X86) || defined(NVCPU_X86_64) +@@ -1093,7 +1104,7 @@ + * + * We need to be careful to mask out _PAGE_NX when the host system + * doesn't support this feature or when it's disabled: the kernel +- * may not do this in its implementation of the change_page_attr() ++ * may not do this in its implementation of the change_page_attr() + * interface. + */ + #ifndef X86_FEATURE_NX +diff -ru usr/src/nv/nv-vm.c usr/src/nv.2305230/nv-vm.c +--- usr/src/nv/nv-vm.c 2008-01-21 11:48:11.000000000 -0800 ++++ usr/src/nv.2305230/nv-vm.c 2008-03-18 12:55:58.755754293 -0700 +@@ -43,42 +43,40 @@ + } + #endif + +-/* +- * AMD Athlon processors expose a subtle bug in the Linux +- * kernel, that may lead to AGP memory corruption. Recent +- * kernel versions had a workaround for this problem, but +- * 2.4.20 is the first kernel to address it properly. The +- * page_attr API provides the means to solve the problem. +- */ +- + static inline void nv_set_page_attrib_uncached(nv_pte_t *page_ptr) + { +-#if defined(NV_CHANGE_PAGE_ATTR_PRESENT) +- if (nv_use_cpa) ++ if (nv_update_memory_types) + { +- struct page *page = virt_to_page(__va(page_ptr->phys_addr)); ++#if defined(NV_SET_PAGES_UC_PRESENT) ++ struct page *page = NV_GET_PAGE_STRUCT(page_ptr->phys_addr); ++ set_pages_uc(page, 1); ++#elif defined(NV_CHANGE_PAGE_ATTR_PRESENT) ++ struct page *page = NV_GET_PAGE_STRUCT(page_ptr->phys_addr); + pgprot_t prot = PAGE_KERNEL_NOCACHE; + #if defined(NVCPU_X86) || defined(NVCPU_X86_64) + pgprot_val(prot) &= __nv_supported_pte_mask; + #endif + change_page_attr(page, 1, prot); +- } + #endif ++ } + } + + static inline void nv_set_page_attrib_cached(nv_pte_t *page_ptr) + { +-#if defined(NV_CHANGE_PAGE_ATTR_PRESENT) +- if (nv_use_cpa) ++ if (nv_update_memory_types) + { +- struct page *page = virt_to_page(__va(page_ptr->phys_addr)); ++#if defined(NV_SET_PAGES_UC_PRESENT) ++ struct page *page = NV_GET_PAGE_STRUCT(page_ptr->phys_addr); ++ set_pages_wb(page, 1); ++#elif defined(NV_CHANGE_PAGE_ATTR_PRESENT) ++ struct page *page = NV_GET_PAGE_STRUCT(page_ptr->phys_addr); + pgprot_t prot = PAGE_KERNEL; + #if defined(NVCPU_X86) || defined(NVCPU_X86_64) + pgprot_val(prot) &= __nv_supported_pte_mask; + #endif + change_page_attr(page, 1, prot); ++#endif + } +-#endif /* NV_CHANGE_PAGE_ATTR_PRESENT */ + } + + static inline void nv_lock_page(nv_pte_t *page_ptr) +@@ -360,8 +358,11 @@ + #if defined(NV_CPA_NEEDS_FLUSHING) + nv_execute_on_all_cpus(cache_flush, NULL); + #endif ++#if (defined(NVCPU_X86) || defined(NVCPU_X86_64)) && \ ++ defined(NV_CHANGE_PAGE_ATTR_PRESENT) + global_flush_tlb(); + #endif ++#endif + } + + /* +@@ -409,11 +410,11 @@ + nv_pte_t *page_ptr = *at->page_table; + unsigned int i, j, gfp_mask; + unsigned long virt_addr = 0, phys_addr; ++ struct page **pages = 0; + #if defined(NV_SG_MAP_BUFFERS) + int ret = -1; + nv_linux_state_t *nvl = NV_GET_NVL_FROM_NV_STATE(nv); + struct pci_dev *dev = nvl->dev; +- struct page **pages = 0; + #endif + + nv_printf(NV_DBG_MEMINFO, "NVRM: VM: nv_vm_malloc_pages: %d pages\n", +@@ -462,22 +463,7 @@ + } + #endif + } +- else if (NV_ALLOC_MAPPING_VMALLOC(at->flags)) +- { +- void *virt_kptr = NULL; +- at->size = at->num_pages * PAGE_SIZE; +- nv_printf(NV_DBG_MEMINFO, "NVRM: VM: vmalloc, size 0x%x\n", at->size); +- NV_VMALLOC(virt_kptr, at->size, NV_ALLOC_MAPPING_CACHED(at->flags)); +- virt_addr = (unsigned long) virt_kptr; +- if (virt_addr == 0) +- { +- nv_printf(NV_DBG_ERRORS, +- "NVRM: nv_vm_malloc failed to allocate vmalloc memory\n"); +- return -1; +- } +- } + +-#if defined(NV_SG_MAP_BUFFERS) + if (NV_ALLOC_MAPPING_VMAP(at->flags)) + { + NV_KMALLOC(pages, sizeof(struct page *) * at->num_pages); +@@ -488,11 +474,10 @@ + return -1; + } + } +-#endif + + for (i = 0; i < at->num_pages; i++) + { +- if (!NV_ALLOC_MAPPING_CONTIG(at->flags) && !NV_ALLOC_MAPPING_VMALLOC(at->flags)) ++ if (!NV_ALLOC_MAPPING_CONTIG(at->flags)) + { + NV_GET_FREE_PAGES(virt_addr, 0, gfp_mask); + if (virt_addr == 0) +@@ -553,10 +538,10 @@ + } + } + nv_sg_load(&page_ptr->sg_list, page_ptr); ++#endif + + if (NV_ALLOC_MAPPING_VMAP(at->flags)) + pages[i] = NV_GET_PAGE_STRUCT(page_ptr->phys_addr); +-#endif + + if (!NV_ALLOC_MAPPING_CACHED(at->flags)) + nv_set_page_attrib_uncached(page_ptr); +@@ -565,41 +550,21 @@ + virt_addr += PAGE_SIZE; + } + +-#if defined(NV_SG_MAP_BUFFERS) + if (NV_ALLOC_MAPPING_VMAP(at->flags)) + { + NV_VMAP(virt_addr, pages, at->num_pages, NV_ALLOC_MAPPING_CACHED(at->flags)); +-#if defined(KERNEL_2_4) +- if (virt_addr != 0) +- { +- unsigned int i; +- /* +- * XXX Linux 2.4's vmap() increments the pages' reference counts +- * in preparation for vfree(); the latter skips the calls to +- * __free_page() if the pages are marked reserved, however, so +- * that the underlying memory is effectively leaked when we free +- * it later. Decrement the count here to avoid this leak. +- */ +- for (i = 0; i < at->num_pages; i++) +- { +- if (PageReserved(pages[i])) +- atomic_dec(&pages[i]->count); +- } +- } +-#endif +- NV_KFREE((void *)pages, sizeof(struct page *) * at->num_pages); + if (virt_addr == 0) + { + nv_printf(NV_DBG_ERRORS, + "NVRM: VM: nv_vm_malloc_pages: failed to vmap pages\n"); + goto failed; + } ++ NV_KFREE((void *)pages, sizeof(struct page *) * at->num_pages); + for (i = 0; i < at->num_pages; i++) + { + at->page_table[i]->virt_addr = virt_addr + i * PAGE_SIZE; + } + } +-#endif /* NV_SG_MAP_BUFFERS */ + + nv_vm_list_page_count(at->page_table, at->num_pages); + +@@ -624,7 +589,7 @@ + nv_sg_unmap_buffer(dev, &page_ptr->sg_list, page_ptr); + #endif + nv_unlock_page(page_ptr); +- if (!NV_ALLOC_MAPPING_CONTIG(at->flags) && !NV_ALLOC_MAPPING_VMALLOC(at->flags)) ++ if (!NV_ALLOC_MAPPING_CONTIG(at->flags)) + NV_FREE_PAGES(page_ptr->virt_addr, 0); + } + } +@@ -638,16 +603,9 @@ + #endif + NV_FREE_PAGES(page_ptr->virt_addr, at->order); + } +- else if (NV_ALLOC_MAPPING_VMALLOC(at->flags)) +- { +- page_ptr = *at->page_table; +- NV_VFREE((void *) page_ptr->virt_addr, at->size); +- } + +-#if defined(NV_SG_MAP_BUFFERS) + if (NV_ALLOC_MAPPING_VMAP(at->flags) && pages != 0) +- NV_VFREE((void *)pages, sizeof(struct page *) * at->num_pages); +-#endif ++ NV_KFREE((void *)pages, sizeof(struct page *) * at->num_pages); + + return -1; + } +@@ -674,19 +632,17 @@ + } + nv_vm_list_page_count(at->page_table, at->num_pages); + +-#if defined(NV_SG_MAP_BUFFERS) + if (NV_ALLOC_MAPPING_VMAP(at->flags)) + NV_VUNMAP((void *)at->page_table[0]->virt_addr, at->num_pages); // undo vmap() +-#endif + + for (i = 0; i < at->num_pages; i++) + { + page_ptr = at->page_table[i]; + if (!NV_ALLOC_MAPPING_CACHED(at->flags)) + nv_set_page_attrib_cached(page_ptr); +-#if defined(NV_SG_MAP_BUFFERS) + if (NV_ALLOC_MAPPING_VMAP(at->flags)) + page_ptr->virt_addr = (unsigned long) __va(page_ptr->phys_addr); ++#if defined(NV_SG_MAP_BUFFERS) + if (!NV_ALLOC_MAPPING_CONTIG(at->flags)) + nv_sg_unmap_buffer(dev, &page_ptr->sg_list, page_ptr); + #endif +@@ -701,7 +657,7 @@ + } + } + nv_unlock_page(page_ptr); +- if (!NV_ALLOC_MAPPING_CONTIG(at->flags) && !NV_ALLOC_MAPPING_VMALLOC(at->flags)) ++ if (!NV_ALLOC_MAPPING_CONTIG(at->flags)) + NV_FREE_PAGES(page_ptr->virt_addr, 0); + } + nv_flush_caches(); +@@ -714,9 +670,136 @@ + #endif + NV_FREE_PAGES(page_ptr->virt_addr, at->order); + } +- else if (NV_ALLOC_MAPPING_VMALLOC(at->flags)) ++} ++ ++#if defined(NV_VMAP_PRESENT) && defined(KERNEL_2_4) && defined(NVCPU_X86) ++static unsigned long ++nv_vmap_vmalloc( ++ int count, ++ struct page **pages, ++ pgprot_t prot ++) ++{ ++ void *virt_addr = NULL; ++ unsigned int i, size = count * PAGE_SIZE; ++ ++ NV_VMALLOC(virt_addr, size, TRUE); ++ if (virt_addr == NULL) ++ { ++ nv_printf(NV_DBG_ERRORS, ++ "NVRM: vmalloc() failed to allocate vmap() scratch pages!\n"); ++ return 0; ++ } ++ ++ for (i = 0; i < (unsigned int)count; i++) + { +- page_ptr = *at->page_table; +- NV_VFREE((void *) page_ptr->virt_addr, at->size); ++ pgd_t *pgd = NULL; ++ pmd_t *pmd = NULL; ++ pte_t *pte = NULL; ++ unsigned long address; ++ struct page *page; ++ ++ address = (unsigned long)virt_addr + i * PAGE_SIZE; ++ ++ pgd = NV_PGD_OFFSET(address, 1, NULL); ++ if (!NV_PGD_PRESENT(pgd)) ++ goto failed; ++ ++ pmd = NV_PMD_OFFSET(address, pgd); ++ if (!NV_PMD_PRESENT(pmd)) ++ goto failed; ++ ++ pte = NV_PTE_OFFSET(address, pmd); ++ if (!NV_PTE_PRESENT(pte)) ++ goto failed; ++ ++ page = NV_GET_PAGE_STRUCT(pte_val(*pte) & PAGE_MASK); ++ get_page(pages[i]); ++ set_pte(pte, mk_pte(pages[i], prot)); ++ put_page(page); ++ NV_PTE_UNMAP(pte); ++ } ++ nv_flush_caches(); ++ ++ return (unsigned long)virt_addr; ++ ++failed: ++ NV_VFREE(virt_addr, size); ++ ++ return 0; ++} ++ ++static void ++nv_vunmap_vmalloc( ++ void *address, ++ int count ++) ++{ ++ NV_VFREE(address, count * PAGE_SIZE); ++} ++#endif /* NV_VMAP_PRESENT && KERNEL_2_4 && NVCPU_X86 */ ++ ++void *nv_vmap( ++ struct page **pages, ++ int count, ++ pgprot_t prot ++) ++{ ++ unsigned long virt_addr = 0; ++#if defined(NV_VMAP_PRESENT) ++#if defined(KERNEL_2_4) && defined(NVCPU_X86) ++ /* ++ * XXX Linux 2.4's vmap() checks the requested mapping's size against ++ * the value of (max_mapnr << PAGESHIFT); since 'map_nr' is a 32-bit ++ * symbol, the checks fails given enough physical memory. We can't solve ++ * this problem by adjusting the value of 'map_nr', but we can avoid ++ * vmap() by going through vmalloc(). ++ */ ++ if (max_mapnr >= 0x100000) ++ virt_addr = nv_vmap_vmalloc(count, pages, prot); ++ else ++#endif ++ NV_VMAP_KERNEL(virt_addr, pages, count, prot); ++#if defined(KERNEL_2_4) ++ if (virt_addr) ++ { ++ int i; ++ /* ++ * XXX Linux 2.4's vmap() increments the pages' reference counts ++ * in preparation for vfree(); the latter skips the calls to ++ * __free_page() if the pages are marked reserved, however, so ++ * that the underlying memory is effectively leaked when we free ++ * it later. Decrement the count here to avoid this leak. ++ */ ++ for (i = 0; i < count; i++) ++ { ++ if (PageReserved(pages[i])) ++ atomic_dec(&pages[i]->count); ++ } + } ++#endif ++#endif /* NV_VMAP_PRESENT */ ++ return (void *)virt_addr; ++} ++ ++void nv_vunmap( ++ void *address, ++ int count ++) ++{ ++#if defined(NV_VMAP_PRESENT) ++#if defined(KERNEL_2_4) && defined(NVCPU_X86) ++ /* ++ * XXX Linux 2.4's vmap() checks the requested mapping's size against ++ * the value of (max_mapnr << PAGESHIFT); since 'map_nr' is a 32-bit ++ * symbol, the checks fails given enough physical memory. We can't solve ++ * this problem by adjusting the value of 'map_nr', but we can avoid ++ * vmap() by going through vmalloc(). ++ */ ++ if (max_mapnr >= 0x100000) ++ nv_vunmap_vmalloc(address, count); ++ else ++#endif ++ NV_VUNMAP_KERNEL(address, count); ++#endif /* NV_VMAP_PRESENT */ + } +diff -ru usr/src/nv/nv-vm.h usr/src/nv.2305230/nv-vm.h +--- usr/src/nv/nv-vm.h 2008-01-21 11:48:11.000000000 -0800 ++++ usr/src/nv.2305230/nv-vm.h 2008-03-18 12:55:54.643519951 -0700 +@@ -11,6 +11,9 @@ + #ifndef _NV_VM_H_ + #define _NV_VM_H_ + ++void * nv_vmap(struct page **, int, pgprot_t); ++void nv_vunmap(void *, int); ++ + int nv_vm_malloc_pages(nv_state_t *, nv_alloc_t *); + void nv_vm_free_pages(nv_state_t *, nv_alloc_t *); + +diff -ru usr/src/nv/nv.c usr/src/nv.2305230/nv.c +--- usr/src/nv/nv.c 2008-01-21 11:48:11.000000000 -0800 ++++ usr/src/nv.2305230/nv.c 2008-03-18 12:56:01.123889244 -0700 +@@ -97,9 +97,7 @@ + unsigned int nv_remap_limit; + #endif + +-#if defined(NV_CHANGE_PAGE_ATTR_PRESENT) +-int nv_use_cpa = 1; +-#endif ++int nv_update_memory_types = 1; + + static void *nv_pte_t_cache = NULL; + +@@ -850,16 +848,13 @@ + + for (i = 0; i < 4; i++) + { +- if (NV_PAT_ENTRY(pat1, i) == 1) ++ if ((i != 1) && NV_PAT_ENTRY(pat1, i) == 1) + { + nv_printf(NV_DBG_ERRORS, "NVRM: PAT index %d already configured for Write-Combining!\n", i); + nv_printf(NV_DBG_ERRORS, "NVRM: Aborting, due to PAT already being configured\n"); + return 0; + } +- } + +- for (i = 0; i < 4; i++) +- { + if (NV_PAT_ENTRY(pat2, i) == 1) + { + nv_printf(NV_DBG_ERRORS, "NVRM: PAT index %d already configured for Write-Combining!\n", i + 4); +@@ -969,30 +964,26 @@ + #endif /* defined(NV_BUILD_NV_PAT_SUPPORT) */ + } + +- + #if defined(NV_CHANGE_PAGE_ATTR_BUG_PRESENT) +- +-/* nv_verify_cpa_interface - determine if the change_page_attr bug is fixed +- * in this kernel. ++/* ++ * nv_verify_cpa_interface() - determine if the change_page_attr() large page ++ * management accounting bug known to exist in early Linux/x86-64 kernels ++ * is present in this kernel. + * +- * there's really not a good way to determine if change_page_attr is fixed. +- * we can't really use cpa on 2.6 x86_64 kernels < 2.6.11, as if we run into +- * the accounting bug, the kernel will throw a BUG. this isn't 100% accurate, +- * as it doesn't throw a bug until we try to restore the caching attributes +- * of the page. so if we can track down a 4M allocation, we can mark it +- * uncached and see if the accounting was done correctly. +- * +- * this is a little ugly, but the most accurate approach to determining if +- * this kernel is good. ++ * There's really no good way to determine if change_page_attr() is working ++ * correctly. We can't reliably use change_page_attr() on Linux/x86-64 2.6 ++ * kernels < 2.6.11: if we run into the accounting bug, the Linux kernel will ++ * trigger a BUG() if we attempt to restore the WB memory type of a page ++ * originally part of a large page. + * +- * why do we even bother? some distributions have back-ported the cpa fix to +- * kernels < 2.6.11. we want to use change_page_attr to avoid random corruption +- * and hangs, but need to make sure it's safe to do so. ++ * So if we can successfully allocate such a page, change its memory type to ++ * UC and check if the accounting was done correctly, we can determine if ++ * the change_page_attr() interface can be used safely. + * +- * return values: +- * 0 - test passed, interface works +- * 1 - test failed, status unclear +- * -1 - test failed, interface broken ++ * Return values: ++ * 0 - test passed, the change_page_attr() interface works ++ * 1 - test failed, the status is unclear ++ * -1 - test failed, the change_page_attr() interface is broken + */ + + static inline pte_t *check_large_page(unsigned long vaddr) +@@ -1000,7 +991,7 @@ + pgd_t *pgd = NULL; + pmd_t *pmd = NULL; + +- pgd = NV_PGD_OFFSET(vaddr, 1, &init_mm); ++ pgd = NV_PGD_OFFSET(vaddr, 1, NULL); + if (!NV_PGD_PRESENT(pgd)) + return NULL; + +@@ -1110,35 +1101,42 @@ + + return 1; + } +- + #endif /* defined(NV_CHANGE_PAGE_ATTR_BUG_PRESENT) */ + +- +-// verify that the kernel's mapping matches the requested type +-// this is to protect against accidental cache aliasing problems ++/* ++ * nv_verify_page_mappings() - verify that the kernel mapping of the specified ++ * page matches the specified type. This is to help detect bugs in the Linux ++ * kernel's change_page_attr() interface, early. ++ * ++ * This function relies on the ability to perform kernel virtul address to PFN ++ * translations and therefore on 'init_mm'. Unfortunately, the latter is no ++ * longer exported in recent Linux/x86 2.6 kernels. The export was removed at ++ * roughtly the same time as the set_pages_{uc,wb}() change_page_attr() ++ * replacement interfaces were introduced; hopefully, it will be sufficient to ++ * check for their presence. ++ */ + int nv_verify_page_mappings( + nv_pte_t *page_ptr, + unsigned int cachetype + ) + { +- struct mm_struct *mm; ++#if defined(NV_CHANGE_PAGE_ATTR_PRESENT) || \ ++ (defined(NV_SET_PAGES_UC_PRESENT) && !defined(NVCPU_X86)) ++ unsigned long retval = -1; ++#if defined(NVCPU_X86) || defined(NVCPU_X86_64) + pgd_t *pgd = NULL; + pmd_t *pmd = NULL; + pte_t *pte = NULL; +- unsigned long retval = -1; + unsigned int flags, expected; + unsigned long address; + static int count = 0; + +-#if defined(NV_CHANGE_PAGE_ATTR_PRESENT) +- if (!nv_use_cpa) ++ if (!nv_update_memory_types) + return 0; +-#endif + + address = (unsigned long)__va(page_ptr->phys_addr); +- mm = &init_mm; // always a kernel page + +- pgd = NV_PGD_OFFSET(address, 1, mm); ++ pgd = NV_PGD_OFFSET(address, 1, NULL); + if (!NV_PGD_PRESENT(pgd)) + { + nv_printf(NV_DBG_ERRORS, "NVRM: pgd not present for addr 0x%lx\n", address); +@@ -1204,7 +1202,11 @@ + } + + failed: ++#endif /* defined(NVCPU_X86) || defined(NVCPU_X86_64) */ + return retval; ++#else ++ return 0; ++#endif + } + + #if defined(NV_BUILD_NV_PAT_SUPPORT) && defined(CONFIG_HOTPLUG_CPU) +@@ -1250,7 +1252,8 @@ + static int __init nvidia_init_module(void) + { + int rc; +- U032 i, count; ++ U032 i, count, data; ++ nv_state_t *nv = NV_STATE_PTR(&nv_ctl_device); + + #if defined(VM_CHECKER) + nv_init_lock(vm_lock); +@@ -1266,11 +1269,18 @@ + return -ENODEV; + } + ++ if (!rm_init_rm()) ++ { ++ nv_printf(NV_DBG_ERRORS, "NVRM: rm_init_rm() failed!\n"); ++ return -EIO; ++ } ++ + memset(nv_linux_devices, 0, sizeof(nv_linux_devices)); + + if (pci_register_driver(&nv_pci_driver) < 0) + { + pci_unregister_driver(&nv_pci_driver); // XXX ??? ++ rm_shutdown_rm(); + nv_printf(NV_DBG_ERRORS, "NVRM: No NVIDIA graphics adapter found!\n"); + return -ENODEV; + } +@@ -1293,6 +1303,7 @@ + if (num_probed_nv_devices == 0) + { + pci_unregister_driver(&nv_pci_driver); ++ rm_shutdown_rm(); + nv_printf(NV_DBG_ERRORS, "NVRM: No NVIDIA graphics adapter probed!\n"); + return -ENODEV; + } +@@ -1307,6 +1318,7 @@ + if (num_nv_devices == 0) + { + pci_unregister_driver(&nv_pci_driver); ++ rm_shutdown_rm(); + nv_printf(NV_DBG_ERRORS, + "NVRM: None of the NVIDIA graphics adapters were initialized!\n"); + return -ENODEV; +@@ -1317,8 +1329,9 @@ + rc = register_chrdev(nv_major, "nvidia", &nv_fops); + if (rc < 0) + { +- nv_printf(NV_DBG_ERRORS, "NVRM: register chrdev failed\n"); + pci_unregister_driver(&nv_pci_driver); ++ rm_shutdown_rm(); ++ nv_printf(NV_DBG_ERRORS, "NVRM: register_chrdev() failed!\n"); + return rc; + } + +@@ -1367,14 +1380,6 @@ + } + #endif + +- // Init the resource manager +- if (!rm_init_rm()) +- { +- nv_printf(NV_DBG_ERRORS, "NVRM: rm_init_rm() failed\n"); +- rc = -EIO; +- goto failed; +- } +- + #if defined(NV_SG_MAP_BUFFERS) + rm_read_registry_dword(NV_STATE_PTR(&nv_ctl_device), "NVreg", "RemapLimit", &nv_remap_limit); + +@@ -1407,48 +1412,41 @@ + /* create /proc/driver/nvidia */ + nvos_proc_create(); + +-#if defined(NV_CHANGE_PAGE_ATTR_PRESENT) ++ /* ++ * Give users an opportunity to disable the driver's use of ++ * the change_page_attr() and set_pages_{uc,wb}() kernel ++ * interfaces. ++ */ ++ rc = rm_read_registry_dword(nv, "NVreg", "UpdateMemoryTypes", &data); ++ if ((rc == 0) && ((int)data != ~0)) + { +- int data; +- +- // allow the user to override us with a registry key +- rc = rm_read_registry_dword(NV_STATE_PTR(&nv_ctl_device), "NVreg", "UseCPA", &data); +- if ((rc == 0) && (data != -1)) +- { +- nv_use_cpa = data; +- } ++ nv_update_memory_types = data; ++ } + #if defined(NV_CHANGE_PAGE_ATTR_BUG_PRESENT) +- else ++ /* ++ * Unless we explicitely detect that the change_page_attr() ++ * inteface is fixed, disable usage of the interface on ++ * this kernel. Notify the user of this problem using the ++ * driver's /proc warnings interface (read by the installer ++ * and the bug report script). ++ */ ++ else ++ { ++ rc = nv_verify_cpa_interface(); ++ if (rc < 0) + { +- /* +- * Unless we explicitely detect that the change_page_attr() +- * inteface is fixed, disable usage of the interface on +- * this kernel. Notify the user of this problem using the +- * driver's /proc warnings interface (read by the installer +- * and the bug report script). +- */ +- rc = nv_verify_cpa_interface(); +- if (rc < 0) +- { +- nv_prints(NV_DBG_ERRORS, __cpgattr_warning); +- nvos_proc_add_warning_file("change_page_attr", __cpgattr_warning); +- nv_use_cpa = 0; +- } +- else if (rc != 0) +- { +- nv_prints(NV_DBG_ERRORS, __cpgattr_warning_2); +- nvos_proc_add_warning_file("change_page_attr", __cpgattr_warning_2); +- nv_use_cpa = 0; +- } ++ nv_prints(NV_DBG_ERRORS, __cpgattr_warning); ++ nvos_proc_add_warning_file("change_page_attr", __cpgattr_warning); ++ nv_update_memory_types = 0; ++ } ++ else if (rc != 0) ++ { ++ nv_prints(NV_DBG_ERRORS, __cpgattr_warning_2); ++ nvos_proc_add_warning_file("change_page_attr", __cpgattr_warning_2); ++ nv_update_memory_types = 0; + } +-#endif + } +-#endif +- +- +-#if defined(DEBUG) +- inter_module_register("nv_linux_devices", THIS_MODULE, nv_linux_devices); +-#endif ++#endif /* defined(NV_CHANGE_PAGE_ATTR_BUG_PRESENT) */ + + #if defined(NVCPU_X86_64) && defined(CONFIG_IA32_EMULATION) && !defined(HAVE_COMPAT_IOCTL) + /* Register ioctl conversions for 32 bit clients */ +@@ -1501,6 +1499,8 @@ + } + + pci_unregister_driver(&nv_pci_driver); ++ rm_shutdown_rm(); ++ + return rc; + } + +@@ -1532,10 +1532,6 @@ + /* remove /proc/driver/nvidia */ + nvos_proc_remove(); + +-#if defined(DEBUG) +- inter_module_unregister("nv_linux_devices"); +-#endif +- + #if defined(NV_PM_SUPPORT_OLD_STYLE_APM) + for (i = 0; i < num_nv_devices; i++) + { +@@ -2112,6 +2108,8 @@ + if (rm_validate_pfn_range(file, NV_VMA_PGOFF(vma), + NV_VMA_SIZE(vma)) == RM_OK) + { ++ if (vma->vm_flags & VM_WRITE) ++ return -EACCES; + vma->vm_flags |= (VM_IO | VM_LOCKED); + #if defined(NV_VM_INSERT_PAGE_PRESENT) + if (NV_VM_INSERT_PAGE(vma, vma->vm_start, pfn_to_page(NV_VMA_PGOFF(vma)))) +@@ -2240,6 +2238,8 @@ + if (rm_validate_pfn_range(file, NV_VMA_PGOFF(vma), + NV_VMA_SIZE(vma)) == RM_OK) + { ++ if (vma->vm_flags & VM_WRITE) ++ return -EACCES; + vma->vm_flags |= (VM_IO | VM_LOCKED); + #if defined(NV_VM_INSERT_PAGE_PRESENT) + if (NV_VM_INSERT_PAGE(vma, vma->vm_start, pfn_to_page(NV_VMA_PGOFF(vma)))) +@@ -3266,8 +3266,21 @@ + pte_t *pte = NULL; + unsigned long retval; + +- mm = (kern) ? &init_mm : current->mm; +- if (!kern) down_read(¤t->mm->mmap_sem); ++ if (!kern) ++ { ++ mm = current->mm; ++ down_read(&mm->mmap_sem); ++ } ++ else ++ { ++#if defined(NV_SET_PAGES_UC_PRESENT) && defined(NVCPU_X86) ++ /* nv_printf(NV_DBG_ERRORS, ++ "NVRM: can't translate KVA in nv_get_phys_address()!\n"); */ ++ return 0; ++#else ++ mm = NULL; ++#endif ++ } + + pgd = NV_PGD_OFFSET(address, kern, mm); + if (!NV_PGD_PRESENT(pgd)) +@@ -3288,11 +3301,13 @@ + retval &= ~_PAGE_NX; + #endif + +- if (!kern) up_read(¤t->mm->mmap_sem); ++ if (!kern) ++ up_read(&mm->mmap_sem); + return retval; + + failed: +- if (!kern) up_read(¤t->mm->mmap_sem); ++ if (!kern) ++ up_read(&mm->mmap_sem); + return 0; + } + +@@ -3300,12 +3315,19 @@ + unsigned long address + ) + { +- // make sure this address is a kernel pointer ++#if defined(NV_SET_PAGES_UC_PRESENT) && defined(NVCPU_X86) ++ nv_linux_state_t *nvl; ++ nv_alloc_t *at; ++ unsigned long virt_addr; ++ U032 i, j; ++#endif ++ ++ /* make sure this address is a kernel virtual address */ + #if defined(DEBUG) && !defined(CONFIG_X86_4G) + if (address < PAGE_OFFSET) + { + nv_printf(NV_DBG_WARNINGS, +- "NVRM: user address passed to get_kern_phys_address: 0x%lx\n", ++ "NVRM: user address passed to get_kern_phys_address: 0x%llx!\n", + address); + return 0; + } +@@ -3315,6 +3337,30 @@ + if ((address > PAGE_OFFSET) && (address < VMALLOC_START)) + return __pa(address); + ++#if defined(NV_SET_PAGES_UC_PRESENT) && defined(NVCPU_X86) ++ for (i = 0; i < num_nv_devices; i++) ++ { ++ nvl = &nv_linux_devices[i]; ++ ++ for (at = nvl->alloc_queue; (at != NULL); at = at->next) ++ { ++ if (!NV_ALLOC_MAPPING_VMAP(at->flags)) ++ continue; ++ ++ for (j = 0; j < at->num_pages; j++) ++ { ++ virt_addr = at->page_table[j]->virt_addr; ++ if ((address >= virt_addr) && ++ (address < (virt_addr + PAGE_SIZE))) ++ { ++ return (at->page_table[j]->phys_addr + ++ (address & ~PAGE_MASK)); ++ } ++ } ++ } ++ } ++#endif ++ + return _get_phys_address(address, 1); + } + +@@ -3322,12 +3368,12 @@ + unsigned long address + ) + { +- // make sure this address is not a kernel pointer ++ /* make sure this address is not a kernel virtual address */ + #if defined(DEBUG) && !defined(CONFIG_X86_4G) + if (address >= PAGE_OFFSET) + { + nv_printf(NV_DBG_WARNINGS, +- "NVRM: kernel address passed to get_user_phys_address: 0x%lx\n", ++ "NVRM: kernel address passed to get_user_phys_address: 0x%llx!\n", + address); + return 0; + } +@@ -3396,8 +3442,6 @@ + if (nv_vm_malloc_pages(nv, at)) + goto failed; + +- at->class = class; +- + // set our 'key' to the page_table. rm_alloc_agp_pages will call + // nv_translate_address below, which will look up pages using + // the value of *pAddress as a key, then index into the page_table +@@ -3952,7 +3996,8 @@ + + if (num_nv_devices == NV_MAX_DEVICES) + { +- nv_printf(NV_DBG_ERRORS, "NVRM: maximum device number (%d) reached!\n", num_nv_devices); ++ nv_printf(NV_DBG_ERRORS, "NVRM: maximum device number (%d) exceeded!\n", ++ (NV_MAX_DEVICES - 1)); + return -1; + } + +@@ -4085,13 +4130,10 @@ + return -1; + } + +-int NV_API_CALL nv_no_incoherent_mappings +-( +- void +-) ++int NV_API_CALL nv_no_incoherent_mappings(void) + { +-#if defined(NV_CHANGE_PAGE_ATTR_PRESENT) +- return 1; ++#if defined(NV_CHANGE_PAGE_ATTR_PRESENT) || defined(NV_SET_PAGES_UC_PRESENT) ++ return (nv_update_memory_types); + #else + return 0; + #endif +diff -ru usr/src/nv/nv.h usr/src/nv.2305230/nv.h +--- usr/src/nv/nv.h 2008-01-21 11:48:11.000000000 -0800 ++++ usr/src/nv.2305230/nv.h 2008-03-18 12:55:56.919649651 -0700 +@@ -335,15 +332,39 @@ + + #define NV_DEVICE_NAME_LENGTH 40 + ++#define NV_MAX_ISR_DELAY_US 20000 ++#define NV_MAX_ISR_DELAY_MS (NV_MAX_ISR_DELAY_US / 1000) ++ ++#define NV_TIMERCMP(a, b, CMP) \ ++ (((a)->tv_sec == (b)->tv_sec) ? \ ++ ((a)->tv_usec CMP (b)->tv_usec) : ((a)->tv_sec CMP (b)->tv_sec)) ++ ++#define NV_TIMERADD(a, b, result) \ ++ { \ ++ (result)->tv_sec = (a)->tv_sec + (b)->tv_sec; \ ++ (result)->tv_usec = (a)->tv_usec + (b)->tv_usec; \ ++ if ((result)->tv_usec >= 1000000) \ ++ { \ ++ ++(result)->tv_sec; \ ++ (result)->tv_usec -= 1000000; \ ++ } \ ++ } ++ ++#define NV_TIMERSUB(a, b, result) \ ++ { \ ++ (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \ ++ (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \ ++ if ((result)->tv_usec < 0) \ ++ { \ ++ --(result)->tv_sec; \ ++ (result)->tv_usec += 1000000; \ ++ } \ ++ } + + /* + * driver internal interfaces + */ + +-/* need a fake device number for control device; just to flag it for msgs */ +-#define NV_CONTROL_DEVICE_NUMBER 100 +- +- + #ifndef NVWATCH + + /* +diff -ru usr/src/nv/os-interface.c usr/src/nv.2305230/os-interface.c +--- usr/src/nv/os-interface.c 2008-01-21 11:48:11.000000000 -0800 ++++ usr/src/nv.2305230/os-interface.c 2008-03-18 12:56:04.288069559 -0700 +@@ -25,7 +25,6 @@ + #include "os-interface.h" + #include "nv-linux.h" + +- + static volatile int os_block_on_smp_barrier; + + #ifdef CONFIG_SMP +@@ -63,7 +62,7 @@ + // + typedef struct os_sema_s + { +- struct semaphore wait; ++ struct completion completion; + spinlock_t lock; + S032 count; + } os_sema_t; +@@ -86,7 +85,7 @@ + return rmStatus; + + os_sema = (os_sema_t *)*ppSema; +- sema_init(&os_sema->wait, 0); ++ init_completion(&os_sema->completion); + spin_lock_init(&os_sema->lock); + os_sema->count = 1; + +@@ -131,7 +130,7 @@ + { + os_sema->count--; + spin_unlock_irqrestore(&os_sema->lock, old_irq); +- down(&os_sema->wait); ++ wait_for_completion(&os_sema->completion); + } + else + { +@@ -208,7 +207,7 @@ + spin_unlock_irqrestore(&os_sema->lock, old_irq); + + if (doWakeup) +- up(&os_sema->wait); ++ complete(&os_sema->completion); + + return RM_OK; + } +@@ -448,8 +447,6 @@ + // + //--------------------------------------------------------------------------- + +-#define NV_MAX_ISR_UDELAY 20000 +-#define NV_MAX_ISR_MDELAY (NV_MAX_ISR_UDELAY / 1000) + #define NV_MSECS_PER_JIFFIE (1000 / HZ) + #define NV_MSECS_TO_JIFFIES(msec) ((msec) * HZ / 1000) + #define NV_USECS_PER_JIFFIE (1000000 / HZ) +@@ -474,7 +471,7 @@ + do_gettimeofday(&tm1); + #endif + +- if (in_irq() && MicroSeconds > NV_MAX_ISR_UDELAY) ++ if (in_irq() && (MicroSeconds > NV_MAX_ISR_DELAY_US)) + return RM_ERROR; + + mdelay_safe_msec = MicroSeconds / 1000; +@@ -494,36 +491,6 @@ + return RM_OK; + } + +-#ifndef timercmp +-# define timercmp(a, b, CMP) \ +- (((a)->tv_sec == (b)->tv_sec) ? \ +- ((a)->tv_usec CMP (b)->tv_usec) : \ +- ((a)->tv_sec CMP (b)->tv_sec)) +-#endif +-#ifndef timeradd +-# define timeradd(a, b, result) \ +- do { \ +- (result)->tv_sec = (a)->tv_sec + (b)->tv_sec; \ +- (result)->tv_usec = (a)->tv_usec + (b)->tv_usec; \ +- if ((result)->tv_usec >= 1000000) \ +- { \ +- ++(result)->tv_sec; \ +- (result)->tv_usec -= 1000000; \ +- } \ +- } while (0) +-#endif +-#ifndef timersub +-# define timersub(a, b, result) \ +- do { \ +- (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \ +- (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \ +- if ((result)->tv_usec < 0) { \ +- --(result)->tv_sec; \ +- (result)->tv_usec += 1000000; \ +- } \ +- } while (0) +-#endif +- + /* + * On Linux, a jiffie represents the time passed in between two timer + * interrupts. The number of jiffies per second (HZ) varies across the +@@ -549,7 +516,7 @@ + tm_start = tm_aux; + #endif + +- if (in_irq() && MilliSeconds > NV_MAX_ISR_MDELAY) ++ if (in_irq() && (MilliSeconds > NV_MAX_ISR_DELAY_MS)) + return RM_ERROR; + + if (!NV_MAY_SLEEP()) +@@ -561,7 +528,7 @@ + MicroSeconds = MilliSeconds * 1000; + tm_end.tv_usec = MicroSeconds; + tm_end.tv_sec = 0; +- timeradd(&tm_aux, &tm_end, &tm_end); ++ NV_TIMERADD(&tm_aux, &tm_end, &tm_end); + + /* do we have a full jiffie to wait? */ + jiffies = NV_USECS_TO_JIFFIES(MicroSeconds); +@@ -590,9 +557,9 @@ + schedule_timeout(jiffies); + /* catch the remainder, if any */ + do_gettimeofday(&tm_aux); +- if (timercmp(&tm_aux, &tm_end, <)) ++ if (NV_TIMERCMP(&tm_aux, &tm_end, <)) + { +- timersub(&tm_end, &tm_aux, &tm_aux); // tm_aux = tm_end - tm_aux ++ NV_TIMERSUB(&tm_end, &tm_aux, &tm_aux); // tm_aux = tm_end - tm_aux + MicroSeconds = tm_aux.tv_usec + tm_aux.tv_sec * 1000000; + } else + MicroSeconds = 0; +@@ -1109,6 +1076,18 @@ + { + void *vaddr; + ++ if (start == 0) ++ { ++ if (mode != NV_MEMORY_CACHED) ++ { ++ nv_printf(NV_DBG_ERRORS, ++ "NVRM: os_map_kernel_space: won't map address 0x%0llx UC!\n", start); ++ return NULL; ++ } ++ else ++ return (void *)PAGE_OFFSET; ++ } ++ + if (!NV_MAY_SLEEP()) + { + nv_printf(NV_DBG_ERRORS, +@@ -1131,6 +1110,9 @@ + U032 size_bytes + ) + { ++ if (addr == (void *)PAGE_OFFSET) ++ return; ++ + NV_IOUNMAP(addr, size_bytes); + } + +@@ -1176,7 +1158,11 @@ + #if defined(CONFIG_X86_REMOTE_DEBUG) + __asm__ __volatile__ ("int $3"); + #elif defined(CONFIG_KGDB) ++#if defined(NV_OLD_MM_KGDB_BREAKPOINT_PRESENT) ++ BREAKPOINT; ++#else + BREAKPOINT(); ++#endif + #elif defined(CONFIG_KDB) + KDB_ENTER(); + #else +diff -ru usr/src/nv/os-registry.c usr/src/nv.2305230/os-registry.c +--- usr/src/nv/os-registry.c 2008-01-21 11:48:11.000000000 -0800 ++++ usr/src/nv.2305230/os-registry.c 2008-03-18 12:56:07.492252151 -0700 +@@ -48,24 +48,6 @@ + * This could be changed to work on a per-device basis. + */ + +-/* +- * The 2nd argument to MODULE_PARM is used to verify parameters passed +- * to the module at load time. It should be a string in the following +- * format: +- * +- * [min[-max]]{b,h,i,l,s} +- * +- * The MIN and MAX specifiers delimit the length of the array. If MAX +- * is omitted, it defaults to MIN; if both are omitted, the default is +- * 1. The final character is a type specifier. +- * +- * b byte +- * h short +- * i int +- * l long +- * s string +- */ +- + /* + * Option: VideoMemoryTypeOverride + * +@@ -360,9 +342,6 @@ + static int NVreg_DevicesConnected = 0; + NV_MODULE_PARAMETER(NVreg_DevicesConnected); + +-static int NVreg_VideoEnhancement = 0; +-NV_MODULE_PARAMETER(NVreg_VideoEnhancement); +- + static int NVreg_RmLogonRC = 1; + NV_MODULE_PARAMETER(NVreg_RmLogonRC); + +@@ -402,34 +381,36 @@ + NV_MODULE_PARAMETER(NVreg_RemapLimit); + + /* +- * Option: UseCPA ++ * Option: UpdateMemoryTypes + * + * Description: + * +- * Many kernels have a broken implementation of change_page_attr that leads +- * to cache aliasing problems. x86_64 kernels between 2.6.0 and 2.6.10 will +- * force a kernel BUG_ON() when this condition is encountered. For this +- * reason, the NVIDIA driver is very careful about not using the CPA kernel +- * interface on these kernels. ++ * Many kernels have broken implementations of the change_page_attr() ++ * kernel interface that may cause cache aliasing problems. Linux/x86-64 ++ * kernels between 2.6.0 and 2.6.10 may prompt kernel BUG()s due to ++ * improper accounting in the interface's large page management code, for ++ * example. For this reason, the NVIDIA Linux driver is very careful about ++ * not using the change_page_attr() kernel interface on these kernels. ++ * ++ * Due to the serious nature of the problems that can arise from bugs in ++ * the change_page_attr(), set_pages_{uc,wb}() and other kernel interfaces ++ * used to modify memory types, the NVIDIA driver implements a manual ++ * registry key override to allow forcibly enabling or disabling use of ++ * these APIs. + * +- * Some distributions have backported this fix to kernel versions that fall +- * within this version range. The NVIDIA driver attempts to automatically +- * detect these fixes and reenable usage of the change_page_attr interface. ++ * Possible values: + * +- * Due to the serious nature of the problems that can arise from this, the +- * NVIDIA driver implements a manual registry key to force usage of this API +- * to be enabled or disabled. This registry key can be used to force usage +- * of the API on a known fixed kernel if the NVIDIA driver fails to detect +- * the kernel as fixed. This registry key can also be used to disable usage +- * of the API on a bad kernel that is misdetected as a fixed kernel. ++ * ~0 = use the NVIDIA driver's default logic (default) ++ * 0 = enable use of change_page_attr(), etc. ++ * 1 = disable use of change_page_attr(), etc. + * +- * The default value is '-1' (use NVIDIA driver default logic) +- * A value of '0' will forcibly disable change_page_attr calls. +- * A value of '1' will forcibly enable change_page_attr calls. ++ * By default, the NVIDIA driver will attempt to auto-detect if it can ++ * safely use the change_page_attr() and other kernel interfaces to modify ++ * the memory types of kernel mappings. + */ + +-static int NVreg_UseCPA = -1; +-NV_MODULE_PARAMETER(NVreg_UseCPA); ++static int NVreg_UpdateMemoryTypes = ~0; ++NV_MODULE_PARAMETER(NVreg_UpdateMemoryTypes); + + // 1 - Force sourcing vbios from ROM + // 0 - business as usual +@@ -477,15 +458,14 @@ + { "NVreg", "ResmanDebugLevel", &NVreg_ResmanDebugLevel, 1 }, + { "NVreg", "FlatPanelMode", &NVreg_FlatPanelMode, 1 }, + { "NVreg", "DevicesConnected", &NVreg_DevicesConnected, 1 }, +- { "NVreg", "VideoEnhancement", &NVreg_VideoEnhancement, 1 }, + { "NVreg", "RmLogonRC", &NVreg_RmLogonRC, 1 }, ++ { "NVreg", "VbiosFromROM", &NVreg_VbiosFromROM, 1 }, + { "NVreg", "ModifyDeviceFiles", &NVreg_ModifyDeviceFiles, 1 }, + { "NVreg", "DeviceFileUID", &NVreg_DeviceFileUID, 1 }, + { "NVreg", "DeviceFileGID", &NVreg_DeviceFileGID, 1 }, + { "NVreg", "DeviceFileMode", &NVreg_DeviceFileMode, 1 }, +- { "NVreg", "VbiosFromROM", &NVreg_VbiosFromROM, 1 }, + { "NVreg", "RemapLimit", &NVreg_RemapLimit, 1 }, +- { "NVreg", "UseCPA", &NVreg_UseCPA, 1 }, ++ { "NVreg", "UpdateMemoryTypes", &NVreg_UpdateMemoryTypes, 1 }, + { "NVreg", "RMEdgeIntrCheck", &NVreg_RMEdgeIntrCheck, 1 }, + { NULL, NULL, NULL, 0 } + }; diff --git a/abs/core-testing/nvidia-71xx/PKGBUILD b/abs/core-testing/nvidia-71xx/PKGBUILD new file mode 100644 index 0000000..3e5d589 --- /dev/null +++ b/abs/core-testing/nvidia-71xx/PKGBUILD @@ -0,0 +1,41 @@ +# Contributor : Alessandro Sagratini <ale_sagra@hotmail.com> + +pkgname=nvidia-71xx +pkgver=71.86.09 +_kernver='2.6.28-LinHES' +pkgrel=1 +pkgdesc="NVIDIA legacy drivers for kernel26-ice, 71xx branch" +arch=(i686 x86_64) +[ "$CARCH" = "i686" ] && ARCH=x86 +[ "$CARCH" = "x86_64" ] && ARCH=x86_64 +url="http://www.nvidia.com/" +depends=('nvidia-71xx-utils' 'kernel26') +conflicts=('nvidia' 'nvidia-96xx') +license=('custom') +source=(http://us.download.nvidia.com/XFree86/Linux-${ARCH}/${pkgver}/NVIDIA-Linux-${ARCH}-${pkgver}-pkg0.run + NVIDIA_kernel-96.43.05-2290218.diff.txt) +install="nvidia-71xx.install" +md5sums=('51ce70e2ba967a2bad1cf01ce25c7f76') +[ "$CARCH" = "x86_64" ] && md5sums=('9d102e8a6a1746423f0e0a231df63eeb' + 'f2d9c8605a0f655b3c5c9b2434b9dccd') + +build() { + cd $startdir/src + + # Extract + cd $startdir/src/ + sh NVIDIA-Linux-${ARCH}-${pkgver}-pkg0.run --extract-only + cd NVIDIA-Linux-${ARCH}-${pkgver}-pkg0 + # Any extra patches are applied in here... +# patch -Np0 -i ../NVIDIA_kernel-96.43.05-2290218.diff.txt || return 1 + + cd usr/src/nv/ + ln -s Makefile.kbuild Makefile + make SYSSRC=/lib/modules/$_kernver/build module + + # install kernel module + mkdir -p $startdir/pkg/lib/modules/${_kernver}/kernel/drivers/video/ + install -m644 nvidia.ko $startdir/pkg/lib/modules/${_kernver}/kernel/drivers/video/ + + sed -i -e "s/KERNEL_VERSION='.*'/KERNEL_VERSION='${_kernver}'/" $startdir/*.install +} diff --git a/abs/core-testing/nvidia-71xx/nvidia-71xx.install b/abs/core-testing/nvidia-71xx/nvidia-71xx.install new file mode 100644 index 0000000..0b44b8d --- /dev/null +++ b/abs/core-testing/nvidia-71xx/nvidia-71xx.install @@ -0,0 +1,23 @@ +# arg 1: the new package version +post_install() { + KERNEL_VERSION='2.6.28-LinHES' + depmod -v $KERNEL_VERSION > /dev/null 2>&1 +} + +# arg 1: the new package version +# arg 2: the old package version +post_upgrade() { + post_install $1 + rmmod nvidia >/dev/null 2>&1 || echo 'In order to use the new nvidia module, exit Xserver and unload it manually.' +} + +# arg 1: the old package version +post_remove() { + KERNEL_VERSION='2.6.28-LinHES' + depmod -v $KERNEL_VERSION > /dev/null 2>&1 + rmmod nvidia >/dev/null 2>&1 +} + +op=$1 +shift +$op $* diff --git a/abs/core-testing/perl_modules/perl-algorithm-diff/PKGBUILD b/abs/core-testing/perl_modules/perl-algorithm-diff/PKGBUILD index 38be2cc..d185772 100644 --- a/abs/core-testing/perl_modules/perl-algorithm-diff/PKGBUILD +++ b/abs/core-testing/perl_modules/perl-algorithm-diff/PKGBUILD @@ -2,13 +2,14 @@ # Maintainer: Charles Mauch <cmauch@gmail.com> pkgname=perl-algorithm-diff pkgver=1.1902 -pkgrel=3 +pkgrel=4 pkgdesc="Perl/CPAN Module Algorithm::Diff : Diff also Longest Common Subsequence" arch=("i686" "x86_64") url="http://search.cpan.org/TYEMQ/Algorithm-Diff" license=("GPL" "Artistic") source=("http://www.cpan.org/authors/id/T/TY/TYEMQ/Algorithm-Diff-1.1902.tar.gz") md5sums=("ff3e17ae485f8adfb8857b183991fbce") +groups=('shepherd-dep') build() { cd $startdir/src/Algorithm-Diff-1.1902 PERL_MM_USE_DEFAULT=1 perl Makefile.PL INSTALLDIRS=vendor || return 1 diff --git a/abs/core-testing/perl_modules/perl-digest-sha1/PKGBUILD b/abs/core-testing/perl_modules/perl-digest-sha1/PKGBUILD index 7a3a414..7bf6976 100644 --- a/abs/core-testing/perl_modules/perl-digest-sha1/PKGBUILD +++ b/abs/core-testing/perl_modules/perl-digest-sha1/PKGBUILD @@ -5,7 +5,7 @@ pkgname=perl-digest-sha1 _realname=Digest-SHA1 pkgver=2.11 -pkgrel=3 +pkgrel=4 pkgdesc="Perl Module: Interface to the SHA-1 Algorithm." arch=(i686 x86_64) license=('PerlArtistic') @@ -16,7 +16,7 @@ source=(http://www.cpan.org/authors/id/G/GA/GAAS/${_realname}-${pkgver}.tar.gz) replaces=('digest-sha1') provides=('digest-sha1') md5sums=('2449bfe21d6589c96eebf94dae24df6b') - +groups=('shepherd-dep') build() { cd ${startdir}/src/${_realname}-${pkgver} # install module in vendor directories. diff --git a/abs/core-testing/perl_modules/perl-javascript/PKGBUILD b/abs/core-testing/perl_modules/perl-javascript/PKGBUILD index 8ce00cb..564e2d9 100644 --- a/abs/core-testing/perl_modules/perl-javascript/PKGBUILD +++ b/abs/core-testing/perl_modules/perl-javascript/PKGBUILD @@ -1,7 +1,7 @@ pkgname=perl-javascript _realname=JavaScript pkgver=1.12 -pkgrel=1 +pkgrel=2 pkgdesc="get name of current working directory" arch=('i686' 'x86_64') url="http://search.cpan.org/~KWILLIAMS/Path-Class" @@ -11,6 +11,7 @@ depends=('perl>=5.10.0' spidermonkey) options=('!emptydirs') source=(http://search.cpan.org/CPAN/authors/id/C/CL/CLAESJAC/JavaScript-$pkgver.tar.gz) #source=(http://search.cpan.org/CPAN/authors/id/T/TB/TBUSCH/JavaScript-SpiderMonkey-0.19.tar.gz) +groups=('shepherd-dep') build() { cd $startdir/src/$_realname-$pkgver JS_INC=/usr/include/js PERL_MM_USE_DEFAULT=1 perl Makefile.PL INSTALLDIRS=vendor || return 1 diff --git a/abs/core-testing/perl_modules/perl-list-compare/PKGBUILD b/abs/core-testing/perl_modules/perl-list-compare/PKGBUILD index c1406c1..7480b98 100644 --- a/abs/core-testing/perl_modules/perl-list-compare/PKGBUILD +++ b/abs/core-testing/perl_modules/perl-list-compare/PKGBUILD @@ -4,12 +4,13 @@ pkgname=perl-list-compare _realname=List-Compare pkgver=0.37 -pkgrel=1 +pkgrel=2 pkgdesc="List::Compare - Compare elements of two or more lists" arch=(i686 x86_64) license=('PerlArtistic') url="http://search.cpan.org/dist/${_realname}/" depends=('perlxml' 'perl>=5.10.0') +groups=('shepherd-dep') options=('!emptydirs') source=(ftp://ftp.cpan.org/pub/CPAN/authors/id/J/JK/JKEENAN/${_realname}-${pkgver}.tar.gz) md5sums=('7c730dd58cc31a5bbb8eb7006edd1704') diff --git a/abs/core-testing/perl_modules/perl-pathtools/PKGBUILD b/abs/core-testing/perl_modules/perl-pathtools/PKGBUILD index 11e69ab..db11a6f 100644 --- a/abs/core-testing/perl_modules/perl-pathtools/PKGBUILD +++ b/abs/core-testing/perl_modules/perl-pathtools/PKGBUILD @@ -1,7 +1,7 @@ pkgname=perl-pathtools pkgver=3.29 -pkgrel=1 +pkgrel=2 pkgdesc="get name of current working directory" arch=('i686' 'x86_64') url="http://search.cpan.org/~KWILLIAMS/Path-Class" @@ -10,7 +10,7 @@ license=('GPL' 'PerlArtistic') depends=('perl>=5.10.0') options=('!emptydirs') source=(http://search.cpan.org/CPAN/authors/id/S/SM/SMUELLER/PathTools-$pkgver.tar.gz) - +groups=('shepherd-dep') build() { cd $startdir/src/PathTools-$pkgver PERL_MM_USE_DEFAULT=1 perl Makefile.PL INSTALLDIRS=vendor || return 1 diff --git a/abs/core-testing/plextor-convertX-driver/PKGBUILD b/abs/core-testing/plextor-convertX-driver/PKGBUILD index fb503fb..14ecfdc 100755 --- a/abs/core-testing/plextor-convertX-driver/PKGBUILD +++ b/abs/core-testing/plextor-convertX-driver/PKGBUILD @@ -2,28 +2,30 @@ pkgname=plextor-convertX-driver pkgver=0.9.8 -pkgrel=3 -_kernver=2.6.27-ARCH +pkgrel=6 +_kernver=2.6.28-LinHES pkgdesc="Drivers for Plextor tuners" arch=(i686 x86_64) url="http://nikosapi.org/software/WIS_Go7007" install="convertX.install" -source=("http://nikosapi.org/software/WIS_Go7007/wis-go7007-linux-0.9.8-2.tar.bz2" 'wis-go7007-2.6.26-nopage.diff' 'wis-go7007-linux-0.9.8-2-2.6.27.patch') +source=("http://go7007.imploder.org/wp-content/uploads/2009/02/wis-go7007-linux-098-4tar.bz2" 'wis-go7007-2.6.26-nopage.diff' 'wis-go7007-linux-0.9.8-2-2.6.27.patch') depends=('udev>=070' 'fxload') makedepends=('gcc') +options=(!strip) build() { # SET UP - cd $startdir/src/wis-go7007-linux-0.9.8-2 || return 1 - patch -Np1 -i ../wis-go7007-2.6.26-nopage.diff || return 1 - patch -Np1 -i ../wis-go7007-linux-0.9.8-2-2.6.27.patch || return 1 + cd $startdir/src/wis-go7007-linux-0.9.8-4 || return 1 +# patch -Np1 -i ../wis-go7007-2.6.26-nopage.diff || return 1 +# patch -Np1 -i ../wis-go7007-linux-0.9.8-2-2.6.27.patch || return 1 # build make clean || return 1 make || return 1 mkdir -p $startdir/pkg/usr/src/linux-$_kernver/include/linux mkdir -p $startdir/pkg/etc/udev/rules.d mkdir -p $startdir/pkg/usr/bin + mkdir -p $startdir/pkg/usr/sbin # install make DESTDIR=$startdir/pkg install || return 1 install -m755 apps/gorecord $startdir/pkg/usr/bin/gorecord diff --git a/abs/core-testing/plextor-convertX-driver/convertX.install b/abs/core-testing/plextor-convertX-driver/convertX.install index 8dfd0b7..8081c6a 100755 --- a/abs/core-testing/plextor-convertX-driver/convertX.install +++ b/abs/core-testing/plextor-convertX-driver/convertX.install @@ -5,7 +5,7 @@ pre_install() { post_install() { # updating module dependencies echo ">>> Updating module dependencies. Please wait ..." - KERNEL_VERSION=2.6.17-STB + KERNEL_VERSION=2.6.28-LinHES depmod -v $KERNEL_VERSION > /dev/null 2>&1 /bin/true } @@ -13,7 +13,7 @@ post_install() { post_upgrade() { # updating module dependencies echo ">>> Updating module dependencies. Please wait ..." - KERNEL_VERSION=2.6.17-STB + KERNEL_VERSION=2.6.28-LinHES depmod -v $KERNEL_VERSION > /dev/null 2>&1 /bin/true } @@ -21,7 +21,7 @@ post_upgrade() { post_remove() { # updating module dependencies echo ">>> Updating module dependencies. Please wait ..." - KERNEL_VERSION=2.6.17-STB + KERNEL_VERSION=2.6.28-LinHES depmod -v $KERNEL_VERSION > /dev/null 2>&1 /bin/true } diff --git a/abs/core-testing/smbclient/PKGBUILD b/abs/core-testing/smbclient/PKGBUILD index 349572b..e2aaedd 100644 --- a/abs/core-testing/smbclient/PKGBUILD +++ b/abs/core-testing/smbclient/PKGBUILD @@ -1,17 +1,17 @@ -# $Id: PKGBUILD 34454 2009-04-09 12:39:47Z tpowa $ +# $Id: PKGBUILD 37507 2009-05-02 15:44:09Z tpowa $ # Maintainer: Jan de Groot <jgc@archlinux.org> pkgname=smbclient -pkgver=3.3.3 +pkgver=3.3.4 # We use the 'A' to fake out pacman's version comparators. Samba chooses # to append 'a','b',etc to their subsequent releases, which pacman # misconstrues as alpha, beta, etc. Bad samba! -_realver=3.3.3 +_realver=3.3.4 pkgrel=1 pkgdesc="Tools to access a server's filespace and printers via SMB" arch=(i686 x86_64) url="http://www.samba.org" license=('GPL3') -depends=('popt' 'libldap' 'libcap>=2.16' 'heimdal>=1.2-1' 'db>=4.7' 'tdb=3.3.3') +depends=('popt' 'libldap' 'libcap>=2.16' 'heimdal>=1.2-1' 'db>=4.7' 'tdb=3.3.4') source=(http://us1.samba.org/samba/ftp/samba-${_realver}.tar.gz) options=(!makeflags) @@ -54,4 +54,4 @@ build() { done install -m644 ../docs/manpages/libsmbclient.7 ${pkgdir}/usr/share/man/man7/ } -md5sums=('4d5835817416d1ffa30783af45c5a9ed') +md5sums=('1443165edb7cb3f56f1e77aec1ee3266') diff --git a/abs/core-testing/tdb/PKGBUILD b/abs/core-testing/tdb/PKGBUILD index 88f37dc..e908119 100644 --- a/abs/core-testing/tdb/PKGBUILD +++ b/abs/core-testing/tdb/PKGBUILD @@ -1,14 +1,14 @@ -# $Id: PKGBUILD 22194 2008-12-22 21:57:23Z tpowa $ +# $Id: PKGBUILD 37511 2009-05-02 16:17:09Z tpowa $ # Maintainer: eric <eric@archlinux.org> # Contributor: Tom Newsom <Jeepster@gmx.co.uk> pkgname=tdb -pkgver=3.2.6 -pkgrel=2 +pkgver=3.3.4 +pkgrel=1 # We use the 'A' to fake out pacman's version comparators. Samba chooses # to append 'a','b',etc to their subsequent releases, which pamcan # misconstrues as alpha, beta, etc. Bad samba! -_realver=3.2.6 +_realver=3.3.4 pkgdesc="A Trivial Database similar to GDBM but allows simultaneous commits" arch=(i686 x86_64) license=('GPL3') @@ -22,7 +22,7 @@ build() { ./configure --prefix=/usr make || return 1 make DESTDIR=$startdir/pkg install - ln -sf /usr/lib/libtdb.so.1.1.1 ${pkgdir}/usr/lib/libtdb.so.1 - ln -sf /usr/lib/libtdb.so.1.1.1 ${pkgdir}/usr/lib/libtdb.so + ln -sf /usr/lib/libtdb.so.1.1.2 ${pkgdir}/usr/lib/libtdb.so.1 + ln -sf /usr/lib/libtdb.so.1.1.2 ${pkgdir}/usr/lib/libtdb.so } -md5sums=('0cd27c7afbb8211616eea4010f32271c') +md5sums=('1443165edb7cb3f56f1e77aec1ee3266') diff --git a/abs/core-testing/tweaker/PKGBUILD b/abs/core-testing/tweaker/PKGBUILD index f546293..9617e49 100644 --- a/abs/core-testing/tweaker/PKGBUILD +++ b/abs/core-testing/tweaker/PKGBUILD @@ -1,6 +1,6 @@ pkgname=tweaker pkgver=1 -pkgrel=29 +pkgrel=31 pkgdesc="" arch=('i686' 'x86_64') diff --git a/abs/core-testing/tweaker/bin/twk_cpu.pl b/abs/core-testing/tweaker/bin/twk_cpu.pl index fb256cb..118bac1 100755 --- a/abs/core-testing/tweaker/bin/twk_cpu.pl +++ b/abs/core-testing/tweaker/bin/twk_cpu.pl @@ -84,7 +84,7 @@ sub implement_option { # } } case "medium" { - change_or_make_setting('AutoCommflagWhileRecording', '0') || exit -1; + change_or_make_setting('AutoCommflagWhileRecording', '1') || exit -1; change_or_make_setting('Theme', 'LinHES') || exit -1; # Moderate eye candy, moderate performance #change_or_make_setting('PreferredMPEG2Decoder', 'libmpeg2') || exit -1; # Least CPU usage, lowest quality #change_or_make_entry("displayprofiles", [["pref_decoder", "libmpeg2"]], [["profilegroupid", "1"], ["profileid", "1"]]) || exit -1; # Least CPU usage, lowest quality @@ -94,7 +94,7 @@ sub implement_option { case "high" { change_or_make_setting('AutoCommflagWhileRecording', '1') || exit -1; # ??? Interacts with screen aspect ratio - change_or_make_setting('Theme', 'LinHES') || exit -1; # High eye candy, potentially low performance + change_or_make_setting('Theme', 'LinHES') || exit -1; # Moderate eye candy, moderate performance #change_or_make_entry("displayprofiles", [["pref_decoder", "ffmpeg"]], [["profilegroupid", "1"], ["profileid", "1"]]) || exit -1; # Most CPU usage, best quality #change_or_make_setting('PreferredMPEG2Decoder', 'ffmpeg') || exit -1; # Most CPU usage, best quality change_or_make_setting('DefaultVideoPlaybackProfile', 'CPU++') || exit -1; # best playback defaults for powerful hardware diff --git a/abs/core-testing/tweaker/bin/twk_general.pl b/abs/core-testing/tweaker/bin/twk_general.pl index 5b48bda..387920c 100755 --- a/abs/core-testing/tweaker/bin/twk_general.pl +++ b/abs/core-testing/tweaker/bin/twk_general.pl @@ -407,12 +407,11 @@ sub implement_option { change_or_make_setting('StartupSecsBeforeRecording', '120'); change_or_make_setting('TruncateDeletesSlowly', '1'); change_or_make_setting('UseOutputPictureControls', '1'); - change_or_make_setting('UserJob1', 'myth2ipod -cut \"%DIR%\" \"%FILE%\"'); - change_or_make_setting('UserJob2', 'myt2xvid3 -cut \"%DIR%\" \"%FILE%\"'); - change_or_make_setting('UserJobDesc1', 'Encode for iPod'); - change_or_make_setting('UserJobDesc2', 'Transcode to XviD'); + change_or_make_setting('UserJob4', 'myth2mp3 -cut \"%DIR%\" \"%FILE%\"'); + change_or_make_setting('UserJobDesc1', 'User Job #1'); + change_or_make_setting('UserJobDesc2', 'User Job #2'); change_or_make_setting('UserJobDesc3', 'User Job #3'); - change_or_make_setting('UserJobDesc4', 'User Job #4'); + change_or_make_setting('UserJobDesc4', 'Extract audio'); change_or_make_setting('VCDPlayerCommand', 'mplayer vcd:\/\/ -cdrom-device %d -fs -zoom -vo xv -vf pp=lb'); change_or_make_setting('VideoArtworkDir', "$SQL_DirVideo/.covers"); change_or_make_setting('VideoBrowserNoDB', '1'); diff --git a/abs/core-testing/tweaker/bin/twk_keymap.sh b/abs/core-testing/tweaker/bin/twk_keymap.sh index 7e4ef8b..2aa38ee 100755 --- a/abs/core-testing/tweaker/bin/twk_keymap.sh +++ b/abs/core-testing/tweaker/bin/twk_keymap.sh @@ -69,5 +69,3 @@ else echo "ERROR: /etc/mplayer/input.conf is missing, which is unexpected." exit -1 fi - -echo "Tweaked keymap"
\ No newline at end of file |