forked from Mirror/pmbootstrap
Recovery installer zip (#404)
Supports flashing with TWRP and other Android recovery OS through adb sideload, as well as exporting a generated recovery zip file. See also: https://github.com/postmarketOS/pmbootstrap/wiki/deviceinfo_flash_methods#recovery-mode-adb
This commit is contained in:
parent
28fa7eeaf0
commit
fbe968f1ab
17 changed files with 552 additions and 54 deletions
|
@ -19,6 +19,8 @@ along with pmbootstrap. If not, see <http://www.gnu.org/licenses/>.
|
|||
import logging
|
||||
import glob
|
||||
import os
|
||||
import socket
|
||||
from contextlib import closing
|
||||
|
||||
import pmb.chroot
|
||||
import pmb.chroot.distccd
|
||||
|
@ -27,6 +29,16 @@ import pmb.install.losetup
|
|||
import pmb.parse.arch
|
||||
|
||||
|
||||
def kill_adb(args):
|
||||
"""
|
||||
Kill adb daemon if it's running.
|
||||
"""
|
||||
port = 5038
|
||||
with closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as sock:
|
||||
if sock.connect_ex(("127.0.0.1", port)) == 0:
|
||||
pmb.chroot.root(args, ["adb", "-P", str(port), "kill-server"])
|
||||
|
||||
|
||||
def shutdown_cryptsetup_device(args, name):
|
||||
"""
|
||||
:param name: cryptsetup device name, usually "pm_crypt" in pmbootstrap
|
||||
|
@ -55,6 +67,9 @@ def shutdown_cryptsetup_device(args, name):
|
|||
def shutdown(args, only_install_related=False):
|
||||
pmb.chroot.distccd.stop(args)
|
||||
|
||||
# Stop adb server
|
||||
kill_adb(args)
|
||||
|
||||
# Umount installation-related paths (order is important!)
|
||||
pmb.helpers.mount.umount_all(args, args.work +
|
||||
"/chroot_native/mnt/install")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue