Repository navigation
Expand file tree
/
Copy pathupdate
More file actions
119 lines (101 loc) · 3.15 KB
/
Copy pathupdate
File metadata and controls
119 lines (101 loc) · 3.15 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#!/usr/bin/env zsh
#-----------------------------------------------------------------------
# This script is to update all Mac/Linux softwares
#
# Author: Hao Feng (F1)
# Init Date: Mar. 13, 2022
# Last Date: Apr. 01, 2023
#
# Copyright (c) 2022, RDS
#-----------------------------------------------------------------------
# since 'update' is called usually through 'ini update', passed parameter
# is listed as 2nd order.
# If you call 'update' directly, $2 should be changed as $1.
# (I have no time to fix the parameters order.)
if [[ $2 == "" ]]; then
if [[ `uname` == "Darwin" ]]; then
# update=(mac brew ai llm mactex)
update=(mac brew)
elif [[ `uname` == "Linux" ]]; then
update=(apt)
fi
else
update=($2)
fi
echoline () {
echo "--------------------------------------------------"
}
function printc_d {
bg=44
fg=37
txt=$1
echo -e "\033[${bg};${fg}m${txt}\033[0m"
}
function print_welcome () {
printc_d "-----------------------------------------------------"
printc_d " This script is to update all Mac/Linux Softwares "
printc_d " "
printc_d " Author: Hao Feng (F1) "
printc_d " "
printc_d " Copyright (c) 2022, RDS "
printc_d " "
printc_d "-----------------------------------------------------"
echo
echo " The following packages will be updated ... "
echo
echo " ${update[@]} "
echo
printc_d "-----------------------------------------------------"
}
print_welcome
num=0
total=${#update[@]}
for mission in ${update[@]}; do
let num++
echo
# echoline
printc_d "[$num/$total]: $mission "
case $mission in
mac)
printc_d " Updating Mac OS system & softwares ... "
echo
softwareupdate --all --install --force
;;
*brew*)
source ~/Init/$mission
printc_d " Updating Homebrew ($mission) applications ... "
echo
echo " * BREW HOME: $HOMEBREW_REPOSITORY"
echo
brewup
echo
echo "Clean up all brew caches ..."
echo "----------------------------"
brew cleanup
;;
*forge | ai | bd | dcm* | *conda* | cloud | llm)
source ~/Init/$mission
printc_d " Updating $condaenv ... "
echo
condaup
if [[ $mission == aconda ]]; then acondaup; fi
condaclean
;;
apt)
printc_d " Updating Ubuntu Linux apt softwares ... "
echo
sudo apt-get update -y && sudo apt-get upgrade -y
sudo apt-get autoremove -y
;;
mactex)
source ~/Init/$mission
printc_d " Updating MacTex ... "
echo
tex_update
;;
*)
printc_d " $mission is NOT in the update lists ..."
echo
;;
esac
done