Maybe some expert can improve it,
thanks.
porteus rc5 64bits xfce
Code: Select all
#! /bin/bash
#based on an alip script
# COLORS {{{
Bold=$(tput bold)
Underline=$(tput sgr 0 1)
Reset=$(tput sgr0)
# Regular Colors
Red=$(tput setaf 1)
Green=$(tput setaf 2)
Yellow=$(tput setaf 3)
Blue=$(tput setaf 4)
Purple=$(tput setaf 5)
Cyan=$(tput setaf 6)
White=$(tput setaf 7)
# Bold
BRed=${Bold}$(tput setaf 1)
BGreen=${Bold}$(tput setaf 2)
BYellow=${Bold}$(tput setaf 3)
BBlue=${Bold}$(tput setaf 4)
BPurple=${Bold}$(tput setaf 5)
BCyan=${Bold}$(tput setaf 6)
BWhite=${Bold}$(tput setaf 7)
print_line() {
printf "%$(tput cols)s\n"|tr ' ' '-'
}
print_title() {
#clear
print_line
echo -e "# ${BPurple}$1${Reset}"
print_line
echo ""
}
print_question(){
T_COLS=`tput cols`
echo -n "${BBlue}$1${Reset}"
}
print_msg(){
T_COLS=`tput cols`
echo -e "${BGreen}$1${Reset}"
sleep 2
}
print_info() {
#Console width number
T_COLS=`tput cols`
echo -e "${Bold}$1${Reset}\n" | fold -sw $(( $T_COLS - 18 )) | sed 's/^/\t /'
}
print_warning() {
T_COLS=`tput cols`
echo -e "${BYellow}$1${Reset}\n" | fold -sw $(( $T_COLS - 1 ))
sleep 4
}
# check for root
#[[ ${EUID} -ne 0 ]] && echo "This script must be run as root." && exit 1
txtbld=$(tput bold) # Bold
txtred=${txtbld}$(tput setaf 1) # Red
rst=$(tput sgr0) # Reset
function redpswd() {
echo -e "$1" $txtred
}
if [ `whoami` != "root" ]; then
redpswd "Enter root's password"
su -c "sh $0 $1"
exit
fi
echo $rst
print_title 'Updating by Porteus Scripts'
ups_chrome(){
print_msg "Update google-chrome"
print_question "Do you want to Update Google-Chrome? [Y|n]"
read yn
yn=${yn:-y}
if [ "$yn" == "y" ]; then
/opt/porteus-scripts/update-chrome
print_msg '... Finished!'
ups_menu
fi
}
ups_firefox(){
print_msg "Update Firefox"
print_question "Do you want to Update Firefox? [Y|n] "
read yn
yn=${yn:-y}
if [ "$yn" == "y" ]; then
/opt/porteus-scripts/update-firefox
print_msg '... Finished!'
ups_menu
fi
}
ups_flash(){
print_msg "Update Flash"
print_question "Do you want to Update Flash? [Y|n] "
read yn
yn=${yn:-y}
if [ "$yn" == "y" ]; then
/opt/porteus-scripts/update-flash
print_msg '... Finished!'
ups_menu
fi
}
ups_libreoffice(){
print_msg "Update Libreoffice"
print_question "Do you want to Libreoffice? [Y|n] "
read yn
yn=${yn:-y}
if [ "$yn" == "y" ]; then
/opt/porteus-scripts/update-libreoffice
print_msg '... Finished!'
ups_menu
fi
}
ups_opera(){
print_msg "Update Opera"
print_question "Do you want to Update Opera? [Y|n] "
read yn
yn=${yn:-y}
if [ "$yn" == "y" ]; then
/opt/porteus-scripts/update-opera
print_msg '... Finished!'
ups_menu
fi
}
ups_palemoon(){
print_msg "Update Palemoon"
print_question "Do you want to Update Palemoon? [Y|n] "
read yn
yn=${yn:-y}
if [ "$yn" == "y" ]; then
/opt/porteus-scripts/update-palemoon
print_msg '... Finished!'
ups_menu
fi
}
ups_vbox(){
print_msg "Update Vbox"
print_question "Do you want to Vbox? [Y|n] "
read yn
yn=${yn:-y}
if [ "$yn" == "y" ]; then
/opt/porteus-scripts/update-vbox
print_msg '... Finished!'
ups_menu
fi
}
ups_wps(){
print_msg "Update Wps-office"
print_question "Do you want to Update Wps? [Y|n] "
read yn
yn=${yn:-y}
if [ "$yn" == "y" ]; then
/opt/porteus-scripts/update-wps-office
print_msg '... Finished!'
ups_menu
fi
}
# END
ups_exit(){
ps aux | grep ups | awk '{print $2}' > /tmp/end
ups=$(cat /tmp/end)
kill -9 $ups
}
ups_menu(){
while true
do
echo
print_question "Choose an action:"
echo
echo
action_list=("chrome" "firefox" "flash" "libreoffice" "opera" "palemoon" "vbox" "wps" "exit");
select action in "${action_list[@]}"; do
case "$REPLY" in
1)
ups_chrome
;;
2)
ups_firefox
;;
3)
ups_flash
;;
4)
ups_libreoffice
;;
5)
ups_opera
;;
6)
ups_palemoon
;;
7)
ups_vbox
;;
8)
ups_wps
;;
9)
ups_exit
;;
*)
print_warning "dommage, essaye encore ops!!"
;;
esac
[[ -n $OPT ]] && break
done
done
}
ups_menu