add spi
This commit is contained in:
parent
e584463eb7
commit
fc7eaf81dd
37
tools/README.spi
Normal file
37
tools/README.spi
Normal file
@ -0,0 +1,37 @@
|
||||
+-----+
|
||||
| spi |
|
||||
+-----+
|
||||
|
||||
spi is a program that takes an output directory from bldr, and installs it to a root
|
||||
filesystem, ideally a chroot
|
||||
|
||||
+--------------+
|
||||
| Installation |
|
||||
+--------------+
|
||||
|
||||
Move spi to a convenient location:
|
||||
(user)$ cp spi PROJECT_DIR
|
||||
|
||||
+-------+
|
||||
| Usage |
|
||||
+-------+
|
||||
|
||||
spi [-h] [-i] DIR TARGET
|
||||
|
||||
+-----------+
|
||||
| Copyright |
|
||||
+-----------+
|
||||
|
||||
(C) 2023 Everest Linux
|
||||
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 <https://www.gnu.org/licenses/>.
|
112
tools/spi
Executable file
112
tools/spi
Executable file
@ -0,0 +1,112 @@
|
||||
#!/bin/sh
|
||||
# System Package Installer
|
||||
|
||||
DIR=${2}
|
||||
TARGET=${3}
|
||||
|
||||
BINDIR=${DIR}/bin
|
||||
SBINDIR=${DIR}/sbin
|
||||
LIBDIR=${DIR}/lib
|
||||
INCLUDEDIR=${DIR}/include
|
||||
SHAREDIR=${DIR}/share
|
||||
|
||||
usage() {
|
||||
printf "${0} - Install a package\n"
|
||||
printf "usage: ${0} [-h] [-i] DIR TARGET\n"
|
||||
printf "\n"
|
||||
printf "${0} {-h} Show this message\n"
|
||||
printf "${0} {-i DIR TARGET} Install package DIR to directory TARGET\n"
|
||||
printf "\n"
|
||||
printf "Spi is free software.\n"
|
||||
printf "See the GNU GPL version 3 for details.\n"
|
||||
}
|
||||
|
||||
usage_small() {
|
||||
printf "usage ${0} [-h] [-i] DIR\n"
|
||||
}
|
||||
|
||||
check_if_input_is_blank() {
|
||||
if [ "${2}" == "" ]; then
|
||||
printf "Package directory not specified.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "${3}" == "" ]; then
|
||||
printf "Target directory not specified.\n"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
check_if_dir_is_pkg() {
|
||||
if [ ! -f "${DIR}/.ispkg" ]; then
|
||||
printf "Directory isn't a package.\n"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
install_bin() {
|
||||
if [ -d "${DIR}/bin" ]; then
|
||||
cp -rv ${BINDIR}/* ${TARGET}/bin
|
||||
else
|
||||
printf "Skipping directory 'bin'\n"
|
||||
fi
|
||||
}
|
||||
|
||||
install_sbin() {
|
||||
if [ -d "${DIR}/sbin" ]; then
|
||||
cp -rv ${SBINDIR}/* ${TARGET}/sbin
|
||||
else
|
||||
printf "Skipping directory 'sbin'\n"
|
||||
fi
|
||||
}
|
||||
|
||||
install_lib() {
|
||||
if [ -d "${DIR}/lib" ]; then
|
||||
cp -rv ${LIBDIR}/* ${TARGET}/lib
|
||||
else
|
||||
printf "Skipping directory 'lib'\n"
|
||||
fi
|
||||
}
|
||||
|
||||
install_include() {
|
||||
if [ -d "${DIR}/include" ]; then
|
||||
cp -rv ${INCLUDEDIR}/* ${TARGET}/include
|
||||
else
|
||||
printf "Skipping directry 'include'\n"
|
||||
fi
|
||||
}
|
||||
|
||||
install_share() {
|
||||
if [ -d "${DIR}/share" ]; then
|
||||
cp -rv ${SHAREDIR}/* ${TARGET}/share
|
||||
else
|
||||
printf "Skipping directory 'share'\n"
|
||||
fi
|
||||
}
|
||||
|
||||
case $1 in
|
||||
-h)
|
||||
usage "$@"
|
||||
exit 0
|
||||
;;
|
||||
-i)
|
||||
check_if_input_is_blank "$@"
|
||||
check_if_dir_is_pkg "$@"
|
||||
install_bin "$@"
|
||||
install_sbin "$@"
|
||||
install_lib "$@"
|
||||
install_include "$@"
|
||||
install_share "$@"
|
||||
exit 0
|
||||
;;
|
||||
-*)
|
||||
usage_small "$@"
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
usage_small "$@"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
usage_small "$@"
|
||||
exit q
|
Loading…
Reference in New Issue
Block a user