Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
pmbootstrap
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
postmarketOS
pmbootstrap
Commits
64554414
Verified
Commit
64554414
authored
6 months ago
by
Newbyte
Browse files
Options
Downloads
Patches
Plain Diff
pmb.install.losetup: Annotate return types (MR 2430)
And fix type errors.
parent
fb7f5353
No related branches found
No related tags found
1 merge request
!2430
pmb.install.losetup: Run kpartx, losetup in chroot
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pmb/install/losetup.py
+6
-4
6 additions, 4 deletions
pmb/install/losetup.py
with
6 additions
and
4 deletions
pmb/install/losetup.py
+
6
−
4
View file @
64554414
...
...
@@ -13,7 +13,7 @@ import pmb.chroot
from
pmb.core
import
Chroot
def
init
():
def
init
()
->
None
:
if
not
Path
(
"
/sys/module/loop
"
).
is_dir
():
pmb
.
helpers
.
run
.
root
([
"
modprobe
"
,
"
loop
"
])
for
loopdevice
in
Path
(
"
/dev/
"
).
glob
(
"
loop*
"
):
...
...
@@ -22,7 +22,7 @@ def init():
pmb
.
helpers
.
mount
.
bind_file
(
loopdevice
,
Chroot
.
native
()
/
loopdevice
)
def
mount
(
img_path
:
Path
,
_sector_size
:
int
|
None
=
None
):
def
mount
(
img_path
:
Path
,
_sector_size
:
int
|
None
=
None
)
->
Path
:
"""
:param img_path: Path to the img file inside native chroot.
"""
...
...
@@ -56,6 +56,8 @@ def mount(img_path: Path, _sector_size: int | None = None):
raise
e
pass
raise
AssertionError
(
"
This should never be reached
"
)
def
device_by_back_file
(
back_file
:
Path
)
->
Path
:
"""
...
...
@@ -75,7 +77,7 @@ def device_by_back_file(back_file: Path) -> Path:
raise
RuntimeError
(
f
"
Failed to find loop device for
{
back_file
}
"
)
def
umount
(
img_path
:
Path
):
def
umount
(
img_path
:
Path
)
->
None
:
"""
:param img_path: Path to the img file inside native chroot.
"""
...
...
@@ -88,7 +90,7 @@ def umount(img_path: Path):
pmb
.
chroot
.
root
([
"
losetup
"
,
"
-d
"
,
device
])
def
detach_all
():
def
detach_all
()
->
None
:
"""
Detach all loop devices used by pmbootstrap
"""
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment