Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Skype-installer
- v="Ver. 1.00"
- ##################
- # Description:
- # A combined Skype Installer and Uninstaller for Mageia.
- # Based in part on Skype4Mandriva by Megaf and adapted by barjac.
- # Uses aria2c as downloader and saves a copy of the tar.bz2 in ~/skype-tbz
- # which is not removed by the uninstaller. This saves bandwidth if a re-install
- # of the same version is required.
- # Also installs libv4l-wrappers required by most webcams to work with Skype
- # in Mageia and incorporates the module preload into the launcher.
- # This works equally well on i586 and x86_64.
- # An install log is created in /var/log/skype-installer.log
- ##################
- # Changelog:
- # Ver 1.00 10/05/2011 First version launched.
- #
- ##################
- # Use:
- # Save this file as "Skype-installer" and in the same directory run:-
- # chmod +x Skype-installer
- # To run this script from the same directory use:-
- # su
- # ./Skype-installer
- #
- ##################
- #
- #
- confirm()
- {
- par=("$@")
- rval=3
- while [[ $rval > 2 ]]; do
- echo -n ${par[0]}" "${par[1]}" "
- ans= ; rval=
- read ans
- if [[ -z $ans ]] || [[ ${#ans} > 1 ]]; then
- rval=3
- else
- case $ans in
- [${par[2]}]*)
- rval=0
- ;;
- [${par[3]}]*)
- rval=1
- ;;
- [${par[4]}]*)
- rval=2
- ;;
- *)
- rval=3
- ;;
- esac
- fi
- done
- return $rval
- }
- chksu()
- {
- if [[ $UID != 0 ]] || [[ $USER = "root" ]]; then
- echo "Sorry, you must run this as root. (Use su NOT su -)"
- exit 1
- fi
- }
- skypeun()
- {
- pkg=$(rpm -qa skype)
- [[ ${#pkg} = 0 ]] || urpme --auto -a skype >> /var/log/skype-installer.log
- rm -rf /opt/skype/ >> /var/log/skype-installer.log
- rm -f /usr/local/bin/skype >> /var/log/skype-installer.log
- rm -f /usr/share/icons/skype.png >> /var/log/skype-installer.log
- rm -f /usr/share/icons/SkypeBlue_48x48.png >> /var/log/skype-installer.log
- rm -f /usr/share/icons/SkypeBlue_16x16.png >> /var/log/skype-installer.log
- rm -f /usr/share/icons/SkypeBlue_32x32.png >> /var/log/skype-installer.log
- rm -f /usr/share/applications/skype.desktop >> /var/log/skype-installer.log
- rm -rf /tmp/skype-installer/ >> /var/log/skype-installer.log
- }
- getskype()
- {
- echo "Downloading Skype latest version - Please be patient..." | tee -a /var/log/skype-installer.log
- mkdir /tmp/skype-installer >> /var/log/skype-installer.log
- aria2c -s1 -c -m0 "http://www.skype.com/go/getskype-linux-beta-dynamic" --dir=/home/$USER/skype-tbz >> /var/log/skype-installer.log
- cp /home/$USER/skype-tbz/$(ls --sort version --reverse /home/$USER/skype-tbz |grep -v aria |grep -m1 skype) /tmp/skype-installer/Skype-latest.tar.bz2 >> /var/log/skype-installer.log
- tar jxvf /tmp/skype-installer/Skype-latest.tar.bz2 -C /tmp/skype-installer/ >> /var/log/skype-installer.log
- }
- getdeps()
- {
- echo "Installing dependencies" | tee -a /var/log/skype-installer.log
- urpmi --auto libasound.so.2 libXv.so.1 libXss.so.1 libQtDBus.so.4 libQtGui.so.4 libQtNetwork.so.4 libv4l-wrappers >> /var/log/skype-installer.log
- }
- skypeinst()
- {
- echo "Installing Skype" | tee -a /var/log/skype-installer.log
- mkdir /opt/skype/ >> /var/log/skype-installer.log
- cp -axRf /tmp/skype-installer/skype-*/* /opt/skype/ >> /var/log/skype-installer.log
- cp -axf /opt/skype/icons/SkypeBlue_48x48.png /usr/share/icons/skype.png >> /var/log/skype-installer.log
- cp -axf /opt/skype/icons/* /usr/share/icons/ >> /var/log/skype-installer.log
- cp -axf /opt/skype/skype.desktop /usr/share/applications/ >> /var/log/skype-installer.log
- echo "LD_PRELOAD=/usr/lib/libv4l/v4l2convert.so /opt/skype/skype --resources=/bin/skype/" > /usr/local/bin/skype && chmod +x /usr/local/bin/skype
- }
- cleanup()
- {
- echo "Removing temporary files" | tee -a /var/log/skype-installer.log
- rm -rf /tmp/skype-installer/ >> /var/log/skype-installer.log
- }
- exiterr()
- {
- echo "An error occurred - Check /var/log/skype-installer.log for clues"
- exit 1
- }
- ########################## Get this show on the road ! #########################
- clear
- echo "Skype Installer - "$v
- chksu
- confirm "(I)nstall latest Skype version, (U)ninstall Only or (Q)uit ?" "[I/U/Q]" "Ii" "Uu" "Qq"
- an=$?
- [[ $an > 1 ]] && exit 1
- rm -f /var/log/skype-installer.log
- if [[ $an = 0 ]]; then
- echo "Uninstalling previous version/s of Skype" | tee -a /var/log/skype-installer.log
- skypeun
- getskype
- getdeps
- skypeinst
- cleanup
- echo "Skype has been installed successfully" | tee -a /var/log/skype-installer.log
- else
- echo "Uninstalling Skype" | tee -a /var/log/skype-installer.log
- skypeun
- echo "Skype has been uninstalled - you may need to remove any manually created desktop launchers by hand." | tee -a /var/log/skype-installer.log
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement