OSDN Git Service

add multiple mirrors
[instantos/instantOS.git] / repo.sh
1 #!/bin/bash
2
3 ###############################################################################
4 ## add repo containing instantOS programs and required prebuilt aur programs ##
5 ###############################################################################
6
7 echo "adding instantOS repo"
8
9 addrepo() {
10     if ! grep -q '\[instant\]' /etc/pacman.conf; then
11         echo "adding $1 repo"
12         echo "[instant]" >>/etc/pacman.conf
13         echo "SigLevel = Optional TrustAll" >>/etc/pacman.conf
14         echo "Include = /etc/pacman.d/instantmirrorlist" >>/etc/pacman.conf
15         if [ -e /usr/share/instantutils/mirrors/"$1" ]; then
16             cat /usr/share/instantutils/mirrors/"$1" >/etc/pacman.d/instantmirrorlist
17         else
18             curl -s https://raw.githubusercontent.com/instantOS/instantOS/master/mirrors/"$1" >/etc/pacman.d/instantmirrorlist
19         fi
20     else
21         echo "instantOS $1 repository already added"
22     fi
23
24 }
25
26 if uname -m | grep -q '^x'; then
27     # default is 64 bit repo
28     addrepo amd64
29 elif uname -m | grep 'arm'; then
30     echo "no official arm repo yet"
31     exit
32     addrepo instantosarm
33 elif uname -m | grep '^i'; then
34     echo "no official 32 bit repo yet"
35     exit
36     addrepo instantos32
37 else
38     echo "no suitable repo for architecture found"
39 fi