pmaports/main/postmarketos-android-recovery-installer/pmos_setpw

32 lines
1.2 KiB
Bash
Executable file

#!/bin/sh
# Copyright 2017 Attila Szollosi
#
# This file is part of postmarketos-android-recovery-installer.
#
# postmarketos-android-recovery-installer is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# postmarketos-android-recovery-installer is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with postmarketos-android-recovery-installer. If not, see <http://www.gnu.org/licenses/>.
exec >> /pmos.log 2>&1
set -ex
# shellcheck source=pmos_install_functions
. /bin/pmos_install_functions
extract_partition_table
set_subpartitions
echo "Set the password of the encrypted rootfs."
cryptsetup luksAddKey -d /lukskey "$ROOT_PARTITION"
# Remove temporary keyfile
cryptsetup luksRemoveKey "$ROOT_PARTITION" /lukskey
echo "Successfully added key to the LUKS device."