kylin-code/resources/linux/rpm/code.spec.template

79 lines
3.0 KiB
Plaintext

Name: @@NAME@@
Version: @@VERSION@@
Release: @@RELEASE@@.el7
Summary: Code editing. Redefined.
Group: Development/Tools
Vendor: KylinIdeTeam
Packager: KylinIdeTeam https://gitee.com/openkylin/kylin-code/contributors?ref=master
License: @@LICENSE@@
URL: https://gitee.com/openkylin/kylin-code
Icon: @@NAME@@.xpm
Requires: @@DEPENDENCIES@@
AutoReq: 0
%description
Kylin Code is a new choice of tool that combines the simplicity of a code editor with what developers need for the core edit-build-debug cycle. See https://code.visualstudio.com/docs/setup/linux for installation instructions and FAQ.
# Don't generate build_id links to prevent conflicts when installing multiple
%define _build_id_links none
%install
mkdir -p %{buildroot}/usr/share/@@NAME@@
mkdir -p %{buildroot}/usr/share/applications
mkdir -p %{buildroot}/usr/share/pixmaps
mkdir -p %{buildroot}/usr/share/bash-completion/completions
mkdir -p %{buildroot}/usr/share/zsh/site-functions
mkdir -p %{buildroot}/usr/share/mime/packages
cp -r usr/share/@@NAME@@/* %{buildroot}/usr/share/@@NAME@@
cp -r usr/share/applications/@@NAME@@.desktop %{buildroot}/usr/share/applications
cp -r usr/share/applications/@@NAME@@-url-handler.desktop %{buildroot}/usr/share/applications
cp -r usr/share/mime/packages/@@NAME@@-workspace.xml %{buildroot}/usr/share/mime/packages/@@NAME@@-workspace.xml
cp -r usr/share/pixmaps/@@ICON@@.png %{buildroot}/usr/share/pixmaps
cp usr/share/bash-completion/completions/@@NAME@@ %{buildroot}/usr/share/bash-completion/completions/@@NAME@@
cp usr/share/zsh/site-functions/_@@NAME@@ %{buildroot}/usr/share/zsh/site-functions/_@@NAME@@
%post
# Remove the legacy bin command if this is the stable build
if [ "@@NAME@@" = "kylin-code" ]; then
rm -f /usr/local/bin/kylin-code
fi
# Symlink bin command to /usr/bin
ln -sf /usr/share/@@NAME@@/bin/@@NAME@@ %{_bindir}/@@NAME@@
# Register yum repository
# TODO: #229: Enable once the yum repository is signed
#if [ "@@NAME@@" != "code-oss" ]; then
# if [ -d "/etc/yum.repos.d" ]; then
# REPO_FILE=/etc/yum.repos.d/@@NAME@@.repo
# rm -f $REPO_FILE
# echo -e "[@@NAME@@]\nname=@@NAME_LONG@@\nbaseurl=@@UPDATEURL@@/api/rpm/@@QUALITY@@/@@ARCHITECTURE@@/rpm" > $REPO_FILE
# fi
#fi
# Update mimetype database to pickup workspace mimetype
update-mime-database /usr/share/mime &> /dev/null || :
%postun
if [ $1 = 0 ]; then
rm -f /usr/bin/@@NAME@@
rm -rf /home/${SUDO_USER}/.config/@@NAME_LONG@@
rm -rf /home/${SUDO_USER}/@@DATA_FOLDER@@
fi
# Update mimetype database for removed workspace mimetype
update-mime-database /usr/share/mime &> /dev/null || :
%files
%defattr(-,root,root)
%attr(4755, root, root) /usr/share/@@NAME@@/chrome-sandbox
/usr/share/@@NAME@@/
/usr/share/applications/@@NAME@@.desktop
/usr/share/applications/@@NAME@@-url-handler.desktop
/usr/share/mime/packages/@@NAME@@-workspace.xml
/usr/share/pixmaps/@@ICON@@.png
/usr/share/bash-completion/completions/@@NAME@@
/usr/share/zsh/site-functions/_@@NAME@@
%config(noreplace) /usr/share/@@NAME@@/resources/app/product.json