Repository navigation
Expand file tree
/
Copy pathupgrade.sh
More file actions
executable file
·97 lines (85 loc) · 2.73 KB
/
Copy pathupgrade.sh
File metadata and controls
executable file
·97 lines (85 loc) · 2.73 KB
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#!/bin/sh
#upgrade LARBS installation. all functions, whether modified or not,
# are copied from the original larbs.sh script
#progsfile="https://raw.githubusercontent.com/dimonf/LARBS/master/progs.csv"
#use local file, to facilitate testing before commit
progsfile=progs.csv
home_dir="/home/$USER"
repodir="$home_dir/.local/src"
aurhelper="yay"
installpkg() {
sudo pacman --noconfirm --needed -S "$1" >/dev/null 2>&1
}
maininstall() {
# Install from main repo.
installpkg "$1"
}
gitmakeinstall() {
progname="${1##*/}"
progname="${progname%.git}"
base_dir=$2
compile=$3
prog_dir="$base_dir/$progname"
# echo "trying to git into $base_dir / $prog_dir from $1"
git -C "$base_dir" clone --depth 1 --single-branch \
--no-tags -q "$1" "$prog_dir" 2>/dev/null ||
{
cd "$prog_dir" || return 1
# echo "trying to 'git pull' in $prog_dir"
git pull --force origin master
}
if [ -n $compile ]; then
cd "$prog_dir" || exit 1
make >/dev/null 2>&1
sudo make install >/dev/null 2>&1
cd /tmp || return 1
fi
}
aurinstall() {
echo "$installed" | grep -q "^$1$" && return 1
$aurhelper -S --noconfirm "$1" >/dev/null 2>&1
}
pipinstall() {
[ -x "$(command -v "pip")" ] || installpkg python-pip >/dev/null 2>&1
yes | pip install "$1"
}
update_loop() {
progsfile=$1
for tag in A G g P ,; do
case $tag in
"A") installed=$(pacman -Qqm) ;;
"G") installed=$(find $repodir -maxdepth 1 -mindepth 1 -type d -exec basename '{}' \;) ;;
"g") installed="" ;;
"P") command -v pip &>/dev/null && installed=$(pip list) ;;
",") installed=`pacman -Q` ;;
esac
#group programs by tag
grep -E "^$tag" $progsfile | while IFS=, read tag program comment; do
#derive destination for git based installation (separated by '|')
echo $program | grep -q '|' && destination=${program#*|} && program=${program%|*}
destination="${destination/#\~/$HOME}"
#skip if already installed
echo "$installed" | grep -q "^$program" && echo "[$tag]$program: already installed, ignoring" && continue
echo "doing [$tag]$program ..."
case $tag in
"A") aurinstall "$program" ;;
"G") gitmakeinstall "$program" "$repodir" compile ;;
"g") gitmakeinstall "$program" "$destination" ;;
"P") pipinstall "$program" "$comment" ;;
*) maininstall "$program" "$comment" ;;
esac
done
done
}
#installationloop
update_loop $1
# enable screen power off
SCR_FILE=/etc/X11/xorg.conf.d/10-screen-off.conf
[ ! -f $SCR_FILE ] && sudo touch $SCR_FILE && sudo tee $SCR_FILE << 'EOF'
Section "Monitor"
Option "DPMS" "true"
EndSection
Section "ServerFlags"
Option "StandbyTime" "15"
EndSection
EOF