Skip to content

Commit 2fd8472

Browse files
authored
Refactor Cockpit update_script part (#3878)
* Update cockpit.sh * formatting
1 parent 6e2cb8d commit 2fd8472

File tree

1 file changed

+32
-20
lines changed

1 file changed

+32
-20
lines changed

ct/cockpit.sh

Lines changed: 32 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -41,44 +41,56 @@ function update_script() {
4141
msg_ok "Updated ${APP} LXC"
4242
exit
4343
fi
44+
4445
if [ "$UPD" == "2" ]; then
4546
msg_info "Installing dependencies (patience)"
46-
$STD apt-get install -y attr
47-
$STD apt-get install -y nfs-kernel-server
48-
$STD apt-get install -y samba
49-
$STD apt-get install -y samba-common-bin
50-
$STD apt-get install -y winbind
51-
$STD apt-get install -y gawk
47+
$STD apt-get install -y \
48+
attr \
49+
nfs-kernel-server \
50+
samba \
51+
samba-common-bin \
52+
winbind \
53+
gawk
5254
msg_ok "Installed dependencies"
5355
msg_info "Installing Cockpit file sharing"
54-
curl -fsSL "$(curl -fsSL https://api.github.com/repos/45Drives/cockpit-file-sharing/releases/latest | grep download | grep focal_all.deb | cut -d\" -f4)" -o $(basename "$(curl -fsSL https://api.github.com/repos/45Drives/cockpit-file-sharing/releases/latest | grep download | grep focal_all.deb | cut -d\" -f4)")
55-
$STD dpkg -i cockpit-file-sharing_*focal_all.deb
56-
rm cockpit-file-sharing_*focal_all.deb
56+
URL=$(curl -fsSL https://api.github.com/repos/45Drives/cockpit-file-sharing/releases/latest | grep download | grep focal_all.deb | cut -d\" -f4)
57+
FILE=$(basename "$URL")
58+
curl -fsSL "$URL" -o "$FILE"
59+
$STD dpkg -i "$FILE" || $STD apt-get install -f -y
60+
rm -f "$FILE"
5761
msg_ok "Installed Cockpit file sharing"
5862
exit
5963
fi
64+
6065
if [ "$UPD" == "3" ]; then
6166
msg_info "Installing dependencies (patience)"
62-
$STD apt-get install -y psmisc
63-
$STD apt-get install -y samba
64-
$STD apt-get install -y samba-common-bin
67+
$STD apt-get install -y \
68+
psmisc \
69+
samba \
70+
samba-common-bin
6571
msg_ok "Installed dependencies"
6672
msg_info "Installing Cockpit identities"
67-
curl -fsSL "$(curl -fsSL https://api.github.com/repos/45Drives/cockpit-identities/releases/latest | grep download | grep focal_all.deb | cut -d\" -f4)" -o $(basename "$(curl -fsSL https://api.github.com/repos/45Drives/cockpit-identities/releases/latest | grep download | grep focal_all.deb | cut -d\" -f4)")
68-
$STD dpkg -i cockpit-identities_*focal_all.deb
69-
rm cockpit-identities_*focal_all.deb
73+
URL=$(curl -fsSL https://api.github.com/repos/45Drives/cockpit-identities/releases/latest | grep download | grep focal_all.deb | cut -d\" -f4)
74+
FILE=$(basename "$URL")
75+
curl -fsSL "$URL" -o "$FILE"
76+
$STD dpkg -i "$FILE" || $STD apt-get install -f -y
77+
rm -f "$FILE"
7078
msg_ok "Installed Cockpit identities"
7179
exit
7280
fi
81+
7382
if [ "$UPD" == "4" ]; then
7483
msg_info "Installing dependencies"
75-
$STD apt-get install -y rsync
76-
$STD apt-get install -y zip
84+
$STD apt-get install -y \
85+
rsync \
86+
zip
7787
msg_ok "Installed dependencies"
7888
msg_info "Installing Cockpit navigator"
79-
curl -fsSL "$(curl -fsSL https://api.github.com/repos/45Drives/cockpit-navigator/releases/latest | grep download | grep focal_all.deb | cut -d\" -f4)" -o $(basename "$(curl -fsSL https://api.github.com/repos/45Drives/cockpit-navigator/releases/latest | grep download | grep focal_all.deb | cut -d\" -f4)")
80-
$STD dpkg -i cockpit-navigator_*focal_all.deb
81-
rm cockpit-navigator_*focal_all.deb
89+
URL=$(curl -fsSL https://api.github.com/repos/45Drives/cockpit-navigator/releases/latest | grep download | grep focal_all.deb | cut -d\" -f4)
90+
FILE=$(basename "$URL")
91+
curl -fsSL "$URL" -o "$FILE"
92+
$STD dpkg -i "$FILE" || $STD apt-get install -f -y
93+
rm -f "$FILE"
8294
msg_ok "Installed Cockpit navigator"
8395
exit
8496
fi

0 commit comments

Comments
 (0)