Browse Source

make shell scripts translatable too

build
Claudio Luck 9 months ago
parent
commit
74f3f9c26f
2 changed files with 24 additions and 13 deletions
  1. +6
    -1
      plat/all/pEp_import.sh
  2. +18
    -12
      plat/lnx/pEp_install.sh

+ 6
- 1
plat/all/pEp_import.sh View File

@ -11,6 +11,11 @@ export DYLD_LIBRARY_PATH
export LD_LIBRARY_PATH
export PATH
export PYTHONPATH
export TEXTDOMAIN="tb_setup"
export TEXTDOMAINDIR="${SETUP_DIR}/po"
tr () {
command gettext tb_setup "$@" 2>/dev/null || echo "$@"
}
for pybin in python2.7s 'python2.7' ; do
pycmd=$(which $pybin 2>/dev/null || : )
if [ -x "$pycmd" ] ; then
@ -25,5 +30,5 @@ for pybin in python2.7s 'python2.7' ; do
exit $?
fi
done
echo "!!! A prerequisite (Python 2.7) was not found on this system." >&2
echo "!!! " $(tr "A prerequisite (Python 2.7) was not found on this system.") >&2
exit 1

+ 18
- 12
plat/lnx/pEp_install.sh View File

@ -8,9 +8,15 @@ mda_tgz=
user_inst=0
xdg_script=
export TEXTDOMAIN="tb_setup"
export TEXTDOMAINDIR="${SETUP_DIR}/po"
tr () {
command gettext tb_setup "$@" 2>/dev/null || echo "$@"
}
while getopts hub:P:O:X:V:Z: opt ; do
case $opt in
\?|h) echo "Usage: $0: [-u] [-b <setup_base>] [-P <mda_plat>] [-O <mda_OS>] [-V <mda_ver>] [<xdg_file>]" ; exit 0 ;;
\?|h) echo $(tr "Usage:") " $0: [-u] [-b <setup_base>] [-P <mda_plat>] [-O <mda_OS>] [-V <mda_ver>] [<xdg_file>]" ; exit 0 ;;
u) user_inst=1 ;;
b) setup_base=$OPTARG/ ;;
P) mda_plat=$OPTARG ;;
@ -42,7 +48,7 @@ _install () {
owners=$2
src=$3
dst=$4
_info "Installing $dst"
_info $(tr "Installing:") "$dst"
[ ! -e "$dst" ] || chmod 0600 "$dst"
cp -f "$src" "$dst"
[ -z "$owners" ] || chown "$owners" "$dst"
@ -50,7 +56,7 @@ _install () {
}
_start_adapter () {
_info "Starting the adapter"
_info $(tr "Starting the adapter")
if [ ! -e "$HOME/.config/systemd/user/default.target.wants/pEp-mini-json-adapter.service" ] ; then
"$adapter_bin" --no-html &
fi
@ -61,7 +67,7 @@ if [ $user_inst -eq 0 ] ; then
adapter_bin="/usr/local/bin/pEp-mini-json-adapter"
_uid=$(id -u)
if [ $_uid -eq 0 ] ; then
_section "Install adapter to system"
_section $(tr "Install adapter to system")
mkdir -p /usr/local/bin /usr/local/share/pEp
_install 0555 root:0 \
"${SETUP_DIR}/pEp-mini-json-adapter" \
@ -74,7 +80,7 @@ if [ $user_inst -eq 0 ] ; then
"${SETUP_DIR}/pEp-mini-json-adapter.service" \
"/etc/systemd/user/pEp-mini-json-adapter.service"
else
_warn "Warning: /etc/systemd/user not present, can not install systemd unit"
_warn $(tr "Warning: /etc/systemd/user not present, can not install systemd unit")
fi
if [ -d /etc/xdg ] ; then
mkdir -p /etc/xdg/autostart
@ -82,12 +88,12 @@ if [ $user_inst -eq 0 ] ; then
"${SETUP_DIR}/pEp-mini-json-adapter.desktop" \
"/etc/xdg/autostart/pEp-mini-json-adapter.desktop"
else
echo "Warning: /etc/xdg not present, can not install autostart entry" >&2
echo $(tr "Warning: /etc/xdg not present, can not install autostart entry") >&2
fi
else
_section "Configure system-installed adapter for user"
_section $(tr "Configure system-installed adapter for user")
if [ -f /etc/systemd/user/pEp-mini-json-adapter.service ] ; then
_info "Activating systemd unit..."
_info $(tr "Activating systemd unit...")
systemctl --user daemon-reload
systemctl --user enable pEp-mini-json-adapter.service
systemctl --user start pEp-mini-json-adapter.service
@ -95,9 +101,9 @@ if [ $user_inst -eq 0 ] ; then
_start_adapter
fi
else
_section "Install adapter to user profile"
_section $(tr "Install adapter to user profile")
if [ -s "${SETUP_DIR}/pEp-mini-json-adapter.user" ] ; then
_warn "This installer does not contain the required adapter"
_warn $(tr "This installer does not contain the required adapter")
exit 1
fi
share_prefix=$HOME/.local/share
@ -119,9 +125,9 @@ else
"${SETUP_DIR}/pEp-mini-json-adapter.desktop.user" \
"${etc_xdg_prefix}/autostart/pEp-mini-json-adapter.desktop"
else
echo "Warning: /etc/xdg not present, can not install autostart entry" >&2
echo $(tr "Warning: /etc/xdg not present, can not install autostart entry") >&2
fi
_start_adapter
fi
_info "Completed"
_info $(tr "Completed")

Loading…
Cancel
Save