OSDN Git Service

simplify keyboard layout setting
[instantos/instantOS.git] / repo.sh
1 #!/bin/bash
2
3 ###############################################################################
4 ## add repo containing instantOS programs and required prebuilt aur programs ##
5 ###############################################################################
6
7
8 whoami | grep -q 'root' || { echo "please run this as root" && exit 1
9 }
10
11 echo "adding instantOS repos"
12
13 addrepo() {
14
15     if grep -q '\[instant\]' /etc/pacman.conf; then
16         echo "removing old mirrors"
17         sed -i '/^\[instant\]/,+2d' /etc/pacman.conf
18     fi
19
20     echo "adding $1 repo"
21     {
22         echo "[instant]"
23         echo "SigLevel = Optional TrustAll"
24         echo "Include = /etc/pacman.d/instantmirrorlist"
25     }>>/etc/pacman.conf
26
27     if [ -e /usr/share/instantutils/mirrors/"$1" ]; then
28         cat /usr/share/instantutils/mirrors/"$1" >/etc/pacman.d/instantmirrorlist
29     else
30         curl -s https://raw.githubusercontent.com/instantOS/instantOS/master/mirrors/"$1" >/etc/pacman.d/instantmirrorlist
31     fi
32
33 }
34
35 if uname -m | grep -q '^x'; then
36     # default is 64 bit repo
37     addrepo amd64
38 elif uname -m | grep 'arm'; then
39     echo "no official arm repo yet"
40     exit
41     addrepo instantosarm
42 elif uname -m | grep '^i'; then
43     echo "no official 32 bit repo yet"
44     exit
45     addrepo instantos32
46 else
47     echo "no suitable repo for architecture found"
48 fi
49
50 echo "done adding the instantos repository"
51