~mil/sxmo-devel

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
3 3

[PATCH sxmo-utils] move sxmo data to XDG_DATA_HOME

Details
Message ID
<20201108201247.11888-1-anjan@momi.ca>
DKIM signature
missing
Download raw message
Patch: +19 -19
Breaking change. Make sure you send an email to the mailing list
telling users to move their
$XDG_CONFIG_HOME/{modem,notifications,contacts.tsv} files/folders to
$XDG_DATA_HOME

Signed-off-by: Anjandev Momi <anjan@momi.ca>
---
 scripts/appscripts/sxmo_record.sh                 | 2 +-
 scripts/appscripts/sxmo_rss.sh                    | 4 ++--
 scripts/core/sxmo_appmenu.sh                      | 2 +-
 scripts/core/sxmo_contacts.sh                     | 4 ++--
 scripts/core/sxmo_statusbar.sh                    | 2 +-
 scripts/modem/sxmo_modemcall.sh                   | 4 ++--
 scripts/modem/sxmo_modemlog.sh                    | 2 +-
 scripts/modem/sxmo_modemmonitor.sh                | 4 ++--
 scripts/modem/sxmo_modemsendsms.sh                | 2 +-
 scripts/modem/sxmo_modemtext.sh                   | 4 ++--
 scripts/notifications/sxmo_notificationmonitor.sh | 2 +-
 scripts/notifications/sxmo_notificationsmenu.sh   | 2 +-
 scripts/notifications/sxmo_notificationwrite.sh   | 4 ++--
 13 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/scripts/appscripts/sxmo_record.sh b/scripts/appscripts/sxmo_record.sh
index 956d016..185b584 100755
--- a/scripts/appscripts/sxmo_record.sh
+++ b/scripts/appscripts/sxmo_record.sh
@@ -1,5 +1,5 @@
#!/usr/bin/env sh
[ -z "$SXMO_RECDIR" ] && SXMO_RECDIR=~/Recordings
[ -z "$SXMO_RECDIR" ] && SXMO_RECDIR="$XDG_DATA_HOME"/sxmo/recordings
mkdir -p "$SXMO_RECDIR"

getdur() {
diff --git a/scripts/appscripts/sxmo_rss.sh b/scripts/appscripts/sxmo_rss.sh
index 2b50862..d298932 100755
--- a/scripts/appscripts/sxmo_rss.sh
+++ b/scripts/appscripts/sxmo_rss.sh
@@ -1,8 +1,8 @@
#!/usr/bin/env sh
FETCHENABLED=1

if [ -f "$XDG_CONFIG_HOME/sxmo/sfeedrc" ]; then
	SFEEDCONF="$XDG_CONFIG_HOME/sxmo/sfeedrc"
if [ -f "$XDG_DATA_HOME/sxmo/sfeedrc" ]; then
	SFEEDCONF="$XDG_DATA_HOME/sxmo/sfeedrc"
elif [ -f "$HOME/.sfeed/sfeedrc" ]; then
	SFEEDCONF="$HOME/.sfeed/sfeedrc"
else
diff --git a/scripts/core/sxmo_appmenu.sh b/scripts/core/sxmo_appmenu.sh
index afa99fb..b66aac1 100755
--- a/scripts/core/sxmo_appmenu.sh
+++ b/scripts/core/sxmo_appmenu.sh
@@ -1,7 +1,7 @@
#!/usr/bin/env sh
trap gracefulexit INT TERM
WIN=$(xdotool getwindowfocus)
NOTIFDIR="$XDG_CONFIG_HOME"/sxmo/notifications
NOTIFDIR="$XDG_DATA_HOME"/sxmo/notifications

gracefulexit() {
	echo "Gracefully exiting $0"
diff --git a/scripts/core/sxmo_contacts.sh b/scripts/core/sxmo_contacts.sh
index e2c26d4..84779fc 100755
--- a/scripts/core/sxmo_contacts.sh
+++ b/scripts/core/sxmo_contacts.sh
@@ -8,8 +8,8 @@
#
# Prints in output format: "number: contact"

CONTACTSFILE="$XDG_CONFIG_HOME"/sxmo/contacts.tsv
LOGFILE="$XDG_CONFIG_HOME"/sxmo/modem/modemlog.tsv
CONTACTSFILE="$XDG_DATA_HOME"/sxmo/contacts.tsv
LOGFILE="$XDG_DATA_HOME"/sxmo/modem/modemlog.tsv

contacts() {
	grep -q . "$CONTACTSFILE" || echo " " > "$CONTACTSFILE"
diff --git a/scripts/core/sxmo_statusbar.sh b/scripts/core/sxmo_statusbar.sh
index 55c9200..240aefc 100755
--- a/scripts/core/sxmo_statusbar.sh
+++ b/scripts/core/sxmo_statusbar.sh
@@ -8,7 +8,7 @@ update() {
	if pgrep -f sxmo_modemcall.sh; then
		NOWS="$(date +"%s")"
		CALLSTARTS="$(date +"%s" -d "$(
			grep -aE 'call_start|call_pickup' "$XDG_CONFIG_HOME"/sxmo/modem/modemlog.tsv |
			grep -aE 'call_start|call_pickup' "$XDG_DATA_HOME"/sxmo/modem/modemlog.tsv |
			tail -n1 |
			cut -f1
		)")"
diff --git a/scripts/modem/sxmo_modemcall.sh b/scripts/modem/sxmo_modemcall.sh
index b56e6ed..ba1b6b5 100755
--- a/scripts/modem/sxmo_modemcall.sh
+++ b/scripts/modem/sxmo_modemcall.sh
@@ -1,5 +1,5 @@
#!/usr/bin/env sh
LOGDIR="$XDG_CONFIG_HOME"/sxmo/modem
LOGDIR="$XDG_DATA_HOME"/sxmo/modem
trap "gracefulexit" INT TERM

modem_n() {
@@ -199,4 +199,4 @@ pickup() {
}

modem_n || fatalerr "Couldn't determine modem number - is modem online?"
"$@"
\ No newline at end of file
"$@"
diff --git a/scripts/modem/sxmo_modemlog.sh b/scripts/modem/sxmo_modemlog.sh
index ff44c69..8205939 100755
--- a/scripts/modem/sxmo_modemlog.sh
+++ b/scripts/modem/sxmo_modemlog.sh
@@ -1,3 +1,3 @@
#!/usr/bin/env sh
LOGDIR="$XDG_CONFIG_HOME"/sxmo/modem
LOGDIR="$XDG_DATA_HOME"/sxmo/modem
st -f "Terminus-14" -e tail -n9999 -f "$LOGDIR"/modemlog.tsv
diff --git a/scripts/modem/sxmo_modemmonitor.sh b/scripts/modem/sxmo_modemmonitor.sh
index a2d21cd..7397a2b 100755
--- a/scripts/modem/sxmo_modemmonitor.sh
+++ b/scripts/modem/sxmo_modemmonitor.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env sh
LOGDIR="$XDG_CONFIG_HOME"/sxmo/modem
NOTIFDIR="$XDG_CONFIG_HOME"/sxmo/notifications
LOGDIR="$XDG_DATA_HOME"/sxmo/modem
NOTIFDIR="$XDG_DATA_HOME"/sxmo/notifications
trap "gracefulexit" INT TERM

err() {
diff --git a/scripts/modem/sxmo_modemsendsms.sh b/scripts/modem/sxmo_modemsendsms.sh
index 7b1296d..32d2d9c 100755
--- a/scripts/modem/sxmo_modemsendsms.sh
+++ b/scripts/modem/sxmo_modemsendsms.sh
@@ -1,5 +1,5 @@
#!/usr/bin/env sh
LOGDIR="$XDG_CONFIG_HOME"/sxmo/modem
LOGDIR="$XDG_DATA_HOME"/sxmo/modem

info() {
	echo "$1" > /dev/stderr
diff --git a/scripts/modem/sxmo_modemtext.sh b/scripts/modem/sxmo_modemtext.sh
index 75bc934..8fbe460 100755
--- a/scripts/modem/sxmo_modemtext.sh
+++ b/scripts/modem/sxmo_modemtext.sh
@@ -1,7 +1,7 @@
#!/usr/bin/env sh
LOGDIR="$XDG_CONFIG_HOME"/sxmo/modem
LOGDIR="$XDG_DATA_HOME"/sxmo/modem
TERMMODE=$([ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ] && echo "true")
DRAFT_DIR="$XDG_CONFIG_HOME/sxmo/modem/draft"
DRAFT_DIR="$XDG_DATA_HOME/sxmo/modem/draft"

menu() {
	if [ "$TERMMODE" != "true" ]; then
diff --git a/scripts/notifications/sxmo_notificationmonitor.sh b/scripts/notifications/sxmo_notificationmonitor.sh
index 2bc378b..7a0bf55 100755
--- a/scripts/notifications/sxmo_notificationmonitor.sh
+++ b/scripts/notifications/sxmo_notificationmonitor.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env sh
trap gracefulexit INT TERM
NOTIFDIR="$XDG_CONFIG_HOME"/sxmo/notifications
NOTIFDIR="$XDG_DATA_HOME"/sxmo/notifications

gracefulexit() {
	echo "Gracefully exiting $0"
diff --git a/scripts/notifications/sxmo_notificationsmenu.sh b/scripts/notifications/sxmo_notificationsmenu.sh
index f635632..dff161a 100755
--- a/scripts/notifications/sxmo_notificationsmenu.sh
+++ b/scripts/notifications/sxmo_notificationsmenu.sh
@@ -1,5 +1,5 @@
#!/usr/bin/env sh
NOTIFDIR="$XDG_CONFIG_HOME"/sxmo/notifications
NOTIFDIR="$XDG_DATA_HOME"/sxmo/notifications

notificationmenu() {
	CHOICES="Close Menu\nClear Notifications"
diff --git a/scripts/notifications/sxmo_notificationwrite.sh b/scripts/notifications/sxmo_notificationwrite.sh
index f662596..62f05f9 100755
--- a/scripts/notifications/sxmo_notificationwrite.sh
+++ b/scripts/notifications/sxmo_notificationwrite.sh
@@ -1,5 +1,5 @@
#!/usr/bin/env sh
NOTIFDIR="$XDG_CONFIG_HOME"/sxmo/notifications
NOTIFDIR="$XDG_DATA_HOME"/sxmo/notifications

# Takes 4 args:
# (1) the filepath of the notification to write (or random to generate a random id)
@@ -22,4 +22,4 @@ writenotification() {
}

[ "$#" -lt 4 ] && echo "Need >=4 args to create a notification" && exit 1
writenotification
\ No newline at end of file
writenotification
-- 
2.29.2

[sxmo-utils/patches/.build.yml] build success

builds.sr.ht
Details
Message ID
<C6Y5NKGOXJIQ.1G64DBCHMYOD0@cirno2>
In-Reply-To
<20201108201247.11888-1-anjan@momi.ca> (view parent)
DKIM signature
missing
Download raw message
sxmo-utils/patches/.build.yml: SUCCESS in 14s

[move sxmo data to XDG_DATA_HOME][0] from [Anjandev Momi][1]

[0]: https://lists.sr.ht/~mil/sxmo-devel/patches/14820
[1]: mailto:anjan@momi.ca

✓ #337367 SUCCESS sxmo-utils/patches/.build.yml https://builds.sr.ht/~mil/job/337367
Details
Message ID
<3ELUPW44G76CI.347KLF8RPJ9IH@milesalan.com>
In-Reply-To
<20201108201247.11888-1-anjan@momi.ca> (view parent)
DKIM signature
fail
Download raw message
DKIM signature: fail
Anjandev Momi <anjan@momi.ca> wrote:
> diff --git a/scripts/appscripts/sxmo_rss.sh b/scripts/appscripts/sxmo_rss.sh
> index 2b50862..d298932 100755
> --- a/scripts/appscripts/sxmo_rss.sh
> +++ b/scripts/appscripts/sxmo_rss.sh
> @@ -1,8 +1,8 @@
>  #!/usr/bin/env sh
>  FETCHENABLED=1
>  
> -if [ -f "$XDG_CONFIG_HOME/sxmo/sfeedrc" ]; then
> -	SFEEDCONF="$XDG_CONFIG_HOME/sxmo/sfeedrc"
> +if [ -f "$XDG_DATA_HOME/sxmo/sfeedrc" ]; then
> +	SFEEDCONF="$XDG_DATA_HOME/sxmo/sfeedrc"
>  elif [ -f "$HOME/.sfeed/sfeedrc" ]; then

>  	SFEEDCONF="$HOME/.sfeed/sfeedrc"
>  else

Hi Anjan - thanks for taking a stab at this. I think the main difference
between 'data' and 'config' in this context / our definitions are:

- data: files written by sxmo itself
- config: files written by the user

If we go by this defintion, everything seems to be in the right place
with this MR except for the sfeedrc, since we'd expect the user
to drop that in. Does that make sense? Other then that, I think
this is good to merge.
Details
Message ID
<878sbbtlld.fsf@momi.ca>
In-Reply-To
<3ELUPW44G76CI.347KLF8RPJ9IH@milesalan.com> (view parent)
DKIM signature
missing
Download raw message
> Hi Anjan - thanks for taking a stab at this. I think the main difference
> between 'data' and 'config' in this context / our definitions are:
>
> - data: files written by sxmo itself
> - config: files written by the user
>
> If we go by this defintion, everything seems to be in the right place
> with this MR except for the sfeedrc, since we'd expect the user
> to drop that in. Does that make sense? Other then that, I think
> this is good to merge.

That is a good distinction. I would have to submit a v2 moving sfeedrc
and contacts.tsv to $XDG_CONFIG_HOME. Ill try to change that before
1.2.0 release hopefully.

I would also like to give time to the community to test this breaking change.

-- 
w:] www.momi.ca
pgp:] https://momi.ca/publickey.txt
Reply to thread Export thread (mbox)