RPM: Add packages for syntax highlighting

refs #8401
This commit is contained in:
Dirk Goetz 2015-04-28 19:14:05 +02:00 committed by Michael Friedrich
parent f4241ba185
commit 916537b33a
2 changed files with 80 additions and 23 deletions

View File

@ -325,28 +325,19 @@ to obtain the Vim configuration, please install the extra package `vim-icinga2`.
### <a id="configuration-syntax-highlighting-vim"></a> Configuration Syntax Highlighting using Vim
Create a new local vim configuration storage in your home directory (`~/.vim`), if it doesn't exist already.
The `~/.vim/syntax` directory contains the actual syntax file and the one in `~/.vim/ftdetect` is used to detect
the file type. Both are called `icinga2.vim`.
Install the package vim-icinga2 with your distribution's package manager.
$ PREFIX=~/.vim
$ mkdir -p $PREFIX/{syntax,ftdetect}
$ cd /usr/share/doc/icinga2-common-[x.x.x]/syntax/vim
$ cp syntax/icinga2.vim $PREFIX/syntax/
$ cp ftdetect/icinga2.vim $PREFIX/ftdetect/
Debian/Ubuntu:
On Debian systems replace the path `/usr/share/doc/icinga2-common-[x.x.x]/syntax/vim` with `/usr/share/vim/addons`. Alternatively,
you can use the `vim-addons` tool to create the `~/.vim/syntax` and `~/.vim/ftdetect` directories and create symlinks to the files
in `/usr/share/vim/addons`:
$ apt-get install vim-icinga2
$ vim-addons install icinga2
Info: installing removed addon 'icinga2' to /home/root/.vim
$ ls -l /home/root/.vim/*
/home/root/.vim/ftdetect:
lrwxrwxrwx 1 root root [...] icinga2.vim -> /usr/share/vim/addons/ftdetect/icinga2.vim
RHEL/CentOS/Fedora:
/home/root/.vim/syntax:
lrwxrwxrwx 1 root root [...] icinga2.vim -> /usr/share/vim/addons/syntax/icinga2.vim
$ yum install vim-icinga2
SLES/openSUSE:
$ zypper install vim-icinga2
Test it:
@ -357,19 +348,30 @@ Test it:
### <a id="configuration-syntax-highlighting-nano"></a> Configuration Syntax Highlighting using Nano
Copy the `/etc/nanorc` sample file to your home directory and rename it to `~/.nanorc`. Create the `/etc/nano`
directory and copy the provided `icinga2.nanorc` into it.
Install the package nano-icinga2 with your distribution's package manager.
Debian/Ubuntu:
$ apt-get install nano-icinga2
RHEL/CentOS/Fedora:
$ yum install nano-icinga2
SLES/openSUSE:
$ zypper install nano-icinga2
Copy the `/etc/nanorc` sample file to your home directory.
$ cp /etc/nanorc ~/.nanorc
# mkdir -p /etc/nano
# cp /usr/share/doc/icinga2-common-[x.x.x]/syntax/nano/icinga2.nanorc /etc/nano
On Debian systems change `/usr/share/doc/icinga2-common-[x.x.x]/syntax/nano/icinga2.nanorc` to `/usr/share/nano/icinga2.nanorc`.
Then include the icinga2.nanorc file in your ~/.nanorc by adding the following line:
## Icinga 2
include "/etc/nano/icinga2.nanorc"
include "/usr/share/nano/icinga2.nanorc"
Test it:

View File

@ -253,6 +253,27 @@ Provides a GUI for the Icinga 2 API.
%endif
%package -n vim-icinga2
Summary: Vim syntax highlighting for icinga2
Group: Applications/System
%if "%{_vendor}" == "suse"
Requires: vim-data
%else
Requires: vim-filesystem
%endif
%description -n vim-icinga2
Vim syntax highlighting for icinga2
%package -n nano-icinga2
Summary: Nano syntax highlighting for icinga2
Group: Applications/System
Requires: nano
%description -n nano-icinga2
Nano syntax highlighting for icinga2
%prep
%setup -q -n %{name}-%{version}
@ -378,6 +399,21 @@ mkdir -p %{buildroot}%{_prefix}/lib/firewalld/services
install -p -m 644 tools/firewalld/%{name}.xml %{buildroot}%{_prefix}/lib/firewalld/services
%endif
%if "%{_vendor}" == "suse"
%if 0%{?suse_version} >= 1310
install -D -m 0644 tools/syntax/vim/syntax/%{name}.vim %{buildroot}%{_datadir}/vim/vim74/syntax/%{name}.vim
install -D -m 0644 tools/syntax/vim/ftdetect/%{name}.vim %{buildroot}%{_datadir}/vim/vim74/ftdetect/%{name}.vim
%else
install -D -m 0644 tools/syntax/vim/syntax/%{name}.vim %{buildroot}%{_datadir}/vim/vim72/syntax/%{name}.vim
install -D -m 0644 tools/syntax/vim/ftdetect/%{name}.vim %{buildroot}%{_datadir}/vim/vim72/ftdetect/%{name}.vim
%endif
%else
install -D -m 0644 tools/syntax/vim/syntax/%{name}.vim %{buildroot}%{_datadir}/vim/vimfiles/syntax/%{name}.vim
install -D -m 0644 tools/syntax/vim/ftdetect/%{name}.vim %{buildroot}%{_datadir}/vim/vimfiles/ftdetect/%{name}.vim
%endif
install -D -m 0644 tools/syntax/nano/%{name}.nanorc %{buildroot}%{_datadir}/nano/%{name}.nanorc
%clean
[ "%{buildroot}" != "/" ] && [ -d "%{buildroot}" ] && rm -rf %{buildroot}
@ -715,4 +751,23 @@ fi
%{_datadir}/applications/icinga2-studio.desktop
%endif
%files -n vim-icinga2
%defattr(-,root,root,-)
%if "%{_vendor}" == "suse"
%if 0%{?suse_version} >= 1310
%{_datadir}/vim/vim74/syntax/%{name}.vim
%{_datadir}/vim/vim74/ftdetect/%{name}.vim
%else
%{_datadir}/vim/vim72/syntax/%{name}.vim
%{_datadir}/vim/vim72/ftdetect/%{name}.vim
%endif
%else
%{_datadir}/vim/vimfiles/syntax/%{name}.vim
%{_datadir}/vim/vimfiles/ftdetect/%{name}.vim
%endif
%files -n nano-icinga2
%defattr(-,root,root,-)
%{_datadir}/nano/%{name}.nanorc
%changelog