Ignore:
Timestamp:
Sep 4, 2013, 2:35:59 AM (13 years ago)
Author:
tobayer
Message:

[titan] tobayer01 swapskin: change echo with escape to printf

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ipk/source.sh4/titanswapskins_tobayer01/CONTROL/preinst

    r23247 r23248  
    1515### FUNCTIONS ###
    1616
    17 RES_COL=60                                                                      # column number to place the status message
    18 MOVE_TO_COL="echo -en \\033[${RES_COL}G"        # command to move to the configured column number
     17RES_COL=60                                                                      # column number to place the status
    1918
    20 echo_success() {                                                        # function to print the SUCCESS status
    21         $MOVE_TO_COL; echo -n "[  OK  ]"; echo
     19echo_success() {                                                        # function to print the OK status
     20        printf "%-${RES_COL}s%s\n" "$1" "[  OK  ]"
    2221}
    2322
    24 echo_failure() {
    25         $MOVE_TO_COL; echo -n "[FAILED]"; echo  # function to print the FAILED status message
     23echo_failure() {                                                        # function to print the FAILED status
     24        printf "%-${RES_COL}s%s\n" "$1" "[FAILED]"
    2625}
    2726
     
    3029### MAIN ###
    3130
    32 echo -n "Checking box type..."
     31msg="Checking box type..."
    3332if [ "$model" = "" ]; then
    34         echo_failure
     33        echo_failure "$msg"
    3534        echo
    3635        echo "Sorry, $plugin is not available for the $model!"
     
    3837        exit 1
    3938else
    40         echo_success
     39        echo_success "$msg"
    4140fi
    4241
    4342
    44 echo -n "Checking installation directory..."
     43msg="Checking installation directory..."
    4544if [ ! -d $plugin_target ]; then
    46         echo_failure
     45        echo_failure "$msg"
    4746        echo
    4847        echo "Sorry, $plugin_target not found!"
     
    5049        exit 1
    5150else
    52         echo_success
     51        echo_success "$msg"
    5352fi
    5453
     
    5756SPACE=`getfreespace $plugin_target`
    5857FREE=`expr $SPACE - 100`
    59 echo -n "Checking free space ($plugin_size in $FREE kB)..."
     58msg="Checking free space ($plugin_size in $FREE kB)..."
    6059if [ "$FREE" -lt "$plugin_size" ]; then
    61         echo_failure
     60        echo_failure "$msg"
    6261        echo
    6362        echo "Sorry, not enough free space in $plugin_target!"
     
    6564        exit 1
    6665else
    67         echo_success
     66        echo_success "$msg"
    6867fi
    6968
    7069
    71 echo -n "Checking image type..."
     70msg="Checking image type..."
    7271if [ `cat /etc/version | grep $buildgroup | wc -l` -eq 0 ]; then
    73         echo_failure
     72        echo_failure "$msg"
    7473        echo
    7574        echo "Sorry, $plugin is not available for this image type!"
     
    7776        exit 1
    7877else
    79         echo_success
     78        echo_success "$msg"
    8079fi
    8180
     
    8382rm -rf $plugin_dir
    8483
    85 echo -n "Installing $plugin..."
    86 echo_success
     84msg="Installing $plugin..."
     85echo_success "$msg"
    8786
    8887exit 0
Note: See TracChangeset for help on using the changeset viewer.