Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
PortWINE
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Mikhail Tergoev
PortWINE
Commits
629f50e0
Commit
629f50e0
authored
Oct 28, 2024
by
Vladislav
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed bugs
parent
0c97d2c0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
27 deletions
+45
-27
functions_helper
data_from_portwine/scripts/functions_helper
+45
-27
No files found.
data_from_portwine/scripts/functions_helper
View file @
629f50e0
...
@@ -850,7 +850,7 @@ debug_timer () {
...
@@ -850,7 +850,7 @@ debug_timer () {
# Параллельное создание базы по времени после завершения приложения
# Параллельное создание базы по времени после завершения приложения
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 line3 line4 count_line i
local
EXEC_DESKTOP TIME_TOTAL BROKEN_LINE FILE_SHA256SUM_ARRAY 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]
}
...
@@ -881,7 +881,6 @@ search_desktop_file () {
...
@@ -881,7 +881,6 @@ search_desktop_file () {
if [[
${
line2
[1]
}
!= "
$FILE_SHA256SUM
" ]]
\
if [[
${
line2
[1]
}
!= "
$FILE_SHA256SUM
" ]]
\
&& [[
${
line2
[0]
}
== "
${
portwine_exe
// /#@_@#
}
" ]] ; then
&& [[
${
line2
[0]
}
== "
${
portwine_exe
// /#@_@#
}
" ]] ; then
FILE_SHA256SUM_NOT_FOUND=1
FILE_SHA256SUM_NOT_FOUND=1
break
fi
fi
done < "
$PORT_WINE_TMP_PATH
/statistics
"
done < "
$PORT_WINE_TMP_PATH
/statistics
"
if [[
$portwine_exe
== "
${
EXEC_DESKTOP
//\
"/}"
]] ; then
if [[
$portwine_exe
== "
${
EXEC_DESKTOP
//\
"/}"
]] ; then
...
@@ -897,9 +896,9 @@ search_desktop_file () {
...
@@ -897,9 +896,9 @@ search_desktop_file () {
## TODO
:
ремонтирует devel пр с entry point потом можно будет это дропнуть
## TODO
:
ремонтирует devel пр с entry point потом можно будет это дропнуть
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 line
4
; do
while IFS=
" "
read -r -a line
3
; do
if [[
${#
line
4
[1]
}
==
"64"
]]
if [[
${#
line
3
[1]
}
==
"64"
]]
then echo
"
${
line
4
[*]
}
"
then echo
"
${
line
3
[*]
}
"
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"
try_remove_file
"
$PORT_WINE_TMP_PATH
/statistics"
try_remove_file
"
$PORT_WINE_TMP_PATH
/statistics"
...
@@ -909,9 +908,9 @@ search_desktop_file () {
...
@@ -909,9 +908,9 @@ search_desktop_file () {
# Ремонт, если есть пустые строки и непонятные строки без .exe, .bat, .msi, .reg
# Ремонт, если есть пустые строки и непонятные строки без .exe, .bat, .msi, .reg
if [[
$BROKEN_LINE
== 1 ]] ; then
if [[
$BROKEN_LINE
== 1 ]] ; then
while IFS=
" "
read -r -a line
3
; do
while IFS=
" "
read -r -a line
4
; do
if [[ -n
${
line
3
[0]
}
]] && [[
${
line3
[0]
}
=~ (.[Bb][Aa][Tt]
$|
.[Ee][Xx][Ee]
$|
.[Mm][Ss][Ii]
$|
.[Rr][Ee][Gg]
$)
]]
if [[ -n
${
line
4
[0]
}
]] && [[
${
line4
[0]
}
=~ (.[Bb][Aa][Tt]
$|
.[Ee][Xx][Ee]
$|
.[Mm][Ss][Ii]
$|
.[Rr][Ee][Gg]
$)
]]
then echo
"
${
line
3
[*]
}
"
then echo
"
${
line
4
[*]
}
"
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"
try_remove_file
"
$PORT_WINE_TMP_PATH
/statistics"
try_remove_file
"
$PORT_WINE_TMP_PATH
/statistics"
...
@@ -938,10 +937,10 @@ search_desktop_file () {
...
@@ -938,10 +937,10 @@ search_desktop_file () {
fi
fi
export TIME_CURRENT=
${
line2
[2]
}
export TIME_CURRENT=
${
line2
[2]
}
# Проверка новых десктоп файлов, чтобы их можно было сортировать первыми при первом создании в главном меню
# Проверка новых десктоп файлов, чтобы их можно было сортировать первыми при первом создании в главном меню
+ ремонт
if [[
$PW_NEW_DESKTOP
== 1 ]] && [[
${
line2
[3]
}
!= NEW_DESKTOP ]] ; then
if [[
$PW_NEW_DESKTOP
== 1 ]] && [[
${
line2
[3]
}
!= NEW_DESKTOP ]] ; then
if [[
$FILE_SHA256SUM_FOUND
== 1 ]] ; then
if [[
$FILE_SHA256SUM_FOUND
== 1 ]] ; then
sed -i
"s|
${
line2
[1]
}
\(
.*
\)
OLD_DESKTOP
|
${
line2
[1]
}
\1
NEW_DESKTOP|"
"
$PORT_WINE_TMP_PATH
/statistics"
sed -i
"s|
${
line2
[1]
}
\(
.*
\)
${
line2
[3]
}
|
${
line2
[1]
}
\1
NEW_DESKTOP|"
"
$PORT_WINE_TMP_PATH
/statistics"
else
else
echo
"
${
portwine_exe
// /#@_@#
}
$FILE_SHA256SUM
$TIME_CURRENT
NEW_DESKTOP"
>>
"
$PORT_WINE_TMP_PATH
/statistics"
echo
"
${
portwine_exe
// /#@_@#
}
$FILE_SHA256SUM
$TIME_CURRENT
NEW_DESKTOP"
>>
"
$PORT_WINE_TMP_PATH
/statistics"
fi
fi
...
@@ -958,28 +957,47 @@ search_desktop_file () {
...
@@ -958,28 +957,47 @@ 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
# Здесь добавляются новые линии для статистики по аналогии, к примеру
${
line2
[4]
}
# L4 важен, чтобы не было путаницы из-за sed, то что используется \(.*\), для
${
line2
[5]
}
это будет L5 и т.д.
count_line=4
count_line=4
# Здесь добавляются новые линии для статистики
if [[ -z
${
line2
[4]
}
]] ; then
if [[ -z
${
line2
[4]
}
]] ; then
line2[4]=0
SKIP_REPAIR=1
sed -i
"s|
$FILE_SHA256SUM
\(
.*
\)
|
$FILE_SHA256SUM
\1
L4-
${
line2
[4]
}
|"
"
$PORT_WINE_TMP_PATH
/statistics"
sed -i
"s|
$FILE_SHA256SUM
\(
.*
\)
|
$FILE_SHA256SUM
\1
L4-
1
|"
"
$PORT_WINE_TMP_PATH
/statistics"
else
else
line2[4]=
${
line2
[4]//L4-/
}
# ремонт, если L4 по каким-то причинам сломался
NUMBER_OF_STARTS=
$((
line2[4]
+
1
))
if [[
${
line2
[4]
}
=~ ^L4 ]] ; then
(( count_line ++ ))
local NUMBER_OF_STARTS=
$((
${
line2
[4]//L4-/
}
+
1
))
else
SKIP_REPAIR=1
sed -i
"s|
$FILE_SHA256SUM
\(
.*
\)
${
line2
[4]
}
|
$FILE_SHA256SUM
\1
L4-1|"
"
$PORT_WINE_TMP_PATH
/statistics"
fi
fi
fi
# сюда L5
(( count_line ++ ))
# Ремонт, если количество элементов массива по каким-то причина больше, чем должно быть
# Пример для L5
if [[ -n
${
line2
[
"
$count_line
"
]
}
]] ; then
# if [[ -z
${
line2
[5]
}
]] ; then
for i in
$(
seq
$count_line
${#
line2
[@]
})
; do
# SKIP_REPAIR=1
unset
'line2[$i]'
# sed -i
"s|
$FILE_SHA256SUM
\(
.*
\)
|
$FILE_SHA256SUM
\1
L5-1|"
"
$PORT_WINE_TMP_PATH
/statistics"
done
# else
sed -i
"s|
${
portwine_exe
// /#@_@#
}
$FILE_SHA256SUM
\(
.*
\)
|
${
line2
[*]
}
|"
"
$PORT_WINE_TMP_PATH
/statistics"
# if [[
${
line2
[5]
}
=~ ^L5 ]] ; then
# local ЗДЕСЬ_НОВАЯ_ПЕРЕМЕННАЯ=
$((
${
line2
[5]//L5-/
}
+
1
))
# else
# SKIP_REPAIR=1
# sed -i
"s|
$FILE_SHA256SUM
\(
.*
\)
${
line2
[5]
}
|
$FILE_SHA256SUM
\1
L5-1|"
"
$PORT_WINE_TMP_PATH
/statistics"
# fi
# fi
# (( count_line ++ ))
if [[
$SKIP_REPAIR
!= 1 ]] ; then
# Ремонт, если количество элементов массива по каким-то причина больше, чем должно быть
if [[ -n
${
line2
[
"
$count_line
"
]
}
]] ; then
for i in
$(
seq
$count_line
${#
line2
[@]
})
; do
unset
'line2[$i]'
done
sed -i
"s|
${
portwine_exe
// /#@_@#
}
$FILE_SHA256SUM
\(
.*
\)
|
${
line2
[*]
}
|"
"
$PORT_WINE_TMP_PATH
/statistics"
fi
# Сюда все sedы от L4, L5 и т.д. (после всех ремонтов)
sed -i
"s|
$FILE_SHA256SUM
\(
.*
\)
L4-
${
line2
[4]
}
|
$FILE_SHA256SUM
\1
L4-
$NUMBER_OF_STARTS
|"
"
$PORT_WINE_TMP_PATH
/statistics"
fi
fi
# Сюда все sedы от L4, L5 и т.д. (после всех ремонтов)
sed -i
"s|
$FILE_SHA256SUM
\(
.*
\)
L4-
${
line2
[4]
}
|
$FILE_SHA256SUM
\1
L4-
$NUMBER_OF_STARTS
|"
"
$PORT_WINE_TMP_PATH
/statistics"
fi
fi
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment