Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

halium-install: option for injecting ssh-key into rootfs #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion halium-install
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ usage()
-h|--help this message
-c|--custom path to customization tarball (needs to be tar.xz)
-k|--keep-userdata do not wipe user data on device
-w|--wipe-file absolute path of a file inside the image to wipe (empty)"
-w|--wipe-file absolute path of a file inside the image to wipe (empty)
-s|--ssh-key path to ssh public key for root access"
exit 1
}

Expand All @@ -118,6 +119,9 @@ while [ $# -gt 0 ]; do
-w|--wipe-file)
[ -n "$2" ] && WIPE_PATH=$2 shift || usage
;;
-s|--ssh-key)
[ -n "$2" ] && SSH_KEY=$2 shift || usage
;;
esac
shift
done
Expand Down Expand Up @@ -190,6 +194,14 @@ do_shell "cd /cache/system && zcat /recovery/$TARBALL | tar xf -"
do_shell "[ -e /cache/system/SWAP.swap ] && mv /cache/system/SWAP.swap /data/SWAP.img"
echo "[done]"

if [ ! -z "$SSH_KEY" ]; then
echo "injecting ssh key for root access ... "
do_shell "mkdir -m 0700 -p /cache/system/root/.ssh"
adb push $SSH_KEY /cache/system/root/.ssh/authorized_keys
do_shell "chmod 0644 /cache/system/root/.ssh/authorized_keys"
echo "[done]"
fi

echo -n "adding android system image to installation ... "
convert_android_img
ANDROID_DIR="/data"
Expand Down