Glacier v3.1.0 - Integrity checking
This commit is contained in:
parent
677d414a28
commit
7705ecfb8a
@ -41,6 +41,11 @@ mv $SRC_DIR/hooks $CONFDIR/glacier
|
|||||||
mv $SRC_DIR/post-hooks $CONFDIR/glacier
|
mv $SRC_DIR/post-hooks $CONFDIR/glacier
|
||||||
mv $SRC_DIR/hooks.sh $CONFDIR/glacier
|
mv $SRC_DIR/hooks.sh $CONFDIR/glacier
|
||||||
mv $SRC_DIR/make.conf $CONFDIR
|
mv $SRC_DIR/make.conf $CONFDIR
|
||||||
|
mv $SRC_DIR/glacier-integrity-check $PREFIX/bin
|
||||||
|
if [ "$?" != "0" ]; then
|
||||||
|
mv $SRC_DIR/glacier-integrity-check $PREFIX
|
||||||
|
printf "directory $PREFIX/bin does not exist, moving to $PREFIX instead\n"
|
||||||
|
fi
|
||||||
|
|
||||||
printf "finished installation\n"
|
printf "finished installation\n"
|
||||||
exit 0
|
exit 0
|
||||||
|
38
src/glacier
38
src/glacier
@ -17,21 +17,22 @@ get_pkg() {
|
|||||||
printf "$red[ $error ]$reset Package '$2' not found.\n"
|
printf "$red[ $error ]$reset Package '$2' not found.\n"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
$GLACIER_DOWNLOAD_BACKEND $GREPO1/$2.checksum || $GLACIER_DOWNLOAD_BACKEND $GREPO2/$2.checksum || $GLACIER_DOWNLOAD_BACKEND $GREPO3/$2.checksum || $GLACIER_DOWNLOAD_BACKEND $GREPO4/$2.checksum || $GLACIER_DOWNLOAD_BACKEND $GREPO5/$2.checksum || $GLACIER_DOWNLOAD_BACKEND $GREPO6/$2.checksum || $GLACIER_DOWNLOAD_BACKEND $GREPO7/$2.checksum || $GLACIER_DOWNLOAD_BACKEND $GREPO8/$2.tar.gz
|
||||||
|
if [ "$?" != "0" ]; then
|
||||||
|
printf "$red[ $error ]$reset Package checksum not found.\n"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# implementing this later because this whole section is a clusterfuck
|
int_check() {
|
||||||
#int_check () {
|
printf "$blue[ i ]$reset Checking package integrity...\n"
|
||||||
# printf "$blue[ i ]$reset Checking package integrity...\n"
|
/usr/bin/glacier-integrity-check
|
||||||
# LOCAL_CHECKSUM=$(cat $2.checksum)
|
if [ "$?" != "0" ]; then
|
||||||
# hsh $2.tar.gz $LOCAL_CHECKSUM
|
printf "$red[ $error ]$reset Integrity check failed.\n"
|
||||||
# if [ "$?" != "0" ]; then
|
exit 1
|
||||||
# printf "$red[ $error ]$reset Integrity check failed.\n"
|
fi
|
||||||
# exit 1
|
printf "$green[ $check ]$reset Integrity check passed.\n"
|
||||||
# else
|
}
|
||||||
# printf "$green[ $check ]$reset Integrity check passed.\n"
|
|
||||||
# exit 0
|
|
||||||
# fi
|
|
||||||
#}
|
|
||||||
|
|
||||||
unpack_pkg() {
|
unpack_pkg() {
|
||||||
printf "$blue[ i ]$reset Unpacking $2.tar.gz...\n"
|
printf "$blue[ i ]$reset Unpacking $2.tar.gz...\n"
|
||||||
@ -108,7 +109,7 @@ clear_cache() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
debug_info() {
|
debug_info() {
|
||||||
printf "$blue>> Glacier v3.0.1$reset\n"
|
printf "$blue>> Glacier v3.1.0$reset\n"
|
||||||
printf ">> Checking for valid download backend...\n"
|
printf ">> Checking for valid download backend...\n"
|
||||||
whereis wget
|
whereis wget
|
||||||
whereis curl
|
whereis curl
|
||||||
@ -196,7 +197,7 @@ case $1 in
|
|||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
-v|--version)
|
-v|--version)
|
||||||
printf "$blue Glacier v3.0.1$reset\n"
|
printf "$blue Glacier v3.1.0$reset\n"
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
-f|-install)
|
-f|-install)
|
||||||
@ -211,7 +212,7 @@ case $1 in
|
|||||||
cd /opt/glacier/workspace
|
cd /opt/glacier/workspace
|
||||||
printf "\n"
|
printf "\n"
|
||||||
get_pkg "$@"
|
get_pkg "$@"
|
||||||
#int_check # Will implement this later on
|
int_check # Will implement this later on
|
||||||
unpack_pkg "$@"
|
unpack_pkg "$@"
|
||||||
installpkg "$@"
|
installpkg "$@"
|
||||||
post_hooks "$@"
|
post_hooks "$@"
|
||||||
@ -232,7 +233,7 @@ case $1 in
|
|||||||
cd /opt/glacier/workspace
|
cd /opt/glacier/workspace
|
||||||
printf "\n"
|
printf "\n"
|
||||||
get_pkg "$@"
|
get_pkg "$@"
|
||||||
#int_check
|
int_check
|
||||||
unpack_pkg "$@"
|
unpack_pkg "$@"
|
||||||
updatepkg "$@"
|
updatepkg "$@"
|
||||||
post_hooks "$@"
|
post_hooks "$@"
|
||||||
@ -253,7 +254,7 @@ case $1 in
|
|||||||
cd /opt/glacier/workspace
|
cd /opt/glacier/workspace
|
||||||
printf "\n"
|
printf "\n"
|
||||||
get_pkg "$@"
|
get_pkg "$@"
|
||||||
#int_check
|
int_check
|
||||||
unpack_pkg "$@"
|
unpack_pkg "$@"
|
||||||
removepkg "$@"
|
removepkg "$@"
|
||||||
post_hooks "$@"
|
post_hooks "$@"
|
||||||
@ -278,6 +279,7 @@ case $1 in
|
|||||||
cd /var/cache/glacier
|
cd /var/cache/glacier
|
||||||
printf "\n"
|
printf "\n"
|
||||||
get_pkg "$@"
|
get_pkg "$@"
|
||||||
|
int_check
|
||||||
printf "$green[ $check ]$reset Operation completed.\n"
|
printf "$green[ $check ]$reset Operation completed.\n"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
17
src/glacier-integrity-check
Executable file
17
src/glacier-integrity-check
Executable file
@ -0,0 +1,17 @@
|
|||||||
|
#!/usr/bin/python3
|
||||||
|
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
|
||||||
|
LOCAL_SUM=os.system("cat *.checksum")
|
||||||
|
PKG_SUM=os.system("sha256sum *.tar.gz")
|
||||||
|
|
||||||
|
if LOCAL_SUM == PKG_SUM:
|
||||||
|
print("checksums match\n")
|
||||||
|
sys.exit(0)
|
||||||
|
elif LOCAL_SUM != PKG_SUM:
|
||||||
|
print("checksums do not match\n")
|
||||||
|
sys.exit(1)
|
||||||
|
else:
|
||||||
|
print("an error occured\n")
|
||||||
|
sys.exit(1)
|
0
src/post-hooks
Normal file → Executable file
0
src/post-hooks
Normal file → Executable file
Loading…
Reference in New Issue
Block a user