#!/bin/sh

/usr/libexec/firmware
/usr/sbin/pwd_mkdb -p /etc/master.passwd >/dev/null 2>&1
/Library/dpkg/info/debianutils.postinst configure 99999
/Library/dpkg/info/apt.postinst configure 999999
/Library/dpkg/info/dash.postinst configure 999999
/Library/dpkg/info/zsh.postinst configure 999999
/Library/dpkg/info/bash.postinst configure 999999
/Library/dpkg/info/vi.postinst configure 999999

/usr/sbin/pwd_mkdb -p /etc/master.passwd

/usr/bin/chsh -s /usr/bin/zsh mobile
/usr/bin/chsh -s /usr/bin/zsh root

if [ -z "$NO_PASSWORD_PROMPT" ]; then
    PASSWORDS=""
    PASSWORD1=""
    PASSWORD2=""
    while [ -z "$PASSWORD1" ] || [ ! "$PASSWORD1" = "$PASSWORD2" ]; do
            PASSWORDS="$(/usr/bin/uialert -b "In order to use command line tools like \"sudo\" after jailbreaking, you will need to set a terminal passcode. (This cannot be empty)" --secure "Password" --secure "Repeat Password" -p "Set" "Set Password")"
            PASSWORD1="$(printf "%s\n" "$PASSWORDS" | /usr/bin/sed -n '1 p')"
            PASSWORD2="$(printf "%s\n" "$PASSWORDS" | /usr/bin/sed -n '2 p')"
    done
    printf "%s\n" "$PASSWORD1" | /usr/sbin/pw usermod 501 -h 0
fi

rm -f /prep_bootstrap.sh
