diff options
| -rw-r--r-- | hello_cangjie_eur.spec | 69 | 
1 files changed, 15 insertions, 54 deletions
| diff --git a/hello_cangjie_eur.spec b/hello_cangjie_eur.spec index b15ba4f..e07b0cf 100644 --- a/hello_cangjie_eur.spec +++ b/hello_cangjie_eur.spec @@ -1,6 +1,6 @@  Name:           hello-cangjie-eur  Version:        0.0.8 -Release:        12%{?dist} +Release:        13%{?dist}  Summary:        Cangjie Eur demo.  License:        MIT  Source:         https://github.com/stevending1st/%{name}/archive/refs/tags/v%{version}.tar.gz @@ -12,6 +12,8 @@ Requires(pre):  wget  A demo for Cangjie and Eur.  %global output_name hello_cangjie_eur +%global output_dir_name %{name}-%{version}-%{release}.%{_arch} +%global command main  %global debug_package %{nil}  %define __requires_exclude (libcangjie-runtime\.so|libsecurec\.so) @@ -41,76 +43,35 @@ if [ ! -f %{_builddir}/Cangjie-0.53.13-linux.tar.gz ]; then     wget -O Cangjie-0.53.13-linux.tar.gz %{download_url}  fi -tar xvf Cangjie-0.53.13-linux.tar.gz +tar -xvf Cangjie-0.53.13-linux.tar.gz  %install  cd %{_builddir}/%{name}-%{version}  rm -rf %{_buildrootdir}/*  source %{_builddir}/cangjie/envsetup.sh -cjpm install --root %{_buildrootdir}/%{name}-%{version}-%{release}.%{_arch} - +cjpm install --root %{_buildrootdir}/%{output_dir_name} +mkdir -p %{_buildrootdir}/%{output_dir_name}%{_bindir} +cd %{_buildrootdir}/%{output_dir_name} +cp -p %{_buildrootdir}/%{output_dir_name}/bin/%{output_name} .%{_bindir}/%{name} +ln -sf %{_bindir}/%{name} .%{_bindir}/%{command}  %clean  rm -rf %{buildroot} -%post -for user_dir in /home/* -do -  # 检查是否为目录 -  if [ -d "$user_dir" ]; then -    # 获取 .bashrc 的完整路径 -    bashrc="$user_dir/.bashrc" -    content="alias main='/usr/bin/%{output_name}'" -     -    # 检查 .bashrc 是否存在 -    if [ -f "$bashrc" ]; then -      # 检查是否已经包含 "$content" -      if ! grep -Fxq "$content" "$bashrc"; then -        # 在 .bashrc 文件末尾添加 "$content" -        echo "$content" >> "$bashrc" -      fi -    else -      echo "$content" >> "$bashrc" -    fi - -    source "$bashrc" -  fi -done - - -%postun -#!/bin/bash -rm -rf %{_libdir}/cangjie -# sed -i '\|source .*/cangjie/envsetup.sh|d' $HOME/.bashrc -# sed -i "\|alias main='/usr/bin/%{name}'|d" $HOME/.bashrc -for user_dir in /home/* -do -  # 检查是否为目录 -  if [ -d "$user_dir" ]; then -    # 获取 .bashrc 的完整路径 -    bashrc="$user_dir/.bashrc" -     -    # 检查 .bashrc 是否存在 -    if [ -f "$bashrc" ]; then -      sed -i '\|source %{_libdir}/cangjie/envsetup.sh|d' "$bashrc" -      sed -i "\|alias main='/usr/bin/%{output_name}'|d" "$bashrc" -      source "$bashrc" -    fi -  fi -done - -  %files  # %license add-license-file-here  # %doc add-docs-here -/bin/%{output_name} +%{_bindir}/%{name} +%{_bindir}/%{command} +%exclude /bin/%{output_name}  %exclude /.packages.toml  %changelog -* Thu Jan 02 2025 stevending1st <stevending1st@163.com> -Project init.   * Sat Feb 15 2025 stevending1st <stevending1st@163.com>  Add pre, post and postun script. + +* Thu Jan 02 2025 stevending1st <stevending1st@163.com> +Project init.  | 
