Changeset 23247


Ignore:
Timestamp:
Sep 4, 2013, 12:34:44 AM (6 years ago)
Author:
tobayer
Message:

[titan] tobayer01 swapskin: optimize control files

Location:
ipk/source.sh4/titanswapskins_tobayer01/CONTROL
Files:
4 edited

Legend:

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

    r23203 r23247  
    22
    33releaseversion=22775
    4 plugin="tobayer01 swapskin"
    5 plugindir="/var/swap/titanskins/tobayer01"
     4plugin_short="tobayer01"
     5plugin_type="swapskin"
     6plugin_target="/var/swap/titanskins"
     7
     8plugin_dir="$plugin_target/$plugin_short"
     9plugin="$plugin_short $plugin_type"
     10
    611imageversion=`cat /etc/version | cut -d "_" -f2 | sed 's/M//'`;
    7 link=`readlink /var/swap`
    812
    9 if [ `df | grep /dev/mtdblock | grep mnt | sed 's/ \+/ /g' | cut -d ' ' -f4 | head -n1 | wc -l` -eq 1 ] && [ $link = "/mnt/swapextensions" ]; then
    10         SPACE=`df | grep /dev/mtdblock | grep mnt | sed 's/ \+/ /g' | cut -d ' ' -f4 | head -n1`
    11         FREE=`expr $SPACE - 100`
    12         echo "New free space: $FREE kb"
    13 else
    14         sync
    15 fi
     13
     14### FUNCTIONS ###
     15
     16RES_COL=60                                                                      # column number to place the status message
     17MOVE_TO_COL="echo -en \\033[${RES_COL}G"        # command to move to the configured column number
     18
     19echo_success() {                                                        # function to print the SUCCESS status
     20        $MOVE_TO_COL; echo -n "[  OK  ]"; echo
     21}
     22
     23echo_failure() {
     24        $MOVE_TO_COL; echo -n "[FAILED]"; echo  # function to print the FAILED status message
     25}
     26
     27
     28
     29### MAIN ###
     30
     31sync
     32SPACE=`getfreespace $plugin_target`
     33FREE=`expr $SPACE - 100`
     34echo
     35echo "New free space: $FREE kB"
     36
    1637
    1738if [ "$imageversion" -gt "$releaseversion" ]; then
    1839        echo "Successfully installed $plugin (non-release version)."
    1940        # ==> rm skin_release.xml
    20         rm $plugindir/skin_release.xml
     41        rm $plugin_dir/skin_release.xml
    2142else
    2243        echo "Successfully installed $plugin (release version)."
    2344        # ==> mv skin_release.xml skin.xml"
    24         mv $plugindir/skin_release.xml $plugindir/skin.xml
     45        mv $plugin_dir/skin_release.xml $plugin_dir/skin.xml
    2546fi
    2647
  • ipk/source.sh4/titanswapskins_tobayer01/CONTROL/postrm

    r23203 r23247  
    11#!/bin/sh
    22
    3 plugin="tobayer01 swapskin"
    4 plugindir="/var/swap/titanskins/tobayer01"
    5 link=`readlink /var/swap`
     3plugin_short="tobayer01"
     4plugin_type="swapskin"
     5plugin_target="/var/swap/titanskins"
    66
    7 rm -rf $plugindir
     7plugin_dir="$plugin_target/$plugin_short"
     8plugin="$plugin_short $plugin_type"
    89
    9 if [ `df | grep /dev/mtdblock | grep mnt | sed 's/ \+/ /g' | cut -d ' ' -f4 | head -n1 | wc -l` -eq 1 ] && [ $link = "/mnt/swapextensions" ]; then
    10         SPACE=`df | grep /dev/mtdblock | grep mnt | sed 's/ \+/ /g' | cut -d ' ' -f4 | head -n1`
    11         FREE=`expr $SPACE - 100`
    12         echo "New free space: $FREE kb"
    13 else
    14         sync
    15 fi
     10
     11### FUNCTIONS ###
     12
     13RES_COL=60                                                                      # column number to place the status message
     14MOVE_TO_COL="echo -en \\033[${RES_COL}G"        # command to move to the configured column number
     15
     16echo_success() {                                                        # function to print the SUCCESS status
     17        $MOVE_TO_COL; echo -n "[  OK  ]"; echo
     18}
     19
     20echo_failure() {
     21        $MOVE_TO_COL; echo -n "[FAILED]"; echo  # function to print the FAILED status message
     22}
     23
     24
     25
     26### MAIN ###
     27
     28rm -rf $plugin_dir
     29
     30sync
     31SPACE=`getfreespace $plugin_target`
     32FREE=`expr $SPACE - 100`
     33echo
     34echo "New free space: $FREE kB"
    1635
    1736echo "Successfully removed $plugin."
  • ipk/source.sh4/titanswapskins_tobayer01/CONTROL/preinst

    r23202 r23247  
    11#!/bin/sh
    22
    3 plugin="tobayer01 swapskin"
    4 plugindir="/var/swap/titanskins/tobayer01"
    5 pluginsize=2300
     3plugin_size=2300
     4plugin_short="tobayer01"
     5plugin_type="swapskin"
     6plugin_target="/var/swap/titanskins"
     7
     8plugin_dir="$plugin_target/$plugin_short"
     9plugin="$plugin_short $plugin_type"
     10
    611model=`cat /etc/model`
    7 link=`readlink /var/swap`
    812buildgroup=`cat /etc/.buildgroup`
    913
    10 sync
    1114
    12 echo "Checking your box type..."
     15### FUNCTIONS ###
     16
     17RES_COL=60                                                                      # column number to place the status message
     18MOVE_TO_COL="echo -en \\033[${RES_COL}G"        # command to move to the configured column number
     19
     20echo_success() {                                                        # function to print the SUCCESS status
     21        $MOVE_TO_COL; echo -n "[  OK  ]"; echo
     22}
     23
     24echo_failure() {
     25        $MOVE_TO_COL; echo -n "[FAILED]"; echo  # function to print the FAILED status message
     26}
     27
     28
     29
     30### MAIN ###
     31
     32echo -n "Checking box type..."
    1333if [ "$model" = "" ]; then
    14         echo ""
    15         echo "Sorry! This plugin is not available for your $model, because it will not work correctly!"
     34        echo_failure
     35        echo
     36        echo "Sorry, $plugin is not available for the $model!"
    1637        echo "Aborting installation..."
    1738        exit 1
    1839else
    19         echo "Box type $model is OK."
     40        echo_success
    2041fi
    2142
    22 echo ""
    23 echo "Checking swapstick..."
    24 if [ ! -d /var/swap/titanskins/ ]; then
    25         echo "----------------------"
    26         echo "Swapstick not found..."
    27         echo "----------------------"
     43
     44echo -n "Checking installation directory..."
     45if [ ! -d $plugin_target ]; then
     46        echo_failure
     47        echo
     48        echo "Sorry, $plugin_target not found!"
     49        echo "Aborting installation..."
    2850        exit 1
    2951else
    30         echo "Swapstick is OK."
     52        echo_success
    3153fi
    3254
    33 if [ `df | grep /dev/mtdblock | grep mnt | sed 's/ \+/ /g' | cut -d ' ' -f4 | head -n1 | wc -l` -eq 1 ] && [ $link = "/mnt/swapextensions" ]; then
    34         SPACE=`df | grep /dev/mtdblock | grep mnt | sed 's/ \+/ /g' | cut -d ' ' -f4 | head -n1`
    35         FREE=`expr $SPACE - 100`
    36         echo ""
    37         echo "Checking free space..."
    38         echo "Package size $pluginsize kb"
    39         echo "Free space $FREE kb"
    40         if [ "$FREE" -lt "$pluginsize" ]; then
    41                 echo "Sorry, not enough free space on your device!"
    42                 exit 1
    43         else
    44                 echo "OK"
    45         fi
     55
     56sync
     57SPACE=`getfreespace $plugin_target`
     58FREE=`expr $SPACE - 100`
     59echo -n "Checking free space ($plugin_size in $FREE kB)..."
     60if [ "$FREE" -lt "$plugin_size" ]; then
     61        echo_failure
     62        echo
     63        echo "Sorry, not enough free space in $plugin_target!"
     64        echo "Aborting installation..."
     65        exit 1
    4666else
    47         sync
     67        echo_success
    4868fi
    4969
    50 echo ""
    51 echo "Checking OS..."
    52 if [ `cat /etc/motd | grep $buildgroup | grep M | grep rev | wc -l` -eq 0 ]; then               
    53         echo "---------------------------"
    54         echo "Don't use this TPK package!"
    55         echo "---"
    56         echo "Only for $buildgroup image!"
    57         echo "---------------------------"
     70
     71echo -n "Checking image type..."
     72if [ `cat /etc/version | grep $buildgroup | wc -l` -eq 0 ]; then
     73        echo_failure
     74        echo
     75        echo "Sorry, $plugin is not available for this image type!"
     76        echo "Aborting installation..."
    5877        exit 1
    5978else
    60         echo "OS is OK."
     79        echo_success
    6180fi
    6281
    63 rm -rf $plugindir
    64 echo ""
    65 echo "Installing $plugin..."
     82
     83rm -rf $plugin_dir
     84
     85echo -n "Installing $plugin..."
     86echo_success
    6687
    6788exit 0
  • ipk/source.sh4/titanswapskins_tobayer01/CONTROL/prerm

    r23203 r23247  
    11#!/bin/sh
    22
    3 plugin="tobayer01 swapskin"
    4 link=`readlink /var/swap`
     3plugin_short="tobayer01"
     4plugin_type="swapskin"
     5plugin_target="/var/swap/titanskins"
    56
    6 if [ `df | grep /dev/mtdblock | grep mnt | sed 's/ \+/ /g' | cut -d ' ' -f4 | head -n1 | wc -l` -eq 1 ] && [ $link = "/mnt/swapextensions" ]; then
    7         SPACE=`df | grep /dev/mtdblock | grep mnt | sed 's/ \+/ /g' | cut -d ' ' -f4 | head -n1`
    8         FREE=`expr $SPACE - 100`
    9         echo "Old free space: $FREE kb"
    10 else
    11         sync
    12 fi
     7plugin_dir="$plugin_target/$plugin_short"
     8plugin="$plugin_short $plugin_type"
    139
    14 echo "Removing $plugin..."
     10
     11### FUNCTIONS ###
     12
     13RES_COL=60                                                                      # column number to place the status message
     14MOVE_TO_COL="echo -en \\033[${RES_COL}G"        # command to move to the configured column number
     15
     16echo_success() {                                                        # function to print the SUCCESS status
     17        $MOVE_TO_COL; echo -n "[  OK  ]"; echo
     18}
     19
     20echo_failure() {
     21        $MOVE_TO_COL; echo -n "[FAILED]"; echo  # function to print the FAILED status message
     22}
     23
     24
     25
     26### MAIN ###
     27
     28sync
     29SPACE=`getfreespace $plugin_target`
     30FREE=`expr $SPACE - 100`
     31echo "Old free space: $FREE kB"
     32
     33
     34echo -n "Removing $plugin..."
     35echo_success
    1536
    1637exit 0
Note: See TracChangeset for help on using the changeset viewer.