Revert "Merge branch 'rescue' into master"

This reverts commit c90e917768, reversing
changes made to f565608971.
merge-requests/260/head
papajoker 7 years ago
parent c90e917768
commit 8a89d305b2

@ -18,9 +18,7 @@ LIBS = \
lib/util-config.sh \
lib/util-desktop.sh \
lib/util-disk.sh \
lib/util-menu.sh \
lib/menu-engine.sh \
lib/util-rescue.sh
lib/util-menu.sh
LISTS = \
data/package-lists/base-openrc-manjaro \
@ -39,9 +37,6 @@ LANG = \
data/translations/portuguese_brasil.trans \
data/translations/russian.trans \
data/translations/spanish.trans
MENUS = \
data/rescue.menu
ICONS = \
data/manjaro-architect.png
@ -96,7 +91,6 @@ uninstall:
for f in ${LIBS}; do rm -f $(DESTDIR)$(PREFIX)$(LIBDIR)/$$f; done
for f in ${LISTS}; do rm -f $(DESTDIR)$(PREFIX)$(DATADIR)/package-lists/$$f; done
for f in ${LANG}; do rm -f $(DESTDIR)$(PREFIX)$(DATADIR)/translations/$$f; done
for f in ${MENUS}; do rm -f $(DESTDIR)$(PREFIX)$(DATADIR)/$$f; done
for f in ${ICONS}; do rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/48x48/apps/$$f; done
for f in ${LAUNCHER}; do rm -f $(DESTDIR)$(PREFIX)/share/applications/$$f; done
for f in ${LIVE}; do rm -f $(DESTDIR)/etc/skel/.config/autostart/$$f; done

@ -22,9 +22,6 @@ import ${LIBDIR}/util-base.sh
import ${LIBDIR}/util-desktop.sh
import ${LIBDIR}/util-disk.sh
import ${LIBDIR}/util-menu.sh
import ${LIBDIR}/ini_val.sh
import ${LIBDIR}/menu-engine.sh
import ${LIBDIR}/util-rescue.sh
import ${DATADIR}/translations/english.trans
if [[ -e /run/miso/bootmnt ]]; then
@ -34,17 +31,11 @@ if [[ -e /run/miso/bootmnt ]]; then
fi
# run in debug mode with -d option
#[[ $1 == "-d" ]] && declare -i debug=1
[[ $1 == "-d" ]] && declare -i debug=1
id_system
select_language
mk_connection
check_requirements
greeting
if ((${ARGS[rescue]})); then
TEMPLATEMENU="rescue"
show_menu rescue
return 0
fi
main_menu

@ -1,29 +0,0 @@
#!menu template
# rescur menu tree
--rescue
----mount ;mount_test_efi
------root ; mount_partition /
--------back ; mnu_return 97
------home ; mount_partition /home
--------back ; mnu_return 97
----InstBs ; check_mount ;
------Mirrorlisting
------refresh keys
------InstBse
------bootloader
------done ; mnu_return 97
----ConfBse ; check_mount
------fstab
------hostname
------locale
------time and date
------root_pw
------create user
------mkinitcpio
---video_driver ; workfunction_videod
---xkbmap ; workfunction_x
----edit_config ; check_menu_edit_config_begin
------init config
------pacman.conf ; nano /etc/pacman.conf
------bash ; nano /tmp/bashrc

@ -428,7 +428,3 @@ _UserCheck="No user accounts have been generated"
# Close Installer
_CloseInstBody="Close installer?"
_LogInfo="Would you like to save the installation-log to the installed system?\nIt will be copied to"
# rescue Menu
_rescueMenuTitle="Rescue"
_rescueMenuBody="rescue mode"

@ -43,7 +43,7 @@ function ini_val() {
fi
local current
current=$(awk -F "${delim}" "/^${key//\//\\\/}${delim}/ {for (i=2; i<NF; i++) printf \$i \" \"; print \$NF}" "${file}")
current=$(awk -F "${delim}" "/^${key}${delim}/ {for (i=2; i<NF; i++) printf \$i \" \"; print \$NF}" "${file}")
if [[ ! "${val}" ]]; then
# get a value

@ -1,266 +0,0 @@
#!/usr/bin/bash
#
# load layout and show dialogs
debug(){
:
}
returnOK(){ return 0; } # function is ok
dialog_menu() {
# add : --keep-tite to aif version
dialog --keep-tite --backtitle "$VERSION - $SYSTEM ($ARCHI)" --column-separator "|" --title "$@"
}
#pick in .transfile
# file .trans not standard -> tinker for demo
# 2 args : keymenu , content(Title or Body or Item? or empty_value)
# tt( keymenu , content='Title' )
tt() {
local str="" content="${2:-Title}"
str="_${1}Menu${content}"
if [ ! -v "$str" ]; then # var not exist ?
str="_${1}${content}"
fi
if [ ! -v "$str" ]; then # var exist ?
[ "$2" != "Body" ] && str="$1" || str=""
else
str="${!str}"
if [ -z "$str" ]; then # error in .trans ?
[ "$2" != "Body" ] && str="$1" || str=""
fi
fi
[[ "$content" == 'Body' && "$str" != '' ]] && str="\n${str} \n "
echo "$str"
}
# trim line with ; as separator
trim_line()
{
local i=0 str='' arrayr=()
IFS=';' arrayr=($1)
for i in "${!arrayr[@]}"; do
# remove firsts space
arrayr[$i]="${arrayr[$i]#"${arrayr[$i]%%[![:space:]]*}"}"
# remove lasts space
while [[ "${arrayr[$i]: -1}" == ' ' ]]; do
arrayr[$i]=${arrayr[$i]:0:-1}
done
done
echo "${arrayr[*]}"
}
# not used
split_line(){ IFS=';' arrayr=($@); }
# trim line menu layout
menu_split_line(){
local str="$@"
[ -z "$str" ] && exit 9
trim_line "${str//-}"
}
# find item in dialog array by key
# menu_item_find ( key='' )
# return line number, 255 not found
menu_item_find() {
[ -z "$1" ] && return 1
local id=0 i=0
for i in "${!options[@]}"; do
if [[ "${options[$i]}" == "$1" ]]; then
(( id= (i-1) /2 ))
echo "$id" && return 0
fi
done
return 1
}
# change or delete item menu
# menu_item_change ( key='' , caption='', callfunction='' )
# only param "key" -> remove item
menu_item_change() {
#set -x
local key="$1" id=255
id=$(menu_item_find "$key")
(($? != 0)) && return 1
#[ -z "$id" ] && return 1
if [[ "$2" == '' && "$3" == '' ]]; then
unset functions[$id]
functions=( "${functions[@]}" )
(( id=(id*2) ))
unset options[$((id+1))]; unset options[$id];
options=( "${options[@]}" )
else
[ -n "$3" ] && functions[$id]="$3"
(( id=(id*2)+1 ))
[ -n "$2" ] && options[$id]="$2"
fi
}
# insert item after a key or add item to the end if not found
# menu_item_insert ( key_after='', caption, callfunction )
menu_item_insert () {
local key="$1" id=255
id=$(menu_item_find "$key")
[ -z "$id" ] && id="${#functions[@]}"
[[ "$2" == '' && "$3" == '' ]] && return 1
(( id=id+1 ))
functions=( "${functions[@]:0:id}" "$3" "${functions[@]:id}" )
(( id=id*2 ))
options=( "${options[@]:0:id}" "9" "$2" "${options[@]:id}" )
}
####################################################
# #parse file data/*.menu
# return array
####################################################
# load_options_menutool( IDmenu , template='default' )
load_options_menutool() {
local menukey="${1:-install_environment}"
local tmp=()
local localfilename="${2:-default}"
local level='' levelsub='' reg loop curentitem i j
local IFS=$'\n'
debug "\nfind menu: $menukey"
options=(); functions=(); fbegin=''; fend='';floop='';
for line in $(grep -v "#" "$DATADIR/${localfilename}.menu"); do
#reg="-.$menukey^[a-zA-Z_;]" #[^a-zA-Z_]"
reg="-.${menukey}([ ;]|$)"
if [[ $line =~ $reg ]]; then
# menu find
level=$(echo "$line" | grep -Eo "\-{1,}")
levelsub="$level--";
# functions check before and after loop
line=$(menu_split_line "$line")
IFS=';' line=($line)
(("${#line[@]}">1)) && fbegin="${line[1]}"
(("${#line[@]}">2)) && fend="${line[2]}"
(("${#line[@]}">3)) && floop="${line[3]}"
debug "key:$menukey find :) ${mnu_params[@]}"
continue
fi
if [ -n "$levelsub" ]; then
reg="^$levelsub[a-zA-Z_]"
if [[ $line =~ $reg ]]; then
# menu item find
line=$(menu_split_line "$line")
IFS=';' line=($line)
IFS=$';\n' line=(${line[*]})
curentitem="${line[0]}"
debug "curitem: $curentitem , function: ${line[1]} "
options+=( 0 "$(tt $curentitem Title)" )
# attach function to item
tmp="${line[1]}"
tmp="${tmp:-returnOK}" # for this test
functions+=( "${tmp}" )
else
reg="^$levelsub--[a-zA-Z_]"
if [[ $line =~ $reg ]]; then
# prev-item load a sub menu
functions[-1]="show_menu $curentitem"
i=$(( "${#options[@]}"-1 ))
tmp="${options[-1]}"
[[ "${tmp: -1}" != ">" ]] && options[-1]="${tmp} |>"
continue
fi
reg="^$level[a-zA-Z_]"
[[ $line =~ $reg ]] && break
fi
fi
done
}
####################################################
# load one menu from template and show dialog
####################################################
# show_menu ( IDmenu='MM' )
show_menu()
{
local cmd id menus choice errcode highlight=1 nbitems=1
local fend fbegin floop # check functions
local options=() functions=() # menu datas
local keymenu="${1:-MM}"
# reset numbers after delete/insert item
renumber_menutool() {
local i=0 j=0
for i in "${!options[@]}"; do
((i % 2==0)) && { ((j=j+1)); options[$i]=$j; }
((i=i+1))
done
}
load_options_menutool "${keymenu}" "$TEMPLATEMENU"
renumber_menutool
debug "options: ${options[@]}"
debug "functions: ${functions[@]}"
# call function chech begin
if [ -n "${fbegin}" ]; then
$fbegin "$keymenu" || return 99
renumber_menutool # if insert or delete item
fi
(( nbitems="${#options[@]}" /2 ))
((nbitems>20)) && nbitems=20 # show max 20 items
while ((1)); do
cmd=(dialog_menu "$(tt ${keymenu} Title)" --default-item ${highlight} --menu "$(tt ${keymenu} Body)" 0 0 )
cmd+=( $nbitems ) # add number of items
# run dialog options
choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty)
# ?choice=eval "${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty
choice="${choice:-0}"
case "$choice" in
0) return ;; # btn cancel
*) debug "\nchoice: $choice" # debug
[ -z "$choice" ] && continue
((--choice))
fn="${functions[$choice]}" # find attach working function to array with 3 column
debug "call function: $fn"
# or use eval for eval ${fn} if variables $var ? nor secure ?
${fn}
errcode=$?
debug "errcode: $errcode"
case "$errcode" in
99) : # check_before in sub_menu
;;
98) : # check_end in sub_menu
;;
97) : # back - prev menu
return 0
;;
0) :
((++choice)) # go to next item if ok
highlight=$choice
;;
*) : # other errors
#(( ($choice+1)*2 ))
DIALOG " ERROR " --msgbox "\n ${options[(( (--$choice*2)+1 ))]} [errcode:${errcode}] \n " 0 0
# return 0 not return
;;
esac
esac
# call function chech loop
if [ -n "${floop}" ]; then
$floop "$keymenu" || return 98
renumber_menutool # if insert or delete item
fi
done
# call function check end in layout
if [ -n "${fend}" ]; then
$fend "$keymenu" || return 98
fi
}

@ -235,22 +235,17 @@ select_filesystem() {
fs_opts=""
CHK_NUM=0
local option==$(getvar "mount.${PARTITION}")
if [[ -z "$option" ]]; then
DIALOG " $_FSTitle " --menu "\n${PARTITION}\n$_FSBody\n " 0 0 12 \
"$_FSSkip" "-" \
"btrfs" "mkfs.btrfs -f" \
"ext3" "mkfs.ext3 -q" \
"ext4" "mkfs.ext4 -q" \
"jfs" "mkfs.jfs -q" \
"nilfs2" "mkfs.nilfs2 -fq" \
"ntfs" "mkfs.ntfs -q" \
"reiserfs" "mkfs.reiserfs -q" \
"vfat" "mkfs.vfat -F32" \
"xfs" "mkfs.xfs -f" 2>${ANSWER} || return 1
else
echo "$option">${ANSWER}
fi
DIALOG " $_FSTitle " --menu "\n$_FSBody\n " 0 0 12 \
"$_FSSkip" "-" \
"btrfs" "mkfs.btrfs -f" \
"ext3" "mkfs.ext3 -q" \
"ext4" "mkfs.ext4 -q" \
"jfs" "mkfs.jfs -q" \
"nilfs2" "mkfs.nilfs2 -fq" \
"ntfs" "mkfs.ntfs -q" \
"reiserfs" "mkfs.reiserfs -q" \
"vfat" "mkfs.vfat -F32" \
"xfs" "mkfs.xfs -f" 2>${ANSWER} || return 1
case $(cat ${ANSWER}) in
"$_FSSkip") FILESYSTEM="$_FSSkip"
@ -334,8 +329,6 @@ mount_opts() {
}
mount_current_partition() {
[ -n "$1" ] && PARTITION="$1"
[ -n "$2" ] && MOUNT="$2"
# Make the mount directory
mkdir -p ${MOUNTPOINT}${MOUNT} 2>$ERR
check_for_error "create mountpoint ${MOUNTPOINT}${MOUNT}" "$?"
@ -847,11 +840,8 @@ mount_partitions() {
done
# Identify and mount root
PARTITION=$(getvar "mount.root")
if [[ -z "$PARTITION" ]]; then
DIALOG " $_PrepMntPart " --menu "\n$_SelRootBody\n " 0 0 12 ${PARTITIONS} 2>${ANSWER} || return 0
PARTITION=$(cat ${ANSWER})
fi
DIALOG " $_PrepMntPart " --menu "\n$_SelRootBody\n " 0 0 12 ${PARTITIONS} 2>${ANSWER} || return 0
PARTITION=$(cat ${ANSWER})
ROOT_PART=${PARTITION}
# Format with FS (or skip) -> # Make the directory and mount. Also identify LUKS and/or LVM

@ -1,60 +0,0 @@
#!/usr/bin/bash
#
# mode rescue functions
# check if efi
mount_test_efi() {
if [[ "$(ini system.bios)" == "UEFI" ]]; then
menu_item_insert "home" "efi/esp" "mount_partition efi"
# TODO: autodetect efi and automount ...
fi
}
mount_partition() {
local p='' s='' i=0
menu_item_change "back" # delete
find_partitions
for p in $PARTITIONS; do
if ((i % 2==0)); then
s="$p"
else
menu_item_insert "" "$p $s" "mount_part $p $1"
fi
((i++))
done
menu_item_insert "" "back" "mnu_return 97"
}
mount_part(){
mount_current_partition "$1" "$2"
return 0
}
mnu_return(){ return "${1:-98}"; }
#change item and function from param
check_menu_edit_config_begin(){
if [[ "${ARGS[init]}" == "systemd" ]]; then
menu_item_change "init config" "systemd configuration" "nano /etc/${ARGS[init]}/system.conf"
else
menu_item_change "init config" "openrc configuration" "nano /etc/rc.conf"
fi
if ((ARGS[remove])); then
menu_item_change "pacman.conf" # no args = remove
fi
# tests
menu_item_insert "pacman.conf" "test insert" "nano test_insert"
menu_item_insert "" "last item" "nano test_add"
return 0
}
check_menu_is_mounted(){
if [[ "${INSTALL[mounted]}" != 1 ]]; then
DIALOG " error " --msgbox "\n make mount in pre-install before\n" 0 0
return "${1:-98}"
fi
}

@ -80,10 +80,6 @@ UEFI_MOUNT="" # UEFI mountpoint (/boot or /boot/efi)
# Edit Files
FILE="" # File(s) to be reviewed
#input infos
declare -A ARGS=()
# Installation
DM_INST="" # Which DMs have been installed?
DM_ENABLED=0 # Has a display manager been enabled?
@ -127,70 +123,6 @@ function finishini {
}
trap finishini EXIT
# read datas from ini file
# read: value=$(ini system.init)
inifile() {
[[ -r "${ARGS[ini]}" ]] || return 1
local section="$1"
[[ "$section" =~ \. ]] || section="manjaro-architect.${section}"
ini_val "${ARGS[ini]}" "$section" 2>/dev/null
}
# read install value
# console param, import ini, or current ini
getvar() {
local value=''
value="${ARGS[$1]}"
[[ -z "$value" ]] && value=$(inifile "$1")
[[ -z "$value" ]] && value=$(ini "$1")
echo "$value"
}
# read console args , set in array ARGS global var
get_ARGS() {
declare key param
getvalue(){
local value="${param##--${key}=}"
[[ "${value:0:1}" == '"' ]] && value="${value/\"/}" # remove quotes
echo "${value}"
}
while [ -n "$1" ]; do
param="$1"
case "${param}" in
--debug|-d)
ARGS[debug]=1
debug=1
;;
--rescue|-r)
ARGS[rescue]=1
;;
--init=*)
key="init"
ARGS[$key]=$(getvalue)
;;
--ini=*)
key="ini"
ARGS[$key]=$(getvalue)
;;
--help|-h)
echo -e "usage [-d|--debug] [-r|--rescue] [--ini=\"file.ini\"] [ --init=openrc ] "
exit 0
;;
--*=*)
key="${param%=*}"
key="${key//-}"
ARGS[$key]=$(getvalue)
;;
-*)
echo "${param}: not used";
;;
esac
shift
done
#declare -g -r ARGS
}
get_ARGS "$@"
# progress through menu entries until number $1 is reached
submenu() {
if [[ $SUB_MENU != "$PARENT" ]]; then
@ -419,16 +351,6 @@ check_requirements() {
# Greet the user when first starting the installer
greeting() {
DIALOG " $_WelTitle $VERSION " --msgbox "\n$_WelBody\n " 0 0
# if params, auto load root partition
local PARTITION=$(getvar "mount.root")
if [[ -n "$PARTITION" ]]; then
local option=$(getvar "mount.${PARTITION}")
if [[ -n "$option" ]]; then
mount_partitions
fi
fi
}
# Originally adapted from AIS. Added option to allow users to edit the mirrorlist.

Loading…
Cancel
Save