Het is zo sep 05, 2010 6:05 pm

Alle tijden zijn GMT + 1 uur [ Zomertijd ]




Plaats een nieuw onderwerp Antwoord op onderwerp  [ 18 berichten ]  Ga naar pagina Vorige  1, 2
Auteur Bericht
 Berichttitel:
BerichtGeplaatst: zo dec 16, 2007 11:50 pm 
Offline
Moderator
Avatar gebruiker

Geregistreerd op: vr dec 22, 2006 2:37 pm
Berichten: 1312
Woonplaats: Omgeving Breda
waarom 1 issue per revisie? Dat doen die grote scripts ook niet. Anders zaten we nu bijv. op gcc 4.2.5487 :p.

_________________
"Been There, Done That, GOING BACK!" - Disneyland Parijs


Omhoog
 Profiel E-mail  
 
 Berichttitel: Re: Script om Gentoo te updaten
BerichtGeplaatst: di apr 13, 2010 9:49 am 
Offline
Moderator
Avatar gebruiker

Geregistreerd op: vr dec 22, 2006 2:37 pm
Berichten: 1312
Woonplaats: Omgeving Breda
En vandaag heb ik weer ff een nieuwe versie gemaakt, omdat eix een update heeft gedaan en het commando om de eix-database bij te werken tegenwoordig eix-update heet ipv update-eix. Deze versie maakt dus gebruik van dat commando. Als je stable Gentoo draait moet je dus gewoon bij 0.7 blijven. Bij unstable Gentoo heb je 0.7.1 nodig. Aangezien door een DB chrash 0.4 de recentste is die in dit topic staat zal ik onderaan deze post ook 0.7 nog ff plaatsen.

update 0.7.1:
Code:
#!/bin/bash
###############################################################################
#                             GENTOO UPDATE SCRIPT                            #
###############################################################################

###############################################################################
#                                                                             #
#  Author:  Tijn Buijs (Cybertinus)                                           #
#  Date:    November 24, 2007                                                 #
#  E-mail:  <my-nickname>@<my-nickname>.nl                                    #
#                                                                             #
#  Copyright (c) 2010 Tijn Buijs                                              #
#                                                                             #
#  Permission to use, copy, modify, and distribute this software for any      #
#  purpose with or without fee is hereby granted, provided that the above     #
#  copyright notice and this permission notice appear in all copies.          #
#                                                                             #
#  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES   #
#  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF           #
#  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR    #
#  ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES     #
#  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN      #
#  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF    #
#  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.             #
#                                                                             #
#  Thanks: Boudewijn Ector, for making some modifications in this script      #
#                                                                             #
###############################################################################

#############
# CHANGELOG #
#############

#0.1   : initial version (TB)
#0.2   : commandline options (BE)
#0.3   : dynamic helper binary paths (BE)
#0.3.1 : fixed bug #1 ($LAYMAN_LOCATION ignored) (TB)
#        fixed bug #2 (extra ' after = at UPDATEDB_LOCATION) (TB)
#        fixed bug #3 (no - in the update-eix command) (TB)
#        added line to indicate that layman is starting (TB)
#        added $EMERGE_LOCATION to make the emerge an option too (TB)
#0.4   : added the commandline option to disable emerge --sync (TB)
#        added an check to see if all executables for all the enabled options
#          are available
#        changed the default behavior. In previous versions all the update
#          parts where disabled by default and you must enable them with an
#          commandline option. From now on everything is enabled by default and
#          you must disable them via an commandline option.
#        added an catch for unknown arguments, it displays the help (TB)
#        added the help commandline option (TB)
#        added the commandline option to show the version number (TB)
#        added the debs for each configuration item in the configurationpart(TB)
#0.5   : added the --skipfirst option, to add the --skipfirst option to emerge (TB)
#0.6   : Added the --no-update option, so you can only run the post-processes (TB)
#        Added support for emerge version 2.2. In 2.2 system isn't a part of
#          world anymore. The script now checks for that. (TB)
#0.7   : Added support for checking symlinks to webapplicatons, in order that they
#          always point to the newest version (TB)
#0.7.1 : eix had an update, the update tool is called 'eix-update' now instead of
#          'update-eix'. So, when using eix 0.20.3 or newer this version is needed
#          to be able to update the eix date during the update process (TB)

#################
# CONFIGURATION #
#################

# Update layman? (needs app-portage/layman)
RUN_LAYMAN='Y'

# Sync emerge DB? (no aditional dependicies)
RUN_SYNC='Y'

# Do the actual update? (no aditional dependicies)
RUN_UPDATE='Y'

# Run updatedb afterwards? (needs sys-apps/slocate)
RUN_UPDATEDB='Y'

# Run update-eix afterwards? (needs app-portage/eix)
RUN_UPDATEEIX='Y'

# Run prelink afterwards? (see http://www.gentoo.org/doc/en/prelink-howto.xml)
RUN_PRELINK='Y'

# Run the check for webapplications
RUN_WEBAPPCHECK='Y'

# Locations (only required to set when you enable the corresponding command)
LAYMAN_LOCATION=`which layman 2> /dev/null`
EMERGE_LOCATION=`which emerge 2> /dev/null`
UPDATEDB_LOCATION=`which updatedb 2> /dev/null`
UPDATEEIX_LOCATION=`which eix-update 2> /dev/null`
PRELINK_LOCATION='/etc/cron.daily/prelink'

# Webapp configuration
# The names of al the webapps that need to be checked
WEBAPPS=("phpmp" "phpmyadmin" "squirrelmail")
# The location where all webapps are installed
WEBAPP_LOCATION="/usr/share/webapps/"
# A list of all the symlinks, linking to the webapplications. Note: you must name the symlinks in the same orders as you did with the names
WEBAPP_SYMLINKS=("/home/tijn/localhost/htdocs/phpmp" "/home/tijn/localhost/htdocs/phpmyadmin" "/home/tijn/localhost/htdocs/local.cybertinus.nl/webmail")


#################
# ACTUAL SCRIPT #
#################

VERSION="0.7.1"
SKIPFIRST="N"

function show_help()
{
   command=`basename $1`
   echo "$command
This program updates your complete Gentoo installation to the newest versions
of al the installed software on your system.

Usage: $command [-l | --layman] [-s | --sync] [-u | --updatedb]
          [-x | --updateeix] [-p | --prelink] [-S | --skipfirst]
      $command [-h | --help]
      $command [-v | --version]
-l | --layman    : Don't update the layman overlays
-s | --sync      : Don't update the Portage cache
-U | --no-update : Don't run the actual update
-u | --updatedb  : Don't run updatedb afterwards
-x | --updateeix : Don't update the eix database afterwards
-p | --prelink   : Don't prelink the system afterwards
-w | --no-webapp : Don't check the webapp symlinks for linking to the latest version
-S | --skipfirst : Add the --skipfirst option to emerge
-h | --help      : Show this help, then exit
-v | --version   : Show which version of this script you are currently using
"
}

function show_version()
{
   echo "Current version: $VERSION"
}

# handle the commandline options  (By BE)
while [ -n "$(echo $1 | grep -- '-')" -a $# -gt 0 ]; do
   case $1 in
      # full options
      --layman ) RUN_LAYMAN='N';;
      --sync ) RUN_SYNC='N';;
      --no-update ) RUN_UPDATE='N';;
      --updatedb ) RUN_UPDATEDB='N';;
      --updateeix ) RUN_UPDATEEIX='N';;
      --prelink ) RUN_PRELINK='N';;
      --skipfirst ) SKIPFIRST='Y';;
      --no-webapp ) RUN_WEBAPPCHECK='N';;
      --help ) show_help $0; exit 0;;
      --version ) show_version; exit 0;;

      #single char versions of options
      -l ) RUN_LAYMAN='N';;
      -s ) RUN_SYNC='N';;
      -U ) RUN_UPDATE='N';;
      -u ) RUN_UPDATEDB='N';;
      -x ) RUN_UPDATEEIX='N';;
      -S ) SKIPFIRST="Y";;
      -p ) RUN_PRELINK='N';;
      -w ) RUN_WEBAPPCHECK='N';;
      -h ) show_help $0; exit 0;;
      -v ) show_version; exit 0;;

      #Catch for unkown arguments
      * )
         echo "Unknown argument $1."
         echo ""
         show_help $0
         exit 1
      ;;
   esac
   shift
done

#end of commandline option handling


# Update layman (overlays)
if [ "$RUN_LAYMAN" = 'Y' ] ; then
   if [ ! -e "$LAYMAN_LOCATION" -o ! -x "$LAYMAN_LOCATION" ] ; then
      echo 'The layman executable is not found or is not executable.'
      echo 'Have you installed app-portage/layman?'
   else
      echo 'Updating the Layman overlays now';
      $LAYMAN_LOCATION -S
   fi
fi

# Run normal updates
# Staring the normal sync
if [ "$RUN_SYNC" = 'Y' ] ; then
   if [ ! -e "$EMERGE_LOCATION" -o ! -x "$EMERGE_LOCATION" ] ; then
      echo 'The emerge executable is not found or is not executable.'
      echo 'This is one of the main parts of Gentoo. I think you have a serious problem.'
   else
      echo 'Syncing the Portage database now';
      $EMERGE_LOCATION --sync
   fi
fi

if [ ! -e "$EMERGE_LOCATION" -o ! -x "$EMERGE_LOCATION" ] ; then
   echo 'The emerge executable is not found or is not executable.'
   echo 'This is one of the main parts of Gentoo. I think you have a serious problem.'
else
   ANSWER='n'
   if [ "$RUN_UPDATE" = 'Y' ] ; then
      EMERGE_OPTIONS="-vuDN"
      if [ $SKIPFIRST = "Y" ] ; then
         EMERGE_OPTIONS="$EMERGE_OPTIONS --skipfirst"
      fi
      EMERGE_VERSION=$(emerge -V 2> /dev/null | awk '/.*2.2.*/')
      if [ -n "$EMERGE_VERSION" ] ; then
         EMERGE_SETS="@world @system"
      else
         EMERGE_SETS="world"
      fi
      $EMERGE_LOCATION $EMERGE_OPTIONS -p $EMERGE_SETS
      echo -n -e '\nWould you like to merge these packages? [\033[1;32mYes\033[0m/\033[1;31mNo\033[0m] '
      read ANSWER
      ANSWER=$(echo $ANSWER | tr '[A-Z]' '[a-z]')
   fi
   if [ "$ANSWER" = "y" -o "$ANSWER" = "yes" -o "$RUN_UPDATE" = 'N' ] ; then
      if [ "$RUN_UPDATE" = 'Y' ] ; then
         # Do regular updates
         $EMERGE_LOCATION $EMERGE_OPTIONS world
      fi

      # CHECK FOR POST-UPDATE COMMANDS
      # Check 1: run updatedb?
      if [ "$RUN_UPDATEDB" = 'Y' ] ; then
         if [ ! -e "$UPDATEDB_LOCATION" -o ! -x "$UPDATEDB_LOCATION" ] ; then
            echo 'The updatedb executable is not found or is not executable.'
            echo 'Have you installed sys-apps/slocate?'
         else
            echo -n 'Running updatedb now... '
            $UPDATEDB_LOCATION
            echo 'done'
         fi
      fi

      # Check 2: run eix-update? (for updating the eix database, faster searching
      #          in the portage database)
      if [ "$RUN_UPDATEEIX" = "Y" ] ; then
         if [ ! -e "$UPDATEEIX_LOCATION" -o ! -x "$UPDATEEIX_LOCATION" ] ; then
            echo 'The eix-update executable is not found or is not executable.'
            echo 'Have you installed app-portage/eix?'
         else
            echo 'Running eix-update now...'
            $UPDATEEIX_LOCATION
            echo 'Done updating the eix database';
         fi
      fi

      # Check 3: run prelink? See http://www.gentoo.org/doc/en/prelink-howto.xml
      #          for more information
      if [ "$RUN_PRELINK" = "Y" ] ; then
         if [ ! -e "$PRELINK_LOCATION" -o ! -x "$PRELINK_LOCATION" ] ; then
            echo 'The prelink command is not found or is not executable.'
            echo 'Have you read and followed http://www.gentoo.org/doc/en/prelink-howto.xml?'
         else
            echo -n 'Running prelink now... '
            $PRELINK_LOCATION
            echo 'done'
         fi
      fi

      # Check 4: check if the webapplications all link to the latest version
      if [ "$RUN_WEBAPPCHECK" = "Y" ] ; then
         # A loop across all given webapps
         for i in $(seq 0 $((${#WEBAPPS[@]}- 1))) ; do
            # Check to see if the given symlink really is a symlink
            if [ -h ${WEBAPP_SYMLINKS[$i]} ] ; then
               # Resolving the highest version installed on the system
               HIGHEST_VERSION=$(ls $WEBAPP_LOCATION${WEBAPPS[$i]} | tail -n 1)
               # Resolving the version the symlink currently links to
               CURRENT_VERSION=$(basename `dirname $(ls -l ${WEBAPP_SYMLINKS[$i]} | cut -d '>' -f 2)`)
               # Show what has been found
               echo "*** ${WEBAPPS[$i]} ***"
               echo "Highest version: $HIGHEST_VERSION"
               echo "Current version: $CURRENT_VERSION"
               # Check to see if the symlink needs updating
               if [ $HIGHEST_VERSION != $CURRENT_VERSION ] ; then
                  echo 'The version is not up-to-date. Updating symlink now'
                  rm ${WEBAPP_SYMLINKS[$i]}
                  ln -s $WEBAPP_LOCATION${WEBAPPS[$i]}/$HIGHEST_VERSION/htdocs/ ${WEBAPP_SYMLINKS[$i]}
               fi
            else
               echo "${WEBAPP_SYMLINKS[$i]} isn't a symlink, please update the configuration of update. This \"symlink\" is ignored for now." 1>&2
            fi
         done
      fi
   fi
fi


update 0.7:
Code:
#!/bin/bash
###############################################################################
#                             GENTOO UPDATE SCRIPT                            #
###############################################################################

###############################################################################
#                                                                             #
#  Author:  Tijn Buijs (Cybertinus)                                           #
#  Date:    November 24, 2007                                                 #
#  E-mail:  <my-nickname>@<my-nickname>.nl and firstname@firsnamelastname.nl  #
#                                                                             #
#  Copyright (c) 2009 Tijn Buijs                                              #
#                                                                             #
#  Permission to use, copy, modify, and distribute this software for any      #
#  purpose with or without fee is hereby granted, provided that the above     #
#  copyright notice and this permission notice appear in all copies.          #
#                                                                             #
#  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES   #
#  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF           #
#  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR    #
#  ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES     #
#  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN      #
#  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF    #
#  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.             #
#                                                                             #
#  Thanks: Boudewijn Ector, for making some modifications in this script      #
#                                                                             #
###############################################################################

#############
# CHANGELOG #
#############

#0.1   : initial version (TB)
#0.2   : commandline options (BE)
#0.3   : dynamic helper binary paths (BE)
#0.3.1 : fixed bug #1 ($LAYMAN_LOCATION ignored) (TB)
#        fixed bug #2 (extra ' after = at UPDATEDB_LOCATION) (TB)
#        fixed bug #3 (no - in the update-eix command) (TB)
#        added line to indicate that layman is starting (TB)
#        added $EMERGE_LOCATION to make the emerge an option too (TB)
#0.4   : added the commandline option to disable emerge --sync (TB)
#        added an check to see if all executables for all the enabled options
#          are available
#        changed the default behavior. In previous versions all the update
#          parts where disabled by default and you must enable them with an
#          commandline option. From now on everything is enabled by default and
#          you must disable them via an commandline option.
#        added an catch for unknown arguments, it displays the help (TB)
#        added the help commandline option (TB)
#        added the commandline option to show the version number (TB)
#        added the debs for each configuration item in the configurationpart(TB)
#0.5   : added the --skipfirst option, to add the --skipfirst option to emerge (TB)
#0.6   : Added the --no-update option, so you can only run the post-processes (TB)
#        Added support for emerge version 2.2. In 2.2 system isn't a part of
#          world anymore. The script now checks for that. (TB)
#0.7   : Added support for checking symlinks to webapplicatons, in order that they
#          always to the newest version (TB)

#################
# CONFIGURATION #
#################

# Update layman? (needs app-portage/layman)
RUN_LAYMAN='Y'

# Sync emerge DB? (no aditional dependicies)
RUN_SYNC='Y'

# Do the actual update? (no aditional dependicies)
RUN_UPDATE='Y'

# Run updatedb afterwards? (needs sys-apps/slocate)
RUN_UPDATEDB='Y'

# Run update-eix afterwards? (needs app-portage/eix)
RUN_UPDATEEIX='Y'

# Run prelink afterwards? (see http://www.gentoo.org/doc/en/prelink-howto.xml)
RUN_PRELINK='Y'

# Run the check for webapplications
RUN_WEBAPPCHECK='Y'

# Locations (only required to set when you enable the corresponding command)
LAYMAN_LOCATION=`which layman 2> /dev/null`
EMERGE_LOCATION=`which emerge 2> /dev/null`
UPDATEDB_LOCATION=`which updatedb 2> /dev/null`
UPDATEEIX_LOCATION=`which update-eix 2> /dev/null`
PRELINK_LOCATION='/etc/cron.daily/prelink'

# Webapp configuration
# The names of al the webapps that need to be checked
WEBAPPS=("phpmp" "phpmyadmin" "squirrelmail")
# The location where all webapps are installed
WEBAPP_LOCATION="/usr/share/webapps/"
# A list of all the symlinks, linking to the webapplications. Note: you must name the symlinks in the same orders as you did with the names
WEBAPP_SYMLINKS=("/home/tijn/localhost/htdocs/phpmp" "/home/tijn/localhost/htdocs/phpmyadmin" "/home/tijn/localhost/htdocs/local.cybertinus.nl/webmail")


#################
# ACTUAL SCRIPT #
#################

VERSION="0.7"
SKIPFIRST="N"

function show_help()
{
   command=`basename $1`
   echo "$command
This program updates your complete Gentoo installation to the newest versions
of al the installed software on your system.

Usage: $command [-l | --layman] [-s | --sync] [-u | --updatedb]
          [-x | --updateeix] [-p | --prelink] [-S | --skipfirst]
      $command [-h | --help]
      $command [-v | --version]
-l | --layman    : Don't update the layman overlays
-s | --sync      : Don't update the Portage cache
-U | --no-update : Don't run the actual update
-u | --updatedb  : Don't run updatedb afterwards
-x | --updateeix : Don't run updateeix afterwards
-p | --prelink   : Don't prelink the system afterwards
-w | --no-webapp : Don't check the webapp symlinks for linking to the latest version
-S | --skipfirst : Add the --skipfirst option to emerge
-h | --help      : Show this help, then exit
-v | --version   : Show which version of this script you are currently using
"
}

function show_version()
{
   echo "Current version: $VERSION"
}

# handle the commandline options  (By BE)
while [ -n "$(echo $1 | grep -- '-')" -a $# -gt 0 ]; do
   case $1 in
      # full options
      --layman ) RUN_LAYMAN='N';;
      --sync ) RUN_SYNC='N';;
      --no-update ) RUN_UPDATE='N';;
      --updatedb ) RUN_UPDATEDB='N';;
      --updateeix ) RUN_UPDATEEIX='N';;
      --prelink ) RUN_PRELINK='N';;
      --skipfirst ) SKIPFIRST='Y';;
      --no-webapp ) RUN_WEBAPPCHECK='N';;
      --help ) show_help $0; exit 0;;
      --version ) show_version; exit 0;;

      #single char versions of options
      -l ) RUN_LAYMAN='N';;
      -s ) RUN_SYNC='N';;
      -U ) RUN_UPDATE='N';;
      -u ) RUN_UPDATEDB='N';;
      -x ) RUN_UPDATEEIX='N';;
      -S ) SKIPFIRST="Y";;
      -p ) RUN_PRELINK='N';;
      -w ) RUN_WEBAPPCHECK='N';;
      -h ) show_help $0; exit 0;;
      -v ) show_version; exit 0;;

      #Catch for unkown arguments
      * )
         echo "Unknown argument $1."
         echo ""
         show_help $0
         exit 1
      ;;
   esac
   shift
done

#end of commandline option handling


# Update layman (overlays)
if [ "$RUN_LAYMAN" = 'Y' ] ; then
   if [ ! -e "$LAYMAN_LOCATION" -o ! -x "$LAYMAN_LOCATION" ] ; then
      echo 'The layman executable is not found or is not executable.'
      echo 'Have you installed app-portage/layman?'
   else
      echo 'Updating the Layman overlays now';
      $LAYMAN_LOCATION -S
   fi
fi

# Run normal updates
# Staring the normal sync
if [ "$RUN_SYNC" = 'Y' ] ; then
   if [ ! -e "$EMERGE_LOCATION" -o ! -x "$EMERGE_LOCATION" ] ; then
      echo 'The emerge executable is not found or is not executable.'
      echo 'This is one of the main parts of Gentoo. I think you have a serious problem.'
   else
      echo 'Syncing the Portage database now';
      $EMERGE_LOCATION --sync
   fi
fi

if [ ! -e "$EMERGE_LOCATION" -o ! -x "$EMERGE_LOCATION" ] ; then
   echo 'The emerge executable is not found or is not executable.'
   echo 'This is one of the main parts of Gentoo. I think you have a serious problem.'
else
   ANSWER='n'
   if [ "$RUN_UPDATE" = 'Y' ] ; then
      EMERGE_OPTIONS="-vuDN"
      if [ $SKIPFIRST = "Y" ] ; then
         EMERGE_OPTIONS="$EMERGE_OPTIONS --skipfirst"
      fi
      EMERGE_VERSION=$(emerge -V 2> /dev/null | awk '/.*2.2.*/')
      if [ -n "$EMERGE_VERSION" ] ; then
         EMERGE_SETS="@world @system"
      else
         EMERGE_SETS="world"
      fi
      $EMERGE_LOCATION $EMERGE_OPTIONS -p $EMERGE_SETS
      echo -n -e '\nWould you like to merge these packages? [\033[1;32mYes\033[0m/\033[1;31mNo\033[0m] '
      read ANSWER
      ANSWER=$(echo $ANSWER | tr '[A-Z]' '[a-z]')
   fi
   if [ "$ANSWER" = "y" -o "$ANSWER" = "yes" -o "$RUN_UPDATE" = 'N' ] ; then
      if [ "$RUN_UPDATE" = 'Y' ] ; then
         # Do regular updates
         $EMERGE_LOCATION $EMERGE_OPTIONS world
      fi

      # CHECK FOR POST-UPDATE COMMANDS
      # Check 1: run updatedb?
      if [ "$RUN_UPDATEDB" = 'Y' ] ; then
         if [ ! -e "$UPDATEDB_LOCATION" -o ! -x "$UPDATEDB_LOCATION" ] ; then
            echo 'The updatedb executable is not found or is not executable.'
            echo 'Have you installed sys-apps/slocate?'
         else
            echo -n 'Running updatedb now... '
            $UPDATEDB_LOCATION
            echo 'done'
         fi
      fi

      # Check 2: run update-eix? (for updating the eix database, faster searching
      #          in the portage database)
      if [ "$RUN_UPDATEEIX" = "Y" ] ; then
         if [ ! -e "$UPDATEEIX_LOCATION" -o ! -x "$UPDATEEIX_LOCATION" ] ; then
            echo 'The update-eix executable is not found or is not executable.'
            echo 'Have you installed app-portage/eix?'
         else
            echo 'Running update-eix now...'
            $UPDATEEIX_LOCATION
            echo 'Done updating the eix database';
         fi
      fi

      # Check 3: run prelink? See http://www.gentoo.org/doc/en/prelink-howto.xml
      #          for more information
      if [ "$RUN_PRELINK" = "Y" ] ; then
         if [ ! -e "$PRELINK_LOCATION" -o ! -x "$PRELINK_LOCATION" ] ; then
            echo 'The prelink command is not found or is not executable.'
            echo 'Have you read and followed http://www.gentoo.org/doc/en/prelink-howto.xml?'
         else
            echo -n 'Running prelink now... '
            $PRELINK_LOCATION
            echo 'done'
         fi
      fi

      # Check 4: check if the webapplications all link to the latest version
      if [ "$RUN_WEBAPPCHECK" = "Y" ] ; then
         # A loop across all given webapps
         for i in $(seq 0 $((${#WEBAPPS[@]}- 1))) ; do
            # Check to see if the given symlink really is a symlink
            if [ -h ${WEBAPP_SYMLINKS[$i]} ] ; then
               # Resolving the highest version installed on the system
               HIGHEST_VERSION=$(ls $WEBAPP_LOCATION${WEBAPPS[$i]} | tail -n 1)
               # Resolving the version the symlink currently links to
               CURRENT_VERSION=$(basename `dirname $(ls -l ${WEBAPP_SYMLINKS[$i]} | cut -d '>' -f 2)`)
               # Show what has been found
               echo "*** ${WEBAPPS[$i]} ***"
               echo "Highest version: $HIGHEST_VERSION"
               echo "Current version: $CURRENT_VERSION"
               # Check to see if the symlink needs updating
               if [ $HIGHEST_VERSION != $CURRENT_VERSION ] ; then
                  echo 'The version is not up-to-date. Updating symlink now'
                  rm ${WEBAPP_SYMLINKS[$i]}
                  ln -s $WEBAPP_LOCATION${WEBAPPS[$i]}/$HIGHEST_VERSION/htdocs/ ${WEBAPP_SYMLINKS[$i]}
               fi
            else
               echo "${WEBAPP_SYMLINKS[$i]} isn't a symlink, please update the configuration of update. This \"symlink\" is ignored for now." 1>&2
            fi
         done
      fi
   fi
fi

_________________
"Been There, Done That, GOING BACK!" - Disneyland Parijs


Omhoog
 Profiel E-mail  
 
 Berichttitel: Re: Script om Gentoo te updaten
BerichtGeplaatst: zo jul 04, 2010 11:29 am 
Offline
Moderator
Avatar gebruiker

Geregistreerd op: vr dec 22, 2006 2:37 pm
Berichten: 1312
Woonplaats: Omgeving Breda
En weer eens een nieuwe versie gemaakt. De eerste belangrijke wijziging is dat de emerge optie --with-bdeps nu ondersteund wordt. Uit de manual van emerge:
Code:
--with-bdeps < y | n >
   In  dependency  calculations,  pull  in build time dependencies that are not strictly required.
   This defaults to ´n´ for installation actions, meaning they will not be installed, and ´y´  for
   the  --depclean  action,  meaning  they  will  not  be  removed.   This setting can be added to
   EMERGE_DEFAULT_OPTS (see make.conf(5)) and later overridden via the command line.

Ik denk dat deze optie verklaard dat je nog wel eens pakketten tegen komt die niet geupdate zijn (bijv. als je een emerge -ave @world draait).
Deze optie toevoegen was de reden dat ik weer ben gaan rommelen aan m'n update script :).

Een andere belangrijke wijziging is dat de commandline optie's nu de default settings veranderen naar de andere waarde. Als je dus standaard layman aan hebt staan, dan zet --layman hem nu uit. En als je layman standaard uit hebt staan, dan zet --layman hem nu juist aan. Vroeger zette --layman de optie altijd uit. Ook als dat de standaard waarde al was. Die opties zijn nu dus een stukje nuttiger geworden.

Verder heb ik nog een paar kleine dingetjes veranderd. Zie de changelog voor alle veranderingen.

update 0.8
Code:
#!/bin/bash
###############################################################################
#                             GENTOO UPDATE SCRIPT                            #
###############################################################################

###############################################################################
#                                                                             #
#  Author:  Tijn Buijs (Cybertinus)                                           #
#  Date:    November 24, 2007                                                 #
#  E-mail:  <my-nickname>@<my-nickname>.nl                                    #
#                                                                             #
#  Copyright (c) 2010 Tijn Buijs                                              #
#                                                                             #
#  Permission to use, copy, modify, and distribute this software for any      #
#  purpose with or without fee is hereby granted, provided that the above     #
#  copyright notice and this permission notice appear in all copies.          #
#                                                                             #
#  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES   #
#  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF           #
#  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR    #
#  ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES     #
#  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN      #
#  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF    #
#  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.             #
#                                                                             #
#  Thanks: Boudewijn Ector, for making some modifications in this script      #
#                                                                             #
###############################################################################

#############
# CHANGELOG #
#############

#0.1   : Initial version (TB)
#0.2   : Commandline options (BE)
#0.3   : Dynamic helper binary paths (BE)
#0.3.1 : Fixed bug #1 ($LAYMAN_LOCATION ignored) (TB)
#        Fixed bug #2 (extra ' after = at UPDATEDB_LOCATION) (TB)
#        Fixed bug #3 (no - in the update-eix command) (TB)
#        Added line to indicate that layman is starting (TB)
#        Added $EMERGE_LOCATION to make the emerge an option too (TB)
#0.4   : Added the commandline option to disable emerge --sync (TB)
#        Added an check to see if all executables for all the enabled options
#          are available
#        Changed the default behavior. In previous versions all the update
#          parts where disabled by default and you must enable them with an
#          commandline option. From now on everything is enabled by default and
#          you must disable them via an commandline option.
#        Added an catch for unknown arguments, it displays the help (TB)
#        Added the help commandline option (TB)
#        Added the commandline option to show the version number (TB)
#        Added the debs for each configuration item in the configurationpart(TB)
#0.5   : Added the --skipfirst option, to add the --skipfirst option to emerge (TB)
#0.6   : Added the --no-update option, so you can only run the post-processes (TB)
#        Added support for emerge version 2.2. In 2.2 system isn't a part of
#          world anymore. The script now checks for that. (TB)
#0.7   : Added support for checking symlinks to webapplicatons, in order that they
#          always point to the newest version (TB)
#0.7.1 : eix had an update, the update tool is called 'eix-update' now instead of
#          'update-eix'. So, when using eix 0.20.3 or newer this version is needed
#          to be able to update the eix date during the update process (TB)
#0.8   : Added dynamic options. It toggles the default setting, instead of
#          always enabeling it. Also updated the helpfunction to reflect this (TB)
#        Updated the help function to have all the options in the help message
#          (in previous versions the short-list wasn't complete) (TB)
#        Added support for --with-bdeps (TB)
#        Added a few comments in the actual script, to make it understandable (TB)
#        When running the actual update (when the user pressed 'y', after the
#          package list) the used set was always "world", also when using portage
#          2.2. It is using @world @system in Portage 2.2 now. Creating the
#          package list did use @world @system.

#################
# CONFIGURATION #
#################

# Update layman? (needs app-portage/layman)
RUN_LAYMAN='Y'

# Sync emerge DB? (no aditional dependicies)
RUN_SYNC='Y'

# Do the actual update? (no aditional dependicies)
RUN_UPDATE='Y'

# Add the option --with-bdeps to the emerge command
ADD_BDEPS='Y'

# Run updatedb afterwards? (needs sys-apps/slocate)
RUN_UPDATEDB='Y'

# Run update-eix afterwards? (needs app-portage/eix)
RUN_UPDATEEIX='Y'

# Run prelink afterwards? (see http://www.gentoo.org/doc/en/prelink-howto.xml)
RUN_PRELINK='Y'

# Run the check for webapplications
RUN_WEBAPPCHECK='Y'

# Locations (only required to set when you enable the corresponding command)
LAYMAN_LOCATION=`which layman 2> /dev/null`
EMERGE_LOCATION=`which emerge 2> /dev/null`
UPDATEDB_LOCATION=`which updatedb 2> /dev/null`
UPDATEEIX_LOCATION=`which eix-update 2> /dev/null`
PRELINK_LOCATION='/etc/cron.daily/prelink'

# Webapp configuration
# The names of al the webapps that need to be checked
WEBAPPS=("phpmp" "phpmyadmin" "squirrelmail")
# The location where all webapps are installed
WEBAPP_LOCATION="/usr/share/webapps/"
# A list of all the symlinks, linking to the webapplications. Note: you must name the symlinks in the same orders as you did with the names
WEBAPP_SYMLINKS=("/home/username/localhost/htdocs/phpmp" "/home/username/localhost/htdocs/phpmyadmin" "/home/username/localhost/htdocs/webmail")


#################
# ACTUAL SCRIPT #
#################

VERSION="0.8"
SKIPFIRST="N"

function show_help()
{
   command=`basename $1`
   echo "$command
This program updates your complete Gentoo installation to the newest versions
of al the installed software on your system.

Usage: $command [-l | --layman] [-s | --sync] [-U | --update] [-u | --updatedb]
          [-x | --updateeix] [-p | --prelink] [-w | --webapp] [-S | --skipfirst]
      $command [-h | --help]
      $command [-v | --version]
-l | --layman    : Toggle the update of the layman overlays (default: $RUN_LAYMAN)
-s | --sync      : Toggle the update of the Portage cache (default: $RUN_SYNC)
-U | --update    : Toggle to run the actual update (default: $RUN_UPDATE)
-b | --bdeps     : Toggle the adding of --with-bdeps to the emerge command (default: $ADD_BDEPS)
-u | --updatedb  : Toggle the run of updatedb afterwards (default: $RUN_UPDATEDB)
-x | --updateeix : Toggle to update the eix database afterwards (default: $RUN_UPDATEEIX)
-p | --prelink   : Toggle to  prelink the system afterwards (default: $RUN_PRELINK)
-w | --webapp    : Toggle to check the webapp symlinks for linking to the latest version (default: $RUN_WEBAPPCHECK)
-S | --skipfirst : Add the --skipfirst option to emerge
-h | --help      : Show this help, then exit
-v | --version   : Show which version of this script you are currently using

default: Y       : When the commandline option isn't set, the action RUNS, when set it DOESN'T RUN.
default: N       : When the commandline option isn't set, the action DOESN'T RUN, when set it RUNS.
"
}

function show_version()
{
   echo "Current version: $VERSION"
}

# handle the commandline options (Original by BE, edited by TB)
while [ -n "$(echo $1 | grep -- '-')" -a $# -gt 0 ]; do
   case $1 in
      # full options
      --layman ) if [ $RUN_LAYMAN = "Y" ] ; then RUN_LAYMAN='N' ; else RUN_LAYMAN='Y' ; fi;;
      --sync ) if [ $RUN_SYNC = "Y" ] ; then RUN_SYNC='N' ; else RUN_SYNC='Y' ; fi;;
      --update ) if [ $RUN_UPDATE = "Y" ] ; then RUN_UPDATE='N' ; else RUN_UPDATE='Y' ; fi;;
      --bdeps ) if [ $ADD_BDEPS = "Y" ] ; then ADD_BDEPS='N' ; else ADD_BDEPS='Y'; fi;;
      --updatedb ) if [ $RUN_UPDATEDB = "Y" ] ; then RUN_UPDATEDB='N' ; else RUN_UPDATEDB='Y' ; fi;;
      --updateeix ) if [ $RUN_UPDATEEIX = "Y" ] ; then RUN_UPDATEEIX='N' ; else RUN_UPDATEEIX='Y' ; fi;;
      --prelink ) if [ $RUN_PRELINK = "Y" ] ; then RUN_PRELINK='N' ; else RUN_PRELINK='Y' ; fi;;
      --skipfirst ) if [ $SKIPFIRST = "Y" ] ; then SKIPFIRST='N' ; else SKIPFIRST='Y' ; fi;;
      --webapp ) if [ $RUN_WEBAPPCHECK = "Y" ] ; then RUN_WEBAPPCHECK='N' ; else RUN_WEBAPPCHECK='Y' ; fi;;
      --help ) show_help $0; exit 0;;
      --version ) show_version; exit 0;;

      #single char versions of options
      -l ) if [ $RUN_LAYMAN = "Y" ] ; then RUN_LAYMAN='N' ; else RUN_LAYMAN='Y' ; fi;;
      -s ) if [ $RUN_SYNC = "Y" ] ; then RUN_SYNC='N' ; else RUN_SYNC='Y' ; fi;;
      -U ) if [ $RUN_UPDATE = "Y" ] ; then RUN_UPDATE='N' ; else RUN_UPDATE='Y' ; fi;;
      -b ) if [ $ADD_BDEPS = "Y" ] ; then ADD_BDEPS='N' ; else ADD_BDEPS='Y' ; fi;;
      -u ) if [ $RUN_UPDATEDB = "Y" ] ; then RUN_UPDATEDB='N' ; else RUN_UPDATEDB='Y' ; fi;;
      -x ) if [ $RUN_UPDATEEIX = "Y" ] ; then RUN_UPDATEEIX='N' ; else RUN_UPDATEEIX='Y' ; fi;;
      -S ) if [ $SKIPFIRST = "Y" ] ; then SKIPFIRST='N' ; else SKIPFIRST='Y' ; fi;;
      -p ) if [ $RUN_PRELINK = "Y" ] ; then RUN_PRELINK='N' ; else RUN_PRELINK='Y' ; fi;;
      -w ) if [ $RUN_WEBAPPCHECK = "Y" ] ; then RUN_WEBAPPCHECK='N' ; else RUN_WEBAPPCHECK='Y' ; fi;;
      -h ) show_help $0; exit 0;;
      -v ) show_version; exit 0;;

      #Catch for unkown arguments
      * )
         echo "Unknown argument $1."
         echo ""
         show_help $0
         exit 1
      ;;
   esac
   shift
done

#end of commandline option handling


# Update layman (overlays)
if [ "$RUN_LAYMAN" = 'Y' ] ; then
   if [ ! -e "$LAYMAN_LOCATION" -o ! -x "$LAYMAN_LOCATION" ] ; then
      echo 'The layman executable is not found or is not executable.'
      echo 'Have you installed app-portage/layman?'
   else
      echo 'Updating the Layman overlays now';
      $LAYMAN_LOCATION -S
   fi
fi

# Run normal updates
# Staring the normal sync
if [ "$RUN_SYNC" = 'Y' ] ; then
   if [ ! -e "$EMERGE_LOCATION" -o ! -x "$EMERGE_LOCATION" ] ; then
      echo 'The emerge executable is not found or is not executable.'
      echo 'This is one of the main parts of Gentoo. I think you have a serious problem.'
   else
      echo 'Syncing the Portage database now';
      $EMERGE_LOCATION --sync
   fi
fi

if [ ! -e "$EMERGE_LOCATION" -o ! -x "$EMERGE_LOCATION" ] ; then
   echo 'The emerge executable is not found or is not executable.'
   echo 'This is one of the main parts of Gentoo. I think you have a serious problem.'
else
   ANSWER='n'
   if [ "$RUN_UPDATE" = 'Y' ] ; then
      # Set the default options
      EMERGE_OPTIONS="-vuDN"

      # Check to see if --skipfirst needs to be added
      if [ $SKIPFIRST = "Y" ] ; then
         EMERGE_OPTIONS="$EMERGE_OPTIONS --skipfirst"
      fi

      # Add the --with-bdeps options, with the correct setting
      ADD_BDEPS=$(echo $ADD_BDEPS | tr [:upper:] [:lower:])
      EMERGE_OPTIONS="$EMERGE_OPTIONS --with-bdeps $ADD_BDEPS"

      # Determen of "world" or "@world @system" needs to be used, depending on the emerge version
      EMERGE_VERSION=$(emerge -V 2> /dev/null | awk '/.*2.2.*/')
      if [ -n "$EMERGE_VERSION" ] ; then
         EMERGE_SETS="@world @system"
      else
         EMERGE_SETS="world"
      fi

      # Show what gets updated
      $EMERGE_LOCATION $EMERGE_OPTIONS -p $EMERGE_SETS
      echo -n -e '\nWould you like to merge these packages? [\033[1;32mYes\033[0m/\033[1;31mNo\033[0m] '
      read ANSWER
      ANSWER=$(echo $ANSWER | tr '[A-Z]' '[a-z]')
   fi
   if [ "$ANSWER" = "y" -o "$ANSWER" = "yes" -o "$RUN_UPDATE" = 'N' ] ; then
      if [ "$RUN_UPDATE" = 'Y' ] ; then
         # Do regular updates
         $EMERGE_LOCATION $EMERGE_OPTIONS $EMERGE_SETS
      fi

      # CHECK FOR POST-UPDATE COMMANDS
      # Check 1: run updatedb?
      if [ "$RUN_UPDATEDB" = 'Y' ] ; then
         if [ ! -e "$UPDATEDB_LOCATION" -o ! -x "$UPDATEDB_LOCATION" ] ; then
            echo 'The updatedb executable is not found or is not executable.'
            echo 'Have you installed sys-apps/slocate?'
         else
            echo -n 'Running updatedb now... '
            $UPDATEDB_LOCATION
            echo 'done'
         fi
      fi

      # Check 2: run eix-update? (for updating the eix database, faster searching
      #          in the portage database)
      if [ "$RUN_UPDATEEIX" = "Y" ] ; then
         if [ ! -e "$UPDATEEIX_LOCATION" -o ! -x "$UPDATEEIX_LOCATION" ] ; then
            echo 'The eix-update executable is not found or is not executable.'
            echo 'Have you installed app-portage/eix?'
         else
            echo 'Running eix-update now...'
            $UPDATEEIX_LOCATION
            echo 'Done updating the eix database';
         fi
      fi

      # Check 3: run prelink? See http://www.gentoo.org/doc/en/prelink-howto.xml
      #          for more information
      if [ "$RUN_PRELINK" = "Y" ] ; then
         if [ ! -e "$PRELINK_LOCATION" -o ! -x "$PRELINK_LOCATION" ] ; then
            echo 'The prelink command is not found or is not executable.'
            echo 'Have you read and followed http://www.gentoo.org/doc/en/prelink-howto.xml?'
         else
            echo -n 'Running prelink now... '
            $PRELINK_LOCATION
            echo 'done'
         fi
      fi

      # Check 4: check if the webapplications all link to the latest version
      if [ "$RUN_WEBAPPCHECK" = "Y" ] ; then
         # A loop across all given webapps
         for i in $(seq 0 $((${#WEBAPPS[@]}- 1))) ; do
            # Check to see if the given symlink really is a symlink
            if [ -h ${WEBAPP_SYMLINKS[$i]} ] ; then
               # Resolving the highest version installed on the system
               HIGHEST_VERSION=$(ls $WEBAPP_LOCATION${WEBAPPS[$i]} | tail -n 1)
               # Resolving the version the symlink currently links to
               CURRENT_VERSION=$(basename `dirname $(ls -l ${WEBAPP_SYMLINKS[$i]} | cut -d '>' -f 2)`)
               # Show what has been found
               echo "*** ${WEBAPPS[$i]} ***"
               echo "Highest version: $HIGHEST_VERSION"
               echo "Current version: $CURRENT_VERSION"
               # Check to see if the symlink needs updating
               if [ $HIGHEST_VERSION != $CURRENT_VERSION ] ; then
                  echo 'The version is not up-to-date. Updating symlink now'
                  rm ${WEBAPP_SYMLINKS[$i]}
                  ln -s $WEBAPP_LOCATION${WEBAPPS[$i]}/$HIGHEST_VERSION/htdocs/ ${WEBAPP_SYMLINKS[$i]}
               fi
            else
               echo "${WEBAPP_SYMLINKS[$i]} isn't a symlink, please update the configuration of update. This \"symlink\" is ignored for now." 1>&2
            fi
         done
      fi
   fi
fi


En een patchfile t.o.v. 0.7.1 (deze patchfile is nuttiger dan de vorige patchfile die ik heb gemaakt :p) :
Code:
--- update-0.7.1   2010-04-13 09:40:03.000000000 +0200
+++ update-0.8   2010-07-04 11:20:47.000000000 +0200
@@ -31,26 +31,26 @@
# CHANGELOG #
#############

-#0.1   : initial version (TB)
-#0.2   : commandline options (BE)
-#0.3   : dynamic helper binary paths (BE)
-#0.3.1 : fixed bug #1 ($LAYMAN_LOCATION ignored) (TB)
-#        fixed bug #2 (extra ' after = at UPDATEDB_LOCATION) (TB)
-#        fixed bug #3 (no - in the update-eix command) (TB)
-#        added line to indicate that layman is starting (TB)
-#        added $EMERGE_LOCATION to make the emerge an option too (TB)
-#0.4   : added the commandline option to disable emerge --sync (TB)
-#        added an check to see if all executables for all the enabled options
+#0.1   : Initial version (TB)
+#0.2   : Commandline options (BE)
+#0.3   : Dynamic helper binary paths (BE)
+#0.3.1 : Fixed bug #1 ($LAYMAN_LOCATION ignored) (TB)
+#        Fixed bug #2 (extra ' after = at UPDATEDB_LOCATION) (TB)
+#        Fixed bug #3 (no - in the update-eix command) (TB)
+#        Added line to indicate that layman is starting (TB)
+#        Added $EMERGE_LOCATION to make the emerge an option too (TB)
+#0.4   : Added the commandline option to disable emerge --sync (TB)
+#        Added an check to see if all executables for all the enabled options
#          are available
-#        changed the default behavior. In previous versions all the update
+#        Changed the default behavior. In previous versions all the update
#          parts where disabled by default and you must enable them with an
#          commandline option. From now on everything is enabled by default and
#          you must disable them via an commandline option.
-#        added an catch for unknown arguments, it displays the help (TB)
-#        added the help commandline option (TB)
-#        added the commandline option to show the version number (TB)
-#        added the debs for each configuration item in the configurationpart(TB)
-#0.5   : added the --skipfirst option, to add the --skipfirst option to emerge (TB)
+#        Added an catch for unknown arguments, it displays the help (TB)
+#        Added the help commandline option (TB)
+#        Added the commandline option to show the version number (TB)
+#        Added the debs for each configuration item in the configurationpart(TB)
+#0.5   : Added the --skipfirst option, to add the --skipfirst option to emerge (TB)
#0.6   : Added the --no-update option, so you can only run the post-processes (TB)
#        Added support for emerge version 2.2. In 2.2 system isn't a part of
#          world anymore. The script now checks for that. (TB)
@@ -59,6 +59,16 @@
#0.7.1 : eix had an update, the update tool is called 'eix-update' now instead of
#          'update-eix'. So, when using eix 0.20.3 or newer this version is needed
#          to be able to update the eix date during the update process (TB)
+#0.8   : Added dynamic options. It toggles the default setting, instead of
+#          always enabeling it. Also updated the helpfunction to reflect this (TB)
+#        Updated the help function to have all the options in the help message
+#          (in previous versions the short-list wasn't complete) (TB)
+#        Added support for --with-bdeps (TB)
+#        Added a few comments in the actual script, to make it understandable (TB)
+#        When running the actual update (when the user pressed 'y', after the
+#          package list) the used set was always "world", also when using portage
+#          2.2. It is using @world @system in Portage 2.2 now. Creating the
+#          package list did use @world @system.

#################
# CONFIGURATION #
@@ -73,6 +83,9 @@
# Do the actual update? (no aditional dependicies)
RUN_UPDATE='Y'

+# Add the option --with-bdeps to the emerge command
+ADD_BDEPS='Y'
+
# Run updatedb afterwards? (needs sys-apps/slocate)
RUN_UPDATEDB='Y'

@@ -105,7 +118,7 @@
# ACTUAL SCRIPT #
#################

-VERSION="0.7.1"
+VERSION="0.8"
SKIPFIRST="N"

function show_help()
@@ -115,20 +128,24 @@
This program updates your complete Gentoo installation to the newest versions
of al the installed software on your system.

-Usage: $command [-l | --layman] [-s | --sync] [-u | --updatedb]
-          [-x | --updateeix] [-p | --prelink] [-S | --skipfirst]
+Usage: $command [-l | --layman] [-s | --sync] [-U | --update] [-u | --updatedb]
+          [-x | --updateeix] [-p | --prelink] [-w | --webapp] [-S | --skipfirst]
      $command [-h | --help]
      $command [-v | --version]
--l | --layman    : Don't update the layman overlays
--s | --sync      : Don't update the Portage cache
--U | --no-update : Don't run the actual update
--u | --updatedb  : Don't run updatedb afterwards
--x | --updateeix : Don't update the eix database afterwards
--p | --prelink   : Don't prelink the system afterwards
--w | --no-webapp : Don't check the webapp symlinks for linking to the latest version
+-l | --layman    : Toggle the update of the layman overlays (default: $RUN_LAYMAN)
+-s | --sync      : Toggle the update of the Portage cache (default: $RUN_SYNC)
+-U | --update    : Toggle to run the actual update (default: $RUN_UPDATE)
+-b | --bdeps     : Toggle the adding of --with-bdeps to the emerge command (default: $ADD_BDEPS)
+-u | --updatedb  : Toggle the run of updatedb afterwards (default: $RUN_UPDATEDB)
+-x | --updateeix : Toggle to update the eix database afterwards (default: $RUN_UPDATEEIX)
+-p | --prelink   : Toggle to  prelink the system afterwards (default: $RUN_PRELINK)
+-w | --webapp    : Toggle to check the webapp symlinks for linking to the latest version (default: $RUN_WEBAPPCHECK)
-S | --skipfirst : Add the --skipfirst option to emerge
-h | --help      : Show this help, then exit
-v | --version   : Show which version of this script you are currently using
+
+default: Y       : When the commandline option isn't set, the action RUNS, when set it DOESN'T RUN.
+default: N       : When the commandline option isn't set, the action DOESN'T RUN, when set it RUNS.
"
}

@@ -137,30 +154,32 @@
   echo "Current version: $VERSION"
}

-# handle the commandline options  (By BE)
+# handle the commandline options (Original by BE, edited by TB)
while [ -n "$(echo $1 | grep -- '-')" -a $# -gt 0 ]; do
   case $1 in
      # full options
-      --layman ) RUN_LAYMAN='N';;
-      --sync ) RUN_SYNC='N';;
-      --no-update ) RUN_UPDATE='N';;
-      --updatedb ) RUN_UPDATEDB='N';;
-      --updateeix ) RUN_UPDATEEIX='N';;
-      --prelink ) RUN_PRELINK='N';;
-      --skipfirst ) SKIPFIRST='Y';;
-      --no-webapp ) RUN_WEBAPPCHECK='N';;
+      --layman ) if [ $RUN_LAYMAN = "Y" ] ; then RUN_LAYMAN='N' ; else RUN_LAYMAN='Y' ; fi;;
+      --sync ) if [ $RUN_SYNC = "Y" ] ; then RUN_SYNC='N' ; else RUN_SYNC='Y' ; fi;;
+      --update ) if [ $RUN_UPDATE = "Y" ] ; then RUN_UPDATE='N' ; else RUN_UPDATE='Y' ; fi;;
+      --bdeps ) if [ $ADD_BDEPS = "Y" ] ; then ADD_BDEPS='N' ; else ADD_BDEPS='Y'; fi;;
+      --updatedb ) if [ $RUN_UPDATEDB = "Y" ] ; then RUN_UPDATEDB='N' ; else RUN_UPDATEDB='Y' ; fi;;
+      --updateeix ) if [ $RUN_UPDATEEIX = "Y" ] ; then RUN_UPDATEEIX='N' ; else RUN_UPDATEEIX='Y' ; fi;;
+      --prelink ) if [ $RUN_PRELINK = "Y" ] ; then RUN_PRELINK='N' ; else RUN_PRELINK='Y' ; fi;;
+      --skipfirst ) if [ $SKIPFIRST = "Y" ] ; then SKIPFIRST='N' ; else SKIPFIRST='Y' ; fi;;
+      --webapp ) if [ $RUN_WEBAPPCHECK = "Y" ] ; then RUN_WEBAPPCHECK='N' ; else RUN_WEBAPPCHECK='Y' ; fi;;
      --help ) show_help $0; exit 0;;
      --version ) show_version; exit 0;;

      #single char versions of options
-      -l ) RUN_LAYMAN='N';;
-      -s ) RUN_SYNC='N';;
-      -U ) RUN_UPDATE='N';;
-      -u ) RUN_UPDATEDB='N';;
-      -x ) RUN_UPDATEEIX='N';;
-      -S ) SKIPFIRST="Y";;
-      -p ) RUN_PRELINK='N';;
-      -w ) RUN_WEBAPPCHECK='N';;
+      -l ) if [ $RUN_LAYMAN = "Y" ] ; then RUN_LAYMAN='N' ; else RUN_LAYMAN='Y' ; fi;;
+      -s ) if [ $RUN_SYNC = "Y" ] ; then RUN_SYNC='N' ; else RUN_SYNC='Y' ; fi;;
+      -U ) if [ $RUN_UPDATE = "Y" ] ; then RUN_UPDATE='N' ; else RUN_UPDATE='Y' ; fi;;
+      -b ) if [ $ADD_BDEPS = "Y" ] ; then ADD_BDEPS='N' ; else ADD_BDEPS='Y' ; fi;;
+      -u ) if [ $RUN_UPDATEDB = "Y" ] ; then RUN_UPDATEDB='N' ; else RUN_UPDATEDB='Y' ; fi;;
+      -x ) if [ $RUN_UPDATEEIX = "Y" ] ; then RUN_UPDATEEIX='N' ; else RUN_UPDATEEIX='Y' ; fi;;
+      -S ) if [ $SKIPFIRST = "Y" ] ; then SKIPFIRST='N' ; else SKIPFIRST='Y' ; fi;;
+      -p ) if [ $RUN_PRELINK = "Y" ] ; then RUN_PRELINK='N' ; else RUN_PRELINK='Y' ; fi;;
+      -w ) if [ $RUN_WEBAPPCHECK = "Y" ] ; then RUN_WEBAPPCHECK='N' ; else RUN_WEBAPPCHECK='Y' ; fi;;
      -h ) show_help $0; exit 0;;
      -v ) show_version; exit 0;;

@@ -207,16 +226,27 @@
else
   ANSWER='n'
   if [ "$RUN_UPDATE" = 'Y' ] ; then
+      # Set the default options
      EMERGE_OPTIONS="-vuDN"
+
+      # Check to see if --skipfirst needs to be added
      if [ $SKIPFIRST = "Y" ] ; then
         EMERGE_OPTIONS="$EMERGE_OPTIONS --skipfirst"
      fi
+
+      # Add the --with-bdeps options, with the correct setting
+      ADD_BDEPS=$(echo $ADD_BDEPS | tr [:upper:] [:lower:])
+      EMERGE_OPTIONS="$EMERGE_OPTIONS --with-bdeps $ADD_BDEPS"
+
+      # Determen of "world" or "@world @system" needs to be used, depending on the emerge version
      EMERGE_VERSION=$(emerge -V 2> /dev/null | awk '/.*2.2.*/')
      if [ -n "$EMERGE_VERSION" ] ; then
         EMERGE_SETS="@world @system"
      else
         EMERGE_SETS="world"
      fi
+
+      # Show what gets updated
      $EMERGE_LOCATION $EMERGE_OPTIONS -p $EMERGE_SETS
      echo -n -e '\nWould you like to merge these packages? [\033[1;32mYes\033[0m/\033[1;31mNo\033[0m] '
      read ANSWER
@@ -225,7 +255,7 @@
   if [ "$ANSWER" = "y" -o "$ANSWER" = "yes" -o "$RUN_UPDATE" = 'N' ] ; then
      if [ "$RUN_UPDATE" = 'Y' ] ; then
         # Do regular updates
-         $EMERGE_LOCATION $EMERGE_OPTIONS world
+         $EMERGE_LOCATION $EMERGE_OPTIONS $EMERGE_SETS
      fi

      # CHECK FOR POST-UPDATE COMMANDS


Mocht je een patchfile nodig hebben vanaf een andere versie: laat het even weten, ik heb hem zo gemaakt.

_________________
"Been There, Done That, GOING BACK!" - Disneyland Parijs


Omhoog
 Profiel E-mail  
 
Geef de vorige berichten weer:  Sorteer op  
Plaats een nieuw onderwerp Antwoord op onderwerp  [ 18 berichten ]  Ga naar pagina Vorige  1, 2

Alle tijden zijn GMT + 1 uur [ Zomertijd ]


Wie is er online

Gebruikers op dit forum: Geen geregistreerde gebruikers en 1 gast


Je mag geen nieuwe onderwerpen in dit forum plaatsen
Je mag niet antwoorden op een onderwerp in dit forum
Je mag je berichten in dit forum niet wijzigen
Je mag je berichten niet uit dit forum verwijderen

Zoek naar:
Ga naar:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
phpBB.nl Vertaling