1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990 |
- #!/bin/bash
- # shellcheck disable=SC2181
- # Hyperbola GNU+Linux-libre Fast Install (hyperfi)
- # --------------------------------
- # Last author : Jesus E.
- # First author : MatMoul
- # https://github.com/MatMoul
- # http://sourceforge.net/u/matmoul
- # project : https://github.com/MatMoul/archfi
- # http://sourceforge.net/projects/archfi/
- # First license : LGPL-3.0 (http://opensource.org/licenses/lgpl-3.0.html)
- # Second license : GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
- #
- # Reference : https://wiki.hyperbola.info/doku.php?id=en:guide:installation
- apptitle="Hyperbola GNU+Linux-Libre Fast Install (hyperfi) - Version: 0.4.0 (GPLv3)"
- baseurl=https://git.sr.ht/~heckyel/hyperfi/blob/master
- cpl=0
- skipfont="0"
- fspkgs=""
- # --------------------------------------------------------
- mainmenu(){
- if [ "${1}" = "" ]; then
- nextitem="."
- else
- nextitem=${1}
- fi
- options=()
- options+=("${txtlanguage}" "Language")
- options+=("${txtsetkeymap}" "(loadkeys ...)")
- options+=("${txteditor}" "(${txtoptional})")
- options+=("${txtdiskpartmenu}" "")
- options+=("${txtselectpartsmenu}" "")
- options+=("" "")
- options+=("${txtreboot}" "")
- sel=$(whiptail --backtitle "${apptitle}" --title "${txtmainmenu}" --menu "" --cancel-button "${txtexit}" --default-item "${nextitem}" 0 0 0 \
- "${options[@]}" \
- 3>&1 1>&2 2>&3)
- if [ "$?" = "0" ]; then
- case ${sel} in
- "${txtlanguage}")
- chooselanguage
- nextitem="${txtsetkeymap}"
- ;;
- "${txtsetkeymap}")
- setkeymap
- nextitem="${txtdiskpartmenu}"
- ;;
- "${txteditor}")
- chooseeditor
- nextitem="${txtdiskpartmenu}"
- ;;
- "${txtdiskpartmenu}")
- diskpartmenu
- nextitem="${txtselectpartsmenu}"
- ;;
- "${txtselectpartsmenu}")
- selectparts
- nextitem="${txtreboot}"
- ;;
- "${txthelp}")
- help
- nextitem="${txtreboot}"
- ;;
- "${txtchangelog}")
- showchangelog
- nextitem="${txtreboot}"
- ;;
- "${txtreboot}")
- rebootpc
- nextitem="${txtreboot}"
- ;;
- esac
- mainmenu "${nextitem}"
- else
- clear
- fi
- }
- chooselanguage(){
- options=()
- options+=("Arabic" "(By Mohammad Alawadi)")
- options+=("Brazilian" "(By MaxWilliamJF)")
- options+=("Dutch" "(By bowero)")
- options+=("English" "(By MatMoul)")
- options+=("French" "(By MatMoul)")
- options+=("German" "(By untergrundbiber)")
- options+=("Greek" "(By quelotic)")
- options+=("Italian" "(By thegoldgoat)")
- options+=("Hungarian" "(By KardiWeb)")
- options+=("Norwegian" "(By mrboen94)")
- options+=("Polish" "(By dawidd6)")
- options+=("Portuguese" "(By hugok)")
- options+=("Russian" "(By Anonymous_Prodject)")
- options+=("Spanish" "(By Mystogab)")
- options+=("Turkish" "(By c0b41)")
- sel=$(whiptail --backtitle "${apptitle}" --title "${txtlanguage}" --menu "" 0 0 0 \
- "${options[@]}" \
- 3>&1 1>&2 2>&3)
- if [ "$?" = "0" ]; then
- clear
- if [ "${sel}" = "English" ]; then
- loadstrings
- else
- eval "$(curl -L "${baseurl}/lng/${sel}" | sed '/^#/ d')"
- fi
- if [ "${skipfont}" = "0" ]; then
- eval "$(setfont "${font}")"
- fi
- font=
- if [ "$(grep "^#${locale}" /etc/locale.gen)" != "" ]; then
- sed -i "/#${locale}/s/^#//g" /etc/locale.gen
- locale-gen
- fi
- export LANG=${locale}
- fi
- }
- setkeymap(){
- items=$(find /usr/share/kbd/keymaps/ -type f -printf "%f\n" | sort -V)
- options=()
- for item in ${items}; do
- options+=("${item%%.*}" "")
- done
- keymap=$(whiptail --backtitle "${apptitle}" --title "${txtsetkeymap}" --menu "" 0 0 0 \
- "${options[@]}" \
- 3>&1 1>&2 2>&3)
- if [ "$?" = "0" ]; then
- clear
- echo "loadkeys ${keymap}"
- loadkeys "${keymap}"
- pressanykey
- fi
- }
- chooseeditor(){
- options=()
- options+=("nano" "")
- options+=("vim" "")
- options+=("vi" "")
- options+=("edit" "")
- sel=$(whiptail --backtitle "${apptitle}" --title "${txteditor}" --menu "" 0 0 0 \
- "${options[@]}" \
- 3>&1 1>&2 2>&3)
- if [ "$?" = "0" ]; then
- clear
- echo "export EDITOR=${sel}"
- export EDITOR=${sel}
- EDITOR=${sel}
- pressanykey
- fi
- }
- rebootpc(){
- if (whiptail --backtitle "${apptitle}" --title "${txtreboot}" --yesno "${txtreboot} ?" --defaultno 0 0); then
- clear
- reboot
- fi
- }
- # --------------------------------------------------------
- # --------------------------------------------------------
- selectdisk(){
- items=$(lsblk -d -p -n -l -o NAME,SIZE -e 7,11)
- options=()
- IFS_ORIG=$IFS
- IFS=$'\n'
- for item in ${items}
- do
- options+=("${item}" "")
- done
- IFS=$IFS_ORIG
- result=$(whiptail --backtitle "${apptitle}" --title "${1}" --menu "" 0 0 0 "${options[@]}" 3>&1 1>&2 2>&3)
- if [ "$?" != "0" ]
- then
- return 1
- fi
- echo "${result%%\ *}"
- return 0
- }
- diskpartmenu(){
- if [ "${1}" = "" ]; then
- nextitem="."
- else
- nextitem=${1}
- fi
- options=()
- if [ "${eficomputer}" == "0" ]; then
- options+=("${txtautoparts} (gpt)" "")
- options+=("${txtautoparts} (dos)" "")
- else
- options+=("${txtautoparts} (gpt,efi)" "")
- options+=("${txtautoparts} (gpt)" "")
- options+=("${txtautoparts} (dos)" "")
- options+=("${txtautoparts} (gpt,bios+efi,noswap)" "")
- fi
- options+=("${txteditparts} (cfdisk)" "")
- options+=("${txteditparts} (cgdisk)" "")
- sel=$(whiptail --backtitle "${apptitle}" --title "${txtdiskpartmenu}" --menu "" --cancel-button "${txtback}" --default-item "${nextitem}" 0 0 0 \
- "${options[@]}" \
- 3>&1 1>&2 2>&3)
- if [ "$?" = "0" ]; then
- case ${sel} in
- "${txtautoparts} (dos)")
- diskpartautodos
- nextitem="${txtautoparts} (dos)"
- ;;
- "${txtautoparts} (gpt)")
- diskpartautogpt
- nextitem="${txtautoparts} (gpt)"
- ;;
- "${txtautoparts} (gpt,efi)")
- diskpartautoefi
- nextitem="${txtautoparts} (gpt,efi)"
- ;;
- "${txtautoparts} (gpt,bios+efi,noswap)")
- diskpartautoefiusb
- nextitem="${txtautoparts} (gpt,bios+efi,noswap)"
- ;;
- "${txteditparts} (cfdisk)")
- diskpartcfdisk
- nextitem="${txteditparts} (cfdisk)"
- ;;
- "${txteditparts} (cgdisk)")
- diskpartcgdisk
- nextitem="${txteditparts} (cgdisk)"
- ;;
- esac
- diskpartmenu "${nextitem}"
- fi
- }
- diskpartautodos(){
- device=$(selectdisk "${txtautoparts} (dos)")
- if [ "$?" = "0" ]; then
- if (whiptail --backtitle "${apptitle}" --title "${txtautoparts} (dos)" --yesno "${txtautopartsconfirm//%1/${device}}" --defaultno 0 0); then
- clear
- echo "${txtautopartclear}"
- parted "${device}" mklabel msdos
- sleep 1
- echo "${txtautopartcreate//%1/boot}"
- echo -e "n\np\n\n\n+512M\na\nw" | fdisk "${device}"
- sleep 1
- echo "${txtautopartcreate//%1/swap}"
- swapsize=$(grep MemTotal /proc/meminfo | awk '{ print $2 }')
- swapsize=$((swapsize/1000))"M"
- echo -e "n\np\n\n\n+${swapsize}\nt\n\n82\nw" | fdisk "${device}"
- sleep 1
- echo "${txtautopartcreate//%1/root}"
- echo -e "n\np\n\n\n\nw" | fdisk "${device}"
- sleep 1
- echo ""
- pressanykey
- if [ "${device::8}" == "/dev/nvm" ]; then
- bootdev=${device}"p1"
- swapdev=${device}"p2"
- rootdev=${device}"p3"
- else
- bootdev=${device}"1"
- swapdev=${device}"2"
- rootdev=${device}"3"
- fi
- efimode="0"
- fi
- fi
- }
- diskpartautogpt(){
- device=$(selectdisk "${txtautoparts} (gpt)")
- if [ "$?" = "0" ]; then
- if (whiptail --backtitle "${apptitle}" --title "${txtautoparts} (gpt)" --yesno "${txtautopartsconfirm//%1/${device}}" --defaultno 0 0); then
- clear
- echo "${txtautopartclear}"
- parted "${device}" mklabel gpt
- echo "${txtautopartcreate//%1/BIOS boot}"
- sgdisk "${device}" -n=1:0:+31M -t=1:ef02
- echo "${txtautopartcreate//%1/boot}"
- sgdisk "${device}" -n=2:0:+512M
- echo "${txtautopartcreate//%1/swap}"
- swapsize=$(grep MemTotal /proc/meminfo | awk '{ print $2 }')
- swapsize=$((swapsize/1000))"M"
- sgdisk "${device}" -n=3:0:+${swapsize} -t=3:8200
- echo "${txtautopartcreate//%1/root}"
- sgdisk "${device}" -n=4:0:0
- echo ""
- pressanykey
- if [ "${device::8}" == "/dev/nvm" ]; then
- bootdev=${device}"p2"
- swapdev=${device}"p3"
- rootdev=${device}"p4"
- else
- bootdev=${device}"2"
- swapdev=${device}"3"
- rootdev=${device}"4"
- fi
- efimode="0"
- fi
- fi
- }
- diskpartautoefi(){
- device=$(selectdisk "${txtautoparts} (gpt,efi)")
- if [ "$?" = "0" ]; then
- if (whiptail --backtitle "${apptitle}" --title "${txtautoparts} (gpt,efi)" --yesno "${txtautopartsconfirm//%1/${device}}" --defaultno 0 0); then
- clear
- echo "${txtautopartclear}"
- parted "${device}" mklabel gpt
- echo "${txtautopartcreate//%1/EFI boot}"
- sgdisk "${device}" -n=1:0:+1024M -t=1:ef00
- echo "${txtautopartcreate//%1/swap}"
- swapsize=$(grep MemTotal /proc/meminfo | awk '{ print $2 }')
- swapsize=$((swapsize/1000))"M"
- sgdisk "${device}" -n=2:0:+${swapsize} -t=2:8200
- echo "${txtautopartcreate//%1/root}"
- sgdisk "${device}" -n=3:0:0
- echo ""
- pressanykey
- if [ "${device::8}" == "/dev/nvm" ]; then
- bootdev=${device}"p1"
- swapdev=${device}"p2"
- rootdev=${device}"p3"
- else
- bootdev=${device}"1"
- swapdev=${device}"2"
- rootdev=${device}"3"
- fi
- efimode="1"
- fi
- fi
- }
- diskpartautoefiusb(){
- device=$(selectdisk "${txtautoparts} (gpt,efi)")
- if [ "$?" = "0" ]; then
- if (whiptail --backtitle "${apptitle}" --title "${txtautoparts} (gpt,efi)" --yesno "${txtautopartsconfirm//%1/${device}}" --defaultno 0 0); then
- clear
- echo "${txtautopartclear}"
- parted "${device}" mklabel gpt
- echo "${txtautopartcreate//%1/EFI boot}"
- sgdisk "${device}" -n=1:0:+1024M -t=1:ef00
- echo "${txtautopartcreate//%1/BIOS boot}"
- sgdisk "${device}" -n=2:0:+31M -t=2:ef02
- echo "${txtautopartcreate//%1/root}"
- sgdisk "${device}" -n=3:0:0
- echo "${txthybridpartcreate}"
- echo -e "r\nh\n3\nN\n\nY\nN\nw\nY\n" | gdisk "${device}"
- echo ""
- pressanykey
- if [ "${device::8}" == "/dev/nvm" ]; then
- bootdev=${device}"p1"
- swapdev=
- rootdev=${device}"p3"
- else
- bootdev=${device}"1"
- swapdev=
- rootdev=${device}"3"
- fi
- efimode="2"
- fi
- fi
- }
- diskpartcfdisk(){
- device=$( selectdisk "${txteditparts} (cfdisk)" )
- if [ "$?" = "0" ]; then
- clear
- cfdisk "${device}"
- fi
- }
- diskpartcgdisk(){
- device=$( selectdisk "${txteditparts} (cgdisk)" )
- if [ "$?" = "0" ]; then
- clear
- cgdisk "${device}"
- fi
- }
- # --------------------------------------------------------
- # --------------------------------------------------------
- selectparts(){
- items=$(lsblk -p -n -l -o NAME -e 7,11)
- options=()
- for item in ${items}; do
- options+=("${item}" "")
- done
- bootdev=$(whiptail --backtitle "${apptitle}" --title "${txtselectpartsmenu}" --menu "${txtselectdevice//%1/boot}" --default-item "${bootdev}" 0 0 0 \
- "none" "-" \
- "${options[@]}" \
- 3>&1 1>&2 2>&3)
- if [ ! "$?" = "0" ]; then
- return 1
- else
- if [ "${bootdev}" = "none" ]; then
- bootdev=
- fi
- fi
- swapdev=$(whiptail --backtitle "${apptitle}" --title "${txtselectpartsmenu}" --menu "${txtselectdevice//%1/swap}" --default-item "${swapdev}" 0 0 0 \
- "none" "-" \
- "${options[@]}" \
- 3>&1 1>&2 2>&3)
- if [ ! "$?" = "0" ]; then
- return 1
- else
- if [ "${swapdev}" = "none" ]; then
- swapdev=
- fi
- fi
- rootdev=$(whiptail --backtitle "${apptitle}" --title "${txtselectpartsmenu}" --menu "${txtselectdevice//%1/root}" --default-item "${rootdev}" 0 0 0 \
- "${options[@]}" \
- 3>&1 1>&2 2>&3)
- if [ ! "$?" = "0" ]; then
- return 1
- fi
- realrootdev=${rootdev}
- homedev=$(whiptail --backtitle "${apptitle}" --title "${txtselectpartsmenu}" --menu "${txtselectdevice//%1/home}" 0 0 0 \
- "none" "-" \
- "${options[@]}" \
- 3>&1 1>&2 2>&3)
- if [ ! "$?" = "0" ]; then
- return 1
- else
- if [ "${homedev}" = "none" ]; then
- homedev=
- fi
- fi
- msg="${txtselecteddevices}\n\n"
- msg=${msg}"boot : ${bootdev}\n"
- msg=${msg}"swap : ${swapdev}\n"
- msg=${msg}"root : ${rootdev}\n"
- msg=${msg}"home : ${homedev}\n\n"
- if (whiptail --backtitle "${apptitle}" --title "${txtselectpartsmenu}" --yesno "${msg}" 0 0); then
- isnvme=0
- if [ "${bootdev::8}" == "/dev/nvm" ]; then
- isnvme=1
- fi
- if [ "${rootdev::8}" == "/dev/nvm" ]; then
- isnvme=1
- fi
- mountmenu
- fi
- }
- # --------------------------------------------------------
- # --------------------------------------------------------
- mountmenu(){
- if [ "${1}" = "" ]; then
- nextitem="."
- else
- nextitem=${1}
- fi
- options=()
- options+=("${txtformatdevices}" "")
- options+=("${txtmount}" "${txtmountdesc}")
- sel=$(whiptail --backtitle "${apptitle}" --title "${txtformatmountmenu}" --menu "" --cancel-button "${txtback}" --default-item "${nextitem}" 0 0 0 \
- "${options[@]}" \
- 3>&1 1>&2 2>&3)
- if [ "$?" = "0" ]; then
- case ${sel} in
- "${txtformatdevices}")
- formatdevices
- nextitem="${txtmount}"
- ;;
- "${txtmount}")
- mountparts
- nextitem="${txtmount}"
- ;;
- esac
- mountmenu "${nextitem}"
- fi
- }
- formatdevices(){
- if (whiptail --backtitle "${apptitle}" --title "${txtformatdevices}" --yesno "${txtformatdeviceconfirm}" --defaultno 0 0); then
- fspkgs=""
- if [ ! "${bootdev}" = "" ]; then
- formatbootdevice boot "${bootdev}"
- fi
- if [ ! "${swapdev}" = "" ]; then
- formatswapdevice swap" ${swapdev}"
- fi
- formatdevice root "${rootdev}"
- if [ ! "${homedev}" = "" ]; then
- formatdevice home "${homedev}"
- fi
- fi
- }
- formatbootdevice(){
- options=()
- if [ "${efimode}" == "1" ]||[ "${efimode}" = "2" ]; then
- options+=("fat32" "(EFI)")
- fi
- options+=("ext2" "")
- options+=("ext3" "")
- options+=("ext4" "")
- if [ ! "${efimode}" = "1" ]&&[ ! "${efimode}" = "2" ]; then
- options+=("fat32" "(EFI)")
- fi
- sel=$(whiptail --backtitle "${apptitle}" --title "${txtformatdevice}" --menu "${txtselectpartformat//%1/${1} (${2})}" 0 0 0 \
- "${options[@]}" \
- 3>&1 1>&2 2>&3)
- if [ ! "$?" = "0" ]; then
- return 1
- fi
- clear
- echo "${txtformatingpart//%1/${2}} ${sel}"
- echo "----------------------------------------------"
- case ${sel} in
- ext2)
- echo "mkfs.ext2 ${2}"
- mkfs.ext2 "${2}"
- ;;
- ext3)
- echo "mkfs.ext3 ${2}"
- mkfs.ext3 "${2}"
- ;;
- ext4)
- echo "mkfs.ext4 ${2}"
- mkfs.ext4 "${2}"
- ;;
- fat32)
- fspkgs=("${fspkgs[@]} dosfstools")
- echo "mkfs.fat ${2}"
- mkfs.fat "${2}"
- ;;
- esac
- echo ""
- pressanykey
- }
- formatswapdevice(){
- options=()
- options+=("swap" "")
- sel=$(whiptail --backtitle "${apptitle}" --title "${txtformatdevice}" --menu "${txtselectpartformat//%1/${1} (${2})}" 0 0 0 \
- "${options[@]}" \
- 3>&1 1>&2 2>&3)
- if [ ! "$?" = "0" ]; then
- return 1
- fi
- clear
- echo "${txtformatingpart//%1/${swapdev}} swap"
- echo "----------------------------------------------------"
- case ${sel} in
- swap)
- echo "mkswap ${swapdev}"
- mkswap "${swapdev}"
- echo ""
- pressanykey
- ;;
- esac
- clear
- }
- formatdevice(){
- options=()
- options+=("btrfs" "")
- options+=("ext4" "")
- options+=("ext3" "")
- options+=("ext2" "")
- options+=("xfs" "")
- options+=("f2fs" "")
- options+=("jfs" "")
- options+=("reiserfs" "")
- if [ ! "${3}" = "noluks" ]; then
- options+=("luks" "encrypted")
- fi
- sel=$(whiptail --backtitle "${apptitle}" --title "${txtformatdevice}" --menu "${txtselectpartformat//%1/${1} (${2})}" 0 0 0 \
- "${options[@]}" \
- 3>&1 1>&2 2>&3)
- if [ ! "$?" = "0" ]; then
- return 1
- fi
- clear
- echo "${txtformatingpart//%1/${2}} ${sel}"
- echo "----------------------------------------------"
- case ${sel} in
- btrfs)
- fspkgs=("${fspkgs[@]} btrfs-progs")
- echo "mkfs.btrfs -f ${2}"
- mkfs.btrfs -f "${2}"
- if [ "${1}" = "root" ]; then
- echo "mount ${2} /mnt"
- echo "btrfs subvolume create /mnt/root"
- echo "btrfs subvolume set-default /mnt/root"
- echo "umount /mnt"
- mount "${2}" /mnt
- btrfs subvolume create /mnt/root
- btrfs subvolume set-default /mnt/root
- umount /mnt
- fi
- ;;
- ext4)
- echo "mkfs.ext4 ${2}"
- mkfs.ext4 "${2}"
- ;;
- ext3)
- echo "mkfs.ext3 ${2}"
- mkfs.ext3 "${2}"
- ;;
- ext2)
- echo "mkfs.ext2 ${2}"
- mkfs.ext2 "${2}"
- ;;
- xfs)
- fspkgs=("${fspkgs[@]} xfsprogs")
- echo "mkfs.xfs -f ${2}"
- mkfs.xfs -f "${2}"
- ;;
- f2fs)
- fspkgs=("${fspkgs[@]} f2fs-tools")
- echo "mkfs.f2fs -f $2"
- mkfs.f2fs -f "${2}"
- ;;
- jfs)
- fspkgs=("${fspkgs[@]} jfsutils")
- echo "mkfs.jfs -f ${2}"
- mkfs.jfs -f "${2}"
- ;;
- reiserfs)
- fspkgs=("${fspkgs[@]} reiserfsprogs")
- echo "mkfs.reiserfs -f ${2}"
- mkfs.reiserfs -f "${2}"
- ;;
- luks)
- echo "${txtcreateluksdevice}"
- echo "cryptsetup luksFormat ${2}"
- cryptsetup luksFormat "${2}"
- if [ ! "$?" = "0" ]; then
- pressanykey
- return 1
- fi
- pressanykey
- echo ""
- echo "${txtopenluksdevice}"
- echo "cryptsetup luksOpen ${2} ${1}"
- cryptsetup luksOpen "${2}" "${1}"
- if [ ! "$?" = "0" ]; then
- pressanykey
- return 1
- fi
- pressanykey
- options=()
- options+=("normal" "")
- options+=("fast" "")
- sel=$(whiptail --backtitle "${apptitle}" --title "${txtformatdevice}" --menu "Wipe device ?" --cancel-button="${txtignore}" 0 0 0 \
- "${options[@]}" \
- 3>&1 1>&2 2>&3)
- if [ "$?" = "0" ]; then
- case ${sel} in
- normal)
- echo "dd if=/dev/zero of=/dev/mapper/${1}"
- dd if=/dev/zero of=/dev/mapper/"${1}" & PID=$! &>/dev/null
- ;;
- fast)
- echo "dd if=/dev/zero of=/dev/mapper/${1} bs=60M"
- dd if=/dev/zero of=/dev/mapper/"${1}" bs=60M & PID=$! &>/dev/null
- ;;
- esac
- clear
- sleep 1
- while kill -USR1 ${PID} &>/dev/null
- do
- sleep 1
- done
- fi
- echo ""
- pressanykey
- formatdevice "${1}" /dev/mapper/"${1}" noluks
- if [ "${1}" = "root" ]; then
- realrootdev=${rootdev}
- rootdev=/dev/mapper/${1}
- luksroot=1
- luksrootuuid=$(cryptsetup luksUUID "${2}")
- else
- case ${1} in
- home) homedev=/dev/mapper/"${1}" ;;
- esac
- luksdrive=1
- crypttab="\n${1} UUID=$(cryptsetup luksUUID "${2}") none"
- fi
- echo ""
- echo "${txtluksdevicecreated}"
- ;;
- esac
- echo ""
- pressanykey
- }
- mountparts(){
- clear
- echo "mount ${rootdev} /mnt"
- mount "${rootdev}" /mnt
- echo "mkdir /mnt/{boot,home}"
- mkdir /mnt/{boot,home} 2>/dev/null
- if [ ! "${bootdev}" = "" ]; then
- echo "mount ${bootdev} /mnt/boot"
- mount "${bootdev}" /mnt/boot
- fi
- if [ ! "${swapdev}" = "" ]; then
- echo "swapon ${swapdev}"
- swapon "${swapdev}"
- fi
- if [ ! "${homedev}" = "" ]; then
- echo "mount ${homedev} /mnt/home"
- mount "${homedev}" /mnt/home
- fi
- pressanykey
- installmenu
- }
- # --------------------------------------------------------
- # --------------------------------------------------------
- installmenu(){
- if [ "${1}" = "" ]; then
- nextitem="${txtinstallhyperbola}"
- else
- nextitem=${1}
- fi
- options=()
- options+=("${txtselectmirrorsbycountry}" "(${txtoptional})")
- options+=("${txteditmirrorlist}" "(${txtoptional})")
- options+=("${txteditpacmanconf}" "(${txtoptional})")
- options+=("${txtinstallhyperbola}" "pacstrap")
- options+=("${txtconfighyperbola}" "")
- sel=$(whiptail --backtitle "${apptitle}" --title "${txtinstallmenu}" --menu "" --cancel-button "${txtunmount}" --default-item "${nextitem}" 0 0 0 \
- "${options[@]}" \
- 3>&1 1>&2 2>&3)
- if [ "$?" = "0" ]; then
- case ${sel} in
- "${txtselectmirrorsbycountry}")
- selectmirrorsbycountry
- nextitem="${txtinstallhyperbola}"
- ;;
- "${txteditmirrorlist}")
- ${EDITOR} /etc/pacman.d/mirrorlist
- nextitem="${txtinstallhyperbola}"
- ;;
- "${txteditpacmanconf}")
- ${EDITOR} /etc/pacman.conf
- nextitem="${txtinstallhyperbola}"
- ;;
- "${txtinstallhyperbola}")
- if(installbase); then
- nextitem="${txtconfighyperbola}"
- fi
- ;;
- "${txtconfighyperbola}")
- archmenu
- nextitem="${txtconfighyperbola}"
- ;;
- esac
- installmenu "${nextitem}"
- else
- unmountdevices
- fi
- }
- selectmirrorsbycountry() {
- if [[ ! -f /etc/pacman.d/mirrorlist.backup ]]; then
- cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.backup
- fi
- items=$( sed -n "/^##.*/N; {s/^## \(.*\)\nServer.*/\1/p}" < /etc/pacman.d/mirrorlist.backup | sort -u )
- options=()
- IFS_ORIG=$IFS
- IFS=$'\n'
- for item in ${items}; do
- options+=("${item}" "")
- done
- IFS=$IFS_ORIG
- country=$(whiptail --backtitle "${apptitle}" --title "${txtselectcountry}" --menu "" 0 0 0 "${options[@]}" 3>&1 1>&2 2>&3)
- if [ "$?" != "0" ]; then
- return 1
- fi
- sed "s/^\(Server .*\)/\#\1/;/^## $country/N; {s/^\(## .*\n\)\#Server \(.*\)/\1Server \2/}" < /etc/pacman.d/mirrorlist.backup > /etc/pacman.d/mirrorlist
- }
- installbase(){
- pkgs="base"
- options=()
- options+=("linux-libre-lts" "")
- sel=$(whiptail --backtitle "${apptitle}" --title "${txtinstallhyperbolakernel}" --menu "" 0 0 0 \
- "${options[@]}" \
- 3>&1 1>&2 2>&3)
- if [ "$?" = "0" ]; then
- pkgs+=" ${sel}"
- else
- return 1
- fi
- options=()
- options+=("kernel-firmware" "(${txtoptional})" on)
- sel=$(whiptail --backtitle "${apptitle}" --title "${txtinstallhyperbolafirmwares}" --checklist "" 0 0 0 \
- "${options[@]}" \
- 3>&1 1>&2 2>&3)
- if [ ! "$?" = "0" ]; then
- return 1
- fi
- for itm in $sel; do
- pkgs="$pkgs ${itm//\"/}"
- done
- options=()
- for value in "${fspkgs[@]}"; do
- if [[ "${value}" == *"dosfstools"* ]]; then
- options+=("dosfstools" "" on)
- else
- options+=("dosfstools" "" off)
- fi
- if [[ "${value}" == *"btrfs-progs"* ]]; then
- options+=("btrfs-progs" "" on)
- else
- options+=("btrfs-progs" "" off)
- fi
- if [[ "${value}" == *"xfsprogs"* ]]; then
- options+=("xfsprogs" "" on)
- else
- options+=("xfsprogs" "" off)
- fi
- if [[ "${value}" == *"f2fs-tools"* ]]; then
- options+=("f2fs-tools" "" on)
- else
- options+=("f2fs-tools" "" off)
- fi
- if [[ "${value}" == *"jfsutils"* ]]; then
- options+=("jfsutils" "" on)
- else
- options+=("jfsutils" "" off)
- fi
- if [[ "${value}" == *"reiserfsprogs"* ]]; then
- options+=("reiserfsprogs" "" on)
- else
- options+=("reiserfsprogs" "" off)
- fi
- done
- options+=("lvm2" "" off)
- options+=("dmraid" "" off)
- sel=$(whiptail --backtitle "${apptitle}" --title "${txtinstallhyperbolafilesystems}" --checklist "" 0 0 0 \
- "${options[@]}" \
- 3>&1 1>&2 2>&3)
- if [ ! "$?" = "0" ]; then
- return 1
- fi
- for itm in $sel; do
- pkgs="$pkgs ${itm//\"/}"
- done
- if [[ ${cpl} == 1 ]]; then
- sed -i '/^\s*$/d' /tmp/hyperfi-custom-package-list
- sed -i '/^#/ d' /tmp/hyperfi-custom-package-list
- options=()
- while read -r pkg; do
- options+=("${pkg}" "" on)
- done < /tmp/hyperfi-custom-package-list
- sel=$(whiptail --backtitle "${apptitle}" --title "${txtinstallhyperbolacustompackagelist}" --checklist "" 0 0 0 \
- "${options[@]}" \
- 3>&1 1>&2 2>&3)
- if [ ! "$?" = "0" ]; then
- return 1
- fi
- for itm in $sel; do
- pkgs="$pkgs ${itm//\"/}"
- done
- fi
- clear
- echo "pacstrap /mnt ${pkgs}"
- # shellcheck disable=SC2086
- pacstrap /mnt ${pkgs}
- pressanykey
- }
- unmountdevices(){
- clear
- echo "umount -R /mnt"
- umount -R /mnt
- if [ ! "${swapdev}" = "" ]; then
- echo "swapoff ${swapdev}"
- swapoff "${swapdev}"
- fi
- pressanykey
- }
- # --------------------------------------------------------
- # --------------------------------------------------------
- archmenu(){
- if [ "${1}" = "" ]; then
- nextitem="."
- else
- nextitem=${1}
- fi
- options=()
- options+=("${txtsethostname}" "/etc/hostname")
- options+=("${txtsetkeymap}" "/etc/vconsole.conf")
- options+=("${txtsetfont}" "/etc/vconsole.conf (${txtoptional})")
- options+=("${txtsetlocale}" "/etc/locale.conf, /etc/locale.gen")
- options+=("${txtsettime}" "/etc/localtime")
- options+=("${txtsetrootpassword}" "")
- options+=("${txtgenerate//%1/fstab}" "")
- if [ "${luksdrive}" = "1" ]; then
- options+=("${txtgenerate//%1/crypttab}" "")
- fi
- if [ "${luksroot}" = "1" ]; then
- options+=("${txtgenerate//%1/mkinitcpio.conf-luks}" "(encrypt hooks)")
- fi
- if [ "${isnvme}" = "1" ]; then
- options+=("${txtgenerate//%1/mkinitcpio.conf-nvme}" "(nvme module)")
- fi
- options+=("${txtedit//%1/fstab}" "(${txtoptional})")
- options+=("${txtedit//%1/crypttab}" "(${txtoptional})")
- options+=("${txtedit//%1/mkinitcpio.conf}" "(${txtoptional})")
- options+=("${txtedit//%1/mirrorlist}" "(${txtoptional})")
- options+=("${txtedit//%1/pacman.conf}" "(${txtoptional})")
- options+=("${txtbootloader}" "")
- options+=("${txtextrasmenu}" "")
- options+=("hyperdi" "${txthyperdidesc}")
- sel=$(whiptail --backtitle "${apptitle}" --title "${txthyperbolainstallmenu}" --menu "" --cancel-button "${txtback}" --default-item "${nextitem}" 0 0 0 \
- "${options[@]}" \
- 3>&1 1>&2 2>&3)
- if [ "$?" = "0" ]; then
- case ${sel} in
- "${txtsethostname}")
- archsethostname
- nextitem="${txtsetkeymap}"
- ;;
- "${txtsetkeymap}")
- archsetkeymap
- nextitem="${txtsetlocale}"
- ;;
- "${txtsetfont}")
- archsetfont
- nextitem="${txtsetlocale}"
- ;;
- "${txtsetlocale}")
- archsetlocale
- nextitem="${txtsettime}"
- ;;
- "${txtsettime}")
- archsettime
- nextitem="${txtsetrootpassword}"
- ;;
- "${txtsetrootpassword}")
- archsetrootpassword
- nextitem="${txtgenerate//%1/fstab}"
- ;;
- "${txtgenerate//%1/fstab}")
- archgenfstabmenu
- if [ "${luksdrive}" = "1" ]; then
- nextitem="${txtgenerate//%1/crypttab}"
- else
- if [ "${luksroot}" = "1" ]; then
- nextitem="${txtgenerate//%1/mkinitcpio.conf-luks}"
- else
- if [ "${isnvme}" = "1" ]; then
- nextitem="${txtgenerate//%1/mkinitcpio.conf-nvme}"
- else
- nextitem="${txtbootloader}"
- fi
- fi
- fi
- ;;
- "${txtgenerate//%1/crypttab}")
- archgencrypttab
- if [ "${luksroot}" = "1" ]; then
- nextitem="${txtgenerate//%1/mkinitcpio.conf-luks}"
- else
- if [ "${isnvme}" = "1" ]; then
- nextitem="${txtgenerate//%1/mkinitcpio.conf-nvme}"
- else
- nextitem="${txtbootloader}"
- fi
- fi
- ;;
- "${txtgenerate//%1/mkinitcpio.conf-luks}")
- archgenmkinitcpioluks
- if [ "${isnvme}" = "1" ]; then
- nextitem="${txtgenerate//%1/mkinitcpio.conf-nvme}"
- else
- nextitem="${txtbootloader}"
- fi
- ;;
- "${txtgenerate//%1/mkinitcpio.conf-nvme}")
- archgenmkinitcpionvme
- nextitem="${txtbootloader}"
- ;;
- "${txtedit//%1/fstab}")
- ${EDITOR} /mnt/etc/fstab
- nextitem="${txtedit//%1/fstab}"
- ;;
- "${txtedit//%1/crypttab}")
- ${EDITOR} /mnt/etc/crypttab
- nextitem="${txtedit//%1/crypttab}"
- ;;
- "${txtedit//%1/mkinitcpio.conf}")
- archeditmkinitcpio
- nextitem="${txtedit//%1/mkinitcpio.conf}"
- ;;
- "${txtedit//%1/mirrorlist}")
- ${EDITOR} /mnt/etc/pacman.d/mirrorlist
- nextitem="${txtedit//%1/mirrorlist}"
- ;;
- "${txtedit//%1/pacman.conf}")
- ${EDITOR} /mnt/etc/pacman.conf
- nextitem="${txtedit//%1/pacman.conf}"
- ;;
- "${txtbootloader}")
- archbootloadermenu
- nextitem="${txtextrasmenu}"
- ;;
- "${txtextrasmenu}")
- archextrasmenu
- nextitem="hyperdi"
- ;;
- "hyperdi")
- installhyperdi
- nextitem="hyperdi"
- ;;
- esac
- archmenu "${nextitem}"
- fi
- }
- archchroot(){
- echo "arch-chroot /mnt /root"
- cp "${0}" /mnt/root
- chmod 755 /mnt/root/"$(basename "${0}")"
- arch-chroot /mnt /root/"$(basename "${0}")" --chroot "${1}" "${2}"
- rm /mnt/root/"$(basename "${0}")"
- echo "exit"
- }
- archsethostname(){
- hostname=$(whiptail --backtitle "${apptitle}" --title "${txtsethostname}" --inputbox "" 0 0 "hyperbola" 3>&1 1>&2 2>&3)
- if [ "$?" = "0" ]; then
- clear
- echo "echo \"${hostname}\" > /mnt/etc/hostname"
- echo "${hostname}" > /mnt/etc/hostname
- pressanykey
- fi
- }
- archsetkeymap(){
- items=$(find /usr/share/kbd/keymaps/ -type f -printf "%f\n" | sort -V)
- options=()
- defsel=""
- for item in ${items}; do
- if [ "${item%%.*}" == "${keymap}" ]; then
- defsel="${item%%.*}"
- fi
- options+=("${item%%.*}" "")
- done
- keymap=$(whiptail --backtitle "${apptitle}" --title "${txtsetkeymap}" --menu "" --default-item "${defsel}" 0 0 0 \
- "${options[@]}" \
- 3>&1 1>&2 2>&3)
- if [ "$?" = "0" ]; then
- clear
- echo "echo \"KEYMAP=${keymap}\" > /mnt/etc/vconsole.conf"
- echo "KEYMAP=${keymap}" > /mnt/etc/vconsole.conf
- echo "sed -e \"s|^keymap=\\\"us\\\"|keymap=\\\"${keymap}\\\"|g\" -i /mnt/etc/conf.d/keymaps"
- sed -e "s|^keymap=\"us\"|keymap=\"${keymap}\"|g" -i /mnt/etc/conf.d/keymaps
- pressanykey
- fi
- }
- archsetfont(){
- items=$(find /usr/share/kbd/consolefonts/*.psfu.gz -printf "%f\n")
- options=()
- for item in ${items}; do
- options+=("${item%%.*}" "")
- done
- vcfont=$(whiptail --backtitle "${apptitle}" --title "${txtsetfont} (${txtoptional})" --menu "" 0 0 0 \
- "${options[@]}" \
- 3>&1 1>&2 2>&3)
- if [ "$?" = "0" ]; then
- clear
- echo "echo \"FONT=${vcfont}\" >> /mnt/etc/vconsole.conf"
- echo "FONT=${vcfont}" >> /mnt/etc/vconsole.conf
- pressanykey
- fi
- }
- archsetlocale(){
- items=$(ls /usr/share/i18n/locales)
- options=()
- defsel=""
- for item in ${items}; do
- if [ "${defsel}" == "" ]&&[ "${keymap::2}" == "${item::2}" ]; then
- defsel="${item}"
- fi
- options+=("${item}" "")
- done
- locale=$(whiptail --backtitle "${apptitle}" --title "${txtsetlocale}" --menu "" --default-item "${defsel}" 0 0 0 \
- "${options[@]}" \
- 3>&1 1>&2 2>&3)
- if [ "$?" = "0" ]; then
- clear
- echo "echo \"LANG=${locale}.UTF-8\" > /mnt/etc/locale.conf"
- echo "LANG=${locale}.UTF-8" > /mnt/etc/locale.conf
- echo "echo \"LC_COLLATE=C\" >> /mnt/etc/locale.conf"
- echo "LC_COLLATE=C" >> /mnt/etc/locale.conf
- echo "sed -i '/#${locale}.UTF-8/s/^#//g' /mnt/etc/locale.gen"
- sed -i '/#'"${locale}"'.UTF-8/s/^#//g' /mnt/etc/locale.gen
- archchroot setlocale
- pressanykey
- fi
- }
- archsetlocalechroot(){
- echo "locale-gen"
- locale-gen
- exit
- }
- archsettime(){
- items=$(find /usr/share/zoneinfo/ -mindepth 1 -maxdepth 1 -type d -printf '%f/\n' | sort)
- options=()
- for item in ${items}; do
- options+=("${item}" "")
- done
- timezone=$(whiptail --backtitle "${apptitle}" --title "${txtsettime}" --menu "" 0 0 0 \
- "${options[@]}" \
- 3>&1 1>&2 2>&3)
- if [ ! "$?" = "0" ]; then
- return 1
- fi
- items=$(ls /mnt/usr/share/zoneinfo/"${timezone}"/)
- options=()
- for item in ${items}; do
- options+=("${item}" "")
- done
- timezone=${timezone}/$(whiptail --backtitle "${apptitle}" --title "${txtsettime}" --menu "" 0 0 0 \
- "${options[@]}" \
- 3>&1 1>&2 2>&3)
- if [ ! "$?" = "0" ]; then
- return 1
- fi
- clear
- echo "ln -sf /mnt/usr/share/zoneinfo/${timezone} /mnt/etc/localtime"
- ln -sf /usr/share/zoneinfo/"${timezone}" /mnt/etc/localtime
- pressanykey
- options=()
- options+=("UTC" "")
- options+=("Local" "")
- sel=$(whiptail --backtitle "${apptitle}" --title "${txtsettime}" --menu "${txthwclock}" 0 0 0 \
- "${options[@]}" \
- 3>&1 1>&2 2>&3)
- if [ ! "$?" = "0" ]; then
- return 1
- fi
- clear
- case ${sel} in
- "${txthwclockutc}")
- archchroot settimeutc
- ;;
- "${txthwclocklocal}")
- archchroot settimelocal
- ;;
- esac
- pressanykey
- }
- archsettimeutcchroot(){
- echo "hwclock --systohc --utc"
- hwclock --systohc --utc
- exit
- }
- archsettimelocalchroot(){
- echo "hwclock --systohc --localtime"
- hwclock --systohc --localtime
- exit
- }
- archsetrootpassword(){
- clear
- archchroot setrootpassword
- pressanykey
- }
- archsetrootpasswordchroot(){
- echo "passwd root"
- passed=1
- while [[ ${passed} != 0 ]]; do
- passwd root
- passed=$?
- done
- exit
- }
- archgenfstabmenu(){
- options=()
- options+=("UUID" "genfstab -U")
- options+=("LABEL" "genfstab -L")
- options+=("PARTUUID" "genfstab -t PARTUUID")
- options+=("PARTLABEL" "genfstab -t PARTLABEL")
- sel=$(whiptail --backtitle "${apptitle}" --title "${txtgenerate//%1/fstab}" --menu "" --cancel-button "${txtback}" --default-item "${nextitem}" 0 0 0 \
- "${options[@]}" \
- 3>&1 1>&2 2>&3)
- if [ "$?" = "0" ]; then
- case ${sel} in
- "UUID")
- clear
- echo "genfstab -U -p /mnt > /mnt/etc/fstab"
- genfstab -U -p /mnt > /mnt/etc/fstab
- ;;
- "LABEL")
- clear
- echo "genfstab -L -p /mnt > /mnt/etc/fstab"
- genfstab -L -p /mnt > /mnt/etc/fstab
- ;;
- "PARTUUID")
- clear
- echo "genfstab -t PARTUUID -p /mnt > /mnt/etc/fstab"
- genfstab -t PARTUUID -p /mnt > /mnt/etc/fstab
- ;;
- "PARTLABEL")
- clear
- echo "genfstab -t PARTLABEL -p /mnt > /mnt/etc/fstab"
- genfstab -t PARTLABEL -p /mnt > /mnt/etc/fstab
- ;;
- esac
- fi
- pressanykey
- }
- archgencrypttab(){
- clear
- echo "echo -e \"${crypttab}\" >> /mnt/etc/crypttab"
- echo -e "${crypttab}" >> /mnt/etc/crypttab
- pressanykey
- }
- archgenmkinitcpioluks(){
- clear
- echo "sed -i \"s/block filesystems/block encrypt filesystems/g\" /mnt/etc/mkinitcpio.conf"
- sed -i "s/block filesystems/block encrypt filesystems/g" /mnt/etc/mkinitcpio.conf
- archchroot genmkinitcpio
- pressanykey
- }
- archgenmkinitcpionvme(){
- clear
- echo "sed -i \"s/MODULES=()/MODULES=(nvme)/g\" /mnt/etc/mkinitcpio.conf"
- sed -i "s/MODULES=()/MODULES=(nvme)/g" /mnt/etc/mkinitcpio.conf
- archchroot genmkinitcpio
- pressanykey
- }
- archeditmkinitcpio(){
- ${EDITOR} /mnt/etc/mkinitcpio.conf
- if (whiptail --backtitle "${apptitle}" --title "${txtedit//%1/mkinitcpio.conf}" --yesno "${txtgenerate//%1/mkinitcpio} ?" 0 0); then
- clear
- archchroot genmkinitcpio
- pressanykey
- fi
- }
- archgenmkinitcpiochroot(){
- echo "mkinitcpio -p linux-libre-lts"
- mkinitcpio -p linux-libre-lts
- exit
- }
- archbootloadermenu(){
- options=()
- options+=("grub" "")
- if [ "${efimode}" == "1" ]; then
- options+=("refind" "")
- fi
- if [ "${efimode}" != "2" ]; then
- options+=("syslinux" "")
- fi
- sel=$(whiptail --backtitle "${apptitle}" --title "${txtbootloadermenu}" --menu "" --cancel-button "${txtback}" 0 0 0 \
- "${options[@]}" \
- 3>&1 1>&2 2>&3)
- if [ "$?" = "0" ]; then
- case ${sel} in
- "grub") archbootloadergrubmenu;;
- "refind") archbootloaderrefindmenu;;
- "syslinux")archbootloadersyslinuxbmenu;;
- esac
- fi
- }
- archbootloadergrubmenu(){
- if [ "${1}" = "" ]; then
- nextblitem="."
- else
- nextblitem=${1}
- fi
- options=()
- options+=("${txtinstall//%1/grub}" "pacstrap grub (efibootmgr), grub-mkconfig")
- options+=("${txtedit//%1/grub}" "(${txtoptional})")
- options+=("${txtinstall//%1/bootloader}" "grub-install")
- sel=$(whiptail --backtitle "${apptitle}" --title "${txtbootloadergrubmenu}" --menu "" --cancel-button "${txtback}" --default-item "${nextblitem}" 0 0 0 \
- "${options[@]}" \
- 3>&1 1>&2 2>&3)
- if [ "$?" = "0" ]; then
- case ${sel} in
- "${txtinstall//%1/grub}")
- archgrubinstall
- nextblitem="${txtinstall//%1/bootloader}"
- ;;
- "${txtedit//%1/grub}")
- ${EDITOR} /mnt/etc/default/grub
- if (whiptail --backtitle "${apptitle}" --title "${txtedit//%1/grub}" --yesno "${txtrungrubmakeconfig}" 0 0) ; then
- clear
- archchroot grubinstall
- pressanykey
- fi
- nextblitem="${txtinstall//%1/bootloader}"
- ;;
- "${txtinstall//%1/bootloader}")
- archgrubinstallbootloader
- nextblitem="${txtinstall//%1/bootloader}"
- ;;
- esac
- archbootloadergrubmenu "${nextblitem}"
- fi
- }
- archgrubinstall(){
- clear
- echo "pacstrap /mnt grub"
- pacstrap /mnt grub
- pressanykey
- if [ "${eficomputer}" == "1" ]; then
- if [ "${efimode}" == "1" ]||[ "${efimode}" == "2" ]; then
- if (whiptail --backtitle "${apptitle}" --title "${txtinstall//%1/efibootmgr}" --yesno "${txtefibootmgr}" 0 0) ; then
- clear
- echo "pacstrap /mnt efibootmgr"
- pacstrap /mnt efibootmgr
- pressanykey
- fi
- else
- if (whiptail --backtitle "${apptitle}" --title "${txtinstall//%1/efibootmgr}" --yesno "${txtefibootmgr}" --defaultno 0 0) ; then
- clear
- echo "pacstrap /mnt efibootmgr"
- pacstrap /mnt efibootmgr
- pressanykey
- fi
- fi
- fi
- if [ "${luksroot}" = "1" ]; then
- if (whiptail --backtitle "${apptitle}" --title "${txtinstall//%1/grub}" --yesno "${txtgrubluksdetected}" 0 0) ; then
- clear
- echo "sed -e \"s|GRUB_CMDLINE_LINUX=\\\"\\\"|GRUB_CMDLINE_LINUX=\\\"cryptdevice=/dev/disk/by-uuid/${luksrootuuid}:root\\\"|g\" -i /mnt/etc/default/grub"
- sed -e "s|GRUB_CMDLINE_LINUX=\"\"|GRUB_CMDLINE_LINUX=\"cryptdevice=/dev/disk/by-uuid/${luksrootuuid}:root\"|g" -i /mnt/etc/default/grub
- pressanykey
- fi
- fi
- clear
- archchroot grubinstall
- pressanykey
- }
- archgrubinstallchroot(){
- echo "mkdir /boot/grub"
- echo "grub-mkconfig -o /boot/grub/grub.cfg"
- mkdir /boot/grub
- grub-mkconfig -o /boot/grub/grub.cfg
- exit
- }
- archgrubinstallbootloader(){
- device=$( selectdisk "${txtinstall//%1/bootloader}" )
- if [ "$?" = "0" ]; then
- if [ "${eficomputer}" == "1" ]; then
- options=()
- if [ "${efimode}" = "1" ]; then
- options+=("EFI" "")
- options+=("BIOS" "")
- options+=("BIOS+EFI" "")
- elif [ "${efimode}" = "2" ]; then
- options+=("BIOS+EFI" "")
- options+=("BIOS" "")
- options+=("EFI" "")
- else
- options+=("BIOS" "")
- options+=("EFI" "")
- options+=("BIOS+EFI" "")
- fi
- sel=$(whiptail --backtitle "${apptitle}" --title "${txtinstall//%1/bootloader}" --menu "" --cancel-button "${txtback}" 0 0 0 \
- "${options[@]}" \
- 3>&1 1>&2 2>&3)
- if [ "$?" = "0" ]; then
- clear
- case ${sel} in
- "BIOS") archchroot grubbootloaderinstall "${device}";;
- "EFI") archchroot grubbootloaderefiinstall "${device}";;
- "BIOS+EFI") archchroot grubbootloaderefiusbinstall "${device}";;
- esac
- pressanykey
- fi
- else
- clear
- archchroot grubbootloaderinstall "${device}"
- pressanykey
- fi
- fi
- }
- archgrubinstallbootloaderchroot(){
- if [ ! "${1}" = "none" ]; then
- echo "grub-install --target=i386-pc --recheck ${1}"
- grub-install --target=i386-pc --recheck "${1}"
- fi
- exit
- }
- archgrubinstallbootloaderefichroot(){
- if [ ! "${1}" = "none" ]; then
- echo "grub-install --target=x86_64-efi --efi-directory=/boot --recheck ${1}"
- grub-install --target=x86_64-efi --efi-directory=/boot --recheck "${1}"
- isvbox=$(lspci | grep "VirtualBox G")
- if [ "${isvbox}" ]; then
- echo "VirtualBox detected, creating startup.nsh..."
- printf '%s' '\EFI\arch\grubx64.efi' > /boot/startup.nsh
- fi
- fi
- exit
- }
- archgrubinstallbootloaderefiusbchroot(){
- if [ ! "${1}" = "none" ]; then
- echo "grub-install --target=i386-pc --recheck ${1}"
- grub-install --target=i386-pc --recheck "${1}"
- echo "grub-install --target=x86_64-efi --efi-directory=/boot --removable --recheck ${1}"
- grub-install --target=x86_64-efi --efi-directory=/boot --removable --recheck "${1}"
- isvbox=$(lspci | grep "VirtualBox G")
- if [ "${isvbox}" ]; then
- echo "VirtualBox detected, creating startup.nsh..."
- printf '%s' '\EFI\arch\grubx64.efi' > /boot/startup.nsh
- fi
- fi
- exit
- }
- archbootloadersyslinuxbmenu(){
- if [ "${1}" = "" ]; then
- nextblitem="."
- else
- nextblitem=${1}
- fi
- options=()
- options+=("${txtinstall//%1/syslinux}" "pacstrap syslinux (gptfdisk,mtools)")
- options+=("${txtedit//%1/syslinux}" "(${txtoptional})")
- options+=("${txtinstall//%1/bootloader}" "syslinux-install_update")
- sel=$(whiptail --backtitle "${apptitle}" --title "${txtbootloadersyslinuxmenu}" --menu "" --cancel-button "${txtback}" --default-item "${nextblitem}" 0 0 0 \
- "${options[@]}" \
- 3>&1 1>&2 2>&3)
- if [ "$?" = "0" ]; then
- case ${sel} in
- "${txtinstall//%1/syslinux}")
- archsyslinuxinstall
- nextblitem="${txtinstall//%1/bootloader}"
- ;;
- "${txtedit//%1/syslinux}")
- ${EDITOR} /mnt/boot/syslinux/syslinux.cfg
- nextblitem="${txtinstall//%1/bootloader}"
- ;;
- "${txtinstall//%1/bootloader}")
- archsyslinuxinstallbootloader
- nextblitem="${txtinstall//%1/bootloader}"
- ;;
- esac
- archbootloadersyslinuxbmenu "${nextblitem}"
- fi
- }
- archsyslinuxinstall(){
- clear
- if [ "${efimode}" == "1" ]||[ "${efimode}" == "2" ]; then
- echo "${txtsyslinuxaddefibootmgr}"
- additionalpkg=${additionalpkg}"efibootmgr "
- fi
- if [ "${isnvme}" = "1" ]; then
- if [ "$(parted "${realrootdev::(-2)}" print|grep gpt)" != "" ]; then
- echo "${txtsyslinuxaddgptfdisk}"
- additionalpkg=${additionalpkg}"gptfdisk "
- fi
- else
- if [ "$(parted "${realrootdev::8}" print|grep gpt)" != "" ]; then
- echo "${txtsyslinuxaddgptfdisk}"
- additionalpkg=${additionalpkg}"gptfdisk "
- fi
- fi
- if [ "${bootdev}" != "" ]; then
- if [ "$(parted "${bootdev}" print|grep fat)" != "" ]; then
- echo "${txtsyslinuxaddmtools}"
- additionalpkg=${additionalpkg}"mtools "
- fi
- fi
- echo "pacstrap /mnt syslinux ${additionalpkg}"
- # shellcheck disable=SC2086
- pacstrap /mnt syslinux ${additionalpkg}
- pressanykey
- clear
- echo "Updating /boot/syslinux/syslinux.cfg"
- if [ "${luksroot}" = "1" ]; then
- echo "sed -i \"/APPEND\ root=/c\ APPEND root=/dev/mapper/root cryptdevice=${realrootdev}:root rw\" /mnt/boot/syslinux/syslinux.cfg"
- sed -i "/APPEND\ root=/c\ APPEND root=/dev/mapper/root cryptdevice=${realrootdev}:root\ rw" /mnt/boot/syslinux/syslinux.cfg
- else
- echo "sed -i \"/APPEND\ root=/c\ APPEND root=${rootdev} rw\" /mnt/boot/syslinux/syslinux.cfg"
- sed -i "/APPEND\ root=/c\ APPEND root=${rootdev}\ rw" /mnt/boot/syslinux/syslinux.cfg
- fi
- pressanykey
- }
- archsyslinuxinstallbootloader(){
- clear
- if [ "${efimode}" == "1" ]||[ "${efimode}" == "2" ]; then
- archchroot syslinuxbootloaderefiinstall "${bootdev}"
- else
- archchroot syslinuxbootloaderinstall "${bootdev}"
- fi
- pressanykey
- }
- archsyslinuxinstallbootloaderchroot(){
- if [ ! "${1}" = "none" ]; then
- echo "syslinux-install_update -i -a -m"
- syslinux-install_update -i -a -m
- fi
- exit
- }
- archsyslinuxinstallbootloaderefichroot(){
- if [ ! "${1}" = "none" ]; then
- echo "cp -r /usr/lib/syslinux/efi64/* /boot/syslinux"
- cp -r /usr/lib/syslinux/efi64/* /boot/syslinux
- if [ "${1::8}" == "/dev/nvm" ]; then
- echo "efibootmgr --create --disk ${1::(-2)} --part ${1:(-1)} --loader /syslinux/syslinux.efi --label \"Syslinux\" --verbose"
- efibootmgr --create --disk "${1::(-2)}" --part "${1:(-1)}" --loader /syslinux/syslinux.efi --label "Syslinux" --verbose
- else
- echo "efibootmgr --create --disk ${1::8} --part ${1:(-1)} --loader /syslinux/syslinux.efi --label \"Syslinux\" --verbose"
- efibootmgr --create --disk "${1::8}" --part "${1:(-1)}" --loader /syslinux/syslinux.efi --label "Syslinux" --verbose
- fi
- isvbox=$(lspci | grep "VirtualBox G")
- if [ "${isvbox}" ]; then
- echo "VirtualBox detected, creating startup.nsh..."
- printf '%s' '\syslinux\syslinux.efi' > /boot/startup.nsh
- fi
- fi
- exit
- }
- archbootloaderrefindmenu(){
- if [ "${1}" = "" ]; then
- nextblitem="."
- else
- nextblitem=${1}
- fi
- options=()
- options+=("${txtinstall//%1/refind}" "pacstrap refind-efi")
- options+=("${txtedit//%1/refind_linux.conf}" "(${txtoptional})")
- sel=$(whiptail --backtitle "${apptitle}" --title "${txtbootloaderrefindmenu}" --menu "" --cancel-button "${txtback}" --default-item "${nextblitem}" 0 0 0 \
- "${options[@]}" \
- 3>&1 1>&2 2>&3)
- if [ "$?" = "0" ]; then
- case ${sel} in
- "${txtinstall//%1/refind}")
- archrefindinstall
- nextblitem="${txtedit//%1/refind_linux.conf}"
- ;;
- "${txtedit//%1/refind_linux.conf}")
- ${EDITOR} /mnt/boot/refind_linux.conf
- nextblitem="${txtedit//%1/refind_linux.conf}"
- ;;
- esac
- archbootloaderrefindmenu "${nextblitem}"
- fi
- }
- archrefindinstall(){
- clear
- echo "pacstrap /mnt refind-efi"
- echo "archchroot refindbootloaderinstall ${realrootdev}"
- echo "echo \"\\\"Hyperbola GNU+Linux-libre \\\" \\\"root=UUID=${rootuuid} rw add_efi_memmap\\\"\" > /mnt/boot/refind_linux.conf"
- echo "echo \"\\\"Hyperbola GNU+Linux-libre Fallback\\\" \\\"root=UUID=${rootuuid} rw add_efi_memmap initrd=/initramfs-linux-fallback.img\\\"\" >> /mnt/boot/refind_linux.conf"
- pacstrap /mnt refind-efi
- archchroot refindbootloaderinstall "${realrootdev}"
- rootuuid=$(blkid -s UUID -o value "${realrootdev}")
- echo "\"Hyperbola GNU+Linux-libre \" \"root=UUID=${rootuuid} rw add_efi_memmap\"" > /mnt/boot/refind_linux.conf
- echo "\"Hyperbola GNU+Linux-libre Fallback\" \"root=UUID=${rootuuid} rw add_efi_memmap initrd=/initramfs-linux-fallback.img\"" >> /mnt/boot/refind_linux.conf
- pressanykey
- }
- archrefindinstallchroot(){
- #--usedefault /dev/sdXY --alldrivers
- echo "refind-install"
- refind-install
- isvbox=$(lspci | grep "VirtualBox G")
- if [ "${isvbox}" ]; then
- echo "VirtualBox detected, creating startup.nsh..."
- printf '%s' '\EFI\refind\refind_x64.efi' > /boot/startup.nsh
- fi
- }
- archextrasmenu(){
- pkgs=""
- options=()
- # personal start
- options+=("openntpd" "" on)
- options+=("ldns" "" on)
- options+=("emacs" "" on)
- options+=("xenocara-server" "" on)
- options+=("xenocara-xinit" "" on)
- options+=("xenocara" "" on)
- options+=("ttf-liberation" "" on)
- options+=("ttf-dejavu" "" on)
- options+=("mesa mesa-demos" "" on)
- options+=("alsa-lib" "" on)
- options+=("iceweasel-uxp" "" on)
- options+=("iceweasel-uxp-l10n-es-es" "" on)
- options+=("aspell-i18n-dict-et" "" on)
- options+=("binutils" "" on)
- options+=("zlib" "" on)
- options+=("bzip2" "" on)
- options+=("unar" "" on)
- options+=("lrzip" "" on)
- options+=("p7zip" "" on)
- options+=("zip" "" on)
- options+=("libzip" "" on)
- options+=("unzip" "" on)
- options+=("udevil" "" on)
- options+=("dash" "" on)
- options+=("ntfs-3g" "" on)
- options+=("exfat-utils" "" on)
- options+=("dosfstools" "" on)
- options+=("wget" "" on)
- options+=("picom" "" on)
- options+=("feh" "" on)
- options+=("sakura" "" on)
- options+=("ttf-hack" "" on)
- options+=("hspell" "" on)
- options+=("libretools" "" on)
- options+=("tree" "" on)
- options+=("htop" "" on)
- options+=("aspell-i18n-dict-es" "" on)
- options+=("aspell-i18n-dict-de" "" on)
- options+=("scrot" "" on)
- options+=("herbe" "" on)
- options+=("wmctrl" "" on)
- options+=("xclip" "" on)
- options+=("espeak" "" on)
- options+=("doas" "" on)
- # personal end
- options+=("nano" "" on)
- options+=("screen" "" on)
- options+=("vim" "" on)
- options+=("dhcpcd" "" on)
- options+=("wpa_supplicant" "" on)
- options+=("iw" "" on)
- options+=("net-tools" "" on)
- options+=("bind-tools" "" on)
- sel=$(whiptail --backtitle "${apptitle}" --title "${txtextrasmenu}" --checklist "" 0 0 0 \
- "${options[@]}" \
- 3>&1 1>&2 2>&3)
- if [ ! "$?" = "0" ]; then
- return 1
- fi
- for itm in $sel; do
- pkgs="$pkgs ${itm//\"/}"
- done
- clear
- echo "pacstrap /mnt ${pkgs}"
- # shellcheck disable=SC2086
- pacstrap /mnt ${pkgs}
- if [[ "${pkgs}" == *"dhcpcd"* ]]; then
- archchroot enabledhcpcd
- fi
- if [[ "${pkgs}" == *"wpa_supplicant"* ]]; then
- archchroot enablewpa_supplicant
- fi
- pressanykey
- }
- archenabledhcpcdchroot(){
- echo "rc-update add dhcpcd default"
- rc-update add dhcpcd default
- exit
- }
- archenablewpa_supplicantchroot(){
- echo "rc-update add wpa_supplicant default"
- rc-update add wpa_supplicant default
- exit
- }
- installhyperdi(){
- txtinstallhyperdi="Hyperbola GNU+Linux-libre Desktop Install (hyperdi) is a second script who can help you to install a full workstation.\n\nYou can just launch the script or install it. Choose in the next menu.\n\nHyperbola GNU+Linux-libre Desktop Install as two dependencies : wget and libnewt.\n\npacstrap wget libnewt ?"
- if(whiptail --backtitle "${apptitle}" --title "hyperdi" --yesno "${txtinstallhyperdi}" 0 0); then
- clear
- echo "pacstrap /mnt wget libnewt"
- pacstrap /mnt wget libnewt
- fi
- if [ "$?" = "0" ]; then
- options=()
- options+=("${txthyperdiinstallandlaunch}" "")
- options+=("${txthyperdilaunch}" "")
- options+=("${txthyperdiinstall}" "")
- sel=$(whiptail --backtitle "${apptitle}" --title "${txthyperdimenu}" --menu "" --cancel-button "${txtback}" 0 0 0 \
- "${options[@]}" \
- 3>&1 1>&2 2>&3)
- if [ "$?" = "0" ]; then
- case ${sel} in
- "${txthyperdiinstallandlaunch}") archchroot hyperdiinstallandlaunch;;
- "${txthyperdilaunch}") archchroot hyperdilaunch;;
- "${txthyperdiinstall}")
- clear
- archchroot hyperdiinstall
- pressanykey
- ;;
- esac
- fi
- fi
- }
- hyperdidownload(){
- txtselectserver="Select source server :"
- txtback="Back"
- options=()
- options+=("sourceforge.net" "recommended")
- options+=("github.com" "")
- sel=$(whiptail --backtitle "${apptitle}" --title "${txtselectserver}" --menu "" --cancel-button "${txtback}" 0 0 0 \
- "${options[@]}" \
- 3>&1 1>&2 2>&3)
- if [ "$?" = "0" ]; then
- case ${sel} in
- "sourceforge.net")
- hyperdiurl=hyperdi.sourceforge.net/hyperdi
- ;;
- "github.com")
- hyperdiurl=matmoul.github.io/hyperdi >hyperdi
- ;;
- esac
- fi
- echo "curl -L ${hyperdiurl} >hyperdi"
- curl -L "${hyperdiurl}" > hyperdi
- }
- hyperdiinstallandlaunchchroot(){
- cd || return
- hyperdidownload
- sh hyperdi -i
- hyperdi --chroot
- exit
- }
- hyperdilaunchchroot(){
- cd || return
- hyperdidownload
- sh hyperdi --chroot
- rm hyperdi
- exit
- }
- hyperdiinstallchroot(){
- cd || return
- hyperdidownload
- sh hyperdi -i
- exit
- }
- # --------------------------------------------------------
- # --------------------------------------------------------
- pressanykey(){
- read -r -n1 -p "${txtpressanykey}"
- }
- loadstrings(){
- locale=en_US.UTF-8
- #font=
- txtexit="Exit"
- txtback="Back"
- txtignore="Ignore"
- txtselectserver="Select source server :"
- txtmainmenu="Main Menu"
- txtlanguage="Language"
- txtsetkeymap="Set Keyboard Layout"
- txteditor="Editor"
- txtdiskpartmenu="Disk Partitions"
- txtselectpartsmenu="Select Partitions and Install"
- txthelp="Help"
- txtchangelog="Changelog"
- txtreboot="Reboot"
- txtautoparts="Auto Partitions"
- txteditparts="Edit Partitions"
- txtautopartsconfirm="Selected device : %1\n\nAll data will be erased ! \n\nContinue ?"
- txtautopartclear="Clear all partition data"
- txtautopartcreate="Create %1 partition"
- txthybridpartcreate="Set hybrid MBR"
- txtselectdevice="Select %1 device :"
- txtselecteddevices="Selected devices :"
- txtformatmountmenu="Format and Mount"
- txtformatdevices="Format Devices"
- txtformatdevice="Format Device"
- txtmount="Mount"
- txtunmount="Unmount"
- txtmountdesc="Install or Config"
- txtformatdeviceconfirm="Warning, all data on selected devices will be erased ! \nFormat devices ?"
- txtselectpartformat="Select partition format for %1 :"
- txtformatingpart="Formatting partition %1 as"
- txtcreateluksdevice="Create luks device :"
- txtopenluksdevice="Open luks device :"
- txtluksdevicecreated="luks device created !"
- txtinstallmenu="Install Menu"
- txthyperbolainstallmenu="Hyperbola Install Menu"
- txtselectmirrorsbycountry="Select mirrors by country"
- txtselectcountry="Select country"
- txteditmirrorlist="Edit mirrorlist"
- txteditpacmanconf="Edit pacman.conf"
- txtinstallhyperbola="Install Hyperbola GNU+Linux-libre - "
- txtinstallhyperbolakernel="Kernel"
- txtinstallhyperbolafirmwares="Firmwares"
- txtinstallhyperbolafilesystems="File Systems"
- txtinstallhyperbolacustompackagelist="Custom Package List"
- txtconfighyperbola="Config Hyperbola GNU+Linux-libre"
- txtsethostname="Set Computer Name"
- txtsetfont="Set Font"
- txtsetlocale="Set Locale"
- txtsettime="Set Time"
- txtsetrootpassword="Set root password"
- txthwclock="Hardware clock :"
- txthwclockutc="UTC"
- txthwclocklocal="Local"
- txtbootloader="Bootloader"
- txtbootloadermenu="Choose your bootloader"
- txtefibootmgr="efibootmgr is required for EFI computers."
- txtbootloadergrubmenu="Grub Install Menu"
- txtrungrubmakeconfig="Run grub-mkconfig ?"
- txtgrubluksdetected="Encrypted root partion !\n\nAdd cryptdevice= to GRUB_CMDLINE_LINUX in /etc/default/grub ?"
- txtbootloadersyslinuxmenu="Syslinux Install Menu"
- txtsyslinuxaddefibootmgr="EFI install require efibootmgr"
- txtsyslinuxaddgptfdisk="GPT disk require gptfdisk"
- txtsyslinuxaddmtools="FAT boot part require mtools"
- txtbootloaderrefindmenu="rEFInd Install Menu"
- txtextrasmenu="Extras"
- txtoptional="Optional"
- txtgenerate="Generate %1"
- txtedit="Edit %1"
- txtinstall="Install %1"
- txtpressanykey="Press any key to continue."
- txthyperdimenu="Hyperbola Desktop Install"
- txthyperdidesc="Full desktop install script"
- txtinstallhyperdi="Hyperbola GNU+Linux-libre Desktop Install (hyperdi) is a second script who can help you to install a full workstation.\n\nYou can just launch the script or install it. Choose in the next menu.\n\nHyperbola GNU+Linux-libre Desktop Install as two dependencies : wget and libnewt.\n\npacstrap wget libnewt ?"
- txthyperdiinstallandlaunch="Install and run hyperdi"
- txthyperdiinstall="Install hyperdi"
- txthyperdilaunch="Launch hyperdi"
- }
- # --------------------------------------------------------
- # --------------------------------------------------------
- while (( "$#" )); do
- case ${1} in
- --help)
- echo "hyperfi"
- echo "------"
- echo "-cpl | --custom-package-list url Set custom package list url"
- echo "-sf | --skip-font Skip setfont from language files"
- echo "-efiX -efi0 : disable EFI, -efi1 efi inst, -efi2 efi hybrid inst"
- echo "-t | --test hypergit name branch Test hyperfi script and language"
- exit 0
- ;;
- -cpl | --custom-package-list)
- curl -L "${2}" > /tmp/hyperfi-custom-package-list
- if [[ "$?" != "0" ]]; then
- echo "Error downloading custom package list"
- exit 0
- fi
- cpl=1
- ;;
- -sf | --skip-font) skipfont=1;;
- -t | --test)
- curl -o hyperfi "https://hgit.ga/${2}/hyperfi/raw/branch/${3}/hyperfi"
- sh hyperfi -tt "${2}" "${3}"
- exit 0
- ;;
- -tt) baseurl="https://hgit.ga/${2}/hyperfi/raw/branch/${3}";;
- -efi0)
- efimode=0
- ;;
- -efi1)
- eficomputer=1
- efimode=1
- ;;
- -efi2)
- eficomputer=1
- efimode=2
- ;;
- --chroot)
- chroot=1
- command=${2}
- args=${3}
- ;;
- esac
- shift
- done
- if [ "${chroot}" = "1" ]; then
- case ${command} in
- 'setrootpassword') archsetrootpasswordchroot;;
- 'setlocale') archsetlocalechroot;;
- 'settimeutc') archsettimeutcchroot;;
- 'settimelocal') archsettimelocalchroot;;
- 'genmkinitcpio') archgenmkinitcpiochroot;;
- 'enabledhcpcd') archenabledhcpcdchroot;;
- 'enablewpa_supplicant') archenablewpa_supplicantchroot;;
- 'grubinstall') archgrubinstallchroot;;
- 'grubbootloaderinstall') archgrubinstallbootloaderchroot "${args}";;
- 'grubbootloaderefiinstall') archgrubinstallbootloaderefichroot "${args}";;
- 'grubbootloaderefiusbinstall') archgrubinstallbootloaderefiusbchroot "${args}";;
- 'syslinuxbootloaderinstall') archsyslinuxinstallbootloaderchroot "${args}";;
- 'syslinuxbootloaderefiinstall') archsyslinuxinstallbootloaderefichroot "${args}";;
- 'refindbootloaderinstall') archrefindinstallchroot "${args}";;
- 'hyperdiinstallandlaunch') hyperdiinstallandlaunchchroot;;
- 'hyperdiinstall') hyperdiinstallchroot;;
- 'hyperdilaunch') hyperdilaunchchroot;;
- esac
- else
- pacman -S --needed arch-install-scripts wget libnewt
- dmesg |grep efi: > /dev/null
- if [ "$?" == "1" ]; then
- if [ "${eficomputer}" != "1" ]; then
- eficomputer=0
- fi
- else
- eficomputer=1
- if [ "${efimode}" == "" ]; then
- efimode=1
- fi
- fi
- loadstrings
- EDITOR=nano
- mainmenu
- fi
- exit 0
- # --------------------------------------------------------
|