Skip to content
This repository has been archived by the owner on Oct 3, 2023. It is now read-only.

Use checklists for choosing software to install #23

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
19 changes: 12 additions & 7 deletions functions/install_functions
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,20 @@ function install_from_list() {
echo_message title "Starting installation of ${1}..."
# Variables
LIST=$(dirname "$0")'/data/'${2}'.list'
PACKAGES=$(cat $LIST | sed 's/$/ ON/')
# Draw window
if (eval `resize` && whiptail \
CHOICES=$(eval `resize` && whiptail \
--title "Install ${2^}" \
--yesno "Current list of packages that will be installed: \n\n$(cat ${LIST}) \n\nWould you like to proceed?" \
$LINES $COLUMNS $(( $LINES - 12 )) \
--scrolltext \
3>&1 1>&2 2>&3) then
--checklist \
"Choose which packages will be installed:" \
$LINES $COLUMNS $(( $LINES - 12 )) \
${PACKAGES[@]} \
--noitem \
3>&1 1>&2 2>&3)
if [ $? = 0 ]; then
# Install loop
for PACKAGE in $(cat $LIST); do
for PACKAGE in $CHOICES; do
PACKAGE=$(echo $PACKAGE | tr -d '"')
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why I need to do this, maybe I'm doing something wrong here...?

# If package is not installed
if [ $(check_package_installed $PACKAGE) != 0 ]; then
# Install package
Expand Down Expand Up @@ -201,4 +206,4 @@ function install_snap_package() {
whiptail --title "Installed" --msgbox "${1} is already installed." 8 56
${3}
fi
}
}