Commit b9d2ca86 authored by Vitaly Lipatov's avatar Vitaly Lipatov

epm play: add Sublime Text 4 support

parent e90c858b
#!/bin/sh
PKGNAME=sublime-text
DESCRIPTION='Sublime Text 4 from the official site'
. $(dirname $0)/common.sh
arch="$($DISTRVENDOR -a)"
case "$arch" in
x86_64)
arch=x64
;;
aarch64)
arch=arm64
;;
*)
fatal "$arch arch is not supported"
;;
esac
PKG=$($EGET --list --latest https://www.sublimetext.com/download "sublime_text_build_*_$arch.tar.xz") || fatal "Can't get package URL"
[ -n "$PKG" ] || fatal "Can't get package URL"
PKGFILE=$(echo /tmp/$(basename $PKGURL) | sed -e "s|/sublime_text_build_|/$PKGNAME-|")
$EGET -O $PKGFILE $PKGURL || exit
epm install --repack "$PKG" || exit
rm -fv $PKGFILE
echo
echo "NOTE: Sublime Text 4 is a proprietary software. We recommend use open source editors: Codium, VS Code, Atom."
#!/bin/sh -x
# It will be run with two args: buildroot spec
BUILDROOT="$1"
SPEC="$2"
PRODUCT=sublime-text
PRODUCTCUR=subl
PRODUCTDIR=/opt/$PRODUCT
. $(dirname $0)/common.sh
subst "s|^Group:.*|Group: Text tools|" $SPEC
subst "s|^URL:.*|URL: https://www.sublimetext.com|" $SPEC
subst "s|^Summary:.*|Summary: Sophisticated text editor for code, html and prose|" $SPEC
subst "s|^License: unknown$|License: Proprietary|" $SPEC
# move package to /opt
ROOTDIR=sublime_text
mkdir -p $BUILDROOT/opt
mv $BUILDROOT/$ROOTDIR $BUILDROOT$PRODUCTDIR
subst "s|\"/$ROOTDIR/|\"$PRODUCTDIR/|" $SPEC
for res in 128x128 16x16 256x256 32x32 48x48; do
install -dm755 "$BUILDROOT/usr/share/icons/hicolor/${res}/apps"
cp $BUILDROOT$PRODUCTDIR/Icon/${res}/sublime-text.png $BUILDROOT/usr/share/icons/hicolor/${res}/apps/sublime-text.png
pack_file /usr/share/icons/hicolor/${res}/apps/sublime-text.png
done
# add binary to the search path
mkdir -p $BUILDROOT/usr/bin/
ln -s $PRODUCTDIR/sublime_text $BUILDROOT/usr/bin/$PRODUCT
subst "s|%files|%files\n/usr/bin/$PRODUCT|" $SPEC
ln -s $PRODUCTDIR/sublime_text $BUILDROOT/usr/bin/$PRODUCTCUR
subst "s|%files|%files\n/usr/bin/$PRODUCTCUR|" $SPEC
# create desktop file
mkdir -p $BUILDROOT/usr/share/applications/
cat <<EOF >$BUILDROOT/usr/share/applications/$PRODUCT.desktop
[Desktop Entry]
Version=1.0
Type=Application
Name=Sublime Text
GenericName=Text Editor
Comment=Sophisticated text editor for code, markup and prose
Exec=subl %F
Terminal=false
MimeType=text/plain;
Icon=sublime-text
Categories=TextEditor;Development;
StartupNotify=true
StartupWMClass=subl
Actions=Window;Document;
[Desktop Action Window]
Name=New Window
Exec=subl -n
OnlyShowIn=Unity;
[Desktop Action Document]
Name=New File
Exec=subl --command new_file
OnlyShowIn=Unity;
EOF
subst "s|%files|%files\n/usr/share/applications/$PRODUCT.desktop|" $SPEC
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment