#!/usr/bin/perl -w use Tk; my $mw = MainWindow->new; while (1) { sleep 2; next if (`ls /dev/sdb1 2>/dev/null|wc -l` == 0); `gnome-mount -d /dev/sdb1`; $_ = `ls /media|head -n1`; chomp; # check to see if the proper directory structure exists on the drive $_ = "/media/".$_."/kiosk_update"; if (-d) { print "found a valid update drive!\n"; $path = $_; # check for calibration request first if ($mw->messageBox(-message => "Do you want to calibrate the touch screen?",-type => "yesno", -icon => "question") eq 'Yes') { `eGalaxTouch`; } # check for screensaver modification request if ($mw->messageBox(-message => "Do you want to modify the screensaver settings?",-type => "yesno", -icon => "question") eq 'Yes') { `gnome-screensaver-preferences`; } # check for power settings modification request if ($mw->messageBox(-message => "Do you want to modify the power settings (screen blanking)?",-type => "yesno", -icon => "question") eq 'Yes') { `gnome-power-preferences`; } # check for new scripts if (-e $path."/updatekiosk" and $mw->messageBox(-message => "Do you want to update the kiosk update software?",-type => "yesno", -icon => "question") eq 'Yes') { `cp "$path/updatekiosk" ~/`; } if (-e $path."/.xsession" and $mw->messageBox(-message => "Do you want to update the kiosk management software?",-type => "yesno", -icon => "question") eq 'Yes') { `cp "$path/.xsession" ~/`; } # check for presentations and videos $choices = `cd $path;ls *.odp *.ppt 2>/dev/null`; print "got choices: $choices\n"; foreach $choice (split(/\n/,$choices)) { chomp $choice; if ($mw->messageBox(-message => "Do you want to use $choice as the presentation for this kiosk?", -type => "yesno", -icon => "question") eq 'Yes') { `mkdir -p ~/kiosk`; `rm -f ~/kiosk/*.odp`; `rm -f ~/kiosk/*.ppt`; `cp "$path/$choice" ~/kiosk`; # grab all possibly associated MP3s `cp $path/*.mp3 ~/kiosk`; # make sure the transfer is synced properly `sync`; last; } } $choices = `cd $path;ls *.flv *.avi *.mkv *.mp4 2>/dev/null`; foreach $choice (split(/\n/,$choices)) { if ($mw->messageBox(-message => "Do you want to use $choice as the introductory video for this kiosk?", -type => "yesno", -icon => "question") eq 'Yes') { `mkdir -p ~/kiosk`; `rm -f ~/kiosk/*.avi`; `rm -f ~/kiosk/*.flv`; `rm -f ~/kiosk/*.mkv`; `rm -f ~/kiosk/*.mp4`; `cp "$path/$choice" ~/kiosk`; `sync`; last; } } # force a reboot `reboot`; return; } }