Code: Select all
#! /bin/bash
is_text_file() {
#grep -qI '.' "$1"
perl -e 'exit((-B $ARGV[0])?1:0);' "$1"
}
# move scriptslist (ingoring case) out of scripts to utility as lowercase filename
cd /tbu/scripts; scriptsarray=(*); cd /tbu
nscripts=${#scriptsarray[@]}
if [ "$nscripts" = "1" ] && [ "${scriptsarray[0]}" = "*" ]; then exit 0; fi
if [ "$nscripts" -lt "1" ]; then exit 0; fi
let nscripts=nscripts-1
for i in `seq 0 $nscripts`
do
echo "${scriptsarray[$i]}" | grep -i "scriptslist.txt" > /dev/null
if [ "$?" = "0" ] && [ "${#scriptsarray[$i]}" = "15" ]; then
mv /tbu/scripts/${scriptsarray[$i]} /tbu/utility/scriptslist.txt
chmod 644 /tbu/utility/scriptslist.txt
chown 0:0 /tbu/utility/scriptslist.txt
fromdos /tbu/utility/scriptslist.txt
break
fi
done
#change owner to root
chmod 644 /tbu/scripts/* 2> /dev/null
chown 0:0 /tbu/scripts/* 2> /dev/null
#change permissions based on file type
cd /tbu/scripts; scriptsarray=(*); cd /tbu
nscripts=${#scriptsarray[@]}
if [ "$nscripts" = "1" ] && [ "${scriptsarray[0]}" = "*" ]; then exit 0; fi
if [ "$nscripts" -lt "1" ]; then exit 0; fi
let nscripts=nscripts-1
for i in `seq 0 $nscripts`
do
if is_text_file /tbu/scripts/"${scriptsarray[$i]}" ; then
fromdos /tbu/scripts/"${scriptsarray[$i]}" 2> /dev/null
fi
slength=${#scriptsarray[$i]}
if [ "$slength" -ge "5" ]; then
let slength=slength-1
let startchar=slength-3
last4char=${scriptsarray[$i]:$startchar:4}
if [ "$last4char" = ".tbs" ] || [ "$last4char" = ".run" ] || [ "$last4char" = ".TBS" ] || [ "$last4char" = ".RUN" ]; then
chmod 644 /tbu/scripts/"${scriptsarray[$i]}" 2> /dev/null
else
chmod 755 /tbu/scripts/"${scriptsarray[$i]}" 2> /dev/null
fi
else
chmod 755 /tbu/scripts/"${scriptsarray[$i]}" 2> /dev/null
fi
done
Code: Select all
#! /bin/sh
imagel --b --uy --d:l1@0x286 --f:l1@0x285:"/DarkStar" --max:4GiB --v
cat /tbu/ifl.log
read -p "Press [Enter] key to continue..."