cursor icon indicating copy to clipboard operation
cursor copied to clipboard

Add RPM and DEB packages for Linux

Open mysticaltech opened this issue 1 year ago • 25 comments

Hey folks, cursor is amazing but currently the linux version is a .AppImage. Yes, this is simpler for you devs, but for us users it's suboptimal.

AppImages do not ingreate deeply into the OS, we don't get a proper VSCode replacement with nice Icons, possibility to have mutiple instances running etc. It's super limited.

You will need to create two packages on top of AppImage, .rpm, and .deb. That should cover most Linux OSes.

Personally I just need the .rpm as I'm on Fedora but am also thinking about others.

mysticaltech avatar Sep 16 '23 21:09 mysticaltech

yeah, so many bug met by using Appimages. Many AI engineers use linux as their main work env. so i think .deb and .rpm is needed. By the way , I need .deb....

AlexCRX avatar Sep 18 '23 07:09 AlexCRX

This is totally fair. We're a small eng team and are trying to balance new features/bug fixes with supporting more platforms. Agree deb/rpm is better and hope to have these available sometime in the near future.

truell20 avatar Sep 18 '23 19:09 truell20

Looking forward to a deb.

clayrisser avatar Sep 19 '23 16:09 clayrisser

+1 to this. I've tried a number of ways to execute the AppImage on my machine and no dice. I'm looking forward to using Cursor when it's available via .deb.

ephemeralrogue avatar Sep 19 '23 19:09 ephemeralrogue

@nonsensetwice You just need to give it exec permissions with chmod +x cusor-xxx.AppImage, then you can execute either via terminal, or by double clicking. I ended up creating an alias in my shell, so I just execute cursor . in the project I want to open (this is needed because the cursor cli itself won't install via AppImage). It works, but you cannot run multiple instances, and no deep OS integration, so definitely not an ideal long term solution.

mysticaltech avatar Sep 19 '23 20:09 mysticaltech

this is trivial just do something like this.

#!/bin/bash
VER=0.10.4
./cursor-${ver}.AppImage --appimage-extract
mv squashfs-root cursor-${ver}
mkdir -p cursor-${ver}/usr/local/cursor cursor-${ver}/usr/local/bin
mv cursor-${ver}/{*,.*} cursor-${ver}/usr/local/cursor
( cd cursor-${ver}/usr/local/bin/ && ln -s ../cursor/cursor . )
mkdir cursor-${ver}/DEBIAN
cat > cursor-${ver}/DEBIAN/control << ENDL
Package: cursor
Version: ${ver}
Architecture: all
Maintainer: [email protected]
Installed-Size: 158812254
Section: misc
Priority: optional
Description: cursor app
ENDL
dpkg-deb --build cursor-${ver}
# sudo dpkg -i cursor-${ver}.deb

there you go.

kristopolous avatar Sep 20 '23 00:09 kristopolous

Does the AppImage version autoupdate ?

MobiCode48 avatar Sep 21 '23 00:09 MobiCode48

Does the AppImage version autoupdate ?

Sadly no, it's not managed by a package manager.

mysticaltech avatar Sep 21 '23 02:09 mysticaltech

this is trivial just do something like this.

#!/bin/bash
VER=0.10.4
./cursor-${ver}.AppImage --appimage-extract
mv squashfs-root cursor-${ver}
mkdir -p cursor-${ver}/usr/local/cursor cursor-${ver}/usr/local/bin
mv cursor-${ver}/{*,.*} cursor-${ver}/usr/local/cursor
( cd cursor-${ver}/usr/local/bin/ && ln -s ../cursor/cursor . )
mkdir cursor-${ver}/DEBIAN
cat > cursor-${ver}/DEBIAN/control << ENDL
Package: cursor
Version: ${ver}
Architecture: all
Maintainer: [email protected]
Installed-Size: 158812254
Section: misc
Priority: optional
Description: cursor app
ENDL
dpkg-deb --build cursor-${ver}
# sudo dpkg -i cursor-${ver}.deb

there you go.

@kristopolous That's a cool trick, but not ideal to do everytime. And in a perfect world, there would be both an apt and yum repo.

mysticaltech avatar Sep 21 '23 02:09 mysticaltech

This is totally fair. We're a small eng team and are trying to balance new features/bug fixes with supporting more platforms. Agree deb/rpm is better and hope to have these available sometime in the near future.

@truell20 Really appreciate the positive outlook on this. I made a quick research on how to best host yum (for rpm) and apt (for deb) repository and found someone on reddit mentioning sonartype.com.

https://help.sonatype.com/repomanager3/nexus-repository-administration/formats/apt-repositories https://help.sonatype.com/repomanager3/nexus-repository-administration/formats/yum-repositories

If those packages are going to be build automatically then it's ideal to have linux package repos for them, it's how vscode does it for instance. That way the app gets updated automatically (for those that turn on automatic updates at the OS level), and everything stays evergreen!

mysticaltech avatar Sep 21 '23 02:09 mysticaltech

this is trivial just do something like this.

#!/bin/bash
VER=0.10.4
./cursor-${ver}.AppImage --appimage-extract
mv squashfs-root cursor-${ver}
mkdir -p cursor-${ver}/usr/local/cursor cursor-${ver}/usr/local/bin
mv cursor-${ver}/{*,.*} cursor-${ver}/usr/local/cursor
( cd cursor-${ver}/usr/local/bin/ && ln -s ../cursor/cursor . )
mkdir cursor-${ver}/DEBIAN
cat > cursor-${ver}/DEBIAN/control << ENDL
Package: cursor
Version: ${ver}
Architecture: all
Maintainer: [email protected]
Installed-Size: 158812254
Section: misc
Priority: optional
Description: cursor app
ENDL
dpkg-deb --build cursor-${ver}
# sudo dpkg -i cursor-${ver}.deb

there you go.

@kristopolous That's a cool trick, but not ideal to do everytime. And in a perfect world, there would be both an apt and yum repo.

You put it in the build script...

I'm a debian maintainer btw, I can get it inside of apt if you're really serious about it.

kristopolous avatar Sep 26 '23 20:09 kristopolous

oh you're just a reporter ... right ... so you'd need to side-load it into the autoUpdater.on('update-downloaded' electron event in the js ... you won't break debian since its self-contained.

kristopolous avatar Sep 26 '23 20:09 kristopolous

this is trivial just do something like this.

#!/bin/bash
VER=0.10.4
./cursor-${ver}.AppImage --appimage-extract
mv squashfs-root cursor-${ver}
mkdir -p cursor-${ver}/usr/local/cursor cursor-${ver}/usr/local/bin
mv cursor-${ver}/{*,.*} cursor-${ver}/usr/local/cursor
( cd cursor-${ver}/usr/local/bin/ && ln -s ../cursor/cursor . )
mkdir cursor-${ver}/DEBIAN
cat > cursor-${ver}/DEBIAN/control << ENDL
Package: cursor
Version: ${ver}
Architecture: all
Maintainer: [email protected]
Installed-Size: 158812254
Section: misc
Priority: optional
Description: cursor app
ENDL
dpkg-deb --build cursor-${ver}
# sudo dpkg -i cursor-${ver}.deb

there you go.

@kristopolous That's a cool trick, but not ideal to do everytime. And in a perfect world, there would be both an apt and yum repo.

You put it in the build script...

I'm a debian maintainer btw, I can get it inside of apt if you're really serious about it.

Ok, very good to know, thanks! I'm on Fedora, so used gpt-4 to convert that script to rpm, did not try it yet but will report back.

#!/bin/bash

# Define version
VER=0.10.4

# Extract the AppImage
./cursor-${VER}.AppImage --appimage-extract

# Move and rename the directory
mv squashfs-root cursor-${VER}

# Create directories
mkdir -p ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
mkdir -p ~/rpmbuild/BUILDROOT/cursor-${VER}-1.x86_64/usr/local/cursor
mkdir -p ~/rpmbuild/BUILDROOT/cursor-${VER}-1.x86_64/usr/local/bin

# Move files
mv cursor-${VER}/{*,.*} ~/rpmbuild/BUILDROOT/cursor-${VER}-1.x86_64/usr/local/cursor/

# Create symbolic link
ln -s ../cursor/cursor ~/rpmbuild/BUILDROOT/cursor-${VER}-1.x86_64/usr/local/bin/cursor

# Create RPM spec file
cat > ~/rpmbuild/SPECS/cursor.spec << EOF
Name: cursor
Version: ${VER}
Release: 1%{?dist}
Summary: cursor app

License: Unknown
URL: http://example.com

%description
cursor app

%prep

%build

%install
cp -a \$RPM_BUILD_DIR/* \$RPM_BUILD_ROOT/

%files
/usr/local/cursor/*
/usr/local/bin/cursor

%changelog
EOF

# Build the RPM package
rpmbuild -bb ~/rpmbuild/SPECS/cursor.spec

# The RPM will be generated in ~/rpmbuild/RPMS/x86_64/

mysticaltech avatar Sep 28 '23 03:09 mysticaltech

I tried with a modified version of the above:

#!/bin/bash

# Define version
VER=0.10.4

# Clean up any previous extraction or build attempts
rm -rf squashfs-root cursor-${VER}
rm -rf ~/rpmbuild

# Extract the AppImage
./cursor-${VER}.AppImage --appimage-extract

# Move and rename the directory
mv squashfs-root cursor-${VER}

# Create directories
mkdir -p ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}

# Move files to ~/rpmbuild/BUILD/ for alignment with RPM conventions
mv cursor-${VER} ~/rpmbuild/BUILD/cursor-${VER}

# Create RPM spec file
cat > ~/rpmbuild/SPECS/cursor.spec << EOF
Name: cursor
Version: ${VER}
Release: 1%{?dist}
Summary: cursor app

License: Cursor
URL: https://www.cursor.so/

%description
cursor app

%prep
# Unpack or prepare your files here, if applicable.

%build
# Build process here, if applicable.

%install
# Debugging output
echo "Listing BUILD directory:"
ls -la %{_builddir}

# Actual install commands
mkdir -p %{buildroot}/usr/local/cursor
mkdir -p %{buildroot}/usr/local/bin

cp -a %{_builddir}/cursor-${VER}/* %{buildroot}/usr/local/cursor/
ln -s ../cursor/cursor %{buildroot}/usr/local/bin/cursor

%files
/usr/local/cursor/*
/usr/local/bin/cursor

%changelog
* Wed Sep 27 2023 Karim Nuafal <[email protected]> - 0.10.4-1
- Initial RPM release
EOF

# Build the RPM package
rpmbuild -bb ~/rpmbuild/SPECS/cursor.spec

# If all goes well, the RPM should be generated in ~/rpmbuild/RPMS/x86_64/

It did succeed in building the RPM, but sadly, it's not using the same C lib, and it seems there is no easy way around this.

Wrote: /home/karim/rpmbuild/RPMS/x86_64/cursor-0.10.4-1.fc38.x86_64.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.x2Ry6n
+ umask 022
+ cd /home/karim/rpmbuild/BUILD
+ /usr/bin/rm -rf /home/karim/rpmbuild/BUILDROOT/cursor-0.10.4-1.fc38.x86_64
+ RPM_EC=0
++ jobs -p
+ exit 0
Executing(rmbuild): /bin/sh -e /var/tmp/rpm-tmp.CHN717
+ umask 022
+ cd /home/karim/rpmbuild/BUILD
+ RPM_EC=0
++ jobs -p
+ exit 0

03:21:40 in ~/Downloads/cursor took 1m 55s 
➜ sudo dnf install /home/karim/rpmbuild/RPMS/x86_64/cursor-0.10.4-1.fc38.x86_64.rpm    
[sudo] password for karim: 
Last metadata expiration check: 3:06:56 ago on Fri 29 Sep 2023 12:15:31 AM CEST.
Error: 
 Problem: conflicting requests
  - nothing provides libc.musl-x86_64.so.1()(64bit) needed by cursor-0.10.4-1.fc38.x86_64 from @commandline
(try to add '--skip-broken' to skip uninstallable packages)

So it's a dead end for me now. Will wait for the official implementation that compiles from source properly to various targets.

mysticaltech avatar Sep 29 '23 01:09 mysticaltech

@truell20 FYI the above failed attempt. The key remains in your hands, as the package should be compiled from source. There seem to be no easy way around this. 🙏

mysticaltech avatar Sep 29 '23 01:09 mysticaltech

@truell20 Good news, there is an automatic way to do Source -> ALL DISTROS packages. Just use https://en.opensuse.org/Portal:Build_Service, it's distributed under a GPL license, meaning you can host the build service yourself without hassles.

Screenshot from 2023-09-29 03-46-40

mysticaltech avatar Sep 29 '23 01:09 mysticaltech

Here's the link to the project, they even provide an ISO to get started right away on any cloud instance: https://github.com/openSUSE/open-build-service

Here's the latest at the time of posting: https://download.opensuse.org/repositories/OBS:/Server:/2.10/images/iso/obs-server.x86_64-oem.iso

mysticaltech avatar Sep 29 '23 01:09 mysticaltech

Last but not least, when those packages are built, they will need hosting to be used by the various Linux package managers. For that, you can use: OpenRepo https://github.com/openkilt/openrepo

mysticaltech avatar Sep 29 '23 01:09 mysticaltech

This is my install script I created that I've been using.

https://gitlab.com/bitspur/community/cody/-/blob/main/installers/cursor/linux-install.sh?ref_type=heads

clayrisser avatar Nov 22 '23 21:11 clayrisser

Based on the above posts I wrote a slightly more complicated script that downloads and updates Cursor automatically (on x64 Linux systems). You can download it here. Let me know if there are any issues with it.

Note: I have hardcoded a lot of the links so the script is very unstable but it's better than having to manually update every other day. Hopefully we get official packages soon.

IliaMManolov avatar Jan 30 '24 02:01 IliaMManolov

Honestly, now the fact that the AppImage auto updates, I'm quite happy, better even than RPM.

mysticaltech avatar Feb 01 '24 12:02 mysticaltech

Hopefully we get deb and rpm package before GTA 6

ilhamprabuzakys avatar Apr 10 '24 17:04 ilhamprabuzakys

@ilhamprabuzakys I'm happy to report that the AppImage works decently enough for me, especially if you create a shortcut in your shell to launch it from the command line. I have an alias called cursor, I just write this in my shell and it opens, as many instances as you want and best of all it proposes you to update when a new update is here. I'm actually quite happy now.

mysticaltech avatar Apr 12 '24 14:04 mysticaltech

@ilhamprabuzakys I'm happy to report that the AppImage works decently enough for me, especially if you create a shortcut in your shell to launch it from the command line. I have an alias called cursor, I just write this in my shell and it opens, as many instances as you want and best of all it proposes you to update when a new update is here. I'm actually quite happy now.

Hi, I want to learn how do to version upgrade with appimage? cursor is release new features at amazing speed and appimage does not seem to self upgrade. Thanks

yangcheng avatar Aug 26 '24 02:08 yangcheng

any updates about .deb for cursor? i'm facing some issues with permissions bc the .appimage is not deeply integrated into the OS :(

valenradovich avatar Sep 10 '24 17:09 valenradovich

+1

yannouuuu avatar Sep 20 '24 12:09 yannouuuu