Make snap helper script POSIX compliant

This commit is contained in:
Jonathan White 2020-07-06 12:35:29 -04:00
parent 9b63e6a289
commit 138378626f

View File

@ -20,29 +20,30 @@ set -e
DEBUG=false DEBUG=false
JSON_BASE=$(cat << EOF JSON_FIREFOX=$(cat << EOF
{ {
"name": "org.keepassxc.keepassxc_browser", "name": "org.keepassxc.keepassxc_browser",
"description": "KeePassXC integration with native messaging support", "description": "KeePassXC integration with native messaging support",
"path": "/snap/bin/keepassxc.proxy", "path": "/snap/bin/keepassxc.proxy",
"type": "stdio", "type": "stdio",
__EXT__ "allowed_extensions": [
"keepassxc-browser@keepassxc.org"
]
} }
EOF EOF
) )
JSON_FIREFOX=$(cat << EOF
"allowed_extensions": [
"keepassxc-browser@keepassxc.org"
]
EOF
)
JSON_CHROME=$(cat << EOF JSON_CHROME=$(cat << EOF
{
"name": "org.keepassxc.keepassxc_browser",
"description": "KeePassXC integration with native messaging support",
"path": "/snap/bin/keepassxc.proxy",
"type": "stdio",
"allowed_origins": [ "allowed_origins": [
"chrome-extension://iopaggbpplllidnfmcghoonnokmjoicf/", "chrome-extension://iopaggbpplllidnfmcghoonnokmjoicf/",
"chrome-extension://oboonakemofpalcgghocfoadofidjkkk/" "chrome-extension://oboonakemofpalcgghocfoadofidjkkk/"
] ]
}
EOF EOF
) )
@ -52,12 +53,12 @@ INSTALL_DIR=""
INSTALL_FILE="org.keepassxc.keepassxc_browser.json" INSTALL_FILE="org.keepassxc.keepassxc_browser.json"
buildJson() { buildJson() {
if [[ ! -z $1 ]]; then if [ -n "$1" ]; then
# Insert Firefox data # Insert Firefox data
JSON_OUT="${JSON_BASE/__EXT__/$JSON_FIREFOX}" JSON_OUT=$JSON_FIREFOX
else else
# Insert Chrome data # Insert Chrome data
JSON_OUT="${JSON_BASE/__EXT__/$JSON_CHROME}" JSON_OUT=$JSON_CHROME
fi fi
} }