4 # Email : hayao@fascode.net
6 # (c) 2019-2021 Fascode Network.
11 #infofile="/run/archiso/bootmnt/alteriso-info"
12 infofile="${HOME}/Desktop/alteriso-info"
16 echo "usage ${0} [options]"
18 echo " General options:"
19 echo " -f | --file [path] Specify the file to read"
20 echo " -s | --shell Enable shell mode"
21 echo " -h | --help This help message and exit."
24 # Argument analysis and processing
27 opt_long="help,file:,shell"
28 OPT=$(getopt -o ${opt_short} -l ${opt_long} -- "${@}")
29 if [[ ${?} != 0 ]]; then
34 unset OPT opt_short opt_long
56 echo "Invalid argument '${1}'" >&2
64 if [[ ! -f "${infofile}" ]]; then
65 echo "${infofile} was not found." >&2
70 if [[ "${shellmode}" = false ]]; then
75 for _item in $(cat "${infofile}" | cut -d ':' -f 1 | sed 's/ *$//' |sed 's| \+|_|g' | tr '[:upper:]' '[:lower:]'); do
76 items+=("$(echo "${_item}")")
85 values=($(cat "${infofile}" | cut -d ':' -f 2- | sed "s|^ ||g" | grep -v ^$))
86 line_number=$(( "$(cat "${infofile}" 2> /dev/null | wc -l)" - 1 ))
89 for line in $(seq 0 "${line_number}"); do
90 echo "${items[${line}]}=\"${values[${line}]}\""