#!/bin/bash
ICON="/usr/share/fastrepo/icons/fastrepo.png"
### run as root ####
this_script_dir="$( cd "$( dirname "$0" )" && pwd )"
this_script="`basename $0`"
this_script_path_n_name="${this_script_dir}/${this_script}"
GUI_SU="pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY"
if [ "$UID" != "0" ]; then
$GUI_SU bash $this_script_path_n_name; exit;
fi
if ! test -f "/etc/apt/sources.list" ; then
cp -rf "/etc/apt/sources.list" "/etc/apt/sources.list-" 
fi
action=$(yad \
--width=475 \
--height=95 \
--button="Cancel"!/usr/share/fastrepo/icons/cancel.svg:1 \
--button="Ok"!/usr/share/fastrepo/icons/ok.svg:0 \
--center \
--window-icon=$ICON \
--title='Fast Repo' \
--entry \
--text=$'Select a Repository From List' \
'ftp://ftp.nluug.nl' 'http://ftp.fau.de' 'http://mirror.math.princeton.edu' 'http://pclinuxos.c3sl.ufpr.br' 'http://ftp.cc.uoc.gr/mirrors' 'http://mirror.internode.on.net' 'http://mirror.aarnet.edu.au' 'http://ftp.jaist.ac.jp' 'http://mirrors.uni-ruse.bg' 'http://pclinuxos.mirror.wearetriple.com' 'http://mirrors.cicku.me/pclinuxos' 'http://distrib-coffee.ipsl.jussieu.fr')
if [ -n "${action}" ];then
case $action in
'ftp://ftp.nluug.nl')
cp -rf "/usr/share/fastrepo/sources/nluug" "/etc/apt/sources.list" 
sleep 0.50 
$(yad --title="Fast Repo" \
--width=450 --height=100 --center --fixed \
--text=$"\nSelected repository: <span font_desc='Sans Bold Italic 10' foreground='#BE7F00'>ftp://ftp.nluug.nl</span>\n\nReload synaptic to apply the repository changes.\n" \
--image="$ICON" \
--center \
--window-icon="$ICON" \
--button="Ok"!/usr/share/fastrepo/icons/ok.svg)
exit
 ;;
'http://ftp.fau.de')
cp -rf "/usr/share/fastrepo/sources/fau" "/etc/apt/sources.list" 
sleep 0.50 
$(yad --title="Fast Repo" \
--width=450 --height=100 --center --fixed \
--text=$"\nSelected repository: <span font_desc='Sans Bold Italic 10' foreground='#BE7F00'>http://ftp.fau.de</span>\n\nReload synaptic to apply the repository changes.\n" \
--image="$ICON" \
--center \
--window-icon="$ICON" \
--button="Ok"!/usr/share/fastrepo/icons/ok.svg)
 ;;
'http://mirror.math.princeton.edu')
cp -rf "/usr/share/fastrepo/sources/princeton" "/etc/apt/sources.list"
sleep 0.50  
$(yad --title="Fast Repo" \
--width=450 --height=100 --center --fixed \
--text=$"\nSelected repository: <span font_desc='Sans Bold Italic 10' foreground='#BE7F00'>http://mirror.math.princeton.edu</span>\n\nReload synaptic to apply the repository changes.\n" \
--image="$ICON" \
--center \
--window-icon="$ICON" \
--button="Ok"!/usr/share/fastrepo/icons/ok.svg)
exit
 ;;
'http://pclinuxos.c3sl.ufpr.br')
cp -rf "/usr/share/fastrepo/sources/ufpr" "/etc/apt/sources.list"
sleep 0.50 
$(yad --title="Fast Repo" \
--width=450 --height=100 --center --fixed \
--text=$"\nSelected repository: <span font_desc='Sans Bold Italic 10' foreground='#BE7F00'>http://pclinuxos.c3sl.ufpr.br</span>\n\nReload synaptic to apply the repository changes.\n" \
--image="$ICON" \
--center \
--window-icon="$ICON" \
--button="Ok"!/usr/share/fastrepo/icons/ok.svg)
exit
 ;;
'http://ftp.cc.uoc.gr/mirrors')
cp -rf "/usr/share/fastrepo/sources/uoc" "/etc/apt/sources.list" 
sleep 0.50 
$(yad --title="Fast Repo" \
--width=450 --height=100 --center --fixed \
--text=$"\nSelected repository: <span font_desc='Sans Bold Italic 10' foreground='#BE7F00'>http://ftp.cc.uoc.gr/mirrors</span>\n\nReload synaptic to apply the repository changes.\n" \
--image="$ICON" \
--center \
--window-icon="$ICON" \
--button="Ok"!/usr/share/fastrepo/icons/ok.svg)
exit
 ;;
'http://mirror.internode.on.net')
cp -rf "/usr/share/fastrepo/sources/internode" "/etc/apt/sources.list" 
sleep 0.50 
$(yad --title="Fast Repo" \
--width=450 --height=100 --center --fixed \
--text=$"\nSelected repository: <span font_desc='Sans Bold Italic 10' foreground='#BE7F00'>http://mirror.internode.on.net</span>\n\nReload synaptic to apply the repository changes.\n" \
--image="$ICON" \
--center \
--window-icon="$ICON" \
--button="Ok"!/usr/share/fastrepo/icons/ok.svg)
exit
 ;;
'http://mirror.aarnet.edu.au')
cp -rf "/usr/share/fastrepo/sources/aarnet" "/etc/apt/sources.list" 
sleep 0.50 
$(yad --title="Fast Repo" \
--width=450 --height=100 --center --fixed \
--text=$"\nSelected repository: <span font_desc='Sans Bold Italic 10' foreground='#BE7F00'>http://mirror.aarnet.edu.au</span>\n\nReload synaptic to apply the repository changes.\n" \
--image="$ICON" \
--center \
--window-icon="$ICON" \
--button="Ok"!/usr/share/fastrepo/icons/ok.svg)
exit
 ;;
'http://ftp.jaist.ac.jp')
cp -rf "/usr/share/fastrepo/sources/jaist" "/etc/apt/sources.list"
sleep 0.50  
$(yad --title="Fast Repo" \
--width=450 --height=100 --center --fixed \
--text=$"\nSelected repository:<span font_desc='Sans Bold Italic 10' foreground='#BE7F00'>http://ftp.jaist.ac.jp</span>\n\nReload synaptic to apply the repository changes.\n" \
--image="$ICON" \
--center \
--window-icon="$ICON" \
--button="Ok"!/usr/share/fastrepo/icons/ok.svg)
exit
 ;;
'http://mirrors.uni-ruse.bg')
cp -rf "/usr/share/fastrepo/sources/uni-ruse" "/etc/apt/sources.list" 
sleep 0.50 
$(yad --title="Fast Repo" \
--width=450 --height=100 --center --fixed \
--text=$"\nSelected repository: <span font_desc='Sans Bold Italic 10' foreground='#BE7F00'>http://mirrors.uni-ruse.bg</span>\n\nReload synaptic to apply the repository changes.\n" \
--image="$ICON" \
--center \
--window-icon="$ICON" \
--button="Ok"!/usr/share/fastrepo/icons/ok.svg)
exit
 ;;
'http://pclinuxos.mirror.wearetriple.com')
cp -rf "/usr/share/fastrepo/sources/wearetriple" "/etc/apt/sources.list" 
sleep 0.50 
$(yad --title="Fast Repo" \
--width=450 --height=100 --center --fixed \
--text=$"\nSelected repository: <span font_desc='Sans Bold Italic 10' foreground='#BE7F00'>http://pclinuxos.mirror.wearetriple.com</span>\n\nReload synaptic to apply the repository changes.\n" \
--image="$ICON" \
--center \
--window-icon="$ICON" \
--button="Ok"!/usr/share/fastrepo/icons/ok.svg)
exit
 ;;
'http://mirrors.cicku.me/pclinuxos')
cp -rf "/usr/share/fastrepo/sources/cicku" "/etc/apt/sources.list" 
sleep 0.50 
$(yad --title="Fast Repo" \
--width=450 --height=100 --center --fixed \
--text=$"\nSelected repository: <span font_desc='Sans Bold Italic 10' foreground='#BE7F00'>http://mirrors.cicku.me/pclinuxos</span>\n\nReload synaptic to apply the repository changes.\n" \
--image="$ICON" \
--center \
--window-icon="$ICON" \
--button="Ok"!/usr/share/fastrepo/icons/ok.svg)
exit
 ;;
'http://distrib-coffee.ipsl.jussieu.fr')
cp -rf "/usr/share/fastrepo/sources/coffee" "/etc/apt/sources.list" 
sleep 0.50 
$(yad --title="Fast Repo" \
--width=450 --height=100 --center --fixed \
--text=$"\nSelected repository: <span font_desc='Sans Bold Italic 10' foreground='#BE7F00'>http://distrib-coffee.ipsl.jussieu.fr</span>\n\nReload synaptic to apply the repository changes.\n" \
--image="$ICON" \
--center \
--window-icon="$ICON" \
--button="Ok"!/usr/share/fastrepo/icons/ok.svg)
 ;;
esac
fi



