You are not logged in.

#1 2024-10-25 08:53:44

jenetism
Member
Registered: 2024-02-28
Posts: 5

How to build an RPM package

As per the wiki https://wiki.archlinux.org/title/Creating_packages/

"Download the source tarball of the software you want to package, extract it, and follow the author's steps to install the program. "

I've downloaded the .rpm file and have extracted it, but I don't know what does it mean to follow the author's step to install the program.
Please help.

Offline

#2 2024-10-25 13:21:06

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,330
Website

Re: How to build an RPM package

An .rpm is not a source tarball - that is a prebuilt binary for red-hat (and related) distros.

And rpm can be converted to a pacman package, but that should only be done if there is no source available.  What is the software you want to package?


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#3 2024-10-25 18:28:54

jenetism
Member
Registered: 2024-02-28
Posts: 5

Re: How to build an RPM package

Thank you for your reply

I've considered every other way I could think of before deciding to build from this source.
The package I'm trying to build is "Astrill", a VPN, it's very important to me because without it, I might be as good as internet-less, the package on AUR is broken, if you install it Astrill will tell you "your installation is broken" after logging in the app.
I've even messaged back and forth with the maintainer to no avail since this is beyond our capability but the lack of support from Astrill.
So far, the only source I could obtain is .rpm and .deb from official website.

Offline

#4 2024-10-25 18:44:25

cryptearth
Member
Registered: 2024-02-03
Posts: 1,015

Re: How to build an RPM package

so - your requirement for <insert vpn provider here> is WHAT exactly? and why just not use a different one? there're over 100 "providers" all belong to a merely dozen of companies behind them - so one is as bad as the next one
also thier site is bullshit: "ipv6 leak test: there's no ipv6 - only ipv4" - yea, tell that my isp as I have native ipv6 for several years now - a site telling me "there's no ipv6" is scam or doesn't have ipv6 itself

Offline

#5 2024-10-25 19:58:06

jenetism
Member
Registered: 2024-02-28
Posts: 5

Re: How to build an RPM package

I appreciate your doing research on Astrill and suggestion crytearth, but I have to say it's not relevant to my question
Astrill is one of the most robust VPNs, if not THE most reliable, VPN in China right now.
Using VPN inside of China is almost completely different than outside of, and there's nothing can tell you which one works except you try it yourself.
And Astrill is currently the most reliable one I've used thus far, as well as the most recommended in China subreddit (which I discovered after the fact)

So, let's just assume I have to use Astrill, with rpm or deb format, is there nothing I can do to build it?
I'm pretty sure it's buildable cuz I just built it last time, and it was installed in /usr/local, which is wack, but it works, I deleted it since I feel like needing a update and want to make it to pacman.

Offline

#6 2024-10-25 23:34:09

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,330
Website

Re: How to build an RPM package

jenetism wrote:

So, let's just assume I have to use Astrill, with rpm or deb format, is there nothing I can do to build it?

As I said before .rpm is not a source tarball, neither is .deb, these are prebuilt binaries for other distros.  You can't build something that is prebuilt.  But it can be used, also just as I said before, an .rpm can be converted to a pacman package, as can a .deb if there is no source available.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#7 2024-10-26 02:36:57

Funny0facer
Member
From: Germany
Registered: 2022-12-03
Posts: 157

Re: How to build an RPM package

Did you try to download the the "Linux CLI 64-bit" from https://www.astrill.com/download/linux instead of the RPM? Unfortunately there is a login barrier and I do not want to create an account there.

Offline

#8 2024-10-26 03:13:03

cryptearth
Member
Registered: 2024-02-03
Posts: 1,015

Re: How to build an RPM package

jenetism wrote:

VPN in China

now we get a base-line
although I have suspected this to be the case it's an important base information that should be added to your initial post
in any case: the best option would be if you would be able to connect to any random ip outside of china and use openvpn to setup your own vpn - by the numbers of attacks my mailserver logs each day from china this doesn't seem to be difficult
the next best option is to search for a provider actifely supporting linux or arch directly - from what you report Astrill doesn't seem to have interest in active supporting your issue - no matter if thier service has high reliability
if you want to stick to Astrill you could either use a vm or switch to a debian or redhat based distro - as Chris Titus often says: the base distro you're on shouldn't match as most things can be done on any of them - and aside from Arch the other base distro he recommends is vanilla debian
as for redhat based distro: there's popular opensuse which uses rpm as its package format - and if you're ok to use overall a bit not-so-up-to-date versions it's fine for productive work and gaming - and one of the few distros I experienced active support for from the gaming community

Offline

#9 2024-10-26 03:17:46

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,330
Website

Re: How to build an RPM package

Recommending a different distro just to be able to use software distributed as .rpm / .deb is ridiculous.  Again, there are simple tools to convert either of these to pacman packages.  As a solution, such conversion would be less appealing than just properly building from source, but worlds better than installing an entirely different distro or moving to another country.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#10 2024-10-26 03:33:05

cryptearth
Member
Registered: 2024-02-03
Posts: 1,015

Re: How to build an RPM package

it's at least some idea rather than "suxx to be you"
OP is unfortunate enough to was born there - and I actually do see switching distro as a valid option here as changing vpn provider to one which does support Arch is another valid option OP denies
if it's OP who wants to bite the bullet I'm just offering additional to chose from
it's basically an XY problem: OP wants to use that service but the service doesn't support Arch - and if using another service is denied then go ahead and use another distro - sometimes it is as simple as that
calling that ridiculous is once again pretty much the definition of the arch meme and as stubborn as OPs "don't wanna use a different service"
although - try to move out of china would be another - or try to throw over the dictatorship - wait, we've seen the result to that one already: june 17 1953 in berlin and june 3/4 1989 in beijing

Offline

#11 2024-10-26 03:41:07

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,330
Website

Re: How to build an RPM package

cryptearth wrote:

it's at least some idea rather than "suxx to be you"

Which is not something anyone has said here.  Are my posts not visible in this thread?  There's one good solution, and one okay solution, offering a crappy option on top of those does not make it the only alternative to "suxx to be you".

Last edited by Trilby (2024-10-26 03:42:49)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#12 2024-10-26 05:57:09

progandy
Member
Registered: 2012-05-17
Posts: 5,266

Re: How to build an RPM package

Funny0facer wrote:

Did you try to download the the "Linux CLI 64-bit" from https://www.astrill.com/download/linux instead of the RPM? Unfortunately there is a login barrier and I do not want to create an account there.

According to an AUR comment that one should work. https://aur.archlinux.org/packages/astrill
Edit: Oh, that comment was from the OP.

You can try to use the .sh installer as a base to create the pkgbuild. It contains an archive with the compiled application and no source code.
https://www.astrilldownloads.com/astril … linux64.sh

Get the archive and extract it:

sed -e "1,/^__ARCHIVE_BELOW__\$/d" astrill-setup-linux64.sh >astrill-setup-linux64.tar.xz
bsdtar -xf astrill-setup-linux64.tar.xz 

And the script part you have to translate to a PKGBUILD. As the program comes with its own libraries, you should install it to /opt. If it is compiled badly, you might have to let it stay in /usr/local even though that is not good practice.

#!/bin/sh
INSTALL_DIR="/usr/local/Astrill"
if [ "$1" != "--sudo" ]; then
	echo ====================================================
	echo Welcome to Astrill Command Line Installer for Linux
	echo ====================================================
	echo Astrill will be installed in \"$INSTALL_DIR\" &&
	if [ `id -u` -ne 0 ]; then
		echo Please enter your root password when prompted.
		echo Hit ENTER to continue or hit Ctrl+C to abort
		read x
		eval "sudo \"$0\" --sudo" && exit 0 || exit 1
	else
		echo Hit ENTER to continue or hit Ctrl+C to abort
		read x
	fi
fi
if [ `id -u` -ne 0 ]; then
	echo "ERROR: You must be root to run setup. Setup is aborted."
	echo "Please run setup using: sudo $0"
	exit 1
fi
# Disable SELinux - LSP crashes with SELinux enabled which breaks booting and crashes various apps
if which setenforce >/dev/null 2>&1 ; then
	setenforce 0 2>/dev/null >/dev/null
fi &&
if [ -f /etc/selinux/config ]; then
	[ ! -L /etc/sysconfig/selinux ] && ln -sf ../selinux/config /etc/sysconfig/selinux
	sed -i "s/^SELINUX=.*\$/SELINUX=disabled/" /etc/selinux/config
fi &&
( killall -q astrill; i=1; ) &&
rm -rf "$INSTALL_DIR" &&
mkdir -p "$INSTALL_DIR" &&
echo "Extracting files..." &&
sed -e "1,/^__ARCHIVE_BELOW__\$/d" "$0" | tar -xjpf - -C "$INSTALL_DIR" --touch >/dev/null &&
echo "Setting permissions..." &&
chmod -R 755 "$INSTALL_DIR" &&
find "$INSTALL_DIR" -type f -exec chmod 644 {} \; &&
for i in asovpnc aswgvpnc openweb asproxy astrill lsptest lsptest64; do if [ -e "$INSTALL_DIR/$i" ]; then chmod 755 "$INSTALL_DIR/$i"; fi; done &&
chown 0:0 "$INSTALL_DIR/asproxy" &&
chmod 4755 "$INSTALL_DIR/asproxy" &&
echo "Installing reconnect service" &&
if which systemctl >/dev/null 2>&1; then
	mkdir -p /etc/systemd/system
	echo "[Unit]
Description=Astrill reconnect after sleep/hibernate
After=suspend.target
After=hibernate.target
After=hybrid-sleep.target

[Service]
Type=oneshot
ExecStart=/usr/local/Astrill/astrill /reconnect

[Install]
WantedBy=suspend.target
WantedBy=hibernate.target
WantedBy=hybrid-sleep.target" > /etc/systemd/system/astrill-reconnect.service
	systemctl enable astrill-reconnect.service
else
mkdir -p /etc/pm/sleep.d &&
echo "#!/bin/sh

export PATH=/sbin:/usr/sbin:/bin:/usr/bin

case \$1 in
	resume|thaw)
		/usr/local/Astrill/astrill /reconnect
	;;
esac
" > /etc/pm/sleep.d/90_astrill &&
chmod +xxx /etc/pm/sleep.d/90_astrill
fi &&
if ! /usr/local/Astrill/astrill /gtk2checkengine; then
	echo "WARNING: Your system is missing pixbuf theme engine. Please install package gtk2-engines-pixbuf or gtk2-engines"
fi &&
echo "Creating icons..." &&
mkdir -p /usr/share/applications &&
echo y | cp -f "$INSTALL_DIR/Astrill.desktop" "/usr/share/applications/" &&
chmod 755 "/usr/share/applications/Astrill.desktop" &&
if [ -d "$HOME/Desktop" ]; then
	echo y | cp -f /usr/local/Astrill/Astrill.desktop "$HOME/Desktop/" &&
	chmod 755 "$HOME/Desktop/Astrill.desktop" &&
	chown $(stat -c "%u:%g" "$HOME/Desktop") "$HOME/Desktop/Astrill.desktop"
fi &&
if [ -x "`which update-menus 2>/dev/null`" ]; then
  update-menus
fi &&
if which update-icon-caches >/dev/null 2>&1 ; then
  update-icon-caches /usr/share/icons/hicolor
fi &&
echo "# Exclude apps if they crash by liblsp due to apparmor
grotty
groff
man" > /etc/lsp.exclude &&
echo "Installing LSP..." &&
if ! /usr/local/Astrill/asproxy --init; then
	echo FAILED TO INSTALL LSP
	exit 1
fi &&
if ! setcap cap_net_admin,cap_net_raw+ep /usr/local/Astrill/astrill; then
	echo FAILED to set capabilities on astrill executable
	exit 1
fi
echo ==================================================== &&
echo "DONE !" &&
echo "Please restart your web browser for all changes to take effect" &&
exit 0
exit 1
__ARCHIVE_BELOW__

Last edited by progandy (2024-10-26 06:11:40)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#13 2024-10-26 09:32:04

jenetism
Member
Registered: 2024-02-28
Posts: 5

Re: How to build an RPM package

Hi Progandy,
Thanks for your help
Eventually I just ran the .sh file and called it a day
I still had too long a way to go before I understand how to create a package from it
Gonna call this resolve now

So for anyone who want to install from source just chmod +xxx the .sh script which you can download from official website
and then run ./[whateverscript].sh

Offline

Board footer

Powered by FluxBB