summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorhonjow2024-05-06 21:59:46 +0000
committerhonjow2024-05-06 21:59:46 +0000
commitfd576d8f80dbf1dd06c31d7c559b399bcbd31cce (patch)
tree04cd1fedf6a9c24367aab8afb658808df66d8e11
parent2e3d2cb151a4b97dda5ad900702b0a93e6433393 (diff)
downloadaur-fd576d8f80dbf1dd06c31d7c559b399bcbd31cce.tar.gz
Update AUR package
-rw-r--r--.SRCINFO4
-rw-r--r--PKGBUILD4
-rw-r--r--sk-chos-addon.install81
3 files changed, 87 insertions, 2 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 3a769f654593..db3d16d27690 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,8 +1,9 @@
pkgbase = sk-chos-addon-git
pkgdesc = Addon for sk-chimeros
- pkgver = r507.ea9dcba
+ pkgver = r514.8d1064d
pkgrel = 1
url = https://github.com/honjow/sk-chos-config.git
+ install = sk-chos-addon.install
arch = any
license = MIT
makedepends = git
@@ -21,6 +22,7 @@ pkgbase = sk-chos-addon-git
conflicts = sk-chos-addon
replaces = sk-chos-addon
options = !strip
+ backup = etc/sk-chos-tool/github_cdn.conf
source = git+https://github.com/honjow/sk-chos-config.git
sha256sums = SKIP
diff --git a/PKGBUILD b/PKGBUILD
index 6d7c2b852518..b0fd2cdc8321 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -3,7 +3,7 @@ pkgname=sk-chos-addon-git
_basename=sk-chos-tool
_pkgname=sk-chos-addon
_reponame=sk-chos-config
-pkgver=r507.ea9dcba
+pkgver=r514.8d1064d
pkgrel=1
pkgdesc="Addon for sk-chimeros"
arch=('any')
@@ -28,6 +28,8 @@ replaces=(sk-chos-addon)
source=("git+$url")
sha256sums=('SKIP')
options=(!strip)
+backup=('etc/sk-chos-tool/github_cdn.conf')
+install=sk-chos-addon.install
pkgver() {
cd "$srcdir/$_reponame"
diff --git a/sk-chos-addon.install b/sk-chos-addon.install
new file mode 100644
index 000000000000..39bbf9a4cb21
--- /dev/null
+++ b/sk-chos-addon.install
@@ -0,0 +1,81 @@
+rc_files=(
+ "/etc/bashrc"
+ "/etc/bash.bashrc"
+ "/etc/zshrc"
+ "/etc/zsh/zshrc"
+)
+
+start_line="# sk-chos user-motd"
+end_line="# sk-chos user-motd end"
+
+read -rd '' motd_command <<EOF
+$start_line
+if test -d "\$HOME"; then
+ if test ! -e "\$HOME"/.config/no-show-user-motd; then
+ if test -x "/usr/libexec/chos-motd"; then
+ /usr/libexec/chos-motd
+ elif test -s "/etc/user-motd"; then
+ cat /etc/user-motd
+ fi
+ fi
+fi
+$end_line
+EOF
+
+update_motd() {
+ echo "Updating motd..."
+ for rc_file in "${rc_files[@]}"; do
+ if [ -f "$rc_file" ]; then
+ if ! grep -q "# user-motd" "$rc_file"; then
+ echo "$motd_command" >>"$rc_file"
+ else
+ sed -i "/$start_line/,/$end_line/d" "$rc_file"
+ echo "$motd_command" >>"$rc_file"
+ fi
+ else
+ echo "$motd_command" >"$rc_file"
+ fi
+ done
+}
+
+remove_motd() {
+ echo "Removing motd..."
+ for rc_file in "${rc_files[@]}"; do
+ if [ -f "$rc_file" ]; then
+ sed -i "/$start_line/,/$end_line/d" "$rc_file"
+ fi
+ done
+}
+
+# 安装或升级后的操作
+post_upgrade_or_install() {
+ update_motd
+}
+
+# 安装前的操作
+pre_install() {
+ echo ""
+}
+
+# 升级前的操作
+pre_upgrade() {
+ echo ""
+}
+
+# 安装后的操作
+post_install() {
+ post_upgrade_or_install
+}
+
+# 升级后的操作
+post_upgrade() {
+ post_upgrade_or_install
+}
+
+pre_remove() {
+ echo ""
+}
+
+post_remove() {
+ remove_motd
+}