summaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
Diffstat (limited to 'gnu')
-rw-r--r--gnu/installer/parted.scm44
1 files changed, 14 insertions, 30 deletions
diff --git a/gnu/installer/parted.scm b/gnu/installer/parted.scm
index ced7a757d7e..c8bb73ee649 100644
--- a/gnu/installer/parted.scm
+++ b/gnu/installer/parted.scm
@@ -343,8 +343,7 @@ fail. See rereadpt function in wipefs.c of util-linux for an explanation."
343 343
344(define (remove-logical-devices) 344(define (remove-logical-devices)
345 "Remove all active logical devices." 345 "Remove all active logical devices."
346 (with-null-output-ports 346 ((run-command-in-installer) "dmsetup" "remove_all"))
347 (invoke "dmsetup" "remove_all")))
348 347
349(define (installer-root-partition-path) 348(define (installer-root-partition-path)
350 "Return the root partition path, or #f if it could not be detected." 349 "Return the root partition path, or #f if it could not be detected."
@@ -1115,53 +1114,37 @@ list and return the updated list."
1115 (file-name file-name)))) 1114 (file-name file-name))))
1116 user-partitions)) 1115 user-partitions))
1117 1116
1118(define-syntax-rule (with-null-output-ports exp ...)
1119 "Evaluate EXP with both the output port and the error port pointing to the
1120bit bucket."
1121 (with-output-to-port (%make-void-port "w")
1122 (lambda ()
1123 (with-error-to-port (%make-void-port "w")
1124 (lambda () exp ...)))))
1125
1126(define (create-btrfs-file-system partition) 1117(define (create-btrfs-file-system partition)
1127 "Create a btrfs file-system for PARTITION file-name." 1118 "Create a btrfs file-system for PARTITION file-name."
1128 (with-null-output-ports 1119 ((run-command-in-installer) "mkfs.btrfs" "-f" partition))
1129 (invoke "mkfs.btrfs" "-f" partition)))
1130 1120
1131(define (create-ext4-file-system partition) 1121(define (create-ext4-file-system partition)
1132 "Create an ext4 file-system for PARTITION file-name." 1122 "Create an ext4 file-system for PARTITION file-name."
1133 (with-null-output-ports 1123 ((run-command-in-installer) "mkfs.ext4" "-F" partition))
1134 (invoke "mkfs.ext4" "-F" partition)))
1135 1124
1136(define (create-fat16-file-system partition) 1125(define (create-fat16-file-system partition)
1137 "Create a fat16 file-system for PARTITION file-name." 1126 "Create a fat16 file-system for PARTITION file-name."
1138 (with-null-output-ports 1127 ((run-command-in-installer) "mkfs.fat" "-F16" partition))
1139 (invoke "mkfs.fat" "-F16" partition)))
1140 1128
1141(define (create-fat32-file-system partition) 1129(define (create-fat32-file-system partition)
1142 "Create a fat32 file-system for PARTITION file-name." 1130 "Create a fat32 file-system for PARTITION file-name."
1143 (with-null-output-ports 1131 ((run-command-in-installer) "mkfs.fat" "-F32" partition))
1144 (invoke "mkfs.fat" "-F32" partition)))
1145 1132
1146(define (create-jfs-file-system partition) 1133(define (create-jfs-file-system partition)
1147 "Create a JFS file-system for PARTITION file-name." 1134 "Create a JFS file-system for PARTITION file-name."
1148 (with-null-output-ports 1135 ((run-command-in-installer) "jfs_mkfs" "-f" partition))
1149 (invoke "jfs_mkfs" "-f" partition)))
1150 1136
1151(define (create-ntfs-file-system partition) 1137(define (create-ntfs-file-system partition)
1152 "Create a JFS file-system for PARTITION file-name." 1138 "Create a JFS file-system for PARTITION file-name."
1153 (with-null-output-ports 1139 ((run-command-in-installer) "mkfs.ntfs" "-F" "-f" partition))
1154 (invoke "mkfs.ntfs" "-F" "-f" partition)))
1155 1140
1156(define (create-xfs-file-system partition) 1141(define (create-xfs-file-system partition)
1157 "Create an XFS file-system for PARTITION file-name." 1142 "Create an XFS file-system for PARTITION file-name."
1158 (with-null-output-ports 1143 ((run-command-in-installer) "mkfs.xfs" "-f" partition))
1159 (invoke "mkfs.xfs" "-f" partition)))
1160 1144
1161(define (create-swap-partition partition) 1145(define (create-swap-partition partition)
1162 "Set up swap area on PARTITION file-name." 1146 "Set up swap area on PARTITION file-name."
1163 (with-null-output-ports 1147 ((run-command-in-installer) "mkswap" "-f" partition))
1164 (invoke "mkswap" "-f" partition)))
1165 1148
1166(define (call-with-luks-key-file password proc) 1149(define (call-with-luks-key-file password proc)
1167 "Write PASSWORD in a temporary file and pass it to PROC as argument." 1150 "Write PASSWORD in a temporary file and pass it to PROC as argument."
@@ -1190,15 +1173,16 @@ USER-PARTITION if it is encrypted, or the plain file-name otherwise."
1190 (lambda (key-file) 1173 (lambda (key-file)
1191 (installer-log-line "formatting and opening LUKS entry ~s at ~s" 1174 (installer-log-line "formatting and opening LUKS entry ~s at ~s"
1192 label file-name) 1175 label file-name)
1193 (system* "cryptsetup" "-q" "luksFormat" file-name key-file) 1176 ((run-command-in-installer) "cryptsetup" "-q" "luksFormat"
1194 (system* "cryptsetup" "open" "--type" "luks" 1177 file-name key-file)
1195 "--key-file" key-file file-name label))))) 1178 ((run-command-in-installer) "cryptsetup" "open" "--type" "luks"
1179 "--key-file" key-file file-name label)))))
1196 1180
1197(define (luks-close user-partition) 1181(define (luks-close user-partition)
1198 "Close the encrypted partition pointed by USER-PARTITION." 1182 "Close the encrypted partition pointed by USER-PARTITION."
1199 (let ((label (user-partition-crypt-label user-partition))) 1183 (let ((label (user-partition-crypt-label user-partition)))
1200 (installer-log-line "closing LUKS entry ~s" label) 1184 (installer-log-line "closing LUKS entry ~s" label)
1201 (system* "cryptsetup" "close" label))) 1185 ((run-command-in-installer) "cryptsetup" "close" label)))
1202 1186
1203(define (format-user-partitions user-partitions) 1187(define (format-user-partitions user-partitions)
1204 "Format the <user-partition> records in USER-PARTITIONS list with 1188 "Format the <user-partition> records in USER-PARTITIONS list with