#!/bin/bash . ./lib options=() options+=("Config" "/etc/mkinitcpio.conf") options+=("mkinicpio" "") defaultitem="Config" sel=$(dialog --backtitle "$apptitle" --title "Initcpio Config Menu :" --default-item "$defaultitem" --cancel-button "Back" --menu "" 0 0 0 \ "${options[@]}" \ 3>&1 1>&2 2>&3) if [ ! "$?" = "0" ]; then exit 1 fi sed -i "/^defaultitem=/c\defaultitem=\"$sel\"" $0 case $sel in 'Config') editfile /etc/mkinitcpio.conf;; 'mkinicpio') options=() configs=$(ls /etc/mkinitcpio.d) for itm in $configs; do options+=("${itm::-7}" "" on) done sel=$(dialog --backtitle "$apptitle" --title "Choose configs :" --cancel-button "Back" --checklist "" 0 0 0 \ "${options[@]}" \ 3>&1 1>&2 2>&3) if [ ! "$?" = "0" ]; then exit 1 fi clear for itm in $sel; do case $itm in *) itm=$(sed "s/\"//g" <<<"$itm") echo "mkinitcpio -p $itm" mkinitcpio -p $itm ;; esac done pressanykey ;; esac exit 0