How to pass data to a file while Package installation on mac
Asked Answered
P

1

1

I am making an app in python. Using python 2.7 on mac osx 10.8.5. I converted python code into an app using py2app. Then I converted myapp.app into package myapp.pkg using Packages. I am using a configuration file which I kept in Contents-->Resources-->config.cfg. config.cfg file contains data which is necessary for running of app.

My issue is how to pass serverIP and serverPort to config.cfg file while installing myapp through myapp.pkg i.e. through Packages. My config.cfg file is like key-value pair.I am using config.parsar to read config.cfg file.

[KMS]
serverIP1 = 
serverPort1 =
serverIP2 =
serverPort2 = 

I need to pass these value to config.cfg file while installing package.The installer should ask these values and the user should input these values.

Palmary answered 10/11, 2013 at 18:22 Comment(0)
V
0

A possible solution would be to write a packagemaker plugin that will ask these details from the user and then save it to some file. Then during installation, from a post-install script, you can read this file and modify your config file.

However, it is bad idea to keep such config files inside the app file. A better place for such files is ~/Library/Preferences or ~/Library/Application Support.

Tutorials for creating packagemaker plugin: (Requires Cocoa knowledge) http://www.mactech.com/articles/mactech/Vol.25/25.06/InstallerPlugins/index.html http://s.sudre.free.fr/Stuff/Installer/Installer_Plugins/

Voyles answered 11/11, 2013 at 3:33 Comment(3)
Sir, how to write packagemaker plugin, is I have to work on something like GUI window also for asking user input details. Actually I have to distribute this app to others also, thats why I am keeping config file inside app.Palmary
I have posted some links above.Voyles
how to save the data entered by the user during installation in a file.Palmary

© 2022 - 2024 — McMap. All rights reserved.