fix: enhanced active package

This commit is contained in:
2024-01-20 12:00:50 +08:00
parent 37bb3bb0f6
commit f04d6364ed

View File

@@ -2,8 +2,15 @@
filename="$1"
neType="$2"
duration=180
expectBin=/usr/bin/expect
extension=$(basename "${1}" | awk -F . '{print $NF}')
if [ ! -f ${expectBin} ]; then
echo "Please install software expect first"
exit 99
fi
case "${extension}" in
deb)
if [ ${neType} == "OMC" ]; then
@@ -11,7 +18,7 @@ case "${extension}" in
fi
expect <<EOF
spawn dpkg -i --force-all "$filename"
set timeout 180
set timeout ${duration}
expect {
"y/n" { send "n\n"; exp_continue }
}
@@ -23,7 +30,7 @@ EOF
fi
expect <<EOF
spawn rpm -Uvh "$filename"
set timeout 180
set timeout ${duration}
expect {
"y/n" { send "n\n"; exp_continue }
}
@@ -32,6 +39,6 @@ EOF
*)
echo "The file does not have a .deb or .rpm extension"
exit 1
exit 100
;;
esac