summaryrefslogtreecommitdiffstats
path: root/root/posodobi.sh
blob: e490d843584e8e8553f9d27065dd233db2a2b0d2 (plain) (blame)
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
#!/bin/bash
if grep "cron" <<<"$@" > /dev/null
then
	# [ `ps aux | grep posod[o]bi | wc -l` -gt 1 ] && { echo posodobi.sh že teče. takole:; ps aux | grep posod[o]bi; exit 0; }
	i=`sed s,^./,,g <<<$0`
	t=`mktemp -p "" $i.XXX.html`
	status=$?
	if [ ! $status -eq 0 ]
	then
		echo začasne datoteke ni uspelo izdelati. mktemp je končal s $status.
		exit 1
	fi
	set -o pipefail
	$0 --no-ask --colour 2>&1 | aha --black --title "`hostname` $0 cron `date`" > $t
	status=$?
	if [ ! $status -eq 0 ]
	then
		echo posodobitev ni uspela. $0 je končal s $status. izhod je dostopen na http://tmp.sijanec.eu/`rev <<<$t | cut -d/ -f1 | rev`
	fi
	chmod go+r $t
	exit $status
fi
set -xe
f=
a=
grep "no-sync" <<<"$@" || /usr/sbin/emaint sync --auto
grep "no-ask" <<<"$@" || a=--ask
grep "colo" <<<"$@" && f="$f --color y"
[ `hostname` = varovalka ] && f="$f" # --exclude=media-libs/mesa
swap=/mnt/slu/a/tmp/swap
[ -f $swap ] && swapon $swap
trap "swapoff $swap" EXIT
emerge --tree --verbose --update $f $a --newuse --changed-use --backtrack 30 --deep --with-bdeps=y --rebuilt-binaries --autounmask --autounmask-write --autounmask-backtrack=y @world # --exclude=sci-electronics/kicad
emerge --verbose $f --autounmask-write --autounmask @preserved-rebuild
emerge --depclean $f
/root/linux/dist.sh
dmenu_path > /dev/null # update cache