diff options
author | P. J. McDermott <pjm@nac.net> | 2012-03-06 13:39:44 (EST) |
---|---|---|
committer | P. J. McDermott <pjm@nac.net> | 2012-03-06 13:39:44 (EST) |
commit | e206c6620ac6c3f2fd01dd2d1b1390e6e262cd8f (patch) | |
tree | 9b386e043d6e6f6dc728b2df201e2aa7ee4f2886 /src/oh-copyconfig | |
parent | f74139e8e838a3b3d68ba3ca5f203a24241cf489 (diff) |
Rename all source files.
Diffstat (limited to 'src/oh-copyconfig')
-rw-r--r-- | src/oh-copyconfig | 80 |
1 files changed, 0 insertions, 80 deletions
diff --git a/src/oh-copyconfig b/src/oh-copyconfig deleted file mode 100644 index 4bd3871..0000000 --- a/src/oh-copyconfig +++ /dev/null @@ -1,80 +0,0 @@ -#! /bin/sh -# -# opkhelper -# src/oh-copyconfig -# Copy build-time or run-time platform configuration files. -# -# Copyright (C) 2012 Patrick "P. J." McDermott -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -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' - exit 0 -fi - -if [ -z "${OH_PLATFORM}" ]; then - error 'No target platform defined' -fi - -if [ ${#} -ne 0 ]; then - print_usage ${0} >&2 - exit 1 -fi - -while read -r type src dest; do - if [ -z "${type}" -o -z "${src}" -o -z "${dest}" ]; then - error 'Invalid syntax in config list' - fi - case "${type}" in - runtime) - # The destiest dest that ever dest. - full_dest="dest${dest}" - ;; - buildtime) - # A less desty dest. - full_dest="${dest}" - ;; - *) - error "Invalid config type \"${type}\"" - ;; - esac - # Make sure the destination directory exists. - mkdir -p "$(dirname "${full_dest}")" - # Find the config package files. - if [ -d "/usr/share/config/${OH_PLATFORM}/${OH_SRCPKG}-${OH_PKGVER}" ]; then - full_src="/usr/share/config/${OH_PLATFORM}/${OH_SRCPKG}-${OH_PKGVER}/${src}" - elif [ -d "/usr/share/config/${OH_PLATFORM}/${OH_SRCPKG}" ]; then - full_src="/usr/share/config/${OH_PLATFORM}/${OH_SRCPKG}/${src}" - 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' - fi - # Copy the config file(s). - printf 'oh-copyconfig: Copying "%s" to "%s"...\n' "${src}" "${dest}" - mkdir -p "$(dirname "${full_dest}")" - cp -p "${full_src}" "${full_dest}" || error "Cannot copy \"${src}\"" -done < ../config |