Debian: fixed bugs in upgrade

This commit is contained in:
pelya
2014-05-02 20:01:52 +03:00
parent 61f565890e
commit faafcd2075
3 changed files with 62 additions and 10 deletions

View File

@@ -7,10 +7,10 @@ AppName="Debian"
AppFullName=com.cuntubuntu
# Application version code (integer)
AppVersionCode=140501
AppVersionCode=140502
# Application user-visible version name (string)
AppVersionName="14.05.01"
AppVersionName="14.05.02"
# Specify path to download application data in zip archive in the form 'Description|URL|MirrorURL^Description2|URL2|MirrorURL2^...'
# If you'll start Description with '!' symbol it will be enabled by default, other downloads should be selected by user from startup config menu
@@ -24,7 +24,7 @@ AppDataDownloadUrl="!!System image|:data.tar.gz:http://sourceforge.net/projects/
ResetSdlConfigForThisVersion=y
# Delete application data files when upgrading (specify file/dir paths separated by spaces)
DeleteFilesOnUpgrade="img"
DeleteFilesOnUpgrade="libsdl-DownloadFinished-0.flag libsdl-DownloadFinished-1.flag libsdl-DownloadFinished-2.flag libsdl-DownloadFinished-3.flag"
# Here you may type readme text, which will be shown during startup. Format is:
# Text in English, use \\\\n to separate lines (that's four backslashes)^de:Text in Deutsch^ru:Text in Russian^button:Button that will open some URL:http://url-to-open/

View File

@@ -1,12 +1,9 @@
#!/system/bin/sh
#rm -rf $SDCARD/ubuntu
echo "Extracting XSDL data files"
cd $SECURE_STORAGE_DIR
./busybox tar xzf $UNSECURE_STORAGE_DIR/data-1.tar.gz
rm -f $UNSECURE_STORAGE_DIR/data-1.tar.gz
export SECURE_STORAGE_DIR=$SECURE_STORAGE_DIR/img
cd $SECURE_STORAGE_DIR
echo "Installation path: $SECURE_STORAGE_DIR"
cd $SECURE_STORAGE_DIR/img
echo "Installation path: $SECURE_STORAGE_DIR/img"
./postinstall.sh

View File

@@ -49,10 +49,10 @@ void * unpackFilesThread(void * unused)
if( stat( "data.tar.gz", &st ) == 0 )
{
__android_log_print(ANDROID_LOG_INFO, "XSDL", "Unpacking data");
unpackProgressMbTotal = st.st_size / 1024 / 1024;
if( unpackProgressMbTotal <= 0 )
unpackProgressMbTotal = 1;
__android_log_print(ANDROID_LOG_INFO, "XSDL", "Unpacking data: total size %d Mb", unpackProgressMbTotal);
}
else
{
@@ -62,7 +62,62 @@ void * unpackFilesThread(void * unused)
unpackProgressMb = 0;
strcpy( fname, getenv("SECURE_STORAGE_DIR") );
strcat( fname, "/postinstall.sh" );
strcpy( fname2, getenv("SECURE_STORAGE_DIR") );
strcat( fname2, "/usr/lib/xorg/protocol.txt" );
if( stat( fname, &st ) == 0 || stat( fname2, &st ) == 0 )
{
__android_log_print(ANDROID_LOG_INFO, "XSDL", "Deleting old installation...");
sprintf(unpackLog[0], "Deleting old installation...");
strcpy( fname, getenv("SECURE_STORAGE_DIR") );
strcat( fname, "/busybox" );
strcat( fname, " mkdir -p " );
strcat( fname, getenv("SECURE_STORAGE_DIR") );
strcat( fname, "/../cache" );
system( fname );
strcpy( fname, getenv("SECURE_STORAGE_DIR") );
strcat( fname, "/busybox" );
strcat( fname, " cp -a " );
strcpy( fname, getenv("SECURE_STORAGE_DIR") );
strcat( fname, "/busybox " );
strcat( fname, getenv("SECURE_STORAGE_DIR") );
strcat( fname, "/../cache/busybox" );
system( fname );
strcpy( fname, getenv("SECURE_STORAGE_DIR") );
strcat( fname, "/../cache/busybox" );
strcat( fname, " rm -rf " );
strcat( fname, getenv("SECURE_STORAGE_DIR") );
strcat( fname, "/*" );
system( fname );
strcpy( fname, getenv("SECURE_STORAGE_DIR") );
strcat( fname, "/../cache/busybox" );
strcat( fname, " setsid " );
strcpy( fname, getenv("SECURE_STORAGE_DIR") );
strcat( fname, "/../cache/busybox ash -c 'sleep 2 ; /system/bin/am start -n " );
strcpy( fname, getenv("ANDROID_PACKAGE_NAME") );
strcat( fname, "/.MainActivity'" );
sprintf(unpackLog[0], "Restarting the app...");
__android_log_print(ANDROID_LOG_INFO, "XSDL", "Restarting the app: %s", fname);
system( fname );
exit(0);
}
sprintf(unpackLog[0], "Unpacking data...");
__android_log_print(ANDROID_LOG_INFO, "XSDL", "Unpacking data...");
strcpy( fname, getenv("SECURE_STORAGE_DIR") );
strcat( fname, "/busybox" );
@@ -103,7 +158,7 @@ void * unpackFilesThread(void * unused)
sprintf(unpackLog[0], "Unpacking data: %d/%d Mb, %d%%", unpackProgressMb, unpackProgressMbTotal, unpackProgressMb * 100 / (unpackProgressMbTotal > 0 ? unpackProgressMbTotal : 1));
}
}
__android_log_print(ANDROID_LOG_INFO, "XSDL", "FREAD %dKb DONE", unpackProgressKb);
__android_log_print(ANDROID_LOG_INFO, "XSDL", "FREAD %d Mb DONE", unpackProgressMb);
fclose(ff);
if( pclose(fo) != 0 ) // Returns error on Android 2.3 emulator!