Commit 4ee7af09 authored by Vladislav's avatar Vladislav

Added disabled stat func

parent 629f50e0
...@@ -849,8 +849,7 @@ debug_timer () { ...@@ -849,8 +849,7 @@ debug_timer () {
# Поиск нужного .desktop файла по $portwine_exe (для показа в комментариях нужного времени) # Поиск нужного .desktop файла по $portwine_exe (для показа в комментариях нужного времени)
# Параллельное создание базы по времени после завершения приложения # Параллельное создание базы по времени после завершения приложения
search_desktop_file () { search_desktop_file () {
local desktop_file desktop_file_new line1 line2 line3 line4 count_line i local desktop_file desktop_file_new line1 line2 FILE_SHA256SUM_ARRAY EXEC_DESKTOP BROKEN_LINE FILE_SHA256SUM_FOUND FILE_SHA256SUM_NOT_FOUND
local EXEC_DESKTOP TIME_TOTAL BROKEN_LINE FILE_SHA256SUM_ARRAY FILE_SHA256SUM_FOUND FILE_SHA256SUM_NOT_FOUND SKIP_REPAIR
if [[ -z $FILE_SHA256SUM ]] ; then if [[ -z $FILE_SHA256SUM ]] ; then
read -r -a FILE_SHA256SUM_ARRAY < <(sha256sum "$portwine_exe") read -r -a FILE_SHA256SUM_ARRAY < <(sha256sum "$portwine_exe")
FILE_SHA256SUM=${FILE_SHA256SUM_ARRAY[0]} FILE_SHA256SUM=${FILE_SHA256SUM_ARRAY[0]}
...@@ -869,6 +868,10 @@ search_desktop_file () { ...@@ -869,6 +868,10 @@ search_desktop_file () {
fi fi
fi fi
done < "$desktop_file" done < "$desktop_file"
if [[ $portwine_exe == "${EXEC_DESKTOP//\"/}" ]] ; then
DESKTOP_CORRECT_FILE="$desktop_file"
fi
if [[ $DESKTOP_WITH_TIME == enabled ]] || [[ $SORT_WITH_TIME == enabled ]] ; then
while IFS=" " read -r -a line2 ; do while IFS=" " read -r -a line2 ; do
if [[ -z ${line2[0]} ]] \ if [[ -z ${line2[0]} ]] \
|| [[ ! ${line2[0]} =~ (.[Bb][Aa][Tt]$|.[Ee][Xx][Ee]$|.[Mm][Ss][Ii]$|.[Rr][Ee][Gg]$) ]] ; then || [[ ! ${line2[0]} =~ (.[Bb][Aa][Tt]$|.[Ee][Xx][Ee]$|.[Mm][Ss][Ii]$|.[Rr][Ee][Gg]$) ]] ; then
...@@ -883,27 +886,26 @@ search_desktop_file () { ...@@ -883,27 +886,26 @@ search_desktop_file () {
FILE_SHA256SUM_NOT_FOUND=1 FILE_SHA256SUM_NOT_FOUND=1
fi fi
done < "$PORT_WINE_TMP_PATH/statistics" done < "$PORT_WINE_TMP_PATH/statistics"
if [[ $portwine_exe == "${EXEC_DESKTOP//\"/}" ]] ; then
DESKTOP_CORRECT_FILE="$desktop_file"
fi fi
fi fi
fi fi
done done
IFS="$orig_IFS" IFS="$orig_IFS"
if [[ $DESKTOP_WITH_TIME == enabled ]] || [[ $SORT_WITH_TIME == enabled ]] ; then
local line3 line4 count_line i TIME_TOTAL SKIP_REPAIR
## Ремонты: ## Ремонты:
# Когда приложения ещё нет в статистике
[[ -z ${line2[2]} ]] && line2[2]=0
## TODO: ремонтирует devel пр с entry point потом можно будет это дропнуть # Ремонт, проверяет чтобы длинна хеш суммы была равна 64 символам, в ином случае удалит битые
if [[ $FILE_SHA256SUM_NOT_FOUND == 1 ]] && [[ ${#line2[1]} != "64" ]] ; then if [[ $FILE_SHA256SUM_NOT_FOUND == 1 ]] && [[ ${#line2[1]} != "64" ]] ; then
while IFS=" " read -r -a line3 ; do while IFS=" " read -r -a line3 ; do
if [[ ${#line3[1]} == "64" ]] if [[ ${#line3[1]} == "64" ]]
then echo "${line3[*]}" then echo "${line3[*]}"
fi fi
done < "$PORT_WINE_TMP_PATH/statistics" > "$PORT_WINE_TMP_PATH/statistics_repair" done < "$PORT_WINE_TMP_PATH/statistics" > "$PORT_WINE_TMP_PATH/statistics_repair"
IFS="$orig_IFS"
try_remove_file "$PORT_WINE_TMP_PATH/statistics" try_remove_file "$PORT_WINE_TMP_PATH/statistics"
mv -f "$PORT_WINE_TMP_PATH/statistics_repair" "$PORT_WINE_TMP_PATH/statistics" mv -f "$PORT_WINE_TMP_PATH/statistics_repair" "$PORT_WINE_TMP_PATH/statistics"
return 0 search_desktop_file
fi fi
# Ремонт, если есть пустые строки и непонятные строки без .exe, .bat, .msi, .reg # Ремонт, если есть пустые строки и непонятные строки без .exe, .bat, .msi, .reg
...@@ -913,9 +915,10 @@ search_desktop_file () { ...@@ -913,9 +915,10 @@ search_desktop_file () {
then echo "${line4[*]}" then echo "${line4[*]}"
fi fi
done < "$PORT_WINE_TMP_PATH/statistics" > "$PORT_WINE_TMP_PATH/statistics_repair" done < "$PORT_WINE_TMP_PATH/statistics" > "$PORT_WINE_TMP_PATH/statistics_repair"
IFS="$orig_IFS"
try_remove_file "$PORT_WINE_TMP_PATH/statistics" try_remove_file "$PORT_WINE_TMP_PATH/statistics"
mv -f "$PORT_WINE_TMP_PATH/statistics_repair" "$PORT_WINE_TMP_PATH/statistics" mv -f "$PORT_WINE_TMP_PATH/statistics_repair" "$PORT_WINE_TMP_PATH/statistics"
return 0 search_desktop_file
fi fi
# Ремонтирует путь на новый, если вдруг путь до .exe файла битый или изменился, но .exe файл он опознал # Ремонтирует путь на новый, если вдруг путь до .exe файла битый или изменился, но .exe файл он опознал
...@@ -930,6 +933,8 @@ search_desktop_file () { ...@@ -930,6 +933,8 @@ search_desktop_file () {
line2[1]=$FILE_SHA256SUM line2[1]=$FILE_SHA256SUM
fi fi
# Когда приложения ещё нет в статистике
[[ -z ${line2[2]} ]] && line2[2]=0
# Ремонт, если сломалось время # Ремонт, если сломалось время
if [[ ! ${line2[2]} =~ [0-9]+ ]] || (( line2[2] >= 999999999 )) ; then if [[ ! ${line2[2]} =~ [0-9]+ ]] || (( line2[2] >= 999999999 )) ; then
sed -i "s|${line2[1]} ${line2[2]}|${line2[1]} 0|" "$PORT_WINE_TMP_PATH/statistics" sed -i "s|${line2[1]} ${line2[2]}|${line2[1]} 0|" "$PORT_WINE_TMP_PATH/statistics"
...@@ -958,7 +963,7 @@ search_desktop_file () { ...@@ -958,7 +963,7 @@ search_desktop_file () {
echo "${portwine_exe// /#@_@#} $FILE_SHA256SUM $TIME_TOTAL OLD_DESKTOP" >> "$PORT_WINE_TMP_PATH/statistics" echo "${portwine_exe// /#@_@#} $FILE_SHA256SUM $TIME_TOTAL OLD_DESKTOP" >> "$PORT_WINE_TMP_PATH/statistics"
fi fi
count_line=4 count_line=4
# Здесь добавляются новые линии для статистики # Здесь добавляются новые линии для статистики (L4-) важен
if [[ -z ${line2[4]} ]] ; then if [[ -z ${line2[4]} ]] ; then
SKIP_REPAIR=1 SKIP_REPAIR=1
sed -i "s|$FILE_SHA256SUM \(.*\)|$FILE_SHA256SUM \1 L4-1|" "$PORT_WINE_TMP_PATH/statistics" sed -i "s|$FILE_SHA256SUM \(.*\)|$FILE_SHA256SUM \1 L4-1|" "$PORT_WINE_TMP_PATH/statistics"
...@@ -996,7 +1001,8 @@ search_desktop_file () { ...@@ -996,7 +1001,8 @@ search_desktop_file () {
sed -i "s|${portwine_exe// /#@_@#} $FILE_SHA256SUM \(.*\)|${line2[*]}|" "$PORT_WINE_TMP_PATH/statistics" sed -i "s|${portwine_exe// /#@_@#} $FILE_SHA256SUM \(.*\)|${line2[*]}|" "$PORT_WINE_TMP_PATH/statistics"
fi fi
# Сюда все sedы от L4, L5 и т.д. (после всех ремонтов) # Сюда все sedы от L4, L5 и т.д. (после всех ремонтов)
sed -i "s|$FILE_SHA256SUM \(.*\) L4-${line2[4]}|$FILE_SHA256SUM \1 L4-$NUMBER_OF_STARTS|" "$PORT_WINE_TMP_PATH/statistics" sed -i "s|$FILE_SHA256SUM \(.*\) ${line2[4]}|$FILE_SHA256SUM \1 L4-$NUMBER_OF_STARTS|" "$PORT_WINE_TMP_PATH/statistics"
fi
fi fi
fi fi
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment