Glacier package checker v1.0.0
This commit is contained in:
parent
510e8e504d
commit
3172d57ad7
71
src/glacier-pkg-check/gpc
Executable file
71
src/glacier-pkg-check/gpc
Executable file
@ -0,0 +1,71 @@
|
||||
#!/bin/sh
|
||||
# Glacier package checker
|
||||
|
||||
/etc/gpc.conf
|
||||
source $(pwd)/gpc.conf #remove before release
|
||||
|
||||
INSCRIPT=INSTALL.sh
|
||||
UPSCRIPT=UPDATE.sh
|
||||
RMSCRIPT=REMOVE.sh
|
||||
|
||||
PKGINFO=*-pkginfo.json
|
||||
|
||||
TIMESTAMP=*.ts.sh
|
||||
|
||||
case $1 in
|
||||
check)
|
||||
printf " Searching for package directory...\n"
|
||||
if [ -d "$2" ]; then
|
||||
printf "$green $2 exists.$reset\n"
|
||||
else
|
||||
printf "$red $2 does not exist.$reset\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd $2
|
||||
printf " Searching for instruction scripts in package directory...\n"
|
||||
if [ -f $INSCRIPT -a -f $UPSCRIPT -a -f $RMSCRIPT ]; then
|
||||
printf "$green Instruction scripts exist.$reset\n"
|
||||
else
|
||||
printf "$red Instruction scripts do not exist.$reset\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
printf " Searching for miscellaneous files...\n"
|
||||
if [ -f $PKGINFO -a -f $TIMESTAMP ]; then
|
||||
printf "$green $2.pkginfo and $2.ts.sh exist.$reset\n"
|
||||
else
|
||||
printf "$red $2.pkginfo and $2.ts.sh do not exist.$reset\n"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
mkpkg)
|
||||
printf "$blue Making package...$reset\n"
|
||||
cd $2
|
||||
tar -czvf $2.tar.gz *
|
||||
printf "$blue Creating timestamp...$reset\n"
|
||||
sha256sum $2.tar.gz >> $2.checksum
|
||||
if [ "$?" != "0" ]; then
|
||||
printf "$red Failed to make package.$reset\n"
|
||||
exit 1
|
||||
fi
|
||||
printf "$green Finished making package$reset\n"
|
||||
exit 0
|
||||
;;
|
||||
-h|--help)
|
||||
printf "gpc - test and create Glacier packages\n"
|
||||
printf "\n"
|
||||
printf "gpc {-h|--help} show this message and exit\n"
|
||||
printf "gpc {-v|--version} show the version and exit\n"
|
||||
printf "gpc {check} check a package for errors\n"
|
||||
printf "gpc {mkpkg} create a package from a directory\n"
|
||||
printf "\n"
|
||||
printf "This program is licensed under the GNU GPL v3.0\n"
|
||||
printf "You should have recieved a copy along with this program.\n"
|
||||
printf "If not, see <https://www.gnu.org/licenses/gpl-3.0.en.html>\n"
|
||||
exit 0
|
||||
;;
|
||||
-v|--version)
|
||||
printf "gpc v1.0.0\n"
|
||||
exit 0
|
||||
esac
|
7
src/glacier-pkg-check/gpc.conf
Executable file
7
src/glacier-pkg-check/gpc.conf
Executable file
@ -0,0 +1,7 @@
|
||||
# /etc/gpc.conf
|
||||
|
||||
# Colors and unicode symbols to be used
|
||||
export red="\033[1;31m"
|
||||
export green="\033[1;32m"
|
||||
export blue="\033[1;34m"
|
||||
export reset="\033[m"
|
Loading…
Reference in New Issue
Block a user