You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

cli-installer 35KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241
  1. #!/bin/sh
  2. #
  3. # Copyright (C) 2012-2013 Alf Gaida <agaida@siduction.org>
  4. # 2012 Sebastian Görgen <zeppo@siduction.net>
  5. # 2009-2010 Nikolas Poniros <edhunter@sidux.com>
  6. #
  7. # heavily based on install-gui written by
  8. # Horst Tritremmel <hjt@users.berlios.de>
  9. #
  10. # This program is free software; you can redistribute it and/or
  11. # modify it under the terms of the GNU General Public License
  12. # as published by the Free Software Foundation; either version 2
  13. # of the License, or (at your option) any later version.
  14. #
  15. # This program is distributed in the hope that it will be useful,
  16. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. # GNU General Public License for more details.
  19. #
  20. # You should have received a copy of the GNU General Public License
  21. # along with this package; if not, write to the Free Software
  22. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  23. # MA 02110-1301, USA.
  24. #
  25. # On Debian GNU/Linux systems, the text of the GPL license can be
  26. # found in /usr/share/common-licenses/GPL.
  27. #
  28. # version: 0.2.9
  29. #-----------------------------------------------------------------------
  30. # Short description of the script:
  31. # The script creates the config file ($HOME/.sidconfig) needed by the
  32. # fll-installer and then calls the fll-installer to install siduction
  33. # using said config file.
  34. # Exit codes are:
  35. # 0 if successful,
  36. # 1 if user aborts before the config file is written
  37. # 2 if user aborts after config file is written (whenever a user
  38. # presses OK at an error message
  39. # it is considered as a user abort even if he has no other choice)
  40. call_help ()
  41. {
  42. echo "Usage: cli-installer -I [interface]"
  43. echo "Options:"
  44. echo " -v print program version"
  45. echo " -h print this help message"
  46. echo " -I interface"
  47. echo " select an interface to use with ssft."
  48. echo " options are: text , dialog "
  49. echo " Default is dialog if installed"
  50. exit
  51. }
  52. [ -x /usr/bin/setupcon ] && /usr/bin/setupcon
  53. while getopts vhI: opt
  54. do
  55. case $opt in
  56. v) echo "Version: 0.2.9"; exit;;
  57. I) interface="$OPTARG";;
  58. h) call_help;;
  59. esac
  60. done
  61. if [ $( id -u ) -ne 0 ]; then
  62. echo >&2 "E: You need to be root to run the script"
  63. exit 1
  64. fi
  65. if [ -f /usr/bin/ssft.sh ]; then
  66. . /usr/bin/ssft.sh || exit 1
  67. [ "${interface}" = "text" ] && SSFT_FRONTEND="${interface}" || SSFT_FRONTEND="dialog"
  68. if [ "${SSFT_FRONTEND}" = "dialog" ] && [ -z `which dialog` ]; then
  69. echo "dialog is not installed"
  70. echo "using text instead"
  71. SSFT_FRONTEND="text"
  72. fi
  73. else
  74. echo "Please install ssft"
  75. exit 1
  76. fi
  77. ### DEFINE CONSTANTS ###
  78. #------------------------------------------------------------------------------------------------------------
  79. CONFIG_FILE="${HOME}/.sidconf"
  80. SIGINT=2
  81. SIGTERM=15
  82. HOSTNAME_ALLOWED_CHARS="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
  83. # '-' needs to be at the end because of grep
  84. HOSTNAME_ALLOWED_CHAR_OTHERS="0123456789.-"
  85. USERNAME_ALLOWED_CHARS="abcdefghijklmnopqrstuvwxyz0123456789.-"
  86. # Dont change the order of the character because it might not work with grep anymore
  87. NAME_NAME_NOT_ALLOWED_CHARS="]°!\"§$%&/(){}=?\`+*~#;:=,><|_^\\\[-"
  88. PARTITION_PROG="cfdisk"
  89. CHECK_IF_HOME_EXISTS="no"
  90. HOME_PARTITION=""
  91. IS_DISK_USB="no"
  92. ROOT_IS_LVM="no"
  93. # Temp file to hold a list of available partitions that can be used for installation
  94. # (must be pre-formated)
  95. PARTITIONS_LIST=$(mktemp /tmp/part_list.XXXXXXXX)
  96. # I need 2 because I cant use sed -i
  97. PARTITIONS_LIST_2=$(mktemp /tmp/part_list_2.XXXXXXXX)
  98. SWAP_PART_LIST=$(mktemp /tmp/swap_part_list.XXXXXXXX)
  99. if [ -f ${CONFIG_FILE} ]; then
  100. echo >&2 "E: Config file exists please remove it and run the script again"
  101. exit 1
  102. fi
  103. # If we use dialog as front-end then redirect all stderr to ERROR_LOG
  104. if [ $SSFT_FRONTEND = "dialog" ]; then
  105. # Log file to write in potential error messages
  106. ERROR_LOG=$(mktemp /tmp/error_log.XXXXXXXX)
  107. exec 3>&2
  108. # Use this so all stderr goes to ERROR_LOG
  109. exec 2> $ERROR_LOG
  110. fi
  111. ### VARIABLES NEEDED BY THE CONFIG FILE
  112. #----------------------------------------------------------------------------------------------------------------------------
  113. FORMAT_HD="yes"
  114. FILESYSTEM="ext4"
  115. ROOT_PARTITION=""
  116. MOUNT_POINT_LIST=""
  117. IGNORE_DISK_SPACE="no"
  118. AUTO_SWAP="yes"
  119. SWAP_LIST=""
  120. REAL_NAME=""
  121. USERNAME=""
  122. USERPASS=""
  123. ROOTPASS=""
  124. # not using HOSTNAME as its an evn variable
  125. HOST_NAME="siductionbox"
  126. SERVICES_LIST=""
  127. BOOT_LOADER="grub"
  128. BOOT_DISK="no"
  129. BOOT_WHERE="mbr"
  130. AUTOMOUNT_BOOT="yes"
  131. # make sure that if ctrl+C is pushed, the config file and the temporary files are removed
  132. # same for SIGTERM
  133. trap "rm -f ${CONFIG_FILE}; rm -f ${PARTITIONS_LIST}; rm -f ${PARTITIONS_LIST_2}; exit 2" $SIGINT $SIGTERM
  134. ### GENERAL PURPOSE FUNCTIONS
  135. #----------------------------------------------------------------------------------------------------------------------------
  136. # Function to call ssft_yesno
  137. # $1 is the title for ssft_yesno
  138. # $2 is the text for ssft_yesno
  139. # returns 0 if yes was selected != 0 otherwise
  140. yesno ()
  141. {
  142. title="$1"
  143. msg="$2"
  144. ssft_yesno "${title}" "${msg}"
  145. return $?
  146. }
  147. # Function to display an error message
  148. # Clean up the temp files
  149. # and exit the program
  150. # Be carefull of the exit_code used! Use exit_code = 2 if you dont want
  151. # the config to be deleted
  152. error_msg ()
  153. {
  154. title="ERROR"
  155. msg="$1"
  156. msg="${msg} ${ERROR_LOG} might contain more information"
  157. exit_code="$2"
  158. ssft_display_error "${title}" "${msg}"
  159. rm -f ${PARTITIONS_LIST}
  160. rm -f ${PARTITIONS_LIST_2}
  161. if [ $exit_code -ne 2 ]; then
  162. rm -f ${CONFIG_FILE}
  163. fi
  164. exit $exit_code
  165. }
  166. display_msg ()
  167. {
  168. title="$1"
  169. msg="$2"
  170. ssft_display_message "${title}" "${msg}"
  171. }
  172. # Function to call ssft_select_multiple
  173. # $1 is the title for ssft_select_multiple
  174. # $2 is the text for ssft_select_multiple
  175. # $@ the items list for ssft_select_multiple
  176. # returns the exit code of ssft_select_multiple
  177. select_more ()
  178. {
  179. title="$1"
  180. msg="$2"
  181. shift 2
  182. ssft_select_multiple "${title}" "${msg}" $@
  183. return $?
  184. }
  185. # Function to call ssft_select_single
  186. # $1 is the title for ssft_select_single
  187. # $2 is the text for ssft_select_single
  188. # $@ the items list for ssft_select_single
  189. # returns the exit code of ssft_select_single
  190. select_one ()
  191. {
  192. title="$1"
  193. msg="$2"
  194. shift 2
  195. ssft_select_single "${title}" "${msg}" $@
  196. return $?
  197. }
  198. input_pass ()
  199. {
  200. title="Input Password"
  201. msg="$1"
  202. ssft_read_password "${title}" "${msg}"
  203. return $?
  204. }
  205. input_string ()
  206. {
  207. title="$1"
  208. msg="$2"
  209. ssft_read_string "${title}" "${msg}"
  210. return $?
  211. }
  212. # Function to check the length of a string
  213. # $1 the string
  214. # $2 string type can be "user" "root" "username" "hostname" "real name"
  215. # $3 var to check if string is a password
  216. length_check ()
  217. {
  218. string="$1"
  219. type="$2"
  220. is_pass="$3"
  221. num="$4"
  222. title="$5"
  223. if [ "${is_pass}" = "yes" ]; then
  224. while [ ${#string} -lt 6 ]; do
  225. msg="The password is too short!
  226. It needs to be at least 6 characters long
  227. Enter a $type password. Will not be echoed"
  228. input_pass "${msg}"
  229. if [ $? -eq 0 ]; then
  230. string="${SSFT_RESULT}"
  231. else
  232. error_msg "Can not continue without a password" "1"
  233. fi
  234. done
  235. else
  236. while [ ${#string} -lt ${num} ]; do
  237. msg="The ${type} is too short!
  238. It needs to be at least ${num} characters long
  239. Enter ${type} again."
  240. input_string "${title}" "${msg}"
  241. if [ $? -eq 0 ]; then
  242. string="${SSFT_RESULT}"
  243. else
  244. error_msg "Can not continue without a ${type}" "1"
  245. fi
  246. done
  247. fi
  248. case "$type" in
  249. user) USERPASS="${string}";;
  250. root) ROOTPASS="${string}";;
  251. "hostname") HOST_NAME="${string}";;
  252. username) USERNAME="${string}";;
  253. *) REAL_NAME="${string}"
  254. esac
  255. }
  256. # Function to compare 2 passwords
  257. # $1 password 1
  258. # $2 password 2
  259. # $3 password type "user" or "root"
  260. compare_pass ()
  261. {
  262. pass1="${1}"
  263. pass2="${2}"
  264. type="$3"
  265. while [ "${pass1}" != "${pass2}" ]
  266. do
  267. msg="The passwords do not match
  268. Enter a ${type} password. Will not be echoed"
  269. input_pass "${msg}"
  270. if [ $? -eq 0 ]; then
  271. pass1="${SSFT_RESULT}"
  272. else
  273. error_msg "Can not continue without a ${type} password" "1"
  274. fi
  275. # This line will set ${type}PASS assuming that it passes the length test
  276. length_check "${pass1}" "${type}" "yes"
  277. input_pass "Please enter the password again. Will not be echoed"
  278. if [ $? -eq 0 ]; then
  279. pass2="${SSFT_RESULT}"
  280. else
  281. error_msg "Can not continue without a ${type} password" "1"
  282. fi
  283. done
  284. }
  285. # Function to make sure that all disks are unmounted before
  286. # partition program start and before installation start
  287. # $1 is 1 if config was not written or 2 if config was written
  288. check_for_mounted_disks ()
  289. {
  290. /usr/share/fll-installer-common/um_all "check"
  291. before_config_write="$1"
  292. exit_status=$?
  293. if [ $exit_status -eq 1 ]; then
  294. title="Unmount Partitions"
  295. msg="Some partitions are still mounted.
  296. You need to unmount them for the installer to continue.
  297. Unmount now?"
  298. yesno "${title}" "${msg}"
  299. if [ $? -eq 0 ]; then
  300. /usr/share/fll-installer-common/um_all
  301. exit_status=$?
  302. if [ $exit_status -eq 1 ]; then
  303. if [ $before_config_write -eq 1 ]; then
  304. msg="Could not unmount all partitions
  305. Aborting.."
  306. else
  307. msg="Could not unmount all partitions
  308. Aborting..
  309. I: If you choose 'no' the configuration file will stay
  310. in ${CONFIG_FILE}!"
  311. fi
  312. error_msg "${msg}" "$before_config_write"
  313. else
  314. display_msg "${title}" "Partitions unmounted successfully"
  315. fi
  316. else
  317. if [ $before_config_write -eq 1 ]; then
  318. msg="You chose not to unmount the partitions
  319. Aborting.."
  320. else
  321. msg="You chose not to unmount the partitions
  322. Aborting..
  323. I: If you choose 'no' the configuration file will stay
  324. in ${CONFIG_FILE}!"
  325. fi
  326. error_msg "${msg}" "$before_config_write"
  327. fi
  328. fi
  329. }
  330. # Function to check if there is a username USERNAME in the home partition
  331. # chosen by the user. If yes it asks for a new username or removal of the
  332. # mount point
  333. home_exists ()
  334. {
  335. # As long as there is a HOME_PARTITION set ask for new name or mount point removal
  336. while [ -n "${HOME_PARTITION}" ]
  337. do
  338. # check_existing_home is the script that does the actuall checking
  339. /usr/share/fll-installer-common/check_existing_home ${HOME_PARTITION} ${USERNAME}
  340. exit_status=$?
  341. # No username USERNAME exists on HOME_PARTITION
  342. if [ $exit_status -eq 0 ]; then
  343. # Now add home to the MOUNT_POINT_LIST
  344. mount_point="${HOME_PARTITION}:/home"
  345. # Need this to make sure that there is no space
  346. # in front of the first entry
  347. if [ -n "${MOUNT_POINT_LIST}" ]; then
  348. MOUNT_POINT_LIST="${MOUNT_POINT_LIST} ${mount_point}"
  349. else
  350. MOUNT_POINT_LIST="${mount_point}"
  351. fi
  352. break
  353. elif [ $exit_status -eq 1 ]; then
  354. error_msg "Could not mount partition. Aborting" "1"
  355. # exit_status of check_existing_home is 2
  356. else
  357. #needs some more info
  358. display_msg "Check home" "Username exists"
  359. msg="Username already exists on the partition you selected as home
  360. Do you want to choose a new username or remove the mount point?"
  361. select_one "Check home" "${msg}" "username mount-point"
  362. if [ $? -eq 0 ]; then
  363. if [ "${SSFT_RESULT}" = "username" ]; then
  364. input_username
  365. else
  366. HOME_PARTITION=""
  367. fi
  368. else
  369. error_msg "Check home" "Cancelling.." "1"
  370. fi
  371. fi
  372. done
  373. }
  374. # Function to call cfdisk_wrapper to format the hard disk
  375. format_disk ()
  376. {
  377. title="Format disk"
  378. msg="Do you want to partition your hard disk?"
  379. yesno "${title}" "${msg}"
  380. if [ $? -eq 0 ]; then
  381. msg="Please choose a partitioning program. Available programs are:"
  382. programs_list="cfdisk fdisk parted"
  383. SSFT_DEFAULT="${PARTITION_PROG}"
  384. select_one "${title}" "${msg}" $programs_list
  385. if [ $? -eq 0 ]; then
  386. PARTITION_PROG="${SSFT_RESULT}"
  387. msg="Please choose a disk to partition. Available disks are:"
  388. partition_list=$(/usr/share/fll-installer-common/disk -d 2>/dev/null)
  389. select_more "${title}" "${msg}" $partition_list
  390. if [ $? -eq 0 ]; then
  391. check_for_mounted_disks "1"
  392. for disk in ${SSFT_RESULT} ; do
  393. /usr/share/fll-installer-common/cfdisk_wrapper ${PARTITION_PROG} ${disk}
  394. done
  395. fi
  396. fi
  397. else
  398. msg="You have chosen not to partition your hard disk
  399. If you have not at least one partition on the disk
  400. the installer will not be able to complete the installation
  401. If you do not have a partition please abort now!
  402. Press ctrl+C to abort or ENTER to continue"
  403. display_msg "${title}" "${msg}"
  404. fi
  405. }
  406. # Function for timezone selection
  407. set_timezone ()
  408. {
  409. #initialTZ="$(cat /etc/timezone)"
  410. title="Timezone selection"
  411. msg="Current timezone is: "$(cat /etc/timezone)"
  412. Do you want to change the timezone?"
  413. yesno "${title}" "${msg}"
  414. if [ $? -eq 0 ]; then
  415. dpkg-reconfigure tzdata
  416. #while [ $(($(TZ=$initialTZ date +%k%M) - $(TZ=$(cat /etc/timezone) date +%k%M))) -gt 0 ]; do
  417. #msg="The timezone you chose sets the clock back!
  418. # That will possibly result in a superblock in the future error during boot.
  419. # Do you want to select again $initialTZ to avoid such a problem?"
  420. #yesno "${title}" "${msg}"
  421. #if [ $? -eq 0 ]; then
  422. # dpkg-reconfigure tzdata
  423. #fi
  424. else
  425. display_msg "${title}" "Keeping current timezone"
  426. fi
  427. }
  428. # Function where the user can enter a root partition in case
  429. # the script didnt detect any partitions or the correct partition
  430. custom_root ()
  431. {
  432. #give the user the option to manually set a root partition in case no partitions were found
  433. title="Partitioning"
  434. msg="No partitions were detected by the installer. Do you want to manually set a partion?"
  435. yesno "$title" "$msg"
  436. if [ $? -eq 0 ]; then
  437. msg="Please input a root partition."
  438. input_string "Root partition" "$msg"
  439. if [ $? -eq 0 ]; then
  440. ROOT_PARTITION="${SSFT_RESULT}"
  441. partition_invalid=true
  442. while true; do
  443. partition_valid="true"
  444. if [ ! -b "${ROOT_PARTITION}" ]; then
  445. msg="The partition you entered is not a block device. Please enter a root partition."
  446. # not a block device. not valid partition
  447. partition_valid="false"
  448. fi
  449. # make sure that if device is of the form /dev/[h,s]d? it is actually a partition (number at the end)
  450. # in case of /dev/mapper/* make no checks as we can not assume anything about the partition name
  451. if [ "$(echo "${ROOT_PARTITION}" | grep "/dev/[h,s]d.")" != "" ]; then
  452. if [ "$(echo "${ROOT_PARTITION}" | grep "[h,s]d.[0-9]")" = "" ]; then
  453. msg="You have not entered a valid partition. Please enter a root partition"
  454. # turns out partition was not valid
  455. partition_valid="false"
  456. fi
  457. fi
  458. if [ "$partition_valid" = "true" ]; then
  459. # all good
  460. break
  461. else
  462. input_string "Root partition" "$msg"
  463. if [ $? -eq 0 ]; then
  464. ROOT_PARTITION="${SSFT_RESULT}"
  465. else
  466. error_msg "Can not continue without root partition" "1"
  467. fi
  468. fi
  469. done
  470. # Get just the partition name like sda1, sdb2 etc
  471. partition=$(echo "${ROOT_PARTITION}" | cut -d "/" -f 3)
  472. # Get the mapper name in case user choose a mapper
  473. if [ "$partition" = "mapper" ]; then
  474. partition=$(echo "${ROOT_PARTITION}" | cut -d "/" -f 4)
  475. fi
  476. # Check if the disk / is on is USB
  477. if [ -n "$(/usr/share/fll-installer-common/disk --usb="${partition%?}")" ]; then
  478. IS_DISK_USB="yes"
  479. fi
  480. else
  481. error_msg "Can not continue without root partition" "1"
  482. fi
  483. else
  484. error_msg "Can not continue without partition" "1"
  485. fi
  486. }
  487. #escape_chars ()
  488. #{
  489. # echo "$(echo "$1" | sed -e 's/!/\\!/g' -e 's/\"/\\"/g' -e 's/\$/\\$/g' -e 's/%/\\%/g' \
  490. # -e 's/&/\\&/g' -e 's/{/\\{/g' -e 's/(/\\(/g' -e 's/\[/\\[/g' \
  491. # -e 's/)/\\)/g' -e 's/]/\\]/g' -e 's/=/\\=/g' -e 's/}/\\}/g' \
  492. # -e 's/?/\\?/g' -e 's/\\/\\/g' -e 's/*/\\*/g' -e 's/+/\\+/g' \
  493. # -e 's/~/\\~/g' -e "s/'/\\'/g" -e 's/#/\\#/g' -e 's/>/\\>/g' \
  494. # -e 's/</\\</g' -e 's/`/\\`/g' -e 's/|/\\|/g' -e 's/;/\\;/g' \
  495. # -e 's/-/\\-/g' )"
  496. #}
  497. ### FUNCTIONS TO GET THE VALUES FOR THE VARIABLES THAT WILL BE PASSED LATER TO THE CONFIG FILE
  498. #-------------------------------------------------------------------------------------------------------------------------
  499. # Only for root partition
  500. format_root ()
  501. {
  502. title="Format hard disk"
  503. msg="Do you want the installer to format your
  504. root partition?"
  505. yesno "${title}" "${msg}"
  506. if [ $? -ne 0 ]; then
  507. FORMAT_HD="no"
  508. fi
  509. }
  510. # Only for root partition
  511. select_fs ()
  512. {
  513. title="Filesystem selection"
  514. msg="Select a file system for your root partition"
  515. options="ext3 ext4 ext2 reiserfs"
  516. SSFT_DEFAULT="ext4"
  517. select_one "${title}" "${msg}" $options
  518. if [ $? -eq 0 ]; then
  519. FILESYSTEM="${SSFT_RESULT}"
  520. else
  521. msg="Could not set filesystem. Using ${FILESYSTEM}"
  522. display_msg "${title}" "${msg}"
  523. fi
  524. }
  525. choose_root ()
  526. {
  527. # Create a list of available partitions
  528. # and add those into the temp file (update partitions after partitioning)
  529. /usr/share/fll-installer-common/disk -p 2>/dev/null > ${PARTITIONS_LIST}
  530. title="Install Partition"
  531. msg="Choose a partition to install siduction onto.
  532. Available partitions are:"
  533. select_one "${title}" "${msg}" $(cat ${PARTITIONS_LIST} | cut -d "," -f1) "custom"
  534. if [ $? -eq 0 ]; then
  535. ROOT_PARTITION="${SSFT_RESULT}"
  536. if [ "${ROOT_PARTITION}" = "custom" ]; then
  537. custom_root
  538. fi
  539. else
  540. # give the user the option to manually set partition in case the partition he wants was not detected
  541. custom_root
  542. fi
  543. # Get just the partition name like sda1, sdb2 etc
  544. partition=$(echo "${ROOT_PARTITION}" | cut -d "/" -f 3)
  545. # Get the mapper name in case user choose a mapper
  546. if [ "$partition" = "mapper" ]; then
  547. partition=$(echo "${ROOT_PARTITION}" | cut -d "/" -f 4)
  548. fi
  549. # Check if the disk / is on is USB
  550. if [ -n "$(/usr/share/fll-installer-common/disk --usb="${partition%?}")" ]; then
  551. IS_DISK_USB="yes"
  552. fi
  553. #if [ grep "${ROOT_PARTITION}" ${PARTITIONS_LIST} | grep "lvm" ]; then
  554. # ROOT_IS_LVM="yes"
  555. #fi
  556. cp ${PARTITIONS_LIST} ${PARTITIONS_LIST_2}
  557. # Find the partition name $partition and remove it from the list
  558. sed -e "/${partition}/d" ${PARTITIONS_LIST_2} > ${PARTITIONS_LIST}
  559. }
  560. # set mount points for partitions other than root
  561. set_mount_points ()
  562. {
  563. title="Set mount points"
  564. msg="Do you want to set mount points for other partitions?
  565. W: The partitions need to be already formated
  566. I: The root partition is already set and you should not
  567. set it again"
  568. yesno "${title}" "${msg}"
  569. # Code to select mount point and partition
  570. if [ $? -eq 0 ]; then
  571. ## Loop while PARTITIONS_LIST is not empty. If user selects cancel loop will break
  572. while [ -n "$(cat ${PARTITIONS_LIST})" ]
  573. do
  574. msg="Choose a partition to set its mount point.
  575. Available partitions are:"
  576. select_one "${title}" "${msg}" $(cat ${PARTITIONS_LIST} | cut -d "," -f1)
  577. if [ $? -eq 0 ]; then
  578. partition="${SSFT_RESULT}"
  579. # Get just the partition name like sda1, sdb2 etc
  580. partition_name=$(echo "${partition}" | cut -d "/" -f 3)
  581. # Get the mapper name in case user choose a mapper
  582. if [ "$partition_name" = "mapper" ]; then
  583. partition_name=$(echo "${partition}" | cut -d "/" -f 4)
  584. fi
  585. ## SEE IF THIS IS BETTER TO BE CALLED AFTER MOUNT POINT IS SET IN
  586. ## CASE USER CANCELS
  587. cp ${PARTITIONS_LIST} ${PARTITIONS_LIST_2}
  588. # Find the partition name $partition_name and remove it from the list
  589. sed /${partition_name}/d ${PARTITIONS_LIST_2} > ${PARTITIONS_LIST}
  590. msg="Choose a mount point for ${partition}"
  591. available_mount_points="home boot opt root tmp usr var"
  592. select_one "${title}" "${msg}" "${available_mount_points}"
  593. # If user pressed cancel break out of the loop
  594. ## SEE TO OFFER THE USER THE OPTION TO CANCEL IN CASE HE CHOSE THE WRONG MOUNT POINT
  595. if [ $? -ne 0 ]; then
  596. break
  597. fi
  598. # Remove the mount point chosen by the user from the list of available mount points
  599. temp=$( echo "$available_mount_points" | sed "s/$SSFT_RESULT//" )
  600. available_mount_points="${temp}"
  601. case $SSFT_RESULT in
  602. home )
  603. # If chosen it will be written into MOUNT_POINT_LIST after
  604. # check_home is called
  605. HOME_PARTITION="${partition}"
  606. CHECK_IF_HOME_EXISTS="yes"
  607. ;;
  608. boot )
  609. mount_point="${partition}:/boot"
  610. # Need this to make sure that there is no space
  611. # in front of the first entry
  612. if [ -n "${MOUNT_POINT_LIST}" ]; then
  613. MOUNT_POINT_LIST="${MOUNT_POINT_LIST} ${mount_point}"
  614. else
  615. MOUNT_POINT_LIST="${mount_point}"
  616. fi
  617. ;;
  618. opt )
  619. mount_point="${partition}:/opt"
  620. # Need this to make sure that there is no space
  621. # in front of the first entry
  622. if [ -n "${MOUNT_POINT_LIST}" ]; then
  623. MOUNT_POINT_LIST="${MOUNT_POINT_LIST} ${mount_point}"
  624. else
  625. MOUNT_POINT_LIST="${mount_point}"
  626. fi
  627. ;;
  628. root )
  629. mount_point="${partition}:/root"
  630. # Need this to make sure that there is no space
  631. # in front of the first entry
  632. if [ -n "${MOUNT_POINT_LIST}" ]; then
  633. MOUNT_POINT_LIST="${MOUNT_POINT_LIST} ${mount_point}"
  634. else
  635. MOUNT_POINT_LIST="${mount_point}"
  636. fi
  637. ;;
  638. tmp )
  639. mount_point="${partition}:/tmp"
  640. # Need this to make sure that there is no space
  641. # in front of the first entry
  642. if [ -n "${MOUNT_POINT_LIST}" ]; then
  643. MOUNT_POINT_LIST="${MOUNT_POINT_LIST} ${mount_point}"
  644. else
  645. MOUNT_POINT_LIST="${mount_point}"
  646. fi
  647. ;;
  648. usr )
  649. mount_point="${partition}:/usr"
  650. # Need this to make sure that there is no space
  651. # in front of the first entry
  652. if [ -n "${MOUNT_POINT_LIST}" ]; then
  653. MOUNT_POINT_LIST="${MOUNT_POINT_LIST} ${mount_point}"
  654. else
  655. MOUNT_POINT_LIST="${mount_point}"
  656. fi
  657. ;;
  658. var )
  659. mount_point="${partition}:/var"
  660. # Need this to make sure that there is no space
  661. # in front of the first entry
  662. if [ -n "${MOUNT_POINT_LIST}" ]; then
  663. MOUNT_POINT_LIST="${MOUNT_POINT_LIST} ${mount_point}"
  664. else
  665. MOUNT_POINT_LIST="${mount_point}"
  666. fi
  667. ;;
  668. * )
  669. error_msg "Invalid option" "1"
  670. esac
  671. else
  672. break
  673. fi
  674. done
  675. fi
  676. display_msg "${title}" "Finished setting mount points"
  677. }
  678. # Asks the user if the installer should not check if there is
  679. # enough space on the partition
  680. ignore_disk_space ()
  681. {
  682. title="Check for space"
  683. msg="Do you want the program NOT to check if there is enough space to install siduction?
  684. If you don't know what this means please choose 'no'"
  685. yesno "${title}" "${msg}"
  686. if [ $? -eq 0 ]; then
  687. IGNORE_DISK_SPACE="yes"
  688. fi
  689. }
  690. auto_detect_swap ()
  691. {
  692. title="Swap autodetect"
  693. msg="Do you want the installer to autodetect swap?"
  694. yesno "${title}" "${msg}"
  695. if [ $? -ne 0 ]; then
  696. AUTO_SWAP="no"
  697. fi
  698. }
  699. select_swap ()
  700. {
  701. if [ -s ${SWAP_PART_LIST} ]; then
  702. title="Select swap"
  703. msg="Select the partitions you want to be used as swap by the installer"
  704. select_more "$title" "$msg" $(cat $SWAP_PART_LIST)
  705. if [ $? -eq 0 ]; then
  706. #ssft returns a list with \n in it. remove it and also use sed to remove the space
  707. #at the end of the line
  708. SWAP_LIST="$(echo ${SSFT_RESULT} | tr '\n' ' ' | sed 's/ $//g' )"
  709. fi
  710. else
  711. title="Select swap"
  712. msg="You have no swap partitions. Nothing to select"
  713. display_msg "$title" "$msg"
  714. fi
  715. }
  716. input_real_name ()
  717. {
  718. title="Input Real Name"
  719. msg="Please enter your real name"
  720. input_string "${title}" "${msg}"
  721. if [ $? -eq 0 ]; then
  722. name="${SSFT_RESULT}"
  723. fi
  724. length_check "${name}" "real name" "no" "1" "${title}"
  725. # Need this as length_check sets REAL_NAME but I still
  726. # need to check chars
  727. name="${REAL_NAME}"
  728. # Make sure that name contains only valid characters
  729. while [ -n "$( echo "${name}" | grep "[${NAME_NAME_NOT_ALLOWED_CHARS}]" )" ]
  730. do
  731. title="Input Real Name"
  732. msg="Your input contains characters which are not allowed
  733. Characters which are not allowed are:
  734. ${NAME_NAME_NOT_ALLOWED_CHARS}
  735. Please enter again your real name"
  736. input_string "${title}" "${msg}"
  737. if [ $? -eq 0 ]; then
  738. name="${SSFT_RESULT}"
  739. fi
  740. length_check "${name}" "real name" "no" "1" "${title}"
  741. name="${REAL_NAME}" # length_check set the REAL_NAME but i still need to escape chars
  742. done
  743. ## Used to escape spaces and quotes (')
  744. REAL_NAME=$( echo "$name" | sed -e "s/ /\\\ /g" -e "s/'/\\\'/g" )
  745. }
  746. input_username ()
  747. {
  748. title="Input username"
  749. msg="Please input your username"
  750. input_string "${title}" "${msg}"
  751. if [ $? -eq 0 ]; then
  752. USERNAME="${SSFT_RESULT}"
  753. fi
  754. length_check "${USERNAME}" "username" "no" "1" "${title}"
  755. while [ ! $(echo "${USERNAME}" | grep "^[${USERNAME_ALLOWED_CHARS}]*$") ]
  756. do
  757. title="Input username"
  758. msg="Username contains characters which are not allowed
  759. Allowed characters are:
  760. ${USERNAME_ALLOWED_CHARS}
  761. Please enter username"
  762. input_string "${title}" "${msg}"
  763. if [ $? -eq 0 ]; then
  764. USERNAME="${SSFT_RESULT}"
  765. fi
  766. length_check "${USERNAME}" "username" "no" "1" "${title}"
  767. done
  768. if [ "${CHECK_IF_HOME_EXISTS}" != "no" ]; then
  769. home_exists
  770. fi
  771. }
  772. input_user_pass ()
  773. {
  774. msg="Enter a user password. Will not be echoed
  775. I: Do not use a minus (-) as the first character of the password,
  776. a space as the last or a backslash (\) anywhere in the password
  777. as those are currently not supported."
  778. input_pass "${msg}"
  779. if [ $? -eq 0 ]; then
  780. USERPASS="${SSFT_RESULT}"
  781. else
  782. error_msg "Can not continue without a user password" "1"
  783. fi
  784. length_check "${USERPASS}" "user" "yes"
  785. input_pass "Please enter the password again. Will not be echoed"
  786. if [ $? -eq 0 ]; then
  787. pass2="${SSFT_RESULT}"
  788. else
  789. error_msg "Can not continue without a user password" "1"
  790. fi
  791. compare_pass "${USERPASS}" "${pass2}" "user"
  792. # If the passwords dont pass the test at the first time then
  793. # USERPASS will be set by length_check which is called in compare_pass
  794. #pass1="${USERPASS}"
  795. #pass2="$(escape_chars "$pass1")"
  796. ## create hashed password and escape $
  797. #USERPASS=$( echo "$pass2" | mkpasswd --method=sha-256 -s | sed 's/\$/\\$/g' )
  798. USERPASS="$( mkpasswd --method=sha-256 "${USERPASS}" | sed 's/\$/\\$/g' )"
  799. }
  800. input_root_pass ()
  801. {
  802. msg="Enter a root password. Will not be echoed
  803. I: Do not use a minus (-) as the first character of the password,
  804. a space as the last or a backslash (\) anywhere in the password
  805. as those are currently not supported."
  806. input_pass "${msg}"
  807. if [ $? -eq 0 ]; then
  808. ROOTPASS="${SSFT_RESULT}"
  809. else
  810. error_msg "Can not continue without a root password" "1"
  811. fi
  812. length_check "${ROOTPASS}" "root" "yes"
  813. input_pass "Please enter the password again. Will not be echoed"
  814. if [ $? -eq 0 ]; then
  815. pass2="${SSFT_RESULT}"
  816. else
  817. error_msg "Can not continue without a root password" "1"
  818. fi
  819. compare_pass "${ROOTPASS}" "${pass2}" "root"
  820. # If the passwords dont pass the test at the first time then
  821. # ROOTPASS will be set by length_check which is called in compare_pass
  822. #pass1="${ROOTPASS}"
  823. #pass2="$(escape_chars "$pass1")"
  824. ## create hashed password and escape $
  825. #ROOTPASS=$( echo "$pass2" | mkpasswd --method=sha-256 -s | sed 's/\$/\\$/g' )
  826. ROOTPASS="$( mkpasswd --method=sha-256 "${ROOTPASS}" | sed 's/\$/\\$/g' )"
  827. }
  828. input_hostname ()
  829. {
  830. title="Input hostname"
  831. msg="Please input hostname"
  832. SSFT_DEFAULT="${HOST_NAME}"
  833. input_string "${title}" "${msg}"
  834. if [ $? -eq 0 ]; then
  835. HOST_NAME="${SSFT_RESULT}"
  836. fi
  837. length_check "${HOST_NAME}" "hostname" "no" "0" "${title}"
  838. while [ ! $(echo "${HOST_NAME}" | grep "^[${HOSTNAME_ALLOWED_CHARS}][${HOSTNAME_ALLOWED_CHARS}${HOSTNAME_ALLOWED_CHAR_OTHERS}]*$") ]
  839. do
  840. title="Input hostname"
  841. msg="Hostname contains characters which are not allowed!
  842. Allowed characters are:
  843. ${HOSTNAME_ALLOWED_CHARS}
  844. ${HOSTNAME_ALLOWED_CHAR_OTHERS}
  845. W: The hostname must start with a letter!
  846. Please enter hostname"
  847. input_string "${title}" "${msg}"
  848. if [ $? -eq 0 ]; then
  849. HOST_NAME="${SSFT_RESULT}"
  850. fi
  851. length_check "${HOST_NAME}" "hostname" "no" "0" "${title}"
  852. done
  853. }
  854. # Function so that the user can input some services that should
  855. # start during boot
  856. input_services ()
  857. {
  858. title="Services"
  859. msg="Select the services you want to start on boot"
  860. #services="cups smail ssh samba"
  861. services="ssh"
  862. select_more "$title" "$msg" $services
  863. if [ $? -eq 0 ]; then
  864. #ssft returns a list with \n in it. remove it and also use sed to remove the space
  865. #at the end of the line
  866. SERVICES_LIST="$(echo ${SSFT_RESULT} | tr '\n' ' ' | sed 's/ $//g')"
  867. fi
  868. }
  869. #set_bootloader () {}
  870. # Ask the user if he wants to create a boot disk
  871. #create_boot_disk ()
  872. #{
  873. # title="Create boot-disk"
  874. # msg="Do you want to create a boot-disk?"
  875. # yesno "${title}" "${msg}"
  876. # if [ $? -eq 0 ]; then
  877. # BOOT_DISK="yes"
  878. # fi
  879. #}
  880. # Ask the user where he wants to place the boot-loader mbr or partition
  881. place_boot_loader ()
  882. {
  883. title="Bootloader"
  884. msg="Where do you want the boot-loader to be installed?"
  885. options="mbr partition"
  886. SSFT_DEFAULT="${BOOT_WHERE}"
  887. select_one "${title}" "${msg}" $options
  888. if [ $? -eq 0 ]; then
  889. BOOT_WHERE="${SSFT_RESULT}"
  890. else
  891. msg="Could not set bootloader. Using ${BOOT_WHERE}"
  892. display_msg "${title}" "${msg}"
  893. fi
  894. }
  895. # Function to ask the user if he wants the partitions to be
  896. # auto-mounted on boot
  897. # default is yes
  898. auto_mount_partitions ()
  899. {
  900. title="Automount"
  901. msg="Do you want the partitions to be automounted on boot?"
  902. yesno "${title}" "${msg}"
  903. if [ $? -ne 0 ]; then
  904. AUTOMOUNT_BOOT="no"
  905. fi
  906. }
  907. write_config ()
  908. {
  909. echo "REGISTERED=' SYSTEM_MODULE HD_MODULE HD_FORMAT HD_FSTYPE HD_CHOICE HD_MAP HD_IGNORECHECK SWAP_MODULE SWAP_AUTODETECT SWAP_CHOICES NAME_MODULE NAME_NAME USER_MODULE USER_NAME USERPASS_MODULE USERPASS_CRYPT ROOTPASS_MODULE ROOTPASS_CRYPT HOST_MODULE HOST_NAME SERVICES_MODULE SERVICES_START BOOT_MODULE BOOT_LOADER BOOT_DISK BOOT_WHERE AUTOLOGIN_MODULE INSTALL_READY HD_AUTO'" > ${CONFIG_FILE}
  910. echo >> ${CONFIG_FILE}
  911. echo "SYSTEM_MODULE='configured'" >> ${CONFIG_FILE}
  912. echo "HD_MODULE='configured'" >> ${CONFIG_FILE}
  913. echo >> ${CONFIG_FILE}
  914. echo "# Determines if the HD should be formatted. (mkfs.*)" >> ${CONFIG_FILE}
  915. echo "# Possible are: yes|no" >> ${CONFIG_FILE}
  916. echo "# Default value is: yes" >> ${CONFIG_FILE}
  917. echo "HD_FORMAT='${FORMAT_HD}'" >> ${CONFIG_FILE}
  918. echo >> ${CONFIG_FILE}
  919. echo "# Sets the Filesystem type." >> ${CONFIG_FILE}
  920. echo "# Possible are: ext3|ext4|ext2|reiserfs" >> ${CONFIG_FILE}
  921. echo "# Default value is: ext3" >> ${CONFIG_FILE}
  922. echo "HD_FSTYPE='${FILESYSTEM}'" >> ${CONFIG_FILE}
  923. echo >> ${CONFIG_FILE}
  924. echo "# Here the siduction-System will be installed" >> ${CONFIG_FILE}
  925. echo "# This value will be checked by function module_hd_check" >> ${CONFIG_FILE}
  926. echo "HD_CHOICE='${ROOT_PARTITION}'" >> ${CONFIG_FILE}
  927. echo >> ${CONFIG_FILE}
  928. echo "# Here you can give additional mappings. (Experimental) You need to have the partitions formatted yourself and give the correct mappings like: '"'/dev/hda4:/boot /dev/hda5:/var /dev/hda6:/tmp'"'" >> ${CONFIG_FILE}
  929. echo "HD_MAP='${MOUNT_POINT_LIST}'" >> ${CONFIG_FILE}
  930. echo >> ${CONFIG_FILE}
  931. echo "# If set to yes, the program will NOT check if there is enough space to install siduction on the selected partition(s). Use at your own risk! Useful for example with HD_MAP if you only have a small root partition." >> ${CONFIG_FILE}
  932. echo "# Possible are: yes|no" >> ${CONFIG_FILE}
  933. echo "# Default value is: no" >> ${CONFIG_FILE}
  934. echo "HD_IGNORECHECK='${IGNORE_DISK_SPACE}'" >> ${CONFIG_FILE}
  935. echo >> ${CONFIG_FILE}
  936. echo "SWAP_MODULE='configured'" >> ${CONFIG_FILE}
  937. echo "# If set to yes, the swap partitions will be autodetected." >> ${CONFIG_FILE}
  938. echo "# Possible are: yes|no" >> ${CONFIG_FILE}
  939. echo "# Default value is: yes" >> ${CONFIG_FILE}
  940. echo "SWAP_AUTODETECT='${AUTO_SWAP}'" >> ${CONFIG_FILE}
  941. echo >> ${CONFIG_FILE}
  942. echo "# The swap partitions to be used by the installed siduction." >> ${CONFIG_FILE}
  943. echo "# This value will be checked by function module_swap_check (install-gui)" >> ${CONFIG_FILE}
  944. echo "SWAP_CHOICES='${SWAP_LIST}'" >> ${CONFIG_FILE}
  945. echo >> ${CONFIG_FILE}
  946. echo "NAME_MODULE='configured'" >> ${CONFIG_FILE}
  947. echo "NAME_NAME=${REAL_NAME}" >> ${CONFIG_FILE}
  948. echo >> ${CONFIG_FILE}
  949. echo "USER_MODULE='configured'" >> ${CONFIG_FILE}
  950. echo "USER_NAME='${USERNAME}'" >> ${CONFIG_FILE}
  951. echo >> ${CONFIG_FILE}
  952. echo "USERPASS_MODULE='configured'" >> ${CONFIG_FILE}
  953. echo "USERPASS_CRYPT='${USERPASS}'" >> ${CONFIG_FILE}
  954. echo >> ${CONFIG_FILE}
  955. echo "ROOTPASS_MODULE='configured'" >> ${CONFIG_FILE}
  956. echo "ROOTPASS_CRYPT='${ROOTPASS}'" >> ${CONFIG_FILE}
  957. echo >> ${CONFIG_FILE}
  958. echo "HOST_MODULE='configured'" >> ${CONFIG_FILE}
  959. echo "HOST_NAME='${HOST_NAME}'" >> ${CONFIG_FILE}
  960. echo >> ${CONFIG_FILE}
  961. echo "SERVICES_MODULE='configured'" >> ${CONFIG_FILE}
  962. echo "# Possible services are for now: cups smail ssh samba" >> ${CONFIG_FILE}
  963. echo "# Default value is: cups" >> ${CONFIG_FILE}
  964. echo "SERVICES_START='${SERVICES_LIST}'" >> ${CONFIG_FILE}
  965. echo >> ${CONFIG_FILE}
  966. echo "BOOT_MODULE='configured'" >> ${CONFIG_FILE}
  967. echo "# Chooses the Boot-Loader" >> ${CONFIG_FILE}
  968. echo "# Possible are: grub" >> ${CONFIG_FILE}
  969. echo "# Default value is: grub" >> ${CONFIG_FILE}
  970. echo "BOOT_LOADER='${BOOT_LOADER}'" >> ${CONFIG_FILE}
  971. echo >> ${CONFIG_FILE}
  972. echo "# If set to 'yes' a boot disk will be created!" >> ${CONFIG_FILE}
  973. echo "# Possible are: yes|no" >> ${CONFIG_FILE}
  974. echo "# Default value is: no" >> ${CONFIG_FILE}
  975. echo "BOOT_DISK='${BOOT_DISK}'" >> ${CONFIG_FILE}
  976. echo >> ${CONFIG_FILE}
  977. echo "# Where the Boot-Loader will be installed" >> ${CONFIG_FILE}
  978. echo "# Possible are: mbr|partition" >> ${CONFIG_FILE}
  979. echo "# Default value is: mbr" >> ${CONFIG_FILE}
  980. echo "BOOT_WHERE='${BOOT_WHERE}'" >> ${CONFIG_FILE}
  981. echo >> ${CONFIG_FILE}
  982. echo "AUTOLOGIN_MODULE='configured'" >> ${CONFIG_FILE}
  983. echo "INSTALL_READY='yes'" >> ${CONFIG_FILE}
  984. echo >> ${CONFIG_FILE}
  985. echo >> ${CONFIG_FILE}
  986. echo "# mount partitions on boot. Default value is: yes" >> ${CONFIG_FILE}
  987. echo "HD_AUTO='${AUTOMOUNT_BOOT}'" >> ${CONFIG_FILE}
  988. }
  989. ### MAIN
  990. #--------------------------------------------------------------------------------------------------------------------------
  991. format_disk
  992. set_timezone
  993. format_root
  994. if [ -z "${ROOT_PARTITION}" ]; then
  995. # root partition was not selected manually above
  996. choose_root
  997. fi
  998. # User must specify the file system of the root partition
  999. select_fs
  1000. set_mount_points
  1001. ignore_disk_space
  1002. auto_detect_swap
  1003. if [ "${AUTO_SWAP}" = "no" ]; then
  1004. cut -d" " -f1 /proc/swaps | grep -v "Filename" >> ${SWAP_PART_LIST}
  1005. select_swap
  1006. else
  1007. SWAP_LIST="$(cut -d" " -f1 /proc/swaps | grep -v "Filename" | tr '\n' ' ' | sed 's/ $//g')"
  1008. fi
  1009. input_real_name
  1010. input_username
  1011. input_user_pass
  1012. input_root_pass
  1013. input_hostname
  1014. input_services
  1015. #set_bootloader
  1016. # Leave disabled for now
  1017. #create_boot_disk
  1018. # If the disk choosen as root is USB then force partition
  1019. if [ "${IS_DISK_USB}" = "no" ]; then
  1020. place_boot_loader
  1021. else
  1022. BOOT_WHERE="partition"
  1023. fi
  1024. auto_mount_partitions
  1025. write_config
  1026. display_msg "cli-installer" "Finished creating configuration file"
  1027. # remove the temporary file with the partition list
  1028. rm -f ${PARTITIONS_LIST}
  1029. rm -f ${PARTITIONS_LIST_2}
  1030. check_for_mounted_disks "2"
  1031. # restore stderr and close file descriptor 3 (only if the interface was dialog)
  1032. if [ $SSFT_FRONTEND = "dialog" ]; then
  1033. exec 2>&3 3>&-
  1034. fi
  1035. ### CALL INSTALLER
  1036. title="Call Installer"
  1037. msg="Finished all checks.
  1038. Do you want to start the installation?
  1039. I: If you choose 'no' the configuration file will stay
  1040. in ${CONFIG_FILE}!"
  1041. yesno "${title}" "${msg}"
  1042. if [ $? -eq 0 ]; then
  1043. fll-installer || echo "Some error occured. Looking at ${ERROR_LOG} might provide you with answers" && exit 1
  1044. fi
  1045. # if all goes well remove log
  1046. rm -f $ERROR_LOG
  1047. exit 0