Skip to content
This repository has been archived by the owner on Nov 12, 2022. It is now read-only.

Commit

Permalink
add missing booklet.sh file
Browse files Browse the repository at this point in the history
  • Loading branch information
chrox committed Oct 15, 2017
1 parent dcb9bf2 commit 12255b9
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
.classpath
.project

bin/
./bin/
build/
75 changes: 75 additions & 0 deletions extensions/kpvbooklet/bin/booklet.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#!/bin/sh
#
# KUAL KPVBooklet helper
#

# KOReader's working directory
KOREADER_DIR="/mnt/us/koreader"

# Load our helper functions...
if [ -f "${KOREADER_DIR}/libkohelper.sh" ] ; then
source "${KOREADER_DIR}/libkohelper.sh"
else
echo "Can't source helper functions, aborting!"
exit 1
fi

## Handle logging...
logmsg()
{
# Use the right tools for the platform
if [ "${INIT_TYPE}" == "sysv" ] ; then
msg "koreader: ${1}" "I"
elif [ "${INIT_TYPE}" == "upstart" ] ; then
f_log I koreader kual "" "${1}"
fi

# And handle user visual feedback via eips...
eips_print_bottom_centered "${1}" 1
}


# Handle cre's settings...
set_cre_prop()
{
# We need at least two args
if [ $# -lt 2 ] ; then
logmsg "not enough arg passed to set_cre_prop"
return
fi

cre_prop_key="${1}"
cre_prop_value="${2}"

cre_config="/mnt/us/extensions/kpvbooklet/bin/booklet.ini"

touch ${cre_config}

# Check that the config exists...
if [ -f "${cre_config}" ] ; then
# dos2unix
sed -e "s/$(echo -ne '\r')$//g" -i "${cre_config}"

grep ^${cre_prop_key}= "${cre_config}">/dev/null
if [ $? -eq 1 ] ; then
echo "${cre_prop_key}=${cre_prop_value}">>"${cre_config}"
logmsg "Set ${cre_prop_key} to ${cre_prop_value}"
return
fi

# And finally set the prop
sed -re "s/^(${cre_prop_key})(=)(.*?)$/\1\2${cre_prop_value}/" -i "${cre_config}"
if [ $? -eq 0 ] ; then
logmsg "Set ${cre_prop_key} to ${cre_prop_value}"
else
logmsg "Failed to set ${cre_prop_key}"
fi
fi
}

#eips_print_bottom_centered "test now" 1
# logmsg "its working OK $@"

set_cre_prop ${1} ${2}


1 change: 1 addition & 0 deletions install.ffs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ if [ "$VERSION" \> "5.4" ]; then
fi

progress 80 "Installing KUAL Extension"
mkdir -p /mnt/us/extensions
cp -r extensions/kpvbooklet /mnt/us/extensions/ || fail "Unable to copy KUAL Extension"

progress 90 "Mounting ro"
Expand Down

0 comments on commit 12255b9

Please sign in to comment.