Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some skripts for system integration #25

Open
sphh opened this issue Dec 21, 2020 · 2 comments
Open

Some skripts for system integration #25

sphh opened this issue Dec 21, 2020 · 2 comments

Comments

@sphh
Copy link

sphh commented Dec 21, 2020

This is not an issue as such…

Thank you for taking this under your wing!! I have some scripts on my computer to start msgviewer back from the time, when msgviewer was only available on sourceforge. You might be interested in them. I cannot remember where I got them from (they are definitely not mine ;-) )

Here we go:
cat /usr/local/share/MSGViewer/msgviewer:

#!/usr/bin/env bash

SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
  DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
  SOURCE="$(readlink "$SOURCE")"
  [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"

exec java -jar ${DIR}/msgviewer.jar "$@"

cat /usr/local/share/MSGViewer/msg2eml:

#!/usr/bin/env bash

SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
  DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
  SOURCE="$(readlink "$SOURCE")"
  [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"

exec java -jar ${DIR}/msgviewer.jar -msg2eml "$@"

cat /usr/local/share/MSGViewer/msg2mbox:

#!/usr/bin/env bash

SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
  DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
  SOURCE="$(readlink "$SOURCE")"
  [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"

exec java -jar ${DIR}/msgviewer.jar -msg2mbox "$@"

My directory layout on Linux is:

$ ls -l /usr/local/bin/
lrwxrwxrwx /usr/local/bin/msgviewer -> ../share/MSGViewer/msgviewer
lrwxrwxrwx /usr/local/bin/msg2eml -> ../share/MSGViewer/msg2eml
lrwxrwxrwx /usr/local/bin/msg2mbox -> ../share/MSGViewer/msg2mbox
$ ls -l /usr/local/share/MSGViewer/
-rw-r--r-- /usr/local/share/MSGViewer/icon.png
-rwxr-xr-x /usr/local/share/MSGViewer/msg2eml
-rwxr-xr-x /usr/local/share/MSGViewer/msg2mbox
-rwxr-xr-x /usr/local/share/MSGViewer/msgviewer
-rw-r--r-- /usr/local/share/MSGViewer/msgviewer.jar

Now I can call any of the three commands msgviewer, msg2eml and msg2mbox! Very hand indeed. (Mind you, I only have tested the msgviewer skript with your new github versions …)

BTW I also have a msgviewer.desktop file, to get the viewer into the application menu.
cat /usr/local/share/applications/msgviewer.desktop:

[Desktop Entry]
Encoding=UTF-8
Name=MSGViewer
Comment=
Exec=/usr/local/bin/msgviewer
Icon=/usr/local/share/msgviewer/icon.png
Categories=Application
Version=1.0
Type=Application
Terminal=0

Perhaps this can help persons like #1 to install that beast!

Please feel free to include it, wherever you think it is appropriate.

@lolo101
Copy link
Owner

lolo101 commented Dec 22, 2020

Hi @sphh and thanks for your suggestion.

Bash scripts & .desktop files are system-dependant whereas MsgViewer is intended to run on any system. However we could provide some installers for some systems as release assets.

@sphh
Copy link
Author

sphh commented Dec 22, 2020

Yes, they are system dependent! That's why this is just a basic suggestion for a Linux system and an idea to get started. I am sure that there are many improvements, e.g. opening a message in msgviewer from a file manager …

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants