add special option for pi-gen for building piscsi images (#1107)

Co-authored-by: Tony Kuker <akuker@gmail.com>
This commit is contained in:
Tony Kuker 2023-02-26 20:29:32 -06:00 committed by GitHub
parent 1082b6a7b4
commit 059a31ba53
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -87,6 +87,12 @@ function initialChecks() {
fi fi
} }
# Only to be used for pi-gen automated install
function cacheSudo() {
echo "Caching sudo password"
echo raspberry | sudo -v -S
}
# checks that the current user has sudoers privileges # checks that the current user has sudoers privileges
function sudoCheck() { function sudoCheck() {
if [[ $HEADLESS ]]; then if [[ $HEADLESS ]]; then
@ -1359,6 +1365,25 @@ function runChoice() {
installPackagesStandalone installPackagesStandalone
compilePiscsi compilePiscsi
;; ;;
99)
echo "Hidden setup mode for running the pi-gen utility"
echo "This shouldn't be used by normal users"
sudoCache
createImagesDir
createCfgDir
updatePiscsiGit
installPackages
installHfdisk
fetchHardDiskDrivers
compilePiscsi
installPiscsi
enablePiscsiService
preparePythonCommon
cachePipPackages
installPiscsiWebInterface
installWebInterfaceService
echo "Automated install of the PiSCSI Service $(CONNECT_TYPE) complete!"
;;
-h|--help|h|help) -h|--help|h|help)
showMenu showMenu
;; ;;
@ -1372,7 +1397,7 @@ function runChoice() {
function readChoice() { function readChoice() {
choice=-1 choice=-1
until [ $choice -ge "0" ] && [ $choice -le "16" ]; do until [ $choice -ge "0" ] && ([ $choice -eq "99" ] || [ $choice -le "16" ]) ; do
echo -n "Enter your choice (0-16) or CTRL-C to exit: " echo -n "Enter your choice (0-16) or CTRL-C to exit: "
read -r choice read -r choice
done done