amarok-svn.sh

来自「Amarok是一款在LINUX或其他类UNIX操作系统中运行的音频播放器软件。 」· Shell 代码 · 共 607 行 · 第 1/2 页

SH
607 行
字号
fiechoecho "###################### #### ### ## ## ## # #"## Base checkoutechoecho "# $C_STEP/$S_STEPS - Checking out base files."svn co -N $SVN_SERVER/home/kde/branches/stable/extragear/multimedia $BUILD_DIRif [ "$?" != "0" ]; then #If the command didn't finish successfully  Error "The SVN transfer didn't finish successfully."ficd $BUILD_DIRtouch .amarok-svn-dir #Watermark the directory## Get unsermake, if not installed alreadyecholet C_STEP=C_STEP+1echo "# $C_STEP/$S_STEPS - Getting unsermake."if [ -x "`which unsermake`" ]; then #unsermake installed system wide?  echo "Unsermake is already installed system wide."else  PATH="$BUILD_DIR/unsermake:$PATH"  if [ -x "`which unsermake`" ]; then #Is unsermake installed and in the $PATH now?    echo "Unsermake downloaded by this script. Checking for update."  else    echo "Unsermake wasn't found. Downloading it to '$BUILD_DIR/unsermake'."  fi  svn co -N $SVN_SERVER/home/kde/tags/unmaintained/3/unsermake  if [ "$?" != "0" ]; then #If the command didn't finish successfully    Error "The SVN transfer failed."  fifi## Store the old uninstall commandsecholet C_STEP=C_STEP+1echo "# $C_STEP/$S_STEPS - Saving uninstall commands for your current revision."if [ ! -f "Makefile" ]; then  echo "No current revision was found."else  TMP_OLD_UNINFO="`mktemp`"  TEMP_FILES="$TMP_OLD_UNINFO"  unsermake -n uninstall > $TMP_OLD_UNINFO #Stored in a file so we can run it later, in a simple manner.  if [ "$?" != "0" ]; then #If the command didn't finish successfully    Error "Couldn't get uninstall commands for your current revision."  else    echo "Done."  fifi## Continue checkoutecholet C_STEP=C_STEP+1echo "# $C_STEP/$S_STEPS - Checking out common SVN files."svn co $SVN_SERVER/home/kde/branches/KDE/3.5/kde-common/admin #URL changed since KDE 3.5 branchingif [ "$?" != "0" ]; then #If the command didn't finish successfully  RemoveTemp  Error "The SVN transfer failed."fiecholet C_STEP=C_STEP+1echo "# $C_STEP/$S_STEPS - Updating Amarok files."svn up amarokif [ "$?" != "0" ]; then #If the command didn't finish successfully  RemoveTemp  Error "The SVN transfer failed.\nIf the message from svn (in console) is something like 'amarok is not under version control', you need a never version of svn.\nAt least version 1.1 is needed."fiif [ "$USE_ID" = "1" ]; then  #Append build ID (date and time with no punctuation) to version  sed -re "s/^#define APP_VERSION \"(.*)-SVN.*\"/#define APP_VERSION \"\1-SVN-`date +%y%m%d%H%M`\"/" -i amarok/src/amarok.h  echo "Appended build ID to version number."fiecholet C_STEP=C_STEP+1echo "# $C_STEP/$S_STEPS - Getting localization and documentation:"ENGD_STEP=""if [ "$GET_LANG" != "en_US" ]; then #If a language (not en_US) is selected  ## Localization  echo "- # 1/4 - Checking if localization for selected language exists."  svn ls $SVN_SERVER/home/kde/trunk/l10n/$GET_LANG/messages/extragear-multimedia/amarok.po > /dev/null 2>&1 #Check if language exists  if [ "$?" != "0" ]; then #If the localization wasn't found    GET_LANG="en_US"    echo "WARNING:  Localization for selected language was not found. Reverting to 'en_US'."  else #If localization exists    echo "- # 2/4 - Updating localization file."    if [ ! -d "po" ]; then      mkdir po    fi    cd po    echo "SUBDIRS = $GET_LANG" > Makefile.am    if [ ! -d $GET_LANG ]; then      mkdir $GET_LANG    fi    cd $GET_LANG    echo "KDE_LANG = $GET_LANG" > Makefile.am    echo "SUBDIRS  = \$(AUTODIRS)" >> Makefile.am    echo "POFILES  = AUTO" >> Makefile.am    echo "Downloading current localization file from server."    TMP_L10N="`mktemp`"    TMP_FILES="$TMP_FILES $TMP_L10N"    svn cat $SVN_SERVER/home/kde/trunk/l10n/$GET_LANG/messages/extragear-multimedia/amarok.po 2> /dev/null | tee $TMP_L10N > /dev/null    if [ "$?" != "0" ]; then #If the command didn't finish successfully      Error "The SVN transfer didn't finish successfully."    fi    if [ ! -s "$TMP_L10N" ]; then      echo "WARNING: The downloaded file was empty!"      echo "Some error must have occured."      rm -f Makefile.am      rm -f ../Makefile.am      echo "No localization downloaded, so no localization will be installed!"    elif [ -f "amarok.po" ]; then      if [ -z "`diff -q $TMP_L10N amarok.po 2>&1`" ]; then        echo "You already have the current version of the localization file."      else        echo "New localization file downloaded."        rm -f amarok.po        mv -f $TMP_L10N amarok.po        echo "Replaced the old copy with the downloaded version."      fi    else      mv -f $TMP_L10N amarok.po      echo "Localization file downloaded."    fi    cd ../..    ## Localized documentation    echo "- # 3/4 - Checking if localized documentation for selected language exists."    svn ls $SVN_SERVER/home/kde/trunk/l10n/$GET_LANG/docs/extragear-multimedia/amarok > /dev/null 2>&1 #Check if localized documentation exists    if [ "$?" != "0" ]; then #If the localized documentation wasn't found      GET_LANG="en_US"      echo "WARNING: Localized documentation for selected language was not found. Reverting to default (American English) documentation."      ENGD_STEP=" 4/4 -"    else #If a localized documentation exists      echo "- # 4/4 - Checking out localized documentation."      if [ ! -d "doc" ]; then        mkdir doc      fi      cd doc      echo "SUBDIRS = $GET_LANG" > Makefile.am      svn co $SVN_SERVER/home/kde/trunk/l10n/$GET_LANG/docs/extragear-multimedia/amarok $GET_LANG      if [ "$?" != "0" ]; then #If the command didn't finish successfully        Error "The SVN transfer failed."      fi      cd $GET_LANG      echo "KDE_LANG = $GET_LANG" > Makefile.am      echo "KDE_DOCS = amarok" >> Makefile.am      cd ../..    fi  fifiif [ "$GET_LANG" = "en_US" ]; then #If no language (en_US) is selected. This is a stand alone if-statement to enable fallbacks when selected language isn't found.  ## Default (American English) documentation  echo "- #$ENGD_STEP Checking out default (American English) documentation."  if [ ! -d "doc" ]; then    mkdir doc  fi  cd doc  echo "SUBDIRS = en" > Makefile.am  svn co $SVN_SERVER/home/kde/trunk/extragear/multimedia/doc/amarok en  if [ "$?" != "0" ]; then #If the command didn't finish successfully    Error "The SVN transfer failed."  fi  cd en  echo "KDE_LANG = en" > Makefile.am  echo "KDE_DOCS = amarok" >> Makefile.am  cd ../..fi## Preparationecholet C_STEP=C_STEP+1echo "# $C_STEP/$S_STEPS - Preparing for configuration. (This will take a while.)"WANT_AUTOCONF="2.5" unsermake -f Makefile.cvsif [ "$?" != "0" ]; then #If the command didn't finish successfully  Error "Preparation failed.\nProblems at this step are quite certainly problems with either unsermake or your automake configuration."fiecho -n "*** Patching the configure script to show when it fails... "echo -e "\nif test \"\$all_tests\" = \"bad\"; then\n  exit 1\nfi" >> configure #Does its job, albeit a little bit ugly...if [ "$?" != "0" ]; then #If the command didn't finish successfully  echo "Fail. Amarok will compile even if some dependencies aren't met!"else  echo "Done."fi## Configuration helpif [ "$CONF_HELP" = "true" ]; then  TMP_CONF="`mktemp`"  TMP_FILES="$TMP_FILES $TMP_CONF"  echo -e "<big><b><u>Configuration options</u></b></big>\n" > $TMP_CONF  ./configure --help >> $TMP_CONF  KDTITLE=" :: Configuration options" Dialog --textbox $TMP_CONF 600 800 & #800x600 should be enough. Put it in the background (&) to make the user able to watch it while typing the selected options into the input box.  Dialog --yesno "Do you want to use any extra configuration options (in addition to '--prefix=`kde-config --prefix` --enable-debug=full')?\nNo extra options is the default, and that works fine.\n(Available options are displayed in another window right now.)"  if [ "$?" = "0" ]; then #If the user said yes    CONF_FLAGS_RAW="`kdialog --title \"$KD_TITLE\" --inputbox \"Specify extra configuration options to use\"`"    CONF_FLAGS=""    CONF_FLAGS_SAVE=""    for flag in $CONF_FLAGS_RAW; do      if [ "$flag" != "--help" ]; then        CONF_FLAGS="$CONF_FLAGS $flag"        CONF_FLAGS_SAVE="$CONF_FLAGS_SAVE `echo $flag | sed -e \"s/--/__/\"`"      fi    done    WriteConfig conf_flags "$CONF_FLAGS_SAVE"    if [ "`echo $CONF_FLAGS`" ]; then      echo -e "Extra configuration options:\t'`echo $CONF_FLAGS`'"    fi  fifi## Configurationecholet C_STEP=C_STEP+1echo "# $C_STEP/$S_STEPS - Configuring. (This will also take a while.)"./configure --prefix=`kde-config --prefix` --enable-debug=full$CONF_FLAGSif [ "$?" != "0" ]; then #If the command didn't finish successfully  Error "Configuration failed. Amarok was NOT installed/upgraded."fi## Clean build dir if user wanted to.if [ "$CLEAN_BUILD" = "1" ]; then  let C_STEP=C_STEP+1  echo "# $C_STEP/$S_STEPS - Cleaning the source tree."  Cleanfi## Compilationecholet C_STEP=C_STEP+1echo "# $C_STEP/$S_STEPS - Compiling. (The time of this step depends on the number of new source files that were downloaded.)"Compile## Compare uninstall commands and , if they differ, uninstall the old revision.echolet C_STEP=C_STEP+1echo "# $C_STEP/$S_STEPS - Comparing uninstall commands."if [ ! -f "$TMP_OLD_UNINFO" ]; then  echo "No older revision was found."else  TMP_NEW_UNINFO="`mktemp`"  TMP_FILES="$TMP_FILES $TMP_NEW_UNINFO"  unsermake -n uninstall > $TMP_NEW_UNINFO  if [ "$?" != "0" ]; then #If the command didn't finish successfully.    Error "Couldn't get uninstall commands for the new revision."  fi  UN_DIFF="`diff -q $TMP_OLD_UNINFO $TMP_NEW_UNINFO 2>&1`"  if [ "$?" != "0" -a "$?" != "1" ]; then #If the command didn't finish successfully. diff strangely (?) returns 1 when there are differences.    Error "Couldn't compare the uninstall commands."  elif [ -z "$UN_DIFF" ]; then #If diff was quiet    echo "No differences between your current revision and the new one were found."  else    echo "Differences in the uninstall commands were found, uninstalling your current revision."    echo "Executing '$HOW_ROOT' to get root privileges for uninstallation."    if [ "$HOW_ROOT" = "sudo" ]; then      echo "(You might need to enter your password now.)"      sudo bash $TMP_OLD_UNINFO    elif [ "$HOW_ROOT" = "su -c" ]; then      echo "(You probably have to enter the root password now.)"      su -c "bash $TMP_OLD_UNINFO"    else      kdesu -t bash $TMP_OLD_UNINFO    fi    #No error check here because it seems to trigger even when there is no error, I can't figure out why...    #It doesn't matter much if this step fails anyway...  fi fiRemoveTemp #From here on, no temp files are needed.## Installationecholet C_STEP=C_STEP+1echo "# $C_STEP/$S_STEPS - Installing files."echo "Executing '$HOW_ROOT' to get root privileges for installation."if [ "$HOW_ROOT" = "sudo" ]; then  echo "(You might need to enter your password now.)"  sudo `which unsermake` install #"which" here (and below) is needed because root doesn't use the user's $PATHelif [ "$HOW_ROOT" = "su -c" ]; then  echo "(You probably have to enter the root password now.)"  su -c "`which unsermake` install"else  kdesu -t `which unsermake` installfiif [ "$?" = "0" ]; then #If the command did finish successfully  #stopwatch.  let INST_TIME=`date +%s`-INST_START  let INST_M=INST_TIME/60  let INST_S=INST_TIME%60  echo  echo -e "# DONE - Amarok was successfully installed/updated after $INST_M minute(s) and $INST_S second(s)."  Dialog --msgbox "Done!\nAmarok was successfully installed/updated after $INST_M minute(s) and $INST_S second(s).\nCompilation took $COMP_M minute(s) and $COMP_S second(s).\nStart Amarok from your menu or by running the command \"amarok\"."  exit 0 #Exit succsessfullyelse  echo  Error "Amarok was compiled but NOT installed.\nIf the errors above seem to be permission errors, you could try installing Amarok manually.\n(You also might want to have a look at the settings for this script, use --help to see how.)\nTo install manually, get root privileges in some way and then run 'unsermake install' in the '$BUILD_DIR' directory."fi

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?