mirror of
https://gitee.com/spark-store-project/spark-store
synced 2025-06-06 15:09:50 +08:00
Adjust: Lock the deb file before the install begin to secure
This commit is contained in:
parent
249b0c7a02
commit
38d592d7e3
@ -83,7 +83,13 @@ function hash_check() {
|
||||
IS_SHA512SUM_CHECKED=$(cat "$PACKAGES_DATA_PATH" | grep "$DEB_SHA512SUM")
|
||||
}
|
||||
|
||||
function lock_file(){
|
||||
chattr +i "$1"
|
||||
}
|
||||
|
||||
function unlock_file(){
|
||||
chattr -i "$1"
|
||||
}
|
||||
|
||||
####################################
|
||||
|
||||
@ -121,6 +127,7 @@ if [ ! -f "$1" ]; then
|
||||
DEBPATH=$(realpath "$1")
|
||||
fi
|
||||
|
||||
lock_file "$DEBPATH"
|
||||
|
||||
hash_check "$DEBPATH"
|
||||
|
||||
@ -158,6 +165,8 @@ if [ ! -z "$IS_SHA512SUM_CHECKED" ]; then
|
||||
|
||||
dpkg -i "$DEBPATH" || aptss install -yf
|
||||
|
||||
unlock_file "$DEBPATH"
|
||||
|
||||
if [ "$?" = "0" ] && [ "$2" = "--delete-after-install" ]; then
|
||||
if dpkg -s "$package_name" >/dev/null 2>&1; then
|
||||
echo "软件包已安装:$package_name"
|
||||
|
Loading…
x
Reference in New Issue
Block a user