Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
N
nvidia-patch
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
nvidia-patch
Commits
5c2471af
Commit
5c2471af
authored
Sep 27, 2019
by
Vladislav Yarmak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
linux: make patch invocation idempotent
parent
a82e6112
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
10 deletions
+17
-10
patch.sh
patch.sh
+17
-10
No files found.
patch.sh
View file @
5c2471af
...
...
@@ -28,14 +28,14 @@ DESCRIPTION
opmode
=
"patch"
while
getopts
'rshc:l'
flag
;
do
case
"
${
flag
}
"
in
r
)
opmode
=
"
${
opmode
}
rollback"
;;
s
)
silent_flag
=
'true'
;;
h
)
opmode
=
"
${
opmode
}
help"
;;
c
)
opmode
=
"
${
opmode
}
checkversion"
;
checked_version
=
"
$OPTARG
"
;;
l
)
opmode
=
"
${
opmode
}
listversions"
;;
*
)
echo
"Incorrect option specified in command line"
;
exit
2
;;
esac
case
"
${
flag
}
"
in
r
)
opmode
=
"
${
opmode
}
rollback"
;;
s
)
silent_flag
=
'true'
;;
h
)
opmode
=
"
${
opmode
}
help"
;;
c
)
opmode
=
"
${
opmode
}
checkversion"
;
checked_version
=
"
$OPTARG
"
;;
l
)
opmode
=
"
${
opmode
}
listversions"
;;
*
)
echo
"Incorrect option specified in command line"
;
exit
2
;;
esac
done
if
[[
$silent_flag
]]
;
then
...
...
@@ -181,8 +181,15 @@ rollback () {
patch
()
{
patch_common
if
[[
!
-f
"
$backup_path
/
$object
.
$driver_version
"
]]
;
then
echo
"Attention! Backup not found. Copy current
$object
to backup."
if
[[
-f
"
$backup_path
/
$object
.
$driver_version
"
]]
;
then
bkp_hash
=
"
$(
sha1sum
"
$backup_path
/
$object
.
$driver_version
"
|
cut
-f1
-d
\
)
"
drv_hash
=
"
$(
sha1sum
"
$driver_dir
/
$object
.
$driver_version
"
|
cut
-f1
-d
\
)
"
if
[[
"
$bkp_hash
"
!=
"
$drv_hash
"
]]
;
then
echo
"Backup exists and driver file differ from backup. Skipping patch."
return
0
fi
else
echo
"Attention! Backup not found. Copying current
$object
to backup."
mkdir
-p
"
$backup_path
"
cp
-p
"
$driver_dir
/
$object
.
$driver_version
"
\
"
$backup_path
/
$object
.
$driver_version
"
...
...
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