Changeset 23247 for ipk/source.sh4/titanswapskins_tobayer01/CONTROL/preinst
- Timestamp:
- Sep 4, 2013, 12:34:44 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
ipk/source.sh4/titanswapskins_tobayer01/CONTROL/preinst
r23202 r23247 1 1 #!/bin/sh 2 2 3 plugin="tobayer01 swapskin" 4 plugindir="/var/swap/titanskins/tobayer01" 5 pluginsize=2300 3 plugin_size=2300 4 plugin_short="tobayer01" 5 plugin_type="swapskin" 6 plugin_target="/var/swap/titanskins" 7 8 plugin_dir="$plugin_target/$plugin_short" 9 plugin="$plugin_short $plugin_type" 10 6 11 model=`cat /etc/model` 7 link=`readlink /var/swap`8 12 buildgroup=`cat /etc/.buildgroup` 9 13 10 sync11 14 12 echo "Checking your box type..." 15 ### FUNCTIONS ### 16 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 19 20 echo_success() { # function to print the SUCCESS status 21 $MOVE_TO_COL; echo -n "[ OK ]"; echo 22 } 23 24 echo_failure() { 25 $MOVE_TO_COL; echo -n "[FAILED]"; echo # function to print the FAILED status message 26 } 27 28 29 30 ### MAIN ### 31 32 echo -n "Checking box type..." 13 33 if [ "$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!" 16 37 echo "Aborting installation..." 17 38 exit 1 18 39 else 19 echo "Box type $model is OK."40 echo_success 20 41 fi 21 42 22 echo "" 23 echo "Checking swapstick..." 24 if [ ! -d /var/swap/titanskins/ ]; then 25 echo "----------------------" 26 echo "Swapstick not found..." 27 echo "----------------------" 43 44 echo -n "Checking installation directory..." 45 if [ ! -d $plugin_target ]; then 46 echo_failure 47 echo 48 echo "Sorry, $plugin_target not found!" 49 echo "Aborting installation..." 28 50 exit 1 29 51 else 30 echo "Swapstick is OK."52 echo_success 31 53 fi 32 54 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 56 sync 57 SPACE=`getfreespace $plugin_target` 58 FREE=`expr $SPACE - 100` 59 echo -n "Checking free space ($plugin_size in $FREE kB)..." 60 if [ "$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 46 66 else 47 sync67 echo_success 48 68 fi 49 69 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 71 echo -n "Checking image type..." 72 if [ `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..." 58 77 exit 1 59 78 else 60 echo "OS is OK."79 echo_success 61 80 fi 62 81 63 rm -rf $plugindir 64 echo "" 65 echo "Installing $plugin..." 82 83 rm -rf $plugin_dir 84 85 echo -n "Installing $plugin..." 86 echo_success 66 87 67 88 exit 0
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/openaaf/chrome/common/titannit_trac_banner.png)