afarhan / sbitx

174 stars 61 forks source link

User Settings file interferes with software update #5

Closed wb2osz closed 1 year ago

wb2osz commented 2 years ago

Following your software update instructions:

$ cd sbitx

$ git pull Updating 558ff8f..bd6d81c error: Your local changes to the following files would be overwritten by merge: data/user_settings.ini Please commit your changes or stash them before you merge. Aborting

Examining ~pi/data/user_settings.ini, we find my most recently used frequency, callsign, grid square, an so on. Overwriting that file would cause all of my personalized settings to get lost.

The usual Linux convention is to use a hidden ("dot") file or directory in the user's home directory. We find that it is already there, but it contains a callsign vu2lch, and other settings, from about a month ago.

$ ls -la ~pi/.sbitx total 32 drwxr-xr-x 2 pi pi 4096 Jun 29 07:23 . drwxr-xr-x 33 pi pi 4096 Aug 3 20:01 .. -rw-r--r-- 1 pi pi 481 Jan 31 2022 bands.ini -rw-r--r-- 1 pi pi 1346 Jan 31 2022 band_stack.ini -rw-r--r-- 1 pi pi 1400 Jul 2 17:43 user_settings.ini -rw-r--r-- 1 pi pi 12288 Feb 4 10:20 .user_settings.ini.swp

It looks like you intended to use $HOME/.sbitx/user_settings.ini but accidentally used $HOME/sbitx/data/user_settings.ini instead.

Temporary workaround: Save the user settings file and copy it back again after the update.

$ cp data/user_settings.ini ~ $ git checkout -- data/user_settings.ini $ git pull Updating 558ff8f..bd6d81c Fast-forward data/user_settings.ini | 64 ++++++++++++++++++++++++------------------------- modems.c | 36 ++++++++++++++++++---------- sbitx | Bin 403100 -> 403188 bytes sbitx.c | 5 ++-- sbitx_gtk.c | 9 +++---- sbitx_wallpaper.png | Bin 122284 -> 124840 bytes sdr.h | 1 + 7 files changed, 63 insertions(+), 52 deletions(-)

./build sbitx

flwyd commented 2 years ago

Based on the commit history of data/user_settings.ini it looks like @afarhan often does something like git commit -a which uploads his current settings, including changes in frequency, volume, power, etc.

I agree with @wb2osz that the settings should be stored somewhere outside the git directory (~/.sbitx is a fine proposal). If that's infeasible for some reason, I recommend renaming the current user_settings.ini to user_settings.ini.dist and making sure it's got sensible values for an initial install, e.g. IF at 40, audio at 50… Add data/user_settings.ini to the .gitignore file so that nobody accidentally commits their personal settings. Then have build copy user_settings.ini.dist to user_settings.ini if the latter does not exist so that new users get a good initial config.

When new settings get added in the future the settings-saving code can either automatically write default values for missing settings or the build/update process can highlight setting keys from the dist file that aren't in the ini file.

afarhan commented 2 years ago

Will do, I just got done with all the hardware mods.

On Sat, Nov 19, 2022, 11:48 AM Trevor Stone @.***> wrote:

Based on the commit history of data/user_settings.ini it looks like @afarhan https://github.com/afarhan often does something like git commit -a which uploads his current settings, including changes in frequency, volume, power, etc.

I agree with @wb2osz https://github.com/wb2osz that the settings should be stored somewhere outside the git directory (~/.sbitx is a fine proposal). If that's infeasible for some reason, I recommend renaming the current user_settings.ini to user_settings.ini.dist and making sure it's got sensible values for an initial install, e.g. IF at 40, audio at 50… Add data/user_settings.ini to the .gitignore file so that nobody accidentally commits their personal settings. Then have build copy user_settings.ini.dist to user_settings.ini if the latter does not exist so that new users get a good initial config.

When new settings get added in the future the settings-saving code can either automatically write default values for missing settings or the build/update process can highlight setting keys from the dist file that aren't in the ini file.

— Reply to this email directly, view it on GitHub https://github.com/afarhan/sbitx/issues/5#issuecomment-1320814393, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFYXOBJOONL35ZOLB2MYYTWJBWKNANCNFSM55PIWCBQ . You are receiving this because you were mentioned.Message ID: @.***>

afarhan commented 1 year ago

This has been fixed