2010-08-21, 15:46
well either way that part of script you mentioned are only requirements for script the other cryptic function is the script auto-update, neither would cause the problem you describe.
# f_AgtB is the script auto-update function it
# enables script to receive remote updates at every run
# also offers changelog review
function f_AgtB(){
cd $APPLOC
wget -nc -q http://dl.dropbox.com/u/4325533/XCI/version-check >> ~/setup/logs/xci-script-upgrade.log
if [ "$BETA" != "true" ]; then
a=$(grep "VERSION" version-check | awk -F\" '{print $(NF-1)}')
elif [ "$BETA" = "true" ]; then
a=$(grep "BETAVER" version-check | awk -F\" '{print $(NF-1)}')
fi
b=$VERSION
if [ "${a}" != "" -a "${b}" != "" ]
then
len_a=${#a}
len_b=${#b}
if [ $len_a -gt $len_b ]
then
b=${b}`f_add_zeros $(( $len_a - $len_b ))`
else
a=${a}`f_add_zeros $(( $len_b - $len_a ))`
fi
a=`echo $a | sed 's/\.//'`
b=`echo $b | sed 's/\.//'`
if [ $a -gt $b ]
then
echo 1
else
echo 0
fi
fi
}
function f_add_zeros(){
i=0
while [ $i -lt $1 ]
do
out=${out}0
((i++))
done
echo $out
}
function Update_Check(){
while [ `f_AgtB $a $b` == 1 ] ; do
if [ "$BETA" != "true" ]; then
NEWVERSION=$(grep "VERSION" version-check | awk -F\" '{print $(NF-1)}')
NEWINFOTEXT=$(grep "INFOTEXT" version-check | awk -F\" '{print $(NF-1)}')
elif [ "$BETA" = "true" ]; then
NEWVERSION=$(grep "BETAVER" version-check | awk -F\" '{print $(NF-1)}')
NEWINFOTEXT=$(grep "BETAINFOTEXT" version-check | awk -F\" '{print $(NF-1)}')
fi
dialog --colors --yes-label " Yes Please " --no-label "Not Now" --help-button --help-label "XCI Changelog" --title "\Z1[ INFORMATION ]\Zn" --yesno "\nXCI Version \Z1$NEWVERSION\Zn is now available to download.\nWould you like to download it now or later?" 8 53
case $? in
0)
dialog --colors --title "\Z1[ UPDATING ]\Zn" --infobox " Please wait..." 3 25
rm -f xbmc-installer.sh >> ~/setup/logs/xci-script-upgrade.log
rm -f xci.sh >> ~/setup/logs/xci-script-upgrade.log
if [ "$BETA" != "true" ]; then
wget -nc -q http://dl.dropbox.com/u/4325533/XCI/xci.sh >> ~/setup/logs/xci-script-upgrade.log
elif [ "$BETA" = "true" ]; then
wget -nc -q http://dl.dropbox.com/u/4325533/XCI/Beta/xci.sh >> ~/setup/logs/xci-script-upgrade.log
fi
chmod +x xci.sh
ln -s xci.sh xbmc-installer.sh
sudo ./xci.sh
exit 1;;
1)
break;;
outleradam Wrote:I am using your script as a working reference right now. I am having a cyclic boot issue after installing mini and then xbmc-live and drivers. http://forum.xbmc.org/showthread.php?p=5...post588849
I really hope you don't mind if I critique your code as I am going thorugh it.... It would be appreciated if you would go through mythicalLibrarian and post in my thread. https://mythicallibrarian.googlecode.com/svn/trunk/
I'm wondering why you didn't just go with something like this for package checking, which is POSIX compliant.
Code:if which dialog >/dev/null; then
echo "Verified dialog exists"
else
test "$LinuxDep" = "1" && echo "Please install package 'dialog' on your system" || echo "Please obtain MacPorts and install package dialog"
a="dialog "
fi
if which curl >/dev/null; then
echo "Verified curl exists"
else
test "$LinuxDep" = "1" && echo "Please install 'curl' on your system" || echo "Please obtain MacPorts and install package curl"
c="curl "
fi
if which agrep >/dev/null; then
echo "Verified agrep exists"
else
test "$LinuxDep" = "1" && echo "Please install 'agrep' on your system" || echo "Please obtain MacPorts and install package agrep"
d="agrep "
fi
if which notify-send >/dev/null; then
echo "Verified libnotify-bin exists"
else
echo "'libnotify-bin' is a non essential missing package on your system"
test "$LinuxDep" = "1" && e="libnotify-bin "|| echo "This platform does not support Pop-up notifications.-OK"
fi
if which agrep>/dev/null && which curl>/dev/null && which dialog>/dev/null; then
echo "All checks complete!!!"
else
echo "the proper dependencies must be installed..."
echo "The missing dependencies are $a$b$c$d$e"
test "$LinuxDep" = "1" && echo "Debian based users run 'apt-get install $a$b$c$d$e" || echo "Please obtain MacPorts and install $a$b$c"........................
if [ ! -e .dialogrc ]; then
wget http://dl.dropbox.com/u/4325533/XCI/dialogrc &>> ~/setup/logs/xci-script-upgrade.log
mv dialogrc .dialogrc &>> ~/setup/logs/xci-script-upgrade.log
fi
if [ "$(dpkg -s dialog | grep -i "Status:" | awk '{print $4}' 2>/dev/null)" != "installed" ]; then
echo -e '\E[1;37m\033[1mInstalling Dialog...\033[0m'
aptitude install dialog -y &>> ~/setup/logs/xci-installer.log
fi
if [ "$(uname -a | grep -i "PAE")" != "" ]; then
dialog --sleep 5 --colors --title "\Z1[ INFORMATION ]\Zn" --infobox "Sorry, you seem to be running a PAE kernel, and this script does not support it." 5 40
exit 1
fi
if [ "$(dpkg -s wget | grep -i "Status:" | awk '{print $4}' 2>/dev/null)" != "installed" ]; then
dialog --colors --title "\Z1[ INFORMATION ]\Zn" --infobox " Installing required tools..." 3 45
aptitude install wget -y &>> ~/setup/logs/xci-installer.log
fi
if [ "$(dpkg -s pv | grep -i "Status:" | awk '{print $4}' 2>/dev/null)" != "installed" ]; then
dialog --colors --title "\Z1[ INFORMATION ]\Zn" --infobox " Installing required tools..." 3 45
aptitude install pv -y &>> ~/setup/logs/xci-installer.log
fi
if [ "$(dpkg -s bind9 | grep -i "Status:" | awk '{print $4}' 2>/dev/null)" != "installed" ]; then
dialog --colors --title "\Z1[ INFORMATION ]\Zn" --infobox " Installing required tools..." 3 45
aptitude install bind9 -y &>> ~/setup/logs/xci-installer.log
fi
if [ "$(dpkg -s tar | grep -i "Status:" | awk '{print $4}' 2>/dev/null)" != "installed" ]; then
dialog --colors --title "\Z1[ INFORMATION ]\Zn" --infobox " Installing required tools..." 3 45
aptitude install tar -y &>> ~/setup/logs/xci-installer.log
fi
if [ "$(dpkg -s pastebinit | grep -i "Status:" | awk '{print $4}' 2>/dev/null)" != "installed" ]; then
dialog --colors --title "\Z1[ INFORMATION ]\Zn" --infobox " Installing required tools..." 3 45
aptitude install pastebinit -y &>> ~/setup/logs/xci-installer.log
fi
outleradam Wrote:The function f_AgtB(){ } is a very crypitic title and cryptic functions should be kept away from
*snip
You should wrap text in quotations so that it is compliant regardless of whatever the variable states.. No quotes also does not play well with my IDE (gedit)
dirtylion Wrote:i got problems with installing scripts/plugins
i read this http://code.google.com/p/dandar3-xbmc-ad...oInstaller
but doesn't work for me
maybe you can add aan auto scripts install for SVN repo installer etc..