#!/bin/bash CONFIG_FILE=".config" QCOUNTER=1 rm -rf $CONFIG_FILE touch .config DIALOG_TITLE="DriedLamu Configuration Wizard" DIALOG_H=18 DIALOG_W=60 question() { local question=$1 local property_name=$2 local answer=$3 local note=$4 if [[ $answer == 1 ]]; then dialog --title "$DIALOG_TITLE" --yesno "${QCOUNTER}: $question\n\n$note" $DIALOG_H $DIALOG_W else dialog --title "$DIALOG_TITLE" --defaultno --yesno "${QCOUNTER}: $question\n\n$note" $DIALOG_H $DIALOG_W fi exitcode=$?; case $exitcode in 0) echo -e "${property_name}=1" >> $CONFIG_FILE;; 1) echo -e "${property_name}=0" >> $CONFIG_FILE;; * ) echo Invalid response; exit 1;; esac QCOUNTER=$((QCOUNTER+1)) } dialog --title "$DIALOG_TITLE" --yesno "Welcome to setup wizard for DriedLamu!\n\nA couple of YES/NO closed questions will be ask before proceeding to building your firmware.\nQuestions will be highly related to your preferences, use-cases of your device.\n\nDo you wish to proceed?" 16 60 if [[ $? == 1 ]]; then exit 1 fi exec 3>&1; echo "STOCK_FIRMWARE_PATH='$(dialog --title "$DIALOG_TITLE" --inputbox "Provide stock firmware path.\n\nCurrent directory: $(pwd)" $DIALOG_H $DIALOG_W 2>&1 1>&3)'" >> $CONFIG_FILE; exec 3>&-; question "Preinstall microG." \ "PRELOAD_MICROG" 1 \ "For Non-rooted installs: Installation relies on patching microG apk files by copying signatures accepted by the stock rom.\n\nFor rooted installs: microG is installed with all required libraries without signature spoofing support. Signature spoofing with rooted installs can be achieved with FakeGApps Xposed module." question "Install F-Droid." \ "INSTALL_FDROID" 1 \ "F-Droid is the app market that prioritizes FOSS applications. Installation bundles F-Droid privileged extension. " question "Install recommended essential apps." \ "INSTALL_RECOMMENDED_FOSS_APPS" 1 \ "Install essential apps from Fossify app package. It includes:\n– Calculator \n– Clock \n– Contacts \n– File Manager \n– Gallery \n– Messages \n– Phone \n– Voice Recorder \n– Music Player \n– Calendar" question "Add LineageOS sounds and replace Moto ringtone" \ "ADD_TONES" 1 \ "Replace Moto ringtone with an old fashioned one (Razr V3).\nAlso includes the rest of ringtones, alarm and notification sounds from LineageOS." question "Enable verified boot (vbmeta)" \ "ENABLE_VBMETA" 1 \ "Creates vbmeta images." source .config if [[ $ENABLE_VBMETA == 1 ]]; then exec 3>&1; echo "AVB_KEY_PATH='$(dialog --title "$DIALOG_TITLE" --inputbox "Provide AVB key location which will be used to sign images.\n\nMake sure keys are safely secured." $DIALOG_H $DIALOG_W 2>&1 1>&3)'" >> $CONFIG_FILE; exec 3>&-; source .config if [[ -d "`eval echo ${AVB_KEY_PATH//>}`" ]]; then dialog --title "$DIALOG_TITLE" --yesno "PROCEED WITH CAUTION!\n\nChosen key location: $AVB_KEY_PATH\n\n${bold}You are responsible for storing and protecting the private keys. Loss of the private keys will result in not being able to sign images when upgrading the system with the affected keys. Losing keys might result in loss of personal data from your device. \n\n${normal}Is chosen location correct and do you wish to proceed further?" $DIALOG_H $DIALOG_W if [[ $? == 1 ]]; then exit 1 fi else exit 1 fi fi question "Install Root (APatch)" \ "INSTALL_SU" 0 \ "Install Root by patching boot.img using KernelPatch. If enabled, you will have to provide SuperKey required for APatch authentication later on." source .config if [[ $INSTALL_SU == 1 ]]; then echo -e "SU_METHOD='apatch'" >> $CONFIG_FILE exec 3>&1; echo "SU_PASSWORD='$(dialog --title "$DIALOG_TITLE" --insecure --passwordbox "Provide APatch key which will be used to authenticate SU requests." $DIALOG_H $DIALOG_W 2>&1 1>&3)'" >> $CONFIG_FILE; exec 3>&-; fi question "Enable insecure ADB access." \ "ENABLE_INSECURE_ADB" 0 \ "Feature used for development purposes. If you intend to daily drive this device, switch that to off." question "Disable Motorola's HelloUI" \ "DISABLE_MOTO_HELLO_UI" 0 \ "Feature considered experimental. May cause small UI defects while making system UI look more like AOSP." source .config if [[ $DISABLE_MOTO_HELLO_UI == 0 ]]; then question "Disable Motorola's HelloUI blur-level rendering" \ "DISABLE_MOTO_HELLO_UI_BLUR" 0 \ "Disables blur-level rendering within Moto's HelloUI. It will make notification center translucent." fi dialog --title "$DIALOG_TITLE" --msgbox "Configuration saved to '.config'\n\nYou can now proceed to building with 'make build'." $DIALOG_H $DIALOG_W