summaryrefslogtreecommitdiffstats
path: root/scripts/bootstrap/layman_reinit.sh
blob: 6f977c71f6e9f4e419b6c2f2d8f18ffd6c294bd5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#! /bin/bash

(
    repos=$(xmllint -xpath "//repo/name/text()|//repo/source/text()" /etc/portage/layman.xml  | xargs -n2)      #"
    repos_enabled=$(cat /etc/portage/repos.conf/layman.conf | grep -oP "\[\K[^]]*")
    
    cd /etc/portage
    
    layman -d ALL
    layman -L &> /dev/null
    for repo in "$repos_enabled"; do
        repo_src=$(echo "$repos" | grep -P "^$repo" | awk '{ print $2 }')
        if [ -n "$repo_src" ]; then
            layman -a "$repo" -O "$repo_src"
        else
            layman -a "$repo"
        fi
    done

    git checkout -- layman.xml
    git checkout -- repos.conf/layman.conf 
)