Skip to content

Commit 04f830c

Browse files
committed
v2.3.51
- zen_notify was not enought strict on driver update version to make a real effective comparison. New form is still under whatch to see if it is corresponding to all comparison cases. - zen_nofify was still pointing to /usr/local zenvidia version text. Changed to user zenvidia config directory. - Because May 7th decision, git remote origin source repository has been define in script.conf to be easely change in future. Script updated accordingly. - French translation nutshells
1 parent 79d252c commit 04f830c

File tree

1 file changed

+59
-22
lines changed

1 file changed

+59
-22
lines changed

zen_notify

+59-22
Original file line numberDiff line numberDiff line change
@@ -77,36 +77,73 @@ driver_ctrl(){
7777
cat $drv_temp| sed -En "s/^.*href.*'(.*)\/'>.*$/\1/p"| tail -n1 > $last_beta
7878
LAST_DRV=$(cat $last_update | awk '{ print $1 }')
7979
LAST_BETA=$(cat $last_beta)
80-
81-
## driver version could be in the form xxx.xxx.xxx or xxx.xx
82-
## it is needed to short it to number only.
83-
offi_short=$(echo "$LAST_DRV"| sed -n "s|\.||g;p")
84-
beta_short=$(printf "$LAST_BETA"| sed -n "s|\.||g;p")
85-
8680
if [ -s $nvdir/version.txt ]; then
8781
version=$(cat $nvdir/version.txt)
8882
else
8983
version=$(modinfo -F version nvidia)
9084
fi
91-
# unset ver_array last_array DRV_LIST
92-
ver_array=( $(sed -n "s/\./ /g;p" <<< $version) )
93-
94-
if [ $beta_short -ne $offi_short ]; then
95-
rem_diff=1
96-
last_array=( $(sed -n "s/\./ /g;p" <<< $LAST_BETA) )
85+
## driver version could be in the form xxx.xxx.xxx or xxx.xx
86+
## it is needed to short it to number only.
87+
offi_short(){
88+
if [ "$LAST_DRV" ]; then
89+
unset count_array prefix part
90+
count_array=( $(printf "$LAST_DRV"|tr . ' ') )
91+
for c in ${count_array[@]}; do
92+
i=$(printf "$c"|wc -m)
93+
for ((i=$i; i<3; i++)) { prefix='0';}
94+
part+=$(printf ${prefix}$c)
95+
done
96+
[ ${#count_array[*]} -eq 3 ] || suffix='000'
97+
echo "${part[*]}$suffix"
98+
else
99+
echo "0"
100+
fi
101+
}
102+
beta_short(){
103+
if [ "$LAST_BETA" ]; then
104+
unset count_array prefix part
105+
count_array=( $(printf "$LAST_BETA"|tr . ' ') )
106+
for c in ${count_array[@]}; do
107+
i=$(printf "$c"|wc -m)
108+
for ((i=$i; i<3; i++)) { prefix='0';}
109+
part+=$(printf ${prefix}$c)
110+
done
111+
[ ${#count_array[*]} -eq 3 ] || suffix='000'
112+
echo "${part[*]}$suffix"
113+
else
114+
echo "0"
115+
fi
116+
}
117+
ver_array(){
118+
if [ "$version" ]; then
119+
unset count_array prefix part
120+
count_array=( $(printf "$version"|tr . ' ') )
121+
for c in ${count_array[@]}; do
122+
i=$(printf "$c"|wc -m)
123+
for ((i=$i; i<3; i++)) { prefix='0';}
124+
part+=$(printf ${prefix}$c)
125+
done
126+
[ ${#count_array[*]} -eq 3 ] || suffix='000'
127+
echo "${part[*]}$suffix"
97128
else
98-
rem_diff=0
99-
last_array=( $(sed -n "s/\./ /g;p" <<< $LAST_DRV) )
129+
echo "0"
100130
fi
101-
for ((i=0;i<=2;i++)) {
102-
[ ${last_array[$i]} -eq ${ver_array[$i]} ] || drv_diff=1
103-
[ ${last_array[$i]} -gt ${ver_array[$i]} ] && greater=1
104131
}
132+
if [ $(beta_short) -ne $(offi_short) ]; then
133+
rem_diff=1 ; last_array=( $(beta_short) )
134+
else
135+
rem_diff=0 ; last_array=( $(offi_short) )
136+
fi
137+
for last in ${last_array[@]}; do
138+
[ ${last} -eq $(ver_array) ] || drv_diff=1
139+
[ ${last} -gt $(ver_array) ] && greater=1
140+
done
105141
if [ $rem_diff -eq 1 ]; then
106142
DRV_LIST=( $"$LAST_DRV, official driver" $"$LAST_BETA, beta driver" )
107143
else
108144
DRV_LIST=( $"$LAST_DRV, official drivers" )
109145
fi
146+
echo -e "${DRV_LIST[*]}"
110147
if [ ${#DRV_LIST[@]} -gt 0 ]; then
111148
IFS=$(echo -en "\n\b")
112149
cnt=0
@@ -151,14 +188,14 @@ source_ctrl(){
151188
CHECK_GIT_REPO(){
152189
local_date=$(env LANG=En_en date +%Y''%m''%d)
153190
# extract date from log
154-
git_rm_fetch_date=$(git log origin -n 1 | sed -n '/Date/p'| awk '{print $3" "$4" "$6}')
191+
git_rm_fetch_date=$(git log ${git_source} -n 1 | sed -n '/Date/p'| awk '{print $3" "$4" "$6}')
155192
# convert date to comparable number
156193
git_rm_date=$(date -d "$git_rm_fetch_date" +%Y''%m''%d)
157194
# extract version line
158-
git_rm_version=$(git log origin -n 1 | grep -E -o "v[0-9].*")
159-
#git_local_version=$(cat $local_nvdir/zen_version)
160-
git_local_version=$(cat $nvdir/zen_version)
161-
git_rm_fetch_log=$(git log origin -n 1 | sed -n "/-/,/-/p")
195+
git_rm_version=$(git log ${git_source} -n 1 | grep -E -o "v[0-9].*")
196+
git_local_version=$(cat $local_nvdir/zen_version)
197+
# git_local_version=$(cat $nvdir/zen_version)
198+
git_rm_fetch_log=$(git log ${git_source} -n 1 | sed -n "/-/,/-/p")
162199
# before acting, we need to know the last pull record in local dir.
163200
if [ $rep_git_local ]; then
164201
pushd $rep_git_local

0 commit comments

Comments
 (0)