This is a static archive of our old Q&A Site. Please post any new questions and answers at ask.wireshark.org.

init.lua gets overwritten during an upgrade. How can I prevent that?

0

Currently, a Wireshark upgrade overwrites the system init.lua without checking for user modifications. If would be nice if there was a way to keep the custom entries there.

asked 13 Jan '14, 05:40

MattKnepp's gravatar image

MattKnepp
1111
accept rate: 0%

edited 02 Feb '14, 13:56

helloworld's gravatar image

helloworld
3.1k42041


One Answer:

3

Just place your version of init.lua in your personal config directory (on Windows: %APPDATA%\wireshark) and your modifications will survive an update.

Regards
Kurt

answered 13 Jan '14, 07:03

Kurt%20Knochner's gravatar image

Kurt Knochner ♦
24.8k1039237
accept rate: 15%

edited 13 Jan '14, 07:13

Note though that your init.lua won't pick up any changes Wireshark's init.lua has had in the new version. init.lua doesn't change very often, but if it does your Lua scripts might need those changes. (some of the things in init.lua are constants used inside wireshark, which could theoretically change) So just keep that in mind if something's not working in your scripts when you upgrade.

(31 Jan '14, 14:46) Hadriel

Unless you need to change things in the system init.lua (in which case you run the risk of having your changes no longer apply to an updated system init.lua), putting just your new stuff in your personal init.lua should work.

If you want those additions to be global for all users on your system, there's currently no good way to do that; perhaps there should be a system Lua init file containing stuff such as Wireshark's definitions, an optional system Lua init file containing site customizations and additionsl, and an optional personal Lua init file containing user customizations and additions.

(01 Feb '14, 19:48) Guy Harris ♦♦

Actually, the system init.lua is always loaded first, and then, the personal init.lua. You would only lose the system changes if your personal init.lua overwrites the system values, which you'd want to avoid for the very reason @Hadriel points out.

If you find a need to add to system tables (e.g., adding to the Wiretap file types), make sure to append your own values rather than copy so that you'll pick up any updates from the system initialization. System flags/enumerations in init.lua (e.g., MENU_ANALYZE_UNSORTED, ENC_UTF_8) normally should not be overwritten unless you're "feeling experimental".

@GuyHarris, You're probably right in that there's no "good way" to support global additions to init.lua, but it's still feasible with a one-line modification to the system init.lua to load a "global init.lua", stored in a location that is accessible to all users and not overwriteable by the Wireshark installation.

(02 Feb '14, 13:41) helloworld