Index: ipk/source.sh4/emus_gbox_790/CONTROL/postinst
===================================================================
--- ipk/source.sh4/emus_gbox_790/CONTROL/postinst	(revision 12395)
+++ ipk/source.sh4/emus_gbox_790/CONTROL/postinst	(revision 12781)
@@ -5,11 +5,4 @@
 CONFIGDIR=/var/etc
 echo "successfully installed"
-echo "syncing disk"
-sync
-if [ `df | grep /dev/mtdblock | grep var | sed 's/ \+/ /g' | cut -d ' ' -f4 | head -n1 | wc -l` -eq 1 ]; then
-	SPACE=`df | grep /dev/mtdblock | grep var | sed 's/ \+/ /g' | cut -d ' ' -f4 | head -n1`
-	FREE=`expr $SPACE - 100`
-	echo new freespace size $FREE kb
-fi
 
 if [ ! -e /var/keys/cwshare.cfg ]; then
@@ -49,3 +42,12 @@
 fi
 
+if [ `df | grep /dev/mtdblock | grep var | sed 's/ \+/ /g' | cut -d ' ' -f4 | head -n1 | wc -l` -eq 1 ]; then
+	SPACE=`df | grep /dev/mtdblock | grep var | sed 's/ \+/ /g' | cut -d ' ' -f4 | head -n1`
+	FREE=`expr $SPACE - 100`
+	echo new freespace size $FREE kb
+else
+	echo "syncing disk"
+	sync
+fi
+
 exit 0
Index: ipk/source.sh4/emus_gbox_790/CONTROL/postrm
===================================================================
--- ipk/source.sh4/emus_gbox_790/CONTROL/postrm	(revision 12395)
+++ ipk/source.sh4/emus_gbox_790/CONTROL/postrm	(revision 12781)
@@ -2,13 +2,11 @@
 TMP=/tmp/.keys
 echo "successfully removed"
-echo "syncing disk"
-sync
 if [ `df | grep /dev/mtdblock | grep var | sed 's/ \+/ /g' | cut -d ' ' -f4 | head -n1 | wc -l` -eq 1 ]; then
 	SPACE=`df | grep /dev/mtdblock | grep var | sed 's/ \+/ /g' | cut -d ' ' -f4 | head -n1`
 	FREE=`expr $SPACE - 100`
 	echo new freespace size $FREE kb
+else
+	echo "syncing disk"
+	sync
 fi
-
-sync
-
 exit 0
Index: ipk/source.sh4/emus_gbox_790/CONTROL/preinst
===================================================================
--- ipk/source.sh4/emus_gbox_790/CONTROL/preinst	(revision 12395)
+++ ipk/source.sh4/emus_gbox_790/CONTROL/preinst	(revision 12781)
@@ -2,6 +2,4 @@
 #
 TMP=/tmp/.keys
-echo "syncing disk"
-sync
 
 model=`cat /etc/model`
@@ -21,5 +19,5 @@
 	SPACE=`df | grep /dev/mtdblock | grep var | sed 's/ \+/ /g' | cut -d ' ' -f4 | head -n1`
 	FREE=`expr $SPACE - 100`
-	SIZE=510
+	SIZE=1360
 	echo "checking freespace"
 	echo packege size $SIZE kb
@@ -29,7 +27,10 @@
 		exit 1
 	else
-		echo ok
+		echo ok		
 	fi
-fi   
+else
+	echo "syncing disk"
+	sync
+fi
 echo "installing gbox and configs..."
 buildgroup=`cat /etc/.buildgroup`
@@ -44,4 +45,3 @@
 fi
 
-sync
 exit 0
Index: ipk/source.sh4/emus_gbox_790/CONTROL/prerm
===================================================================
--- ipk/source.sh4/emus_gbox_790/CONTROL/prerm	(revision 12395)
+++ ipk/source.sh4/emus_gbox_790/CONTROL/prerm	(revision 12781)
@@ -1,11 +1,4 @@
 #!/bin/sh
 TMP=/tmp/.keys
-echo "syncing disk"
-sync
-if [ `df | grep /dev/mtdblock | grep var | sed 's/ \+/ /g' | cut -d ' ' -f4 | head -n1 | wc -l` -eq 1 ]; then
-	SPACE=`df | grep /dev/mtdblock | grep var | sed 's/ \+/ /g' | cut -d ' ' -f4 | head -n1`
-	FREE=`expr $SPACE - 100`
-	echo freespace size $FREE kb
-fi
 
 if [ ! -e /var/keys/oscam.conf.oscam ]; then
@@ -34,4 +27,13 @@
 fi
 
+if [ `df | grep /dev/mtdblock | grep var | sed 's/ \+/ /g' | cut -d ' ' -f4 | head -n1 | wc -l` -eq 1 ]; then
+	SPACE=`df | grep /dev/mtdblock | grep var | sed 's/ \+/ /g' | cut -d ' ' -f4 | head -n1`
+	FREE=`expr $SPACE - 100`
+	echo new freespace size $FREE kb
+else
+	echo "syncing disk"
+	sync
+fi
+
 echo "removing gbox and configs"
 exit 0
