summaryrefslogtreecommitdiffstats
path: root/arch-up
blob: 2afb06591c094df052fd21032589d8ae0193bc72 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#! /bin/bash
RESET="\033[0m"
RED="\033[0;31m"
CYAN="\033[0;36m"

function run() {
    echo -e "$CYAN $1 $RESET" && $1
}

function sudo_run() {
    echo -e "$RED sudo$CYAN $1 $RESET" && sudo $1
}

function update_gem() {
    run "/usr/bin/gem update"
    run "/usr/bin/gem clean"
    # run "/opt/ruby1.8/bin/gem update"
    # run "/opt/ruby1.8/bin/gem clean"
}

function update_pkgs() {
    sudo_run "pacman -Syu"
    sudo_run "pacman -Scc --noconfirm"
    sudo_run "rm /var/cache/pacman/pkg/*"
    run "aurget -Syu"
}

function update_makepkg () {
    pkg=$1
    src_dir=$2
    base=~/local
    if [ -d $base/$pkg/src/$src_dir ]; then
        echo -e "$CYAN update $pkg $RESET"
        cd $base/$pkg/src/$src_dir
        if [ $(git pull | grep Already | wc -l) -ne 0 ]; then
            echo "$pkg is Already up-to-date"
        else
            cd $base/$pkg/
            rm *.pkg.tar.xz 2>/dev/null
            makepkg && sudo_run "pacman -Uf --noconfirm $pkg*.pkg.tar.xz"
        fi
    else
        echo "~/local/$pkg/src/$src_dir does not exists"
    fi
}

function update_e17() {
    run "easy_e17.sh -u --sudopwd=$PASSWD $@"
    # sudo_run "find /opt/e17 -mtime +30 ! -type d -exec rm '{}' \;"
    if [ -e ~/local/eperiodique ]; then
        cd ~/local/eperiodique
        if [ $(git pull | grep Already | wc -l) -ne 1 ]; then
            echo "update eperiodique" && ./autogen.sh --prefix=/usr >/dev/null && make >/dev/null && sudo make install >/dev/null
        fi
    fi
}

function check_etc_git() {
    [ -e /etc/.git ] || return
    run "cd /etc"
    sudo_run "find . -name *.pacnew"
    sudo_run "git status"
}