-
Notifications
You must be signed in to change notification settings - Fork 261
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: optmize dfget package upgrade support (#804)
Signed-off-by: Jim Ma <majinjing3@gmail.com>
- Loading branch information
Showing
8 changed files
with
71 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,12 @@ | ||
#!/bin/bash | ||
|
||
if [[ "$D7Y_DEBUG" == "true" ]]; then | ||
set -x | ||
echo post install with param: "$@" | ||
fi | ||
|
||
chmod a+s /usr/bin/dfget | ||
|
||
which systemctl && (systemctl daemon-reload; systemctl enable dfget-daemon.service) | ||
if [[ -f /bin/systemctl || -f /usr/bin/systemctl ]]; then | ||
systemctl daemon-reload; systemctl enable --now dfget-daemon.service | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,10 @@ | ||
#!/bin/bash | ||
|
||
which systemctl && systemctl daemon-reload | ||
if [[ "$D7Y_DEBUG" == "true" ]]; then | ||
set -x | ||
echo post remove with param: "$@" | ||
fi | ||
|
||
if [[ -f /bin/systemctl || -f /usr/bin/systemctl ]]; then | ||
systemctl daemon-reload | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
|
||
if [[ "$D7Y_DEBUG" == "true" ]]; then | ||
set -x | ||
echo pre install with param: "$@" | ||
fi | ||
|
||
# stop dfget daemon before upgrading | ||
if [[ -f "/etc/systemd/system/dfget-daemon.service" ]]; then | ||
if [[ -f /bin/systemctl || -f /usr/bin/systemctl ]]; then | ||
systemctl stop dfget-daemon.service | ||
fi | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,27 @@ | ||
#!/bin/bash | ||
|
||
which systemctl && (systemctl stop dfget-daemon.service; systemctl disable dfget-daemon.service) | ||
if [[ "$D7Y_DEBUG" == "true" ]]; then | ||
set -x | ||
echo pre remove with param: "$@" | ||
fi | ||
|
||
upgrade=0 | ||
|
||
# in rpm install: | ||
# refer: https://docs.fedoraproject.org/en-US/Fedora_Draft_Documentation/0.1/html/RPM_Guide/ch09s04s05.html | ||
if [[ "$1" -gt 0 ]]; then | ||
upgrade=1 | ||
fi | ||
|
||
# in deb install | ||
# refer: https://www.debian.org/doc/debian-policy/ch-maintainerscripts.html | ||
if [[ "$1" =~ "upgrade" ]]; then | ||
upgrade=1 | ||
fi | ||
|
||
# not in upgrade, purge systemd service | ||
if [[ "$upgrade" -eq 0 ]]; then | ||
if [[ -f /bin/systemctl || -f /usr/bin/systemctl ]]; then | ||
systemctl stop dfget-daemon.service; systemctl disable dfget-daemon.service | ||
fi | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters