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"
@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