fix: debian list

This commit is contained in:
Cyrille L 2022-03-30 11:46:16 +02:00
parent 47f8ac7629
commit eb0946cb87
2 changed files with 9 additions and 4 deletions

View File

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
# version: 0.0.15 # version: 0.0.16
# file: upd # file: upd
# Folder: /usr/local/bin # Folder: /usr/local/bin
# By echolib # By echolib

View File

@ -21,6 +21,7 @@ upd__prepare_show
# Check for updates if debian (apt based) # Check for updates if debian (apt based)
#====================================================================== #======================================================================
upd__check_deb() { upd__check_deb() {
echo
upd__sudoroot # Tools: Check if user is admin upd__sudoroot # Tools: Check if user is admin
sudo apt-get update -qq sudo apt-get update -qq
@ -30,13 +31,17 @@ sudo apt list --upgradable -a 2>/dev/null \
| grep "now" \ | grep "now" \
> "$upd_file_tmp_apt" > "$upd_file_tmp_apt"
# Converting datas # Converting datas
[[ -f "$upd_file_check" ]] \
&& rm -f "$upd_file_check"
touch "$upd_file_check"
while read -r "pkg" "old" "new" while read -r "pkg" "old" "new"
do do
pkg=`echo $pkg | awk -F"/" '{print $1}'` pkg=`echo "$pkg" | awk -F'/' '{print $1}'`
new=`echo $new | awk '{print $NF}'` new=`echo "$new" | awk '{print $NF}'`
new=${new/]/} new=${new/]/}
echo "$pkg $old -> $new" > "$upd_file_check" echo "$pkg $old -> $new" >> "$upd_file_check"
done < <( cat "$upd_file_tmp_apt") done < <( cat "$upd_file_tmp_apt")
rm -f "$upd_file_tmp_apt" rm -f "$upd_file_tmp_apt"