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

(
    repos=$(xmllint -xpath "//repo/name/text()|//repo/source/text()" /etc/portage/layman.xml  | xargs -n2)

    cd /etc/portage
    
    layman -d ALL
    git checkout -- layman.xml

    for repo in $(cat /etc/portage/repos.conf/layman.conf | grep -oP "\[\K[^]]*"); 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
)