Discussion Board

Results 1 to 13 of 13
  1. #1
    Regular Contributor Dynasty1215's Avatar
    Join Date
    Jul 2007
    Posts
    151
    hi,
    in my application runing, the qml(js) open database used openDatabaseSync("xxxx", "1.0", "xxxx SQL", 10000); and create some tables, save some datas.
    now, when the application uninstall, i want clear the datas that saved in the database. but i don't know how to.

    The probloms are:
    1.how to set when uninstalling run some exe(or, scrip) i.e, to do something;
    2.how to the the exe(scrip) clear the data (drop table or remove database)

    or, give some other suggestion.

    pls help . thx first. :-)
    Keep Smiling To Life!

    Dynasty1215

  2. #2
    Registered User kusumk's Avatar
    Join Date
    Sep 2011
    Posts
    449
    Hi,

    Please use debian maintainer scripts for running scripts at the time of pre/post installation or pre/post uninstallation.

    For deleting files on installation you can write a postrm or prerm script and put in dir qtc_packaging/debian_harmattan

    http://www.debian.org/doc/debian-pol...erscripts.html

    Threads earlier related to similar topic - http://www.developer.nokia.com/Commu...llation-of-app

    http://www.developer.nokia.com/Commu...ghlight=postrm

    Some examples available at - http://talk.maemo.org/showthread.php?t=80947

    Let us know if you have any problems

  3. #3
    Nokia Developer Moderator gnuton's Avatar
    Join Date
    Mar 2009
    Posts
    1,024
    I think we need to write a wiki page which cover this topic....

  4. #4
    Regular Contributor Dynasty1215's Avatar
    Join Date
    Jul 2007
    Posts
    151
    Sorry beeing late
    Thanks for kusumk and gnuton
    I think the postinst , prerm is useful for me, and now i'am trying use postinst to mkdir when after the application installed
    But, i have a trouble that when the script run, it return a error:

    aegis-installing qtAppmobile (from '')
    Setting up qtAppmobile (1.1.3) ..
    mkdir: can't create directory '/opt/DBOPTTest/temp': No such file or directory
    Processing triggers for desktop-file-utils ...
    dpkg: error processing qtAppmobile (--install):
    subprocess installed post-installation script returned error exit status 1

    In my postinst file, the script are:
    #!/bin/sh

    set -e

    if [ -d "/opt/DBOPTTest/db" ]; then
    echo "Folder exists!"
    else
    mkdir /opt/DBOPTTest/db
    chmod -R 777 /opt/DBOPTTest/db
    fi

    I don't know why have error.
    Any help?
    Thx!
    Keep Smiling To Life!

    Dynasty1215

  5. #5
    Registered User kusumk's Avatar
    Join Date
    Sep 2011
    Posts
    449
    Hi,

    That is because when you uninstall your app /opt/<yourapp> folder is removed.

    If you try to create a folder inside that after removal, it would give error. BTW, Why are you trying to create a dir after uninstallation?

  6. #6
    Regular Contributor Dynasty1215's Avatar
    Join Date
    Jul 2007
    Posts
    151
    Thanks kusumk
    I want to create a dir after installed, not uninstallation.
    I want to create a dir after installed, then, I used the viewer->engine()->setOfflineStoragePath(QString) function for the database dir. In my app(qml), I used openDatabaseSync() open db, create table, save some datas.
    And I want remove the database dir when uninstall the app, that, I think the prerm file can useful for me.
    Is that ?
    Keep Smiling To Life!

    Dynasty1215

  7. #7
    Regular Contributor Dynasty1215's Avatar
    Join Date
    Jul 2007
    Posts
    151
    Now i am useing postinst want to mkdir after install my application
    But there is an error when mkdir. The error is:

    aegis-installing qtAppmobile (from '')
    Setting up qtAppmobile (1.1.3) ..
    mkdir: can't create directory '/opt/DBOPTTest/temp': No such file or directory
    Processing triggers for desktop-file-utils ...
    dpkg: error processing qtAppmobile (--install):
    subprocess installed post-installation script returned error exit status 1

    In My postinst file , the scripts are:
    #!/bin/sh

    set -e

    if [ -d "/opt/DBOPTTest/db" ]; then
    echo "Folder exists!"
    else
    mkdir /opt/DBOPTTest/db
    chmod -R 777 /opt/DBOPTTest/db
    fi

    Any helps?
    Keep Smiling To Life!

    Dynasty1215

  8. #8
    Nokia Developer Champion mikkovtr's Avatar
    Join Date
    Nov 2009
    Posts
    198
    does /opt/DBOPTTest exist?

    try "mkdir -p /opt/DBOPTTest/db", it will create missing parent directories.

    edit: Nevermind, error is from /opt/DBOPTTest/temp, where is this directory coming from?

  9. #9
    Regular Contributor Dynasty1215's Avatar
    Join Date
    Jul 2007
    Posts
    151
    Hi, mikkovtr
    I am sorry, I make a misstake.
    The error infos are: "mkdir: can't create directory '/opt/DBOPTTest/db': No such file or directory", not "mkdir: can't create directory '/opt/DBOPTTest/temp':". You are very careful.
    Now, I am useing "mkdir -p /opt/DBOPTTest/db", that's ok.
    I am unknowing the scripts about linux, that's the key. ;-)
    Who can tell me, where are the more details about the scripts(parameters) likes "mkdir" "-p" etc.
    Thx everyone
    Keep Smiling To Life!

    Dynasty1215

  10. #10
    Nokia Developer Champion mikkovtr's Avatar
    Join Date
    Nov 2009
    Posts
    198
    I don't know any single source, but if you search for "linux shell scripting" or "shell scripting" and you'll find plenty of tutorials. For any particular command, like mkdir, you can search for "man mkdir" to read manual pages. And if you have Linux then type "man mkdir" to your shell.

    I don't want to distract you but usually user created content is stored in user's home directory. Directories can be created also by listing them in debian/dirs file, but it will not get removed files are left behind there.

  11. #11
    Regular Contributor Dynasty1215's Avatar
    Join Date
    Jul 2007
    Posts
    151
    I don't know more about linux dir systerm, so i don't understant the "home" "user" "opt" .e.g and their relations.

    I used postinst mkdir (/opt/DBOPTTest/db) when installing. I used offlineStoragePath(const QString& ) function set the offline storrage path. Then I used function openDatabaseSync, then create table, save datas.

    I want used prerm to remove the dir or drop the database when the app uninstalling.

    Now, the prerm is invalid. After i uninstall the app, the dir existence.

    I can saw the dir uesd Terminal on my n950 devices.

    In the /opt/DBOPTTest/db/Databases (the subdir "Databases" is generat auto)there are tow files:
    ec0b4428c9cc8f4e05969d699e4e814e.ini
    ec0b4428c9cc8f4e05969d699e4e814e.sqlite
    I thinkd , that is I want clear.

    In my prerm file:
    rm -f /opt/DBOPTTest/db

    But it is invalid.

    Any good idea for me ?
    Keep Smiling To Life!

    Dynasty1215

  12. #12
    Nokia Developer Champion mikkovtr's Avatar
    Join Date
    Nov 2009
    Posts
    198
    This should be good read on file locations.
    http://harmattan-dev.nokia.com/docs/...a_storage.html

    But to the problem. I believe you would like to remove /opt/DBOPTTest directory completely. To achieve that use "rm -rf /opt/DBOPTTest". This will recursively remove /opt/DBOPTTest directoctory and every file and subdirectory it contains.

  13. #13
    Regular Contributor Dynasty1215's Avatar
    Join Date
    Jul 2007
    Posts
    151
    Quote Originally Posted by mikkovtr View Post
    This should be good read on file locations.
    http://harmattan-dev.nokia.com/docs/...a_storage.html

    But to the problem. I believe you would like to remove /opt/DBOPTTest directory completely. To achieve that use "rm -rf /opt/DBOPTTest". This will recursively remove /opt/DBOPTTest directoctory and every file and subdirectory it contains.
    Sorry, so long time i have'd to here.
    I am solved it , "rm -rf /opt/DBOPTTest" is ok. Before i had error,"Permission denied", the reason is the "permissions " not enough.
    I added <request context="INSTALL">
    <credential name="UID::user" />
    <credential name="GID::users" />
    </request>

    in the manifest.aegis. It's ok.
    Thx everyone again, :-)
    Keep Smiling To Life!

    Dynasty1215

Similar Threads

  1. How to uninstall S60 without Add/Remove Programs
    By j2me64 in forum Series 40 & S60 Platform Feedback Archive
    Replies: 1
    Last Post: 2009-09-14, 07:45
  2. how to remove txt file when uninstall?
    By nokia_lin in forum Symbian C++
    Replies: 3
    Last Post: 2009-05-11, 05:44
  3. remove directory during uninstall
    By reuvenb in forum Symbian C++
    Replies: 3
    Last Post: 2009-02-08, 14:59
  4. [sis] remove dir on uninstall
    By cbrueckner in forum Symbian C++
    Replies: 3
    Last Post: 2003-12-22, 09:23
  5. Uninstall J2ME Application also remove related RMS ?
    By adywicaksono in forum Mobile Java General
    Replies: 1
    Last Post: 2003-04-25, 05:17

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved