Changeset 891


Ignore:
Timestamp:
Mar 16, 2016, 2:59:03 PM (3 years ago)
Author:
kbut
Message:

update lliurex-version

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lliurex-base-files/trunk/fuentes/install/usr/bin/lliurex-version

    r121 r891  
    1414# variables
    1515CDD_PATH="/usr/share/lliurex-cdd"
    16 CDD_TASKS_PATH="${CDD_PATH}/tasks"
    17 CDD_TASKS_LIST="classroom-srv classroom-ws desktop"
    18 CDD_NUMVERSION=""
    19 CDD_VERSION="Unknown LliureX version"
     16CDD_FLAVOUR="None"
     17CDD_NUMVERSION="0"
    2018RAW_CDD_VERSION=""
    2119
     
    2422   echo "Usage: $0 {-n|-v|-a|-h}" >&2
    2523   echo "       $0 -t CDD_NAME" >&2
     24   echo "       $0 --history" >&2
    2625}
    2726
    2827get_cdd_version(){
    29    local CTASK VERSION_FILE
    30    VERSION_FILE="${CDD_PATH}/version"
    31    if [ -r "$VERSION_FILE" ] ; then
    32       CDD_NUMVERSION="$(head -1 "${VERSION_FILE}")"
    33       RAW_CDD_VERSION="$(find "${CDD_PATH}" -name "cddversion" -exec cat {} \; |sort -u)"
     28   if [ -d ${CDD_PATH} ] ; then
     29      RAW_CDD_VERSION="$(find "${CDD_PATH}" -name "cddflavour" -exec cat {} \; |sort -u)"
    3430      if [ "$RAW_CDD_VERSION" ] ; then
    35          CDD_VERSION="$(echo "${RAW_CDD_VERSION}" |tr "\n" "," |sed -e "s%[[:blank:]]*$%%;s%,$%%;s%,%, %g")"
     31         CDD_FLAVOUR="$(echo "${RAW_CDD_VERSION}" |tr "\n" "," |sed -e "s%[[:blank:]]*$%%;s%,$%%;s%,%, %g")"
    3632      fi
    3733   fi
     34   CDD_NUMVERSION=$(dpkg-query --showformat='${Version}' --show lliurex-version-timestamp)
    3835   return 0
    3936}
     
    4138say_cdd_version(){
    4239   get_cdd_version
    43    if [ -z "$CDD_NUMVERSION" ] ; then
    44       echo "${CDD_VERSION}" >&2
    45       return 0
    46    fi
    4740   case "$1" in
    4841      n)
     
    5043         ;;
    5144      v)
    52          echo "${CDD_VERSION}"
     45         echo "${CDD_FLAVOUR}"
    5346         ;;
    5447      a)
    55          echo "${CDD_VERSION}, ${CDD_NUMVERSION}"
     48         echo "${CDD_FLAVOUR}, ${CDD_NUMVERSION}"
    5649         ;;
    5750   esac
     
    6962}
    7063
     64get_history_version(){
     65        if [ -e /etc/lliurex-cdd-version ]; then
     66                cat /etc/lliurex-cdd-version
     67        else
     68                echo ""
     69        fi
     70}
    7171
    7272case "$1" in
     
    8484      test_cdd_version "$2" || exit 1
    8585      ;;
     86   "--history")
     87                get_history_version
     88          ;;
    8689   *)
    8790      say_cdd_version a
Note: See TracChangeset for help on using the changeset viewer.