make uefi boot work
Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
This commit is contained in:
		
					parent
					
						
							
								2ce00f3357
							
						
					
				
			
			
				commit
				
					
						9ee0de7c8b
					
				
			
		
					 13 changed files with 105 additions and 31 deletions
				
			
		
							
								
								
									
										35
									
								
								cdist/conf/type/__chroot_mount/gencode-local
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										35
									
								
								cdist/conf/type/__chroot_mount/gencode-local
									
										
									
									
									
										Executable file
									
								
							|  | @ -0,0 +1,35 @@ | ||||||
|  | #!/bin/sh | ||||||
|  | # | ||||||
|  | # 2016 Steven Armstrong (steven-cdist at armstrong.cc) | ||||||
|  | # | ||||||
|  | # This file is part of cdist. | ||||||
|  | # | ||||||
|  | # cdist is free software: you can redistribute it and/or modify | ||||||
|  | # it under the terms of the GNU General Public License as published by | ||||||
|  | # the Free Software Foundation, either version 3 of the License, or | ||||||
|  | # (at your option) any later version. | ||||||
|  | # | ||||||
|  | # cdist is distributed in the hope that it will be useful, | ||||||
|  | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||
|  | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||||
|  | # GNU General Public License for more details. | ||||||
|  | # | ||||||
|  | # You should have received a copy of the GNU General Public License | ||||||
|  | # along with cdist. If not, see <http://www.gnu.org/licenses/>. | ||||||
|  | # | ||||||
|  | 
 | ||||||
|  | chroot="/$__object_id" | ||||||
|  | 
 | ||||||
|  | if [ -f "$__object/parameter/manage-resolv-conf" ]; then | ||||||
|  |    resolv_conf="${chroot}/etc/resolv.conf" | ||||||
|  |    original_resolv_conf="${resolv_conf}${__cdist_object_marker}" | ||||||
|  |    cat << DONE | ||||||
|  | $__remote_exec $__target_host << EOSSH | ||||||
|  | if [ -f "${resolv_conf}" ]; then | ||||||
|  |    mv "${resolv_conf}" "${original_resolv_conf}" | ||||||
|  | fi | ||||||
|  | # copy hosts resolv.conf into chroot | ||||||
|  | cp /etc/resolv.conf "${resolv_conf}" | ||||||
|  | EOSSH | ||||||
|  | DONE | ||||||
|  | fi | ||||||
|  | @ -1,5 +1,5 @@ | ||||||
| cdist-type__chroot_mount(7) | cdist-type__chroot_mount(7) | ||||||
| =================================== | =========================== | ||||||
| 
 | 
 | ||||||
| NAME | NAME | ||||||
| ---- | ---- | ||||||
|  | @ -21,6 +21,12 @@ OPTIONAL PARAMETERS | ||||||
| None | None | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | BOOLEAN PARAMETERS | ||||||
|  | ------------------ | ||||||
|  | manage-resolv-conf | ||||||
|  |     manage /etc/resolv.conf inside the chroot | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| EXAMPLES | EXAMPLES | ||||||
| -------- | -------- | ||||||
| 
 | 
 | ||||||
|  | @ -36,7 +42,7 @@ Steven Armstrong <steven-cdist--@--armstrong.cc> | ||||||
| 
 | 
 | ||||||
| COPYING | COPYING | ||||||
| ------- | ------- | ||||||
| Copyright \(C) 2012 Steven Armstrong. You can redistribute it | Copyright \(C) 2012-2017 Steven Armstrong. You can redistribute it | ||||||
| and/or modify it under the terms of the GNU General Public License as | and/or modify it under the terms of the GNU General Public License as | ||||||
| published by the Free Software Foundation, either version 3 of the | published by the Free Software Foundation, either version 3 of the | ||||||
| License, or (at your option) any later version. | License, or (at your option) any later version. | ||||||
|  |  | ||||||
							
								
								
									
										1
									
								
								cdist/conf/type/__chroot_mount/parameter/boolean
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								cdist/conf/type/__chroot_mount/parameter/boolean
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1 @@ | ||||||
|  | manage-resolv-conf | ||||||
							
								
								
									
										35
									
								
								cdist/conf/type/__chroot_umount/gencode-local
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										35
									
								
								cdist/conf/type/__chroot_umount/gencode-local
									
										
									
									
									
										Executable file
									
								
							|  | @ -0,0 +1,35 @@ | ||||||
|  | #!/bin/sh | ||||||
|  | # | ||||||
|  | # 2016 Steven Armstrong (steven-cdist at armstrong.cc) | ||||||
|  | # | ||||||
|  | # This file is part of cdist. | ||||||
|  | # | ||||||
|  | # cdist is free software: you can redistribute it and/or modify | ||||||
|  | # it under the terms of the GNU General Public License as published by | ||||||
|  | # the Free Software Foundation, either version 3 of the License, or | ||||||
|  | # (at your option) any later version. | ||||||
|  | # | ||||||
|  | # cdist is distributed in the hope that it will be useful, | ||||||
|  | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||
|  | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||||
|  | # GNU General Public License for more details. | ||||||
|  | # | ||||||
|  | # You should have received a copy of the GNU General Public License | ||||||
|  | # along with cdist. If not, see <http://www.gnu.org/licenses/>. | ||||||
|  | # | ||||||
|  | 
 | ||||||
|  | chroot="/$__object_id" | ||||||
|  | 
 | ||||||
|  | if [ -f "$__object/parameter/manage-resolv-conf" ]; then | ||||||
|  |    resolv_conf="${chroot}/etc/resolv.conf" | ||||||
|  |    original_resolv_conf="${resolv_conf}${__cdist_object_marker}" | ||||||
|  | cat << DONE | ||||||
|  | $__remote_exec $__target_host << EOSSH | ||||||
|  | if [ -f "${original_resolv_conf}" ]; then | ||||||
|  |    # restore original /etc/resolv.conf that we moved out of the way | ||||||
|  |    # in __chroot_mount/gencode-local | ||||||
|  |    mv -f "${original_resolv_conf}" "${resolv_conf}" | ||||||
|  | fi | ||||||
|  | EOSSH | ||||||
|  | DONE | ||||||
|  | fi | ||||||
|  | @ -21,6 +21,12 @@ OPTIONAL PARAMETERS | ||||||
| None | None | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | BOOLEAN PARAMETERS | ||||||
|  | ------------------ | ||||||
|  | manage-resolv-conf | ||||||
|  |     manage /etc/resolv.conf inside the chroot | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| EXAMPLES | EXAMPLES | ||||||
| -------- | -------- | ||||||
| 
 | 
 | ||||||
|  | @ -41,7 +47,7 @@ Steven Armstrong <steven-cdist--@--armstrong.cc> | ||||||
| 
 | 
 | ||||||
| COPYING | COPYING | ||||||
| ------- | ------- | ||||||
| Copyright \(C) 2012 Steven Armstrong. You can redistribute it | Copyright \(C) 2012-2017 Steven Armstrong. You can redistribute it | ||||||
| and/or modify it under the terms of the GNU General Public License as | and/or modify it under the terms of the GNU General Public License as | ||||||
| published by the Free Software Foundation, either version 3 of the | published by the Free Software Foundation, either version 3 of the | ||||||
| License, or (at your option) any later version. | License, or (at your option) any later version. | ||||||
|  |  | ||||||
							
								
								
									
										1
									
								
								cdist/conf/type/__chroot_umount/parameter/boolean
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								cdist/conf/type/__chroot_umount/parameter/boolean
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1 @@ | ||||||
|  | manage-resolv-conf | ||||||
							
								
								
									
										1
									
								
								cdist/conf/type/__install_chroot_mount/parameter
									
										
									
									
									
										Symbolic link
									
								
							
							
						
						
									
										1
									
								
								cdist/conf/type/__install_chroot_mount/parameter
									
										
									
									
									
										Symbolic link
									
								
							|  | @ -0,0 +1 @@ | ||||||
|  | ../__chroot_mount/parameter | ||||||
							
								
								
									
										1
									
								
								cdist/conf/type/__install_chroot_umount/parameter
									
										
									
									
									
										Symbolic link
									
								
							
							
						
						
									
										1
									
								
								cdist/conf/type/__install_chroot_umount/parameter
									
										
									
									
									
										Symbolic link
									
								
							|  | @ -0,0 +1 @@ | ||||||
|  | ../__chroot_umount/parameter | ||||||
|  | @ -25,17 +25,6 @@ remote_copy="$__type/files/remote/copy" | ||||||
| cdist_args="-v" | cdist_args="-v" | ||||||
| [ "$__debug" = "yes" ] && cdist_args="$cdist_args -d" | [ "$__debug" = "yes" ] && cdist_args="$cdist_args -d" | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| cat << DONE |  | ||||||
| 
 |  | ||||||
| $__remote_exec $__target_host << EOSSH |  | ||||||
| if [ ! -f "${chroot}/etc/resolv.conf" ]; then |  | ||||||
|    touch "${chroot}/etc/resolv.conf" |  | ||||||
| fi |  | ||||||
| mount --bind -o ro /etc/resolv.conf "${chroot}/etc/resolv.conf" |  | ||||||
| EOSSH |  | ||||||
| DONE |  | ||||||
| 
 |  | ||||||
| cat << DONE | cat << DONE | ||||||
| cdist $cdist_args \ | cdist $cdist_args \ | ||||||
|    config \ |    config \ | ||||||
|  | @ -44,15 +33,3 @@ cdist $cdist_args \ | ||||||
|    $__target_host |    $__target_host | ||||||
| DONE | DONE | ||||||
| 
 | 
 | ||||||
| cat << DONE |  | ||||||
| $__remote_exec $__target_host << EOSSH |  | ||||||
| if mountpoint -q "${chroot}/etc/resolv.conf"; then |  | ||||||
|    umount "${chroot}/etc/resolv.conf" |  | ||||||
| fi |  | ||||||
| if [ -f "${chroot}/etc/resolv.conf" -a ! -s "${chroot}/etc/resolv.conf" ]; then |  | ||||||
|    # file exists but is empty which means we created it or it's useless anyway |  | ||||||
|    rm "${chroot}/etc/resolv.conf" |  | ||||||
| fi |  | ||||||
| 
 |  | ||||||
| EOSSH |  | ||||||
| DONE |  | ||||||
|  |  | ||||||
|  | @ -49,6 +49,8 @@ EXAMPLES | ||||||
|     __install_partition_msdos /dev/sda6 --type 83 --size 50% |     __install_partition_msdos /dev/sda6 --type 83 --size 50% | ||||||
|     # rest of the extended partition, linux |     # rest of the extended partition, linux | ||||||
|     __install_partition_msdos /dev/sda7 --type 83 --size + |     __install_partition_msdos /dev/sda7 --type 83 --size + | ||||||
|  |     # nvm device partition 2 | ||||||
|  |     __install_partition_msdos /dev/nvme0n1p2 --device /dev/nvme0n1 --minor 2 --type 83 --size 128M --bootable true | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| AUTHORS | AUTHORS | ||||||
|  | @ -58,7 +60,7 @@ Steven Armstrong <steven-cdist--@--armstrong.cc> | ||||||
| 
 | 
 | ||||||
| COPYING | COPYING | ||||||
| ------- | ------- | ||||||
| Copyright \(C) 2011 Steven Armstrong. You can redistribute it | Copyright \(C) 2011-2017 Steven Armstrong. You can redistribute it | ||||||
| and/or modify it under the terms of the GNU General Public License as | and/or modify it under the terms of the GNU General Public License as | ||||||
| published by the Free Software Foundation, either version 3 of the | published by the Free Software Foundation, either version 3 of the | ||||||
| License, or (at your option) any later version. | License, or (at your option) any later version. | ||||||
|  |  | ||||||
|  | @ -25,10 +25,15 @@ else | ||||||
|    partition="/$__object_id" |    partition="/$__object_id" | ||||||
|    echo "$partition" > "$__object/parameter/partition" |    echo "$partition" > "$__object/parameter/partition" | ||||||
| fi | fi | ||||||
| device="$(echo "$partition" | sed 's/[0-9]//g')" | 
 | ||||||
| echo "$device" > "$__object/parameter/device" | if [ ! -f "$__object/parameter/device" ]; then | ||||||
| minor="$(echo "$partition" | sed 's/[^0-9]//g')" |    device="$(echo "$partition" | sed 's/[0-9]//g')" | ||||||
| echo "$minor" > "$__object/parameter/minor" |    echo "$device" > "$__object/parameter/device" | ||||||
|  | fi | ||||||
|  | if [ ! -f "$__object/parameter/minor" ]; then | ||||||
|  |    minor="$(echo "$partition" | sed 's/[^0-9]//g')" | ||||||
|  |    echo "$minor" > "$__object/parameter/minor" | ||||||
|  | fi | ||||||
| 
 | 
 | ||||||
| if [ ! -f "$__object/parameter/bootable" ]; then | if [ ! -f "$__object/parameter/bootable" ]; then | ||||||
|    echo "false" > "$__object/parameter/bootable" |    echo "false" > "$__object/parameter/bootable" | ||||||
|  |  | ||||||
|  | @ -1,3 +1,5 @@ | ||||||
|  | device | ||||||
|  | minor | ||||||
| partition | partition | ||||||
| bootable | bootable | ||||||
| size | size | ||||||
|  |  | ||||||
|  | @ -18,6 +18,8 @@ | ||||||
| # along with cdist. If not, see <http://www.gnu.org/licenses/>. | # along with cdist. If not, see <http://www.gnu.org/licenses/>. | ||||||
| # | # | ||||||
| 
 | 
 | ||||||
|  | #set -x | ||||||
|  | 
 | ||||||
| die() { | die() { | ||||||
|    echo "[__install_partition_msdos_apply] $@" >&2 |    echo "[__install_partition_msdos_apply] $@" >&2 | ||||||
|    exit 1 |    exit 1 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue