rendered paste body#!/bin/bash
#Software Installer - Generate Menu from text file
exec 3<>"/home/dsl/My_Files/Projects/CREATE_LiveCD/Tools/SoftwareRepo/SoftwareList.txt"
count=0
while read -u 3 line ;do
linepart=${line:0:3}
length=${#line}
case "$linepart" in
"CAT")
count=`expr $count + 1`
category=${line:4:$length}
echo
echo $category
echo
#echo "count is $count"
SoftArray[$count]=$line
;;
"APP")
count=`expr $count + 1`
partline=${line:0:7}
case "$partline" in
"APPNAME")
appname=${line:8:$length}
echo " $appname"
;;
"APPSIZE")
appsize=${line:8:$length}
echo " $appsize"
;;
"APPDESC")
appdesc=${line:8:$length}
echo " $appdesc"
;;
"APPFILE")
appfile=${line:8:$length}
echo " $appfile"
echo
;;
esac
#echo "count is $count"
SoftArray[$count]=$line
;;
esac
done
#TreeViewPt1='response=`
#TreeViewPt1='Xdialog --stdout --check '"'"'Download and install all selected applications'"'"' --title '"'"'Software Installer'"'"' --treeview '"'"'Browse the categories, select an application and press\n Next for more information.\n\n Applications selected for install are marked with an [X].\n'"'"' 25 50 0 '
TreeViewPt1='Xdialog --title "Software Installer" --treeview "Browse the categories, select an application and press\n Next for more information.\n\n Applications selected for install are marked with an [X].\n" 25 50 0 '
TreeViewPt2=''
ArrayLength=${#SoftArray[*]} #Get number of elements in array
count=0
while [ "$count" -lt "$ArrayLength" ] #List all elements in array
do
count=`expr $count + 1`
#echo -n "SoftArray[$count] = "
#echo ${SoftArray[$count]}
line=${SoftArray[$count]}
linepart=${line:0:3}
length=${#line}
#make the xdialog treeview from elements in array
case "$linepart" in
"CAT")
#count=`expr $count + 1`
category=${line:4:$length}
#SoftArray[$count]=$line
TreeViewPt2="$TreeViewPt2\"$count\" \"$category\" \"off\" \"0\" "
;;
"APP")
#count=`expr $count + 1`
partline=${line:0:7}
case "$partline" in
"APPNAME")
appname=${line:8:$length}
TreeViewPt2="$TreeViewPt2\"$count\" \"[ ] $appname\" \"off\" \"1\" "
#echo " $appname"
;;
#"APPSIZE")
#appsize=${line:8:$length}
#TreeViewPt2=`echo "$TreeViewPt2'$count' '$appsize' 'off' '1' "`
#;;
#"APPDESC")
#appdesc=${line:8:$length}
#TreeViewPt2=`echo "$TreeViewPt2'$count' '$appdesc' 'off' '1' "`
#;;
#"APPFILE")
#appfile=${line:8:$length}
#TreeViewPt2=`echo "$TreeViewPt2'$count' '$appfile' 'off' '1' "`
#;;
esac
;;
esac
done
#TreeViewPt2=`echo "$TreeViewPt2'`'"`
echo
echo -n "TreeViewPt1 = "
echo ${TreeViewPt1}
echo
echo -n "TreeViewPt2 = "
echo ${TreeViewPt2}
TreeViewFull="$TreeViewPt1$TreeViewPt2"
echo
echo -n "TreeViewFull = "
echo ${TreeViewFull}
`$TreeViewFull`