Author Topic: AV Wizard does not run - 10.04  (Read 14078 times)

tmwillett

  • Veteran
  • ***
  • Posts: 63
    • View Profile
AV Wizard does not run - 10.04
« on: January 02, 2012, 11:26:29 pm »
I've just completed a fresh install of 10.04 and after I ran the install script and rebooted, the system went straight into LMCE with UI1 and never prompted for the AV Wizard.  I've tried the following with no joy:

- Hold shift key down during boot cycle - no joy
- Run command line to start AV wizard (/usr/pluto/bin/AVWizard_Run.sh) - no joy
- Edit /etc/pluto.conf to launch AV Wizard - no joy
- Edit /etc/pluto.conf to launch as first boot - no joy
- From the Advanced Menu, selected Audio and Video Wizard - no joy

Basically, I can't get the AV Wizard to run at all.  It never gives me an error, it just doesn't run.

Any thoughts before I blow it away and re-install??

Thanks!

l3mce

  • NEEDS to work for LinuxMCE
  • ***
  • Posts: 1084
    • View Profile
Re: AV Wizard does not run - 10.04
« Reply #1 on: January 02, 2012, 11:39:35 pm »
Code: [Select]
apt-get install pluto-avwizard
apt-get install pluto-avwizard-skin-basic
apt-get install pluto-avwizard-sounds
apt-get install msttcorefonts
/usr/pluto/bin/RebootWithAVWizard.sh

One of those is almost guaranteed to not be installed already. The last will do exactly what you expect.
I never quit... I just ping out.

tmwillett

  • Veteran
  • ***
  • Posts: 63
    • View Profile
Re: AV Wizard does not run - 10.04
« Reply #2 on: January 03, 2012, 03:35:06 am »
Thanks..  I checked and all of those packages are already installed.  I did the reboot script and it still just went straight into UI1 w/o bringing up the AV Wizard..

(apt-get update was done first)
Reading package lists... Done
dcerouter_1024693:~# apt-get install pluto-avwizard
Reading package lists... Done
Building dependency tree       
Reading state information... Done
pluto-avwizard is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
dcerouter_1024693:~# apt-get install pluto-avwizard-skin-basic
Reading package lists... Done
Building dependency tree       
Reading state information... Done
pluto-avwizard-skin-basic is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
dcerouter_1024693:~# apt-get install pluto-avwizard-sounds
Reading package lists... Done
Building dependency tree       
Reading state information... Done
pluto-avwizard-sounds is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
dcerouter_1024693:~# apt-get install msttcorefonts
Reading package lists... Done
Building dependency tree       
Reading state information... Done
msttcorefonts is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Any other ideas?

l3mce

  • NEEDS to work for LinuxMCE
  • ***
  • Posts: 1084
    • View Profile
Re: AV Wizard does not run - 10.04
« Reply #3 on: January 03, 2012, 05:39:45 am »
Can you post your latest and your largest (assuming they are not the same) /var/log/pluto/AVWizard_Run_*.log please?
I never quit... I just ping out.

tmwillett

  • Veteran
  • ***
  • Posts: 63
    • View Profile
Re: AV Wizard does not run - 10.04
« Reply #4 on: January 03, 2012, 05:49:11 am »
Sure thing.  Here you go.  This was the last log entry from when I did the reboot with AVWiz script per your suggestion..  All of the log files are about the same in size.  I'm posting the last one, but if you want the first log, I can post it as well.  The system was built and rebooted this morning, so the 9:49 entry is the first boot with LMCE installed:

-rw-r--r-- 1 root root 12295 2012-01-02 09:49 AVWizard_Run_20120102_094915.log
-rw-r--r-- 1 root root 12242 2012-01-02 09:49 AVWizard_Run_20120102_094923.log
-rw-r--r-- 1 root root 13019 2012-01-02 11:53 AVWizard_Run_20120102_115348.log
-rw-r--r-- 1 root root 13019 2012-01-02 11:53 AVWizard_Run_20120102_115349.log
-rw-r--r-- 1 root root 13764 2012-01-02 12:14 AVWizard_Run_20120102_121425.log
-rw-r--r-- 1 root root 13022 2012-01-02 12:14 AVWizard_Run_20120102_121426.log
-rw-r--r-- 1 root root 13022 2012-01-02 12:16 AVWizard_Run_20120102_121650.log
-rw-r--r-- 1 root root 13022 2012-01-02 12:16 AVWizard_Run_20120102_121651.log
-rw-r--r-- 1 root root 13022 2012-01-02 12:25 AVWizard_Run_20120102_122522.log
-rw-r--r-- 1 root root 13022 2012-01-02 12:25 AVWizard_Run_20120102_122523.log
-rw-r--r-- 1 root root 13437 2012-01-02 12:35 AVWizard_Run_20120102_123506.log
-rw-r--r-- 1 root root 13434 2012-01-02 12:36 AVWizard_Run_20120102_123656.log
-rw-r--r-- 1 root root 13434 2012-01-02 16:00 AVWizard_Run_20120102_160042.log
-rw-r--r-- 1 root root 13434 2012-01-02 16:00 AVWizard_Run_20120102_160043.log
-rw-r--r-- 1 root root 13434 2012-01-02 16:08 AVWizard_Run_20120102_160845.log
-rw-r--r-- 1 root root 13434 2012-01-02 16:08 AVWizard_Run_20120102_160846.log
-rw-r--r-- 1 root root 13203 2012-01-02 16:15 AVWizard_Run_20120102_161541.log
-rw-r--r-- 1 root root 13203 2012-01-02 16:15 AVWizard_Run_20120102_161542.log
-rw-r--r-- 1 root root 13208 2012-01-02 19:36 AVWizard_Run_20120102_193658.log
-rw-r--r-- 1 root root 13208 2012-01-02 19:36 AVWizard_Run_20120102_193659.log
-rw-r--r-- 1 root root 13208 2012-01-02 19:44 AVWizard_Run_20120102_194429.log

dcerouter_1024693:/var/log/pluto# cat AVWizard_Run_20120102_194429.log
(EDITED)
+ Enable_Audio_Channels
+ amixer sset IEC958 unmute
amixer: Mixer default load error: Invalid argument
+ amixer sset 'IEC958 1' unmute
amixer: Mixer default load error: Invalid argument
+ amixer sset IEC958,0 unmute
amixer: Mixer default load error: Invalid argument
+ amixer sset IEC958,1 unmute
amixer: Mixer default load error: Invalid argument
+ amixer sset 'IEC958 Default PCM' unmute
amixer: Mixer default load error: Invalid argument
+ amixer sset Beep,0 unmute
amixer: Mixer default load error: Invalid argument
+ alsactl store
alsactl: get_control:239: Cannot read control info '2,0,0,Front Playback Volume,0': Invalid argument
+ VerifyExitCode 'Storing audio channel settings failed'
+ local EXITCODE=22
+ '[' 22 '!=' 0 ']'
+ echo 'An error (Exit code 22) occured during the last action'
An error (Exit code 22) occured during the last action
+ echo 'Storing audio channel settings failed'
Storing audio channel settings failed
+ exit 1
+ StatsMessage Exiting
++ date
+ printf 'Mon Jan  2 19:44:30 CST 2012 - Exiting \n'
Mon Jan  2 19:44:30 CST 2012 - Exiting
++ echo 1
« Last Edit: January 03, 2012, 04:35:46 pm by tmwillett »

toppot

  • Veteran
  • ***
  • Posts: 52
    • View Profile
Re: AV Wizard does not run - 10.04
« Reply #5 on: January 03, 2012, 08:51:59 am »
I've just completed a fresh install of 10.04 and after I ran the install script and rebooted, the system went straight into LMCE with UI1 and never prompted for the AV Wizard.  I've tried the following with no joy:

- Hold shift key down during boot cycle - no joy
- Run command line to start AV wizard (/usr/pluto/bin/AVWizard_Run.sh) - no joy
- Edit /etc/pluto.conf to launch AV Wizard - no joy
- Edit /etc/pluto.conf to launch as first boot - no joy
- From the Advanced Menu, selected Audio and Video Wizard - no joy

Basically, I can't get the AV Wizard to run at all.  It never gives me an error, it just doesn't run.

Any thoughts before I blow it away and re-install??

Thanks!


I had exactly the same experience with 1004 - except I never tried to rectify since it is supposed to be running as the core only, hence I do not care about which settings for the almost unused MD functionality it has - mine is running under VMWare Server, so I desired UI1 in a low resolution anyway :-)

I believe I made a thread about this here, but it did not catch any attention, and since it didn't made any difference for me, I did no follow up... Now it does make a difference (to you), so please let me know if I can assist with logs, debugging or anything else :-)

-Tony

l3mce

  • NEEDS to work for LinuxMCE
  • ***
  • Posts: 1084
    • View Profile
Re: AV Wizard does not run - 10.04
« Reply #6 on: January 03, 2012, 04:03:54 pm »
Ok... so it is an audio problem.

Can you edit that post and get rid of everything from the log before
+ Enable_Audio_Channels

In LMCE do you have any audio? I would guess not.
Can you tell me what hardware you are running? Specifically the motherboard?

Also try running alsamixer in a terminal and unmute everything if you can get to it. Please tell me the results.

If everything is working but AVWizard, open AVWizard_Run.sh, and change the following as an experiment.
From
Code: [Select]
Enable_Audio_Channels () {
# Added this to correctly unmute channels for setup wizard
amixer sset "IEC958" unmute
amixer sset "IEC958 1" unmute
amixer sset 'IEC958',0 unmute
amixer sset 'IEC958',1 unmute
amixer sset 'IEC958 Default PCM' unmute
amixer sset 'Beep',0 unmute
alsactl store
VerifyExitCode "Storing audio channel settings failed"
}

To
Code: [Select]
Enable_Audio_Channels () {
# Added this to correctly unmute channels for setup wizard
amixdigital=$(amixer | grep Simple | grep IEC | cut -d' ' -f4,5,6 | sort | uniq)
   for output in $amixdigital
      do amixer sset $output unmute
   done
VerifyExitCode "Storing audio channel settings failed"
}

And reboot with AVWizard
If that works, I will submit a ticket for fix.
« Last Edit: January 03, 2012, 04:19:09 pm by l3mce »
I never quit... I just ping out.

tmwillett

  • Veteran
  • ***
  • Posts: 63
    • View Profile
Re: AV Wizard does not run - 10.04
« Reply #7 on: January 03, 2012, 04:51:08 pm »
Ok, I edited the log above and my hardware is:

ASUS P5G41T-M LX Motherboard with 4GB SDRAM and a 2.4 Ghz Dual-Core Intel LGA-775 CPU
It has an Intel Graphics GPU (GMA X4500) and ALC887 HD Audio
I was running the final release of 8.10 LMCE on the system, but MythTV was giving me issues on my MD's so I decided to try 10.04 to get a later version of MythTV as well as some other features.

Running alsamixer didn't work.  I got the following:

dcerouter_1024693:/var/log/pluto# alsamixer
cannot load mixer controls: Invalid argument

I've got other sound cards I could install vs. the one on the motherboard.  I didn't try the rest of your suggestion since it wasn't working past alsamixer..

Should I try another sound card or do you want to gather more information before I try that?  It was working fine under 8.10 (both video and audio)

Thanks!

l3mce

  • NEEDS to work for LinuxMCE
  • ***
  • Posts: 1084
    • View Profile
Re: AV Wizard does not run - 10.04
« Reply #8 on: January 03, 2012, 04:55:47 pm »
Another card might work, but this should too, so I am more concerned with why it didn't.

try
apt-get install alsa-base --reinstall

and run alsamixer again after reboot
I never quit... I just ping out.

tmwillett

  • Veteran
  • ***
  • Posts: 63
    • View Profile
Re: AV Wizard does not run - 10.04
« Reply #9 on: January 03, 2012, 06:31:04 pm »
No joy.  It occurred to me that when Sarah was running me through the initial set up, I had sound then.  I just reinstalled my ASUS audio drivers and still no change.  I'm going to rebuild and try it again with a fresh install.  I'll post again to let you know if it worked or not.

l3mce

  • NEEDS to work for LinuxMCE
  • ***
  • Posts: 1084
    • View Profile
Re: AV Wizard does not run - 10.04
« Reply #10 on: January 04, 2012, 08:24:27 pm »
Well... lets back up a little...

What is your video hardware? Are you using an nvidia card?

How are you trying to get audio, over what connection?

what is the output of aplay -l?
I never quit... I just ping out.

tmwillett

  • Veteran
  • ***
  • Posts: 63
    • View Profile
Re: AV Wizard does not run - 10.04
« Reply #11 on: January 05, 2012, 03:04:44 am »
Sorry, I already blew it away.  It has an Intel Graphics GPU (GMA X4500) and ALC887 HD Audio which both worked under 8.10 but not under 10.04.

kalios

  • Newbie
  • *
  • Posts: 14
    • View Profile
Re: AV Wizard does not run - 10.04
« Reply #12 on: March 24, 2012, 08:28:43 pm »
Code: [Select]
apt-get install pluto-avwizard
apt-get install pluto-avwizard-skin-basic
apt-get install pluto-avwizard-sounds
apt-get install msttcorefonts
/usr/pluto/bin/RebootWithAVWizard.sh


I had a problem with installing msttcorefonts, it was timing out when retrieving files from sourceforge. Looked into finding the best way to increase dns timeout period. Used this guide

http://ubuntuforums.org/showpost.php?p=7902019&postcount=33

just followed the quick summary. Installed resolvconf and pdnsd.

Not sure if this breaks anything later on. But will see.




gtsupport

  • Veteran
  • ***
  • Posts: 147
    • View Profile
Re: AV Wizard does not run - 10.04
« Reply #13 on: April 05, 2012, 10:42:49 am »
Hi, did you have any luck resolving this??

I have just installed a clean 1004 system with Linuxmce over the top using the internet installation method.  I can't run the AVWizard, and there are no logs for it either. It hasn't run automatically, and won't run even after typing the rebootwithavwizard command.

Just noticed that when loading, a message tells me that there is no Xorg.conf file, so its loading Nvidia drivers.....etc.
What is happening to my Xorg.conf file? I tried updating to the latest Nvidia driver version, then checking to see if the xorg.conf file is present. It is, so why should it be gone the next time the machine reboots?

Anybody else having problems, or have suggestions?

Matt
« Last Edit: April 05, 2012, 12:42:03 pm by gtsupport »
LinuxMCE - If it was easy, everybody would be doing it!!

l3mce

  • NEEDS to work for LinuxMCE
  • ***
  • Posts: 1084
    • View Profile
Re: AV Wizard does not run - 10.04
« Reply #14 on: April 05, 2012, 03:39:26 pm »
That is my fault.

The next build should be resolved. Sorry for the confusion. In the meantime you can replace your /usr/pluto/bin/Utils.sh file with this.
Code: [Select]
#!/bin/bash

if [[ -n "$HEADER_Utils" ]]; then
    return 0
fi
HEADER_Utils=included

. /usr/pluto/bin/SQL_Ops.sh
. /usr/pluto/bin/Config_Ops.sh

DEVICETEMPLATE_OnScreen_Orbiter=62
DEVICEDATA_Use_OpenGL_effects=172
DEVICEDATA_Use_alpha_blended_UI=169
DEVICEDATA_PK_UI=104

function AddBookmark {
    return 0
    Url="$1"
    Name="$2"

    [[ ! -f /home/public/bookmarks.html ]] || return 0

    # Generate an id for this bookmark
    ID=$(echo "$Url" | sha1sum)
    ID='rdf:#$'${ID:0:6}

    # Generate the bookmark entry
    Bookmark='   <DT><A HREF="'$Url'" ADD_DATE="1126869382" LAST_MODIFIED="1126869442" ID="'$ID'">'$Name'</A>'
    Bookmark=$(echo $Bookmark | sed 's/"/\\\"/g')

    for BookmarksFile in /home/public/bookmarks.html /home/user_*/bookmarks.html ;do
        # See if the bookmark is already there
        if grep -q "ID=\"$ID\"" $BookmarksFile ;then
            continue
        fi

        # Add the bookmark string to the file
        awk '
            BEGIN { HR=0 }
            HR==0 && /<HR>/ {print "'"$Bookmark"'"; HR=1}
            {print}
        ' $BookmarksFile > $BookmarksFile.$$
        mv $BookmarksFile.$$ $BookmarksFile
    done

}

function DelBookmark {
    return 0
    Url="$1"
    Name="$2"

    [[ ! -f /home/public/bookmarks.html ]] || return 0

    # Generate an id for this bookmark
    ID=$(echo "$Url" | sha1sum)
    ID='rdf:#$'${ID:0:6}
   
    for BookmarksFile in /home/public/bookmarks.html /home/user_*/bookmarks.html ;do
        grep -v "ID=\"$ID\"" $BookmarksFile >> $BookmarksFile.$$
        mv $BookmarksFile.$$ $BookmarksFile
    done
}

TranslateSerialPort()
{
    local SearchFor="$1"
    local PCI USB

    SerialPort=
    if [[ "$SearchFor" == pci* ]]; then
        if [[ -d /sys/class/tty ]]; then
            pushd /sys/class/tty &>/dev/null
            for dev in ttyUSB*/device ttyACM*/device; do
                id=$(readlink -f "$dev" | sed -r 's,^.*(pci.*)/usb[0-9]*/[0-9./-]*/[0-9]*-([0-9.]*):[0-9.]*(/ttyUSB[0-9]*)?$,\1+\2,g')
                if [[ "$id" == "$SearchFor" ]]; then
                    SerialPort="/dev/$(dirname "$dev")"
                    break;
                fi
            done
            popd &>/dev/null
        fi
    else
        SerialPort="$SearchFor"
    fi

    builtin echo "$SerialPort"
}

TranslateSoundCard()
{
    local SoundCard="$1" AlsaCard=
    local PCI USB
    local Cards Card Dev

    if [[ -d /sys/class/sound && "$SoundCard" == pci* ]]; then
        if [[ "$SoundCard" == *+* ]]; then
            PCI="${SoundCard%+*}"
            USB="${SoundCard#*+}"
        else
            PCI="${SoundCard}"
            USB=
        fi
        pushd /sys/class/sound &>/dev/null
        Cards=$(find -name 'controlC*')
        for Card in $Cards; do
            Card="${Card#./}"
            Dev=$(readlink "$Card/device"|cut -f3 -d/)
            if [[ -n "$USB" ]]; then
                if [[ "$Dev" == *"$PCI"*usb*"$USB:"* ]]; then
                    AlsaCard="${Card#controlC}"
                    break
                fi
            else
                if [[ "$PCI" == *"$Dev" ]]; then
                    AlsaCard="${Card#controlC}"
                    break
                fi
            fi
        done
        popd &>/dev/null
    fi

    builtin echo "$AlsaCard"
}

UseAlternativeLibs()
{
    export LD_LIBRARY_PATH=/opt/libsdl/lib:/opt/libxine/lib:/opt/libsdl1.2-1.2.7+1.2.8cvs20041007/lib:/opt/linphone-1.3.5/lib
}

function ListTemplates_Category {
    local FK_DeviceCategory_Parent="$1"
    local PK_DeviceTemplate_List=""
    local PK_DeviceCategory=""
    local PK_DeviceTemplate=""

    R=$(RunSQL "SELECT PK_DeviceCategory FROM DeviceCategory WHERE FK_DeviceCategory_Parent = $FK_DeviceCategory_Parent")
    for PK_DeviceCategory in $R ;do
        PK_DeviceTemplate_List="$PK_DeviceTemplate_List $(ListTemplates_Category "$PK_DeviceCategory")"
    done

    R=$(RunSQL "SELECT PK_DeviceTemplate FROM DeviceTemplate WHERE FK_DeviceCategory=$FK_DeviceCategory_Parent")
    for PK_DeviceTemplate in $R ;do
        PK_DeviceTemplate_List="$PK_DeviceTemplate_List $PK_DeviceTemplate"
    done

    echo $PK_DeviceTemplate_List
}


FindDevice_Template()
{
    local PK_Device_Parent="${1//\'}" FK_DeviceTemplate="${2//\'}" NoRecursion="$3" IncludeParent="$4" All="$5"
    local Limit Found=0

    if [[ -z "$PK_Device_Parent" || -z "$FK_DeviceTemplate" ]]; then
        echo ""
        return 1
    fi

    if [[ -z "$All" ]]; then
        Limit="LIMIT 1"
    fi

    local i R Q
    if [[ "$PK_Device_Parent" == 0 ]]; then
        Q="
            SELECT PK_Device
            FROM Device
            WHERE FK_Device_ControlledVia IS NULL AND FK_DeviceTemplate IN ($FK_DeviceTemplate)
            $Limit
        "
    elif [[ -z "$IncludeParent" ]]; then
        Q="
            SELECT PK_Device
            FROM Device
            WHERE FK_Device_ControlledVia='$PK_Device_Parent' AND FK_DeviceTemplate IN ($FK_DeviceTemplate)
            $Limit
        "
    else
        Q="
            SELECT PK_Device
            FROM Device
            WHERE (FK_Device_ControlledVia='$PK_Device_Parent' OR PK_Device='$PK_Device_Parent') AND FK_DeviceTemplate IN ($FK_DeviceTemplate))
            $Limit
        "
    fi
    R="$(RunSQL "$Q")"

    if [[ -n "$R" ]]; then
        echo "$R"
    fi

    if [[ ( -z "$R" || -n "$All" ) && -z "$NoRecursion" ]]; then
        Q="SELECT PK_Device FROM Device WHERE FK_Device_ControlledVia='$PK_Device_Parent'"
        R="$(RunSQL "$Q")"
        for i in $R; do
            if FindDevice_Template "$i" "$FK_DeviceTemplate" "" "" "$All"; then
                if [[ -z "$All" ]]; then
                    return 0
                else
                    Found=1
                fi
            fi
        done
    else
        return 1
    fi

    [[ "$Found" -eq 1 ]]
    return $?
}

FindDevice_Category()
{
    local PK_Device_Parent="${1//\'}" FK_DeviceCategory="${2//\'}" NoRecursion="$3" IncludeParent="$4" All="$5"
    local Limit Found=0

    if [[ -z "$PK_Device_Parent" || -z "$FK_DeviceCategory" ]]; then
        echo ""
        return 1
    fi

    if [[ -z "$All" ]]; then
        Limit="LIMIT 1"
    fi

    local i R Q
    if [[ "$PK_Device_Parent" == 0 ]]; then
        Q="
            SELECT PK_Device
            FROM Device
            JOIN DeviceTemplate ON FK_DeviceTemplate=PK_DeviceTemplate
            WHERE FK_Device_ControlledVia IS NULL AND FK_DeviceCategory IN ($FK_DeviceCategory)
            $Limit
        "
    elif [[ -z "$IncludeParent" ]]; then
        Q="
            SELECT PK_Device
            FROM Device
            JOIN DeviceTemplate ON FK_DeviceTemplate=PK_DeviceTemplate
            WHERE FK_Device_ControlledVia='$PK_Device_Parent' AND FK_DeviceCategory IN ($FK_DeviceCategory)
            $Limit
        "
    else
        Q="
            SELECT PK_Device
            FROM Device
            JOIN DeviceTemplate ON FK_DeviceTemplate=PK_DeviceTemplate
            WHERE (FK_Device_ControlledVia='$PK_Device_Parent' OR PK_Device='$PK_Device_Parent') AND FK_DeviceCategory IN ($FK_DeviceCategory)
            $Limit
        "
    fi
    R="$(RunSQL "$Q")"

    if [[ -n "$R" ]]; then
        echo "$R"
    fi

    if [[ ( -z "$R" || -n "$All" ) && -z "$NoRecursion" ]]; then
        Q="SELECT PK_Device FROM Device WHERE FK_Device_ControlledVia='$PK_Device_Parent'"
        R="$(RunSQL "$Q")"
        for i in $R; do
            if FindDevice_Category "$i" "$FK_DeviceCategory" "" "" "$All"; then
                if [[ -z "$All" ]]; then
                    return 0
                else
                    Found=1
                fi
            fi
        done
    else
        return 1
    fi

    [[ "$Found" -eq 1 ]]
    return $?
}

# Get the device number for the parent of the given device
# Returns: number or empty string
GetDeviceParent()
{
    local PK_Device="$1"
    Q="
        SELECT FK_Device_ControlledVia
        FROM Device
        WHERE PK_Device='$PK_Device'
    "
    local R=$(RunSQL "$Q")
   
    if [[ "$R" == NULL ]]; then
        R=""
    fi
    echo "$R"
}

# Delete a device and make its children top level
# Does exactly the same thing as CMD_Delete_Device in General_Info_Plugin
DeleteDevice()
{
    local PK_Device="$1"
    local Q R

    # Delete embedded devices
    Q="SELECT PK_Device FROM Device where FK_Device_RouteTo=$PK_Device"
    R=$(RunSQL "$Q")
    for Device in $R; do
        DeleteDevice "$Device"
    done

    local -a Queries
    Queries=(
        "UPDATE Device SET FK_Device_ControlledVia=NULL WHERE FK_Device_ControlledVia=$PK_Device"
        "DELETE FROM Device WHERE PK_Device=$PK_Device"
        "DELETE FROM CommandGroup_Command WHERE FK_Device=$PK_Device"
        "DELETE FROM Device_Command WHERE FK_Device=$PK_Device"
        "DELETE FROM Device_CommandGroup WHERE FK_Device=$PK_Device"
        "DELETE FROM Device_DeviceData WHERE FK_Device=$PK_Device"
        "DELETE FROM Device_DeviceGroup WHERE FK_Device=$PK_Device"
        "DELETE FROM Device_Device_Related WHERE FK_Device=$PK_Device OR FK_Device_Related=$PK_Device"
        "DELETE FROM Device_EntertainArea WHERE FK_Device=$PK_Device"
        "DELETE FROM Device_HouseMode WHERE FK_Device=$PK_Device"
        "DELETE FROM Device_Orbiter WHERE FK_Device=$PK_Device"
        "DELETE FROM Device_StartupScript WHERE FK_Device=$PK_Device"
        "DELETE FROM Device_Users WHERE FK_Device=$PK_Device"
        "DELETE FROM Package_Device WHERE FK_Device=$PK_Device"
        "DELETE FROM PaidLicense WHERE FK_Device=$PK_Device"
        "DELETE FROM Device_Device_Pipe WHERE FK_Device_From=$PK_Device OR FK_Device_To=$PK_Device"
        "DELETE FROM PaidLicense WHERE FK_Device=$PK_Device"
    )

    for Q in "${Queries[@]}"; do
        RunSQL "$Q"
    done
}

XineConfSet()
{
    local Setting="$1"
    local Value="$2"
    local XineConf="${3:-/etc/pluto/xine.conf}"
   
    [[ -z "$Setting" || -z "$Value" ]] && return 1
   
    if grep -qF "$Setting" "$XineConf"; then
        sed -i "s/^.*$Setting:.*$/$Setting:$Value/" "$XineConf"
    else
        echo "$Setting:$Value" >>"$XineConf"
    fi
}

DeviceIsDisabled()
{
    local PK_Device="$1"
    local R Q

    [[ -z "$PK_Device" ]] && return 1

    Q="SELECT COUNT(*) FROM Device WHERE PK_Device='$PK_Device' AND Disabled=0"
    R=$(RunSQL "$Q")

    if [[ -n "$R" && "$R" -eq 0 ]]; then
        return 0 # Device is disabled or does not exist at all
    else
        return 1 # Device exists and is enabled
    fi
}

FindInArray()
{
    local Value="$1" Array i
    shift
    Array=("$@")
   
    for ((i = 0; i < ${#Array[*]}; i++)); do
        if [[ "${Array[$i]}" == "$Value" ]]; then
            echo "$i"
            return 0
        fi
    done
    return 1
}

FindInArray_Prefix()
{
    local Value="$1" Array i
    shift
    Array=("$@")

    for ((i = 0; i < ${#Array[*]}; i++)); do
        if [[ "${Array[$i]}" == "$Value"* ]]; then
            echo "$i"
            return 0
        fi
    done
    return 1
}

# Verify that the given string is a valid IPv4
ValidIP()
{
    local IP="$1"

    local IPn="[0-9]{1,3}"
    local IPpattern="^($IPn)\\.($IPn)\\.($IPn)\\.($IPn)$"
    local i Number

    # Bash 3.1 requires $IPpattern to be quoted, otherwise it gives a syntax error
    # Bash 3.2 requires $IPpattern to be unquoted, otherwise it fails to match the pattern
    # Ubuntu has Bash 3.2
    if [[ ! "$IP" =~ $IPpattern ]]; then
        return 1
    fi

    for ((i = 1; i <= 4; i++)); do
        Number="${BASH_REMATCH[$i]}"
        if ((Number < 0 || Number > 255)); then
            return 1
        fi
    done

    return 0
}

# Colors and bolds messages
# '\E begin escape sequence
# [XX; is the text color
# XXm' is the background color
# \033 is the an escape
# [1m bold     [0m unbold
# "" around text   '' around color
# COLOR         FOREGROUND      BACKGROUND
# black         30              40
# red           31              41
# green         32              42
# yellow        33              43
# blue          34              44
# magenta       35              45
# cyan          36              46
# white         37              47

StatusMessage () {
    echo -e '\E[33;40m'"\033[1m  $* \033[0m"
}
ErrorMessage () {
    echo -e '\E[33;41m'"\033[1m  $* \033[0m"
}
NotifyMessage () {
    echo -e '\E[32;40m'"\033[1m  $* \033[0m"
}

confirmRoot () {
    testroot="`whoami`"
    if [ "$testroot" != "root" ]; then
        ErrorMessage "Need to be root to run. Exiting"
        exit 1
    fi
}

StartService() {
ServiceDescription="$1"
ServiceCmd="$2"
ServiceBkg="$3"
    if [[ -x $(echo $ServiceCmd | cut -d ' ' -f1) ]] ;then
        if [ -x /bin/plymouth ]; then
            /bin/plymouth update --status="$ServiceDescription ... "
        fi
        echo -n "$ServiceDescription ... "
            if [[ "$ServiceBkg" == "&" ]] ;then
                $ServiceCmd 1>/dev/null 2>/dev/null &
            else
                $ServiceCmd 1>/dev/null 2>/dev/null
            fi
            err=$?
            if [[ "$err" == "0" ]] ;then
                echo "ok"
            else
                echo "fail"
            fi
    fi
        return $err
}

GetVideoDriver () {
        vga_pci=$(lspci -v | grep -i 'VGA')
        prop_driver="vesa"
        chip_man=$(echo "$vga_pci" | grep -Eo '(ATI|VIA|nVidia|Intel)')
        case $chip_man in
                nVidia)
                prop_driver="nvidia" ;;
                ATI)
                            prop_driver="fglrx"
                        if echo "$vga_pci" | grep -Ei '((r5|r6|r7)|(9|X|ES)(1|2?)([0-9])(5|0)0|Xpress)'; then
                                prop_driver="radeon"; fi ;;

                Intel)
                        prop_driver="intel"
                        if echo $vga_pci | grep "i740"; then
                                prop_driver="i740"; fi
                        if echo $vga_pci | grep "i128"; then
                                prop_driver="i128"; fi ;;

                VIA)
                        prop_driver="openchrome" ;
            if echo $vga_pci | grep -i "Savage"; then
                prop_driver="savage"; fi
            #if echo $vga_pci | grep -i "s3"; then
                #prop_driver="via"; fi
            if echo $vga_pci | grep -i "virge"; then
                                   prop_driver="virge"; fi ;;
        *)
            prop_driver="vesa"
        esac

}

InstallVideoDriver () {
    case "$prop_driver" in
            nvidia)
            if ! PackageIsInstalled nvidia-glx && ! PackageIsInstalled nvidia-glx-new && ! PackageIsInstalled nvidia-glx-71 && ! PackageIsInstalled nvidia-glx-96 && ! PackageIsInstalled nvidia-glx-173 && ! PackageIsInstalled nvidia-glx-180 && ! PackageIsInstalled nvidia-glx-190 && ! PackageIsInstalled nvidia-glx-195 && ! PackageIsInstalled nvidia-glx-260 && ! PackageIsInstalled nvidia-glx-185 && ! PackageIsInstalled nvidia-current; then
                apt-get -yf install pluto-nvidia-video-drivers
                VerifyExitCode "Install Pluto nVidia Driver"
                nv_pid=$(pidof nvidia-install.sh)
                    if [[ -n $nv_pid ]] ; then
                        StatusMessage "Installing nVidia driver this may take a few minutes"
                        installCorrectNvidiaDriver
                    else StartService "Installing nVidia driver this may take a few minutes" ". /usr/pluto/bin/nvidia-install.sh"
                        installCorrectNvidiaDriver
                    fi
            fi ;;
        nouveau)
            if ! PackageIsInstalled xserver-xorg-video-nouveau; then
                apt-get -yf install xserver-xorg-video-nouveau
                VerifyExitCode "Install nouveau Driver"
            fi ;;
        radeon)
            if ! PackageIsInstalled xserver-xorg-video-radeon; then
                apt-get -yf install xserver-xorg-video-radeon
                VerifyExitCode "Install radeon Driver"
            fi ;;
        fglrx)
            if ! PackageIsInstalled fglrx; then
                apt-get -yf install fglrx
                VerifyExitCode "Install fglrx Driver"
            fi ;;
        intel)
            if ! PackageIsInstalled xserver-xorg-video-intel; then
                apt-get -yf install xserver-xorg-video-intel
                VerifyExitCode "Install Intel Driver"
            fi ;;
        i128)
            if ! PackageIsInstalled xserver-xorg-video-i128; then
                apt-get -yf install xserver-xorg-video-i128
                VerifyExitCode "Install i128 Driver"
            fi ;;
        i740)
            if ! PackageIsInstalled xserver-xorg-video-i740; then
                apt-get -yf install xserver-xorg-video-i740
                VerifyExitCode "Install i740 Driver"
            fi ;;
        openchrome)
            if ! PackageIsInstalled xserver-xorg-video-openchrome; then
                apt-get -yf install xserver-xorg-video-openchrome
                VerifyExitCode "Install opencrhome Driver"
            fi ;;
        savage)
            if ! PackageIsInstalled xserver-xorg-video-savage; then
                apt-get -yf install xserver-xorg-video-savage
                VerifyExitCode "Install VIA Savage Driver"
            fi ;;
        via)
            if ! PackageIsInstalled xserver-xorg-video-s3; then
                apt-get -yf install xserver-xorg-video-s3
                VerifyExitCode "Install VIA S3 Driver"
            fi ;;
        virge)
            if ! PackageIsInstalled xserver-xorg-video-s3virge; then
                apt-get -yf install xserver-xorg-video-s3virge
                VerifyExitCode "Install VIA S3 Virge Driver"
            fi ;;
                esac
    if [[ "$chip_man" == "Intel" ]] && [[ -z $online ]]; then
        if ! PackageIsInstalled "libva-driver-i965"; then
            apt-get -yf install libva-driver-i965
            VerifyExitCode "Install Intel Graphics Accelerator"
        fi
    fi
}

CheckVideoDriver () {
    GetVideoDriver
    online=$(ping -c 2 google.com)
    card_detail=$(lspci | grep 'VGA' | cut -d':' -f3)
    offline_mismatch=""
    if [[ -f /etc/X11/xorg.conf ]]; then
        # TODO figure out a better way to isolate the video driver in the xorg.conf list of "Driver" options
            cur_driver=$(grep "Driver" /etc/X11/xorg.conf | grep -Eo '(nvidia|nouveau|radeon|fglrx|savage|openchrome|via|virge|intel|i740|i128|vesa)')
        if [[ "$prop_driver" != "$cur_driver" ]] &&  [[ -z $online ]]; then
            offline_mismatch="true"
        elif [[ "$prop_driver" != "$cur_driver" ]] && [[ -n $online ]]; then
            offline_mismatch="false"
        fi
        # Check to see that the appropriate driver is installed by type
        # If current driver is nvidia, check that it is the correct one

        if [[ "$offline_mismatch" == "false" ]] && [[ "$cur_driver" == "nvidia" ]]; then
            StartService "Checking nVidia driver" ". /usr/pluto/bin/nvidia-install.sh"
            current_nvidia=$(getInstalledNvidiaDriver)
            preferred_nvidia=$(getPreferredNvidiaDriver)
        fi

        if [[ "$cur_driver" == "$prop_driver" ]]; then
            StatusMessage "Correct driver '$prop_driver' already loaded"
            exit 0
        # Remove fglrx or nVidia drivers if they are installed, but do not match current requirements
                elif ([[ "$offline_mismatch" == "false" ]]) || ([[ "$offine_mismatch" == "true" ]] && echo "$prop_driver" | grep -Eq '(nouveau|radeon|openchrome)'); then
                        ErrorMessage "Video chipset change detected !!!"
            if [[ "$cur_driver" == "fglrx" ]]; then
                echo ""
                echo ""
                echo ""
                ErrorMessage "Purging fglrx driver due to multiple conflicts"
                apt-get -y remove --purge xorg-driver-fglrx fglrx* --force-yes
                apt-get -y install --reinstall libgl1-mesa-glx libgl1-mesa-dri fglrx-modaliases --force-yes
                dpkg-reconfigure xserver-xorg
                apt-get -y install --reinstall xserver-xorg-core --force-yes
                rm /etc/X11/xorg.conf
                reboot
            elif [[ $cur_driver == "nvidia" ]]; then
                StatusMessage "Removing old nVidia driver"
                apt-get -yf remove $current_driver --force-yes
            fi
       
            # If there is an xorg, but the driver does not match best selection, install driver and run AVWizard
            StatusMessage "Installing video driver '$prop_driver' for $card_detail"
            InstallVideoDriver
            sleep 2
                        ConfSet "AVWizardOverride" "1"
        elif [[ "$offine_mismatch" == "true" ]]; then
            case "$prop_driver" in
                nvidia)
                    prop_driver="nouveau" ;;
                fglrx)
                    prop_driver="radeon" ;;
                savage)
                    prop_driver="openchrome" ;;
                via)
                    prop_driver="openchrome" ;;
                virge)
                    prop_driver="openchrome" ;;
            esac
            if [[ "$prop_driver" != "$cur_driver" ]]; then
                StatusMessage "Installing video driver '$prop_driver' for $card_detail"
                InstallVideoDriver
                sleep 2
                ConfSet "AVWizardOverride" "1"
            fi
                fi
        else
        # If there is no xorg.conf, install driver and run AVWizard
        if [[ -z $online ]]; then
            case "$prop_driver" in
                nvidia)
                    prop_driver="nouveau" ;;
                fglrx)
                    prop_driver="radeon" ;;
                savage)
                    prop_driver="openchrome" ;;
                via)
                    prop_driver="openchrome" ;;
                virge)
                    prop_driver="openchrome" ;;
            esac
        fi
        StatusMessage "/etc/X11/xorg.conf is missing. Installing video driver '$prop_driver' for $card_detail"
        InstallVideoDriver
        sleep 2
        ConfSet "AVWizardOverride" "1"
        fi
VideoDriver="$prop_driver"
}

ReloadDevicesOnThisMachine()
{
    for Dev in $(cat /usr/pluto/locks/pluto_spawned_local_devices.txt); do
        /usr/pluto/bin/MessageSend "$DCERouter" 0 "$Dev" 7 1 163 "Utils.sh ReloadDevicesOnThisMachine"
    done
}

OpenGLeffects()
{
    local Q

    Q="
        SELECT IK_DeviceData
        FROM Device
        LEFT JOIN Device AS Parent ON Parent.PK_Device=Device.FK_Device_ControlledVia
        JOIN Device_DeviceData ON Device.PK_Device=FK_Device
        WHERE
            Device.FK_DeviceTemplate='$DEVICETEMPLATE_OnScreen_Orbiter'
            AND (
                Device.FK_Device_ControlledVia='$PK_Device'
                OR Parent.FK_Device_ControlledVia='$PK_Device'
            )
        AND FK_DeviceData='$DEVICEDATA_Use_OpenGL_effects'
    "
    RunSQL "$Q"
}

AlphaBlendingEnabled()
{
    local Q

    Q="
        SELECT IK_DeviceData
        FROM Device
        LEFT JOIN Device AS Parent ON Parent.PK_Device=Device.FK_Device_ControlledVia
        JOIN Device_DeviceData ON Device.PK_Device=FK_Device
        WHERE
            Device.FK_DeviceTemplate='$DEVICETEMPLATE_OnScreen_Orbiter'
            AND (
                Device.FK_Device_ControlledVia='$PK_Device'
                OR Parent.FK_Device_ControlledVia='$PK_Device'
            )
        AND FK_DeviceData='$DEVICEDATA_Use_alpha_blended_UI'
    "
    RunSQL "$Q"
}

GetDeviceData()
{
    local Q
    local Device="$1" DeviceData="$2"

    Q="
        SELECT IK_DeviceData
        FROM Device_DeviceData
        WHERE FK_Device='$Device' AND FK_DeviceData='$DeviceData'
    "
    Field 1 "$(RunSQL "$Q")"
}

SetDeviceData()
{
    local Q
    local Device="$1" DeviceData="$2" Value="$3"

    Q="
        UPDATE Device_DeviceData
        SET IK_DeviceData='$Value'
        WHERE FK_Device=$Device AND FK_DeviceData=$DeviceData
    "
    RunSQL "$Q"
}

UI_SetOptions()
{
    local OrbiterDev="$1"
    local OpenGLeffects="$2"
    local AlphaBlending="$3"
    local UI_Version="$4"

    # disable OpenGL effects
    Q="
        REPLACE INTO Device_DeviceData(FK_Device, FK_DeviceData, IK_DeviceData)
        VALUES('$OrbiterDev', '$DEVICEDATA_Use_OpenGL_effects', '$OpenGLeffects')
    "
    RunSQL "$Q"
    # disable alpha blending
    Q="
        REPLACE INTO Device_DeviceData(FK_Device, FK_DeviceData, IK_DeviceData)
        VALUES('$OrbiterDev', '$DEVICEDATA_Use_alpha_blended_UI', '$AlphaBlending')
    "
    RunSQL "$Q"
    # select UI
    Q="
        REPLACE INTO Device_DeviceData(FK_Device, FK_DeviceData, IK_DeviceData)
        VALUES('$OrbiterDev', '$DEVICEDATA_PK_UI', '$UI_Version')
    "
    RunSQL "$Q"
}

function GeneratePassword() {
    #TODO: Replace with this --->  </dev/urandom tr -dc A-Za-z0-9_ | head -c8
        local -a alpha1=(Q W E R T Y U I O P A S D F G H J K L Z X C V B N M)
        local -a alpha2=(q w e r t y u i o p a s d f g h j k l z x c v b n m)
        local -a alpha3=(1 2 3 4 5 6 7 8 9 0)

        local pass=""
        pass=$pass"${alpha1[$(($RANDOM%26))]}${alpha1[$(($RANDOM%26))]}${alpha1[$(($RANDOM%26))]}"
        pass=$pass"${alpha2[$(($RANDOM%26))]}${alpha2[$(($RANDOM%26))]}${alpha2[$(($RANDOM%26))]}"
        pass=$pass"${alpha3[$(($RANDOM%10))]}${alpha3[$(($RANDOM%10))]}"

        local fromwhere=$(( $RANDOM % 3 + 1 ))
        [[ $fromwhere == 1 ]] && pass=$pass"${alpha1[$(($RANDOM%26))]}"
        [[ $fromwhere == 2 ]] && pass=$pass"${alpha2[$(($RANDOM%26))]}"
        [[ $fromwhere == 3 ]] && pass=$pass"${alpha3[$(($RANDOM%10))]}"


        for i in `seq 1 100` ;do
                local split=$(( $RANDOM % ${#pass} + 1 ))
                pass1=${pass:$split}
                pass2=${pass:0:$split}
                pass="${pass1}${pass2}"
        done

        echo $pass
}

function GeneratePasswordOf6Digits()
{
    local pass
    for ((i = 0; i < 6; i++)); do
        pass="${pass}$((RANDOM % 10))"
    done
    echo "$pass"
}

Log()
{
    local File="$1"; shift
    local Msg="$*"

    echo "LOG: $Msg"
    echo "$Msg" >>"$File"
}


function BlacklistConfFiles()
{
    local file=$1

    if [[ -e /etc/confblacklist ]] ;then
        while read line; do
            if [[ "$line" == "$file" ]] ;then
                return 0
            fi
        done < /etc/confblacklist
    fi

    return 1               
}

function VDRInstalled() {
    # Return true if VDR is installed
    DEVICETEMPLATE_VDR_Plugin="1704"
    Q="SELECT PK_Device FROM Device Where FK_DeviceTemplate = $DEVICETEMPLATE_VDR_Plugin"
    VDRDevice=$(RunSQL "$Q")                                         
    if [ "$VDRDevice" == "" ] ; then                                 
        RETURNVALUE=1                                             
    else                                                             
        RETURNVALUE=0                                             
    fi                                                               
    return $RETURNVALUE
}

Then run the following two commands.
Code: [Select]
sudo sed -i 's/InstallVideoDriver/CheckVideoDriver/g' /usr/pluto/bin/X-CleanupVideo.sh
sudo sed -i 's/InstallVideoDriver/CheckVideoDriver/g' /usr/pluto/bin/Xconfigure.sh

A regular reboot will probably then just dump you into avwizard.
« Last Edit: April 05, 2012, 04:06:25 pm by l3mce »
I never quit... I just ping out.