-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate
More file actions
executable file
·82 lines (72 loc) · 1.97 KB
/
Copy pathupdate
File metadata and controls
executable file
·82 lines (72 loc) · 1.97 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
#!/bin/bash
# script to update
# Copyright (C) 2020 Johannes Schmatz <johannes_schmatz@gmx.de>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
. ~/bin/bash.rc/config.sh
. ~/bin/bash.rc/alias.sh
function verb(){
echo -e "$C_BLUE$C_B_GREEN$@$C_NULL"
}
function run_update(){
verb "Updating..."
verb "$@"
# execute the package manager
$@
# grab the exit status
exit_status=$?
if [[ $exit_status != 0 ]]; then
echo "ERROR: exit status of '$@' is $exit_status!"
echo "please check manually!!!"
verb "aborting..."
exit 1
else
verb "Done."
fi
}
function detect_os(){
if [[ ! -s /etc/pacman.conf ]]; then
echo "raspbian"
else
echo "arch"
fi
}
case "$(detect_os)" in #(((
"arch")
if [[ "$(grep ILoveCandy /etc/pacman.conf)" != "ILoveCandy" ]]
then
echo 'Add the following lines to /etc/pacman.conf ' \
'in section [options]'
echo -e "\tILoveCandy"
fi
run_update "sudo pacman -Suy"
# run_update "sudo pacman -Suy --ignore dhcpcd"
# run_update "sudo pacman -Suy --ignore dhcpcd --ignore xf86-video-vesa"
;;
"raspbian")
run_update "sudo apt update && sudo apt upgrade"
;;
*)
echo "Distro not matched!"
echo "detect_os says: $(detect_os)"
echo "aborting..."
;;
esac
echo
verb "== Please restart the following processes =="
echo -ne "$C_RED$C_B_BLUE"
show_update_proc
echo -e "$C_NULL"
# syntax
# vim: ts=8 sts=8 sw=8 noet si syntax=bash