Skip to content

Instantly share code, notes, and snippets.

@rumpelsepp
Last active November 20, 2022 13:04
Show Gist options
  • Save rumpelsepp/d646750910be19332753 to your computer and use it in GitHub Desktop.
Save rumpelsepp/d646750910be19332753 to your computer and use it in GitHub Desktop.
A small script for arch linux which builds and installs "pacaur" automatically
#!/usr/bin/bash -l
#
# The MIT License (MIT)
#
# Copyright (c) 2015-2017 Stefan Tatschner
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
set -e
buildroot="$(mktemp -d)"
# Ask for user passwort once, see sudo(8).
sudo -v
# Make sure we can even build packages on arch linux.
sudo pacman -S --needed --noconfirm base-devel git
mkdir -p "$buildroot"
cd "$buildroot"
# Arch Linux ARM provides a cower package for the RPI!
# Let's either install 'cower' via pacman, or build it.
if [ "$(uname -n)" = 'alarmpi' ]; then
sudo pacman -S --needed --noconfirm cower
else
# Fetch Dave Reisner's key to be able to verify cower.
gpg --keyserver hkp://pool.sks-keyservers.net --recv-keys 487EACC08557AD082088DABA1EB2638FF56C0C53
git clone --depth=1 "https://aur.archlinux.org/cower.git"
cd "${buildroot}/cower"
makepkg --syncdeps --install --noconfirm
fi
cd "$buildroot"
git clone --depth=1 "https://aur.archlinux.org/pacaur.git"
cd "${buildroot}/pacaur"
makepkg --syncdeps --install --noconfirm
cd /
rm -rf "$buildroot"
@iakat
Copy link

iakat commented Sep 18, 2015

The PKGBUILD links 404.

@rumpelsepp
Copy link
Author

Thx. These were the old AUR3 links; fixed.

@conorbone
Copy link

I get key errors :
Verifying source file signatures with gpg... cower-16.tar.gz ... FAILED (unknown public key 1EB2638FF56C0C53) ==> ERROR: One or more PGP signatures could not be verified! ==> Making package: pacaur 4.6.3-1 (Thu 21 Apr 16:05:23 BST 2016) ==> Checking runtime dependencies... ==> Installing missing dependencies... error: target not found: cower ==> ERROR: 'pacman' failed to install missing dependencies.
any feedback?

@ansemjo
Copy link

ansemjo commented Apr 25, 2016

In my experience the keyservers pool is a bit flakey .. it seems you did not successfully receive the gpg key.
Because of that, cower did not install and pacaur had missing dependencies.
@conorbone, try running gpg --recv-keys 1EB2638FF56C0C53 manually beforehand ..

@rumpelsepp, personally I'd just use the default keyserver (currently hkp://keys.gnupg.net) or hkp://pgp.mit.edu
Also, I went back to using curl in my fork. Any reason against it, besides the long links?

@rumpelsepp
Copy link
Author

I somehow missed the notifications on the Gist. :/
Yeah, we could of course tweak the script a bit. I like your implementation using the loop and I would happily steal that. For git vs curl, it is just my personal taste... But yeah, git is required by pacaur anyway, so I think it does not make any difference.

@simnalamburt
Copy link

@rumpelsepp What about --depth=1! 😄

git clone "https://aur.archlinux.org/cower.git" --depth=1
git clone "https://aur.archlinux.org/pacaur.git" --depth=1

@rumpelsepp
Copy link
Author

That's a suggestion which is definitely worth it. :D

@diginfo
Copy link

diginfo commented Jul 21, 2016

I can't run this script, I get the makepkg as root error:

==> ERROR: Running makepkg as root is not allowed as it can cause permanent, catastrophic damage to your system

@rumpelsepp
Copy link
Author

rumpelsepp commented Aug 3, 2016

You can't build packages as root!! The errormessage describes the problem quite well:
http://allanmcrae.com/2015/01/replacing-makepkg-asroot/

Copy link

ghost commented Aug 31, 2016

For some reason pacaur is not getting cloned i had to manually clone it on tmp folder and run the script

@Erazx
Copy link

Erazx commented Sep 2, 2016

  • 1
Cloning into 'pacaur'...
remote: Counting objects: 104, done.
remote: Compressing objects: 100% (82/82), done.
remote: Total 104 (delta 43), reused 77 (delta 22)
Receiving objects: 100% (104/104), 13.79 KiB | 0 bytes/s, done.
Resolving deltas: 100% (43/43), done.
Checking connectivity... done.
install_pacaur.sh: line 50: cd: /tmp/tmp.1kbLTL6AYh/pacaur: No such file or directory

Can't found pacaur directory in /tmp/

@mkodekar
Copy link

mkodekar commented Sep 3, 2016

same as above

Copy link

ghost commented Sep 5, 2016

pacaur is getting cloned inside cower folder adding cd .. before git clone "https://aur.archlinux.org/pacaur.git" should solve the problem

@ianhattendorf
Copy link

Should be cd "$buildroot" || exit 1 just after the cower makepkg, still inside the if statement (could be after as well I guess). cd .. just before git clone will take you to /tmp on arm builds.

@rumpelsepp
Copy link
Author

Any ideas how I can get notifications in gist.github.com? I always miss you guys...

@rumpelsepp
Copy link
Author

The issue should be fixed.

@lumaku
Copy link

lumaku commented Feb 14, 2017

I had the error /bin/sh: pod2man: command not found. Executing the script with $ bash -l then worked.
It seems that the path variable is reset at some point. See here for a similar fix.

@rumpelsepp
Copy link
Author

rumpelsepp commented Mar 10, 2017

Strange. I fixed it accordingly; since I use debian now I cannot test it. So, I hope nothing else breaks. :D

@dsifford
Copy link

@rumpelsepp Gave this a go today and it's working just fine 👍

@mickael9
Copy link

I think sudo pacman -S cower also should have the flags --needed --noconfirm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment