-
-
Save rumpelsepp/d646750910be19332753 to your computer and use it in GitHub Desktop.
#!/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" |
@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
That's a suggestion which is definitely worth it. :D
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
You can't build packages as root!! The errormessage describes the problem quite well:
http://allanmcrae.com/2015/01/replacing-makepkg-asroot/
For some reason pacaur is not getting cloned i had to manually clone it on tmp folder and run the script
- 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/
same as above
pacaur is getting cloned inside cower folder adding cd ..
before git clone "https://aur.archlinux.org/pacaur.git"
should solve the problem
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.
Any ideas how I can get notifications in gist.github.com? I always miss you guys...
The issue should be fixed.
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.
Strange. I fixed it accordingly; since I use debian now I cannot test it. So, I hope nothing else breaks. :D
@rumpelsepp Gave this a go today and it's working just fine 👍
I think sudo pacman -S cower
also should have the flags --needed --noconfirm
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.