diff options
| author | shizhendong <[email protected]> | 2024-05-22 15:43:25 +0800 |
|---|---|---|
| committer | shizhendong <[email protected]> | 2024-05-22 15:43:25 +0800 |
| commit | 8a1fcdfe3dbaf8272ba76dccd4c582e869a56478 (patch) | |
| tree | 8916e79376338503f6d4dc5062e29a25a8b6db80 | |
| parent | 8c3f2de3d30160be579b9828f93d2bc2699e58d6 (diff) | |
test: 调整 deb package 脚本判断条件nz_ipmi_exporter-24.01.13
1. install
beforeinstall.sh
P1:install
P2:
afterinstall.sh
P1:configure
P2:
2. remove
afterremove.sh
P1:remove
P2:
3. updaet
beforeinstall.sh
P1:upgrade
P2:{version}-Release
afterremove.sh
P1:upgrade
P2:{version}-Release
afterinstall.sh
P1:configure
P2:{version}-Release
| -rw-r--r-- | deb_tools/afterinstall.sh | 11 | ||||
| -rw-r--r-- | deb_tools/afterremove.sh | 9 | ||||
| -rw-r--r-- | deb_tools/beforeinstall.sh | 7 |
3 files changed, 3 insertions, 24 deletions
diff --git a/deb_tools/afterinstall.sh b/deb_tools/afterinstall.sh index 3cd9d6b..fae49da 100644 --- a/deb_tools/afterinstall.sh +++ b/deb_tools/afterinstall.sh @@ -1,10 +1,5 @@ #!/bin/bash -echo "afterinstall.sh begin" -echo "P1:"$1 -echo "P2:"$2 - - WORK_DIR=/opt/nezha/ipmi_exporter fn_init_service(){ @@ -86,7 +81,7 @@ restoreComponentConfig(){ } # install -if (( 1 == $1 )); then +if [ "$1" = "configure" ] && [ -z "$2" ]; then fn_init_config fn_init_service fn_init_syslog_logrotate_config @@ -114,7 +109,7 @@ if (( 1 == $1 )); then fi # update -if (( 2 == $1 )); then +if [ "$1" = "configure" ] && [ -n "$2" ]; then fn_init_config fn_init_service fn_init_syslog_logrotate_config @@ -134,5 +129,3 @@ if (( 2 == $1 )); then systemctl enable rsyslog && systemctl restart rsyslog echo 'update nz-ipmi-exporter success !' fi - -echo "afterinstall.sh finshed" diff --git a/deb_tools/afterremove.sh b/deb_tools/afterremove.sh index 5b5a1f0..4055b1c 100644 --- a/deb_tools/afterremove.sh +++ b/deb_tools/afterremove.sh @@ -1,13 +1,9 @@ #!/bin/bash -echo "afterremove.sh begin" -echo "P1:"$1 -echo "P2:"$2 - # 安装目录 NZ_IPMI_EXPORTER_PATH=/opt/nezha/ipmi_exporter -if (( 0 == $1 )); then +if [ "$1" = "remove" ]; then echo 'start remove nz-ipmi-exporter from disk...' @@ -26,6 +22,3 @@ if (( 0 == $1 )); then echo 'uninstall success!' fi - -echo "afterremove.sh finshed" - diff --git a/deb_tools/beforeinstall.sh b/deb_tools/beforeinstall.sh index 3dd6bfb..d5a5f43 100644 --- a/deb_tools/beforeinstall.sh +++ b/deb_tools/beforeinstall.sh @@ -1,10 +1,5 @@ #!/bin/bash - -echo "beforeinstall.sh begin" -echo "P1:"$1 -echo "P2:"$2 - # 安装目录 NZ_IPMI_EXPORTER_PATH=/opt/nezha/ipmi_exporter # 临时目录 @@ -26,5 +21,3 @@ if [ 0 -lt $(dpkg -l | grep nz-ipmi-exporter | wc -l) ];then echo 'clean before install...' rm -rf $NZ_IPMI_EXPORTER_PATH fi - -echo "beforeinstall.sh finshed" |
