wok rev 5116

Updated get-google-chrome: get script added -f / -r options
author Liu Peng <rocky@slitaz.org>
date Fri Mar 19 16:51:33 2010 +0000 (2010-03-19)
parents c64834e1639a
children a0ec5181ee64
files get-google-chrome/receipt get-google-chrome/stuff/get-google-chrome
line diff
     1.1 --- a/get-google-chrome/receipt	Fri Mar 19 15:49:11 2010 +0000
     1.2 +++ b/get-google-chrome/receipt	Fri Mar 19 16:51:33 2010 +0000
     1.3 @@ -1,7 +1,7 @@
     1.4  # SliTaz package receipt.
     1.5  
     1.6  PACKAGE="get-google-chrome"
     1.7 -VERSION="1.01"
     1.8 +VERSION="1.02"
     1.9  CATEGORY="non-free"
    1.10  SHORT_DESC="Google Chrome is built with open source code from Chromium."
    1.11  MAINTAINER="rocky@slitaz.org"
     2.1 --- a/get-google-chrome/stuff/get-google-chrome	Fri Mar 19 15:49:11 2010 +0000
     2.2 +++ b/get-google-chrome/stuff/get-google-chrome	Fri Mar 19 16:51:33 2010 +0000
     2.3 @@ -6,7 +6,17 @@
     2.4  URL="http://dl.google.com/linux/direct/$DEBPKG"
     2.5  CUR_DIR=$(pwd)
     2.6  TEMP_DIR=/tmp/$PACKAGE-$$
     2.7 -ROOT="$1"
     2.8 +ROOT=
     2.9 +FORCED=
    2.10 +
    2.11 +while getopts "hfr:" option; do
    2.12 +    case $option in
    2.13 +        h) echo -e "Usage: $(basename $0) [-f|-r path]\n    -f: force install.\n    -r path: root directory."; exit 1 ;;
    2.14 +        f) FORCED="--forced" ;;
    2.15 +        r) ROOT=$OPTARG ;;
    2.16 +        \?) echo "Wrong argument, Exit ...."; exit 1 ;;
    2.17 +    esac
    2.18 +done
    2.19  
    2.20  # Check if we are root
    2.21  if test $(id -u) != 0 ; then
    2.22 @@ -16,8 +26,8 @@
    2.23  fi
    2.24  
    2.25  # Avoid reinstall
    2.26 -if [ -d $ROOT/var/lib/tazpkg/installed/$PACKAGE ]; then
    2.27 -    echo -e "\n$PACKAGE package is already installed.\n"
    2.28 +if [ -d $ROOT/var/lib/tazpkg/installed/$PACKAGE ] && [ -z $FORCED ]; then
    2.29 +    echo -e "\n$PACKAGE package is already installed, add '-f' option to force install.\n"
    2.30      exit 1
    2.31  fi
    2.32  
    2.33 @@ -145,7 +155,7 @@
    2.34  rm -rf $PACKAGE-$VERSION
    2.35  
    2.36  # Install pseudo package
    2.37 -yes y | tazpkg install $PACKAGE-$VERSION.tazpkg --root=$ROOT
    2.38 +yes y | tazpkg install $PACKAGE-$VERSION.tazpkg --root=$ROOT $FORCED
    2.39  
    2.40  # Clean
    2.41  cd $CUR_DIR