Skip to content

Commit 74442a6

Browse files
committed
chore(mise): add setup script for zsh
1 parent 7634009 commit 74442a6

File tree

1 file changed

+24
-4
lines changed

1 file changed

+24
-4
lines changed

tools/mise/mise.spec

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,18 @@ Supplements: (%{name} and bash)
8585
BuildArch: noarch
8686

8787
%description bash-setup-file
88-
Setup script for %{name}
88+
Bash setup script for %{name}
89+
90+
%package zsh-setup-file
91+
Summary: Zsh setup script for %{name}
92+
Group: System/Shells
93+
Requires: %{name} = %{version}-%{release}
94+
Requires: zsh
95+
Supplements: (%{name} and zsh)
96+
BuildArch: noarch
97+
98+
%description zsh-setup-file
99+
Zsh setup script for %{name}
89100

90101
%prep
91102
%autosetup -p1
@@ -104,11 +115,16 @@ cargo license --color never > LICENSE.dependencies
104115

105116
sed -i '/#compdef/,$!d' target/_%{pkgname}
106117

107-
cat << 'EOF' > target/%{pkgname}.sh
118+
cat << 'EOF' > target/%{pkgname}-bash-setup.sh
108119
# Activate mise. See https://mise.jdx.dev/installing-mise.html#shells
109120
[[ "$SHELL" =~ "bash" ]] && eval "$(mise activate bash)"
110121
EOF
111122

123+
cat << 'EOF' > target/%{pkgname}-zsh-setup.sh
124+
# Activate mise. See https://mise.jdx.dev/installing-mise.html#shells
125+
[[ "$SHELL" =~ "zsh" ]] && eval "$(mise activate zsh)"
126+
EOF
127+
112128
cat << 'EOF' > target/%{pkgname}_cf.fish
113129
# Activate mise. See https://mise.jdx.dev/installing-mise.html#shells
114130
if [ "$MISE_FISH_AUTO_ACTIVATE" != "0" ]
@@ -125,9 +141,10 @@ install -Dpm644 -T man/man1/%{pkgname}.1 %{buildroot}%{_mandir}/man1/%{pkgn
125141
install -Dpm644 -T target/_%{pkgname} %{buildroot}%{_datadir}/zsh/site-functions/_%{pkgname}
126142
install -Dpm644 -T target/%{pkgname} %{buildroot}%{_datadir}/bash-completion/completions/%{pkgname}
127143
install -Dpm644 -T target/%{pkgname}.fish %{buildroot}%{_datadir}/fish/vendor_completions.d/%{pkgname}.fish
128-
install -Dpm644 -T target/%{pkgname}.sh %{buildroot}%{_sysconfdir}/profile.d/%{pkgname}.sh
129144
install -Dpm644 -T target/%{pkgname}_cf.fish %{buildroot}%{_sysconfdir}/fish/conf.d/%{pkgname}.fish
130145
install -Dpm644 -T .disable-self-update %{buildroot}%{_libdir}/%{pkgname}/.disable-self-update
146+
install -Dpm644 -T target/%{pkgname}-bash-setup.sh %{buildroot}%{_sysconfdir}/profile.d/%{pkgname}-bash-setup.sh
147+
install -Dpm644 -T target/%{pkgname}-zsh-setup.sh %{buildroot}%{_sysconfdir}/profile.d/%{pkgname}-zsh-setup.sh
131148

132149

133150
%files
@@ -150,7 +167,10 @@ install -Dpm644 -T .disable-self-update %{buildroot}%{_libdir}/%{pkgname}/
150167
%{_sysconfdir}/fish/*
151168

152169
%files bash-setup-file
153-
%{_sysconfdir}/profile.d/*
170+
%{_sysconfdir}/profile.d/%{pkgname}-bash-setup.sh
171+
172+
%files zsh-setup-file
173+
%{_sysconfdir}/profile.d/%{pkgname}-zsh-setup.sh
154174

155175
%changelog
156176
* DATE Jo Carllyle <[email protected]>

0 commit comments

Comments
 (0)