Skip to content

Instantly share code, notes, and snippets.

@blakek
Last active October 29, 2019 06:32
Show Gist options
  • Save blakek/39ac11b5ca63ba402d2b to your computer and use it in GitHub Desktop.
Save blakek/39ac11b5ca63ba402d2b to your computer and use it in GitHub Desktop.
An easy yaourt install script for Arch Linux (and variants). Made so I can set up Arch either offline or online without having to remember what I need.
#!/bin/bash -e
make_a_pkg() {
printf '** Making package "%s"...\n' "$1"
tar zxf "$1.tar.gz"
cd "$1"
makepkg -si
cd ..
}
download_dependencies() {
echo '** Getting needed packages...'
echo 'package-query'
curl -O# https://aur.archlinux.org/packages/pa/package-query/package-query.tar.gz
echo 'yaourt'
curl -O# https://aur.archlinux.org/packages/ya/yaourt/yaourt.tar.gz
}
install_from_local() {
make_a_pkg package-query
make_a_pkg yaourt
}
install_as_repo() {
echo '
[archlinuxfr]
SigLevel = Never
Server = http://repo.archlinux.fr/$arch
' >> /etc/pacman.conf
pacman -Sy yaourt
}
show_help() {
echo 'install-yaourt.sh - easy yaourt install script
Usage: install-yaourt.sh OPTION
Where option is one of:
-r, --repo Installs as repo. This is the recommended method if you
have an Internet connection
-d, --get-depends Downloads dependencies only (no installation). Could be
used for offline installation.
-l, --local Installs (using makepkg) after you have the dependencies
(e.g. using --get-depends or after manual download)
--install-local Basically calls --get-depends then --local. It is
recommended to use --repo unless you have a reason not to'
}
if [[ "$1" == "--get-depends" || "$1" == "-d" ]]; then
download_dependencies
elif [[ "$1" == "--local" || "$1" == "-l" ]]; then
install_from_local
elif [[ "$1" == "--repo" || "$1" == "-r" ]]; then
install_as_repo
elif [[ "$1" == "--install-local" ]]; then
download_dependencies && install_from_local
else
show_help
exit 1
fi
echo '** DONE'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment