update 11/7/23
This commit is contained in:
parent
7b35bb6d9c
commit
40ddc92c03
2
README
2
README
@ -10,7 +10,7 @@ This repository contains scripts used to create Everest Linux images.
|
||||
|
||||
mkskel - create an Everest Linux compliant filesystem skeleton
|
||||
bldr - build a binary package from an Everest package file
|
||||
install - package agnostic installation script
|
||||
prep - prepare a directory for image creation
|
||||
mkimg - create an image
|
||||
spi - install a package to a directory
|
||||
everest-project-init - initialize a project from a template
|
||||
|
@ -1 +0,0 @@
|
||||
hi
|
22
tools/epush
22
tools/epush
@ -1,22 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Simple wrapper script around git to easily push an update
|
||||
|
||||
COMMIT_MSG=${1}
|
||||
BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
||||
|
||||
printf "Checking if Git repository is present...\n"
|
||||
|
||||
git rev-parse --is-inside-work-tree
|
||||
if [ "$?" != 0 ]; then
|
||||
printf "Not a Git repository.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "${COMMIT_MSG}" = "" ]; then
|
||||
printf "No commit message.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
git add *
|
||||
git commit -m ${COMMIT_MSG}
|
||||
git push origin ${BRANCH}
|
134
tools/project-init/everest-project-init
Executable file
134
tools/project-init/everest-project-init
Executable file
@ -0,0 +1,134 @@
|
||||
#!/bin/sh
|
||||
|
||||
# everest-project-init - initialize a project
|
||||
#
|
||||
# Copyright (C) 2023 Everest Linux
|
||||
#
|
||||
# everest-project-init 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.
|
||||
#
|
||||
# everest-project-init 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 everest-project-init. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
red="\033[1;31m"
|
||||
green="\033[1;32m"
|
||||
yellow="\033[1;33m"
|
||||
blue="\033[1;34m"
|
||||
reset="\033[m"
|
||||
check="\xE2\x9C\x93"
|
||||
|
||||
#
|
||||
# PARAMETERS:
|
||||
# "usage: ${0} [-h] [-v] [-i] [-l] DIR LANG \n"
|
||||
# ^ ^______________^ ^ ^
|
||||
# 0 1 2 3
|
||||
#
|
||||
|
||||
usage () {
|
||||
printf "${0} - Initialize a project\n"
|
||||
printf "usage: ${0} [-h] [-v] [-i] [-l] DIR LANG\n"
|
||||
printf "\n"
|
||||
printf "${0} {-h --help} Show this message\n"
|
||||
printf "${0} {-v --version} Show the current version\n"
|
||||
printf "${0} {-i --init} Initialize in DIR with template LANG\n"
|
||||
printf "${0} {-l --list} List all supported language templates\n"
|
||||
printf "\n"
|
||||
printf "Ensure DIR is a complete directory path.\n"
|
||||
printf "\n"
|
||||
printf "everest-project-init is free software.\n"
|
||||
printf "See the GNU GPL version 3 for details.\n"
|
||||
}
|
||||
|
||||
usage_small() {
|
||||
printf "usage: ${0} [-h] [-v] [-i] [-l] DIR LANG\n"
|
||||
}
|
||||
|
||||
mkprojectdir() {
|
||||
printf "${blue}[i]${reset} Creating project directory...\n"
|
||||
mkdir ./${2}
|
||||
printf "${green}[${check}]${reset} Directory created.\n"
|
||||
}
|
||||
|
||||
mkskel() {
|
||||
printf "${blue}[i]${reset} Creating project directory skeleton...\n"
|
||||
case ${3} in
|
||||
"C")
|
||||
mkdir ${2}/{src,include}
|
||||
;;
|
||||
"Bash")
|
||||
mkdir ${2}/{src,install,man}
|
||||
mkdir ${2}/src/{bin,etc,man}
|
||||
esac
|
||||
printf "${green}[${check}]${reset} Project directory skeleton created.\n"
|
||||
}
|
||||
|
||||
|
||||
dload_license() {
|
||||
LICENSE_URL="https://gnu.org/licenses/gpl-3.0.txt"
|
||||
printf "${blue}[i]${reset} Using license 'GPL 3' for this project.\n"
|
||||
printf "${blue}[i]${reset} Downloading license for project...\n"
|
||||
curl ${LICENSE_URL} -o ${2}/LICENSE
|
||||
printf "${green}[${check}]${reset} License downloaded.\n"
|
||||
}
|
||||
|
||||
mkheader() {
|
||||
printf "${blue}[i]${reset} Generating file header...\n"
|
||||
ROOT_URL="https://git.everestlinux.org/EverestLinux/project-init-file-headers/raw/branch/main"
|
||||
case ${3} in
|
||||
"C")
|
||||
curl -O -J ${ROOT_URL}/template.c
|
||||
if [ "$?" != 0 ]; then
|
||||
printf "${red}[x]${reset} Curl exited with non-zero status.\n"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
"Bash")
|
||||
curl -O -J ${ROOT_URL}/template.sh
|
||||
if [ "$?" != 0 ]; then
|
||||
printf "${red}[x]${reset} Curl exited with non-zero status.\n"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
printf "${blue}[i]${reset} File header generated successfully.\n"
|
||||
case $1 in
|
||||
-h|--help)
|
||||
usage "$@"
|
||||
exit 0
|
||||
;;
|
||||
-v|--version)
|
||||
printf "everest-project-init v0.1rc\n"
|
||||
exit 0
|
||||
;;
|
||||
-i|--init)
|
||||
mkprojectdir "$@"
|
||||
mkskel "$@"
|
||||
dload_license "$@"
|
||||
mkheader "$@"
|
||||
printf "${green}[${check}]${reset} Project generated successfully.\n"
|
||||
exit 0
|
||||
;;
|
||||
-l|--list)
|
||||
printf "Available templates:\n"
|
||||
printf "C\n"
|
||||
printf "Bash/POSIX sh\n"
|
||||
;;
|
||||
-*|--*)
|
||||
usage_small "$@"
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
usage_small "$@"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
usage_small "$@"
|
||||
exit 1
|
@ -84,6 +84,20 @@ install_share() {
|
||||
fi
|
||||
}
|
||||
|
||||
install_extra() {
|
||||
if [ -f "*" ]; then
|
||||
printf "Extra files detected.\n"
|
||||
for f in ${DIR}; do
|
||||
read -p "$(printf "Install file '${f}'? ")" -n 1 -r
|
||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||
cp ${f} ${TARGET}
|
||||
elif [[ $REPLY =~ ^[Nn]$ ]]; then
|
||||
printf "Skipping file '${f}'.\n"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
case $1 in
|
||||
-h)
|
||||
usage "$@"
|
||||
|
Loading…
Reference in New Issue
Block a user