summaryrefslogtreecommitdiffstats
path: root/src/oh-copyconfig.sh
diff options
context:
space:
mode:
Diffstat (limited to 'src/oh-copyconfig.sh')
-rw-r--r--src/oh-copyconfig.sh22
1 files changed, 9 insertions, 13 deletions
diff --git a/src/oh-copyconfig.sh b/src/oh-copyconfig.sh
index 1ca7783..c81a1a3 100644
--- a/src/oh-copyconfig.sh
+++ b/src/oh-copyconfig.sh
@@ -19,24 +19,20 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+. @@LIBDIR@@/opkhelper/messages
+
print_usage()
{
printf 'Usage: %s\n' "$1"
}
-error()
-{
- printf 'oh-copyconfig: Error: %s\n' "${1}" >&2
- exit 1
-}
-
if [ ! -f ../config ]; then
- printf 'oh-copyconfig: No config files to copy.\n'
+ oh_info 'No config files to copy'
exit 0
fi
if [ -z "${OH_HOST_PLATFORM}" ]; then
- error 'No target platform defined'
+ oh_error 'No target platform defined'
fi
if [ ${#} -ne 0 ]; then
@@ -46,7 +42,7 @@ fi
while read -r type src dest; do
if [ -z "${type}" -o -z "${src}" -o -z "${dest}" ]; then
- error 'Invalid syntax in config list'
+ oh_error 'Invalid syntax in config list'
fi
case "${type}" in
runtime)
@@ -58,7 +54,7 @@ while read -r type src dest; do
full_dest="${dest}"
;;
*)
- error "Invalid config type \"${type}\""
+ oh_error 'Invalid config type "%s"' "${type}"
;;
esac
# Make sure the destination directory exists.
@@ -71,10 +67,10 @@ while read -r type src dest; do
else
# This shouldn't happen unless the package maintainer neglected to add
# the config package to the package's Build-Depends field.
- error 'No platform config directory found'
+ oh_error 'No platform config directory found'
fi
# Copy the config file(s).
- printf 'oh-copyconfig: Copying "%s" to "%s"...\n' "${src}" "${dest}"
+ oh_info 'Copying "%s" to "%s"...' "${src}" "${dest}"
mkdir -p "$(dirname "${full_dest}")"
- cp -p "${full_src}" "${full_dest}" || error "Cannot copy \"${src}\""
+ cp -p "${full_src}" "${full_dest}" || oh_error 'Cannot copy "%s"' "${src}"
done < ../config