remove install types
Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
This commit is contained in:
parent
e786803dae
commit
7a1f81dc7b
17 changed files with 0 additions and 481 deletions
|
@ -1,38 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
#
|
|
||||||
# 2011 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/>.
|
|
||||||
#
|
|
||||||
|
|
||||||
device="$(cat "$__object/parameter/device")"
|
|
||||||
type="$(cat "$__object/parameter/type")"
|
|
||||||
|
|
||||||
if [ "$type" = "swap" ]; then
|
|
||||||
echo "mkswap $device"
|
|
||||||
else
|
|
||||||
command="mkfs -t $type -q"
|
|
||||||
if [ -f "$__object/parameter/options" ]; then
|
|
||||||
options="$(cat "$__object/parameter/options")"
|
|
||||||
command="$command $options"
|
|
||||||
fi
|
|
||||||
command="$command $device"
|
|
||||||
if [ -f "$__object/parameter/blocks" ]; then
|
|
||||||
blocks="$(cat "$__object/parameter/blocks")"
|
|
||||||
command="$command $blocks"
|
|
||||||
fi
|
|
||||||
echo "$command"
|
|
||||||
fi
|
|
|
@ -1,57 +0,0 @@
|
||||||
cdist-type__mkfs(7)
|
|
||||||
===================
|
|
||||||
Steven Armstrong <steven-cdist--@--armstrong.cc>
|
|
||||||
|
|
||||||
|
|
||||||
NAME
|
|
||||||
----
|
|
||||||
cdist-type__mkfs - build a linux file system
|
|
||||||
|
|
||||||
|
|
||||||
DESCRIPTION
|
|
||||||
-----------
|
|
||||||
This cdist type is a wrapper for the mkfs command.
|
|
||||||
|
|
||||||
|
|
||||||
REQUIRED PARAMETERS
|
|
||||||
-------------------
|
|
||||||
type::
|
|
||||||
The filesystem type to use. Same as mkfs -t.
|
|
||||||
|
|
||||||
|
|
||||||
OPTIONAL PARAMETERS
|
|
||||||
-------------------
|
|
||||||
device::
|
|
||||||
defaults to object_id
|
|
||||||
|
|
||||||
options::
|
|
||||||
file system-specific options to be passed to the mkfs command
|
|
||||||
|
|
||||||
blocks::
|
|
||||||
the number of blocks to be used for the file system
|
|
||||||
|
|
||||||
|
|
||||||
EXAMPLES
|
|
||||||
--------
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
# reiserfs /dev/sda5
|
|
||||||
__mkfs /dev/sda5 --type reiserfs
|
|
||||||
# same thing with explicit device
|
|
||||||
__mkfs whatever --device /dev/sda5 --type reiserfs
|
|
||||||
|
|
||||||
# jfs with journal on /dev/sda2
|
|
||||||
__mkfs /dev/sda1 --type jfs --options "-j /dev/sda2"
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
SEE ALSO
|
|
||||||
--------
|
|
||||||
- cdist-type(7)
|
|
||||||
- mkfs(8)
|
|
||||||
|
|
||||||
|
|
||||||
COPYING
|
|
||||||
-------
|
|
||||||
Copyright \(C) 2011 Steven Armstrong. Free use of this software is
|
|
||||||
granted under the terms of the GNU General Public License version 3 (GPLv3).
|
|
|
@ -1,31 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
#
|
|
||||||
# 2011 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/>.
|
|
||||||
#
|
|
||||||
|
|
||||||
# set defaults
|
|
||||||
if [ -f "$__object/parameter/device" ]; then
|
|
||||||
device="(cat "$__object/parameter/device")"
|
|
||||||
else
|
|
||||||
device="/$__object_id"
|
|
||||||
echo "$device" > "$__object/parameter/device"
|
|
||||||
fi
|
|
||||||
|
|
||||||
type="(cat "$__object/parameter/type")"
|
|
||||||
|
|
||||||
options="(cat "$__object/parameter/options")"
|
|
|
@ -1,3 +0,0 @@
|
||||||
device
|
|
||||||
options
|
|
||||||
blocks
|
|
|
@ -1 +0,0 @@
|
||||||
type
|
|
|
@ -1,62 +0,0 @@
|
||||||
cdist-type__partition_msdos(7)
|
|
||||||
==============================
|
|
||||||
Steven Armstrong <steven-cdist--@--armstrong.cc>
|
|
||||||
|
|
||||||
|
|
||||||
NAME
|
|
||||||
----
|
|
||||||
cdist-type__partition_msdos - creates msdos partitions
|
|
||||||
|
|
||||||
|
|
||||||
DESCRIPTION
|
|
||||||
-----------
|
|
||||||
This cdist type allows you to create msdos paritions.
|
|
||||||
|
|
||||||
|
|
||||||
REQUIRED PARAMETERS
|
|
||||||
-------------------
|
|
||||||
type::
|
|
||||||
the partition type used in fdisk (such as 82 or 83) or "extended"
|
|
||||||
|
|
||||||
|
|
||||||
OPTIONAL PARAMETERS
|
|
||||||
-------------------
|
|
||||||
partition::
|
|
||||||
defaults to object_id
|
|
||||||
bootable::
|
|
||||||
mark partition as bootable, true or false, defaults to false
|
|
||||||
size::
|
|
||||||
the size of the partition (such as 32M or 15G, whole numbers
|
|
||||||
only), '+' for remaining space, or 'n%' for percentage of remaining
|
|
||||||
(these should only be used after all specific partition sizes are
|
|
||||||
specified). Defaults to +.
|
|
||||||
|
|
||||||
|
|
||||||
EXAMPLES
|
|
||||||
--------
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
# 128MB, linux, bootable
|
|
||||||
__partition_msdos /dev/sda1 --type 83 --size 128M --bootable true
|
|
||||||
# 512MB, swap
|
|
||||||
__partition_msdos /dev/sda2 --type 82 --size 512M
|
|
||||||
# 100GB, extended
|
|
||||||
__partition_msdos /dev/sda3 --type extended --size 100G
|
|
||||||
# 10GB, linux
|
|
||||||
__partition_msdos /dev/sda5 --type 83 --size 10G
|
|
||||||
# 50% of the free space of the extended partition, linux
|
|
||||||
__partition_msdos /dev/sda6 --type 83 --size 50%
|
|
||||||
# rest of the extended partition, linux
|
|
||||||
__partition_msdos /dev/sda7 --type 83 --size +
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
SEE ALSO
|
|
||||||
--------
|
|
||||||
- cdist-type(7)
|
|
||||||
|
|
||||||
|
|
||||||
COPYING
|
|
||||||
-------
|
|
||||||
Copyright \(C) 2011 Steven Armstrong. Free use of this software is
|
|
||||||
granted under the terms of the GNU General Public License version 3 (GPLv3).
|
|
|
@ -1,41 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
#
|
|
||||||
# 2011 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/>.
|
|
||||||
#
|
|
||||||
|
|
||||||
# set defaults
|
|
||||||
if [ -f "$__object/parameter/partition" ]; then
|
|
||||||
partition="(cat "$__object/parameter/partition")"
|
|
||||||
else
|
|
||||||
partition="/$__object_id"
|
|
||||||
echo "$partition" > "$__object/parameter/partition"
|
|
||||||
fi
|
|
||||||
device="$(echo "$partition" | sed 's/[0-9]//g')"
|
|
||||||
echo "$device" > "$__object/parameter/device"
|
|
||||||
minor="$(echo "$partition" | sed 's/[^0-9]//g')"
|
|
||||||
echo "$minor" > "$__object/parameter/minor"
|
|
||||||
|
|
||||||
if [ ! -f "$__object/parameter/bootable" ]; then
|
|
||||||
echo "false" > "$__object/parameter/bootable"
|
|
||||||
fi
|
|
||||||
if [ ! -f "$__object/parameter/size" ]; then
|
|
||||||
echo "+" > "$__object/parameter/size"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# pull in the type that actually does something with the above parameters
|
|
||||||
require="$__object_name" __partition_msdos_apply
|
|
|
@ -1,3 +0,0 @@
|
||||||
partition
|
|
||||||
bootable
|
|
||||||
size
|
|
|
@ -1 +0,0 @@
|
||||||
type
|
|
|
@ -1,3 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
cat /proc/partitions
|
|
|
@ -1,61 +0,0 @@
|
||||||
die() {
|
|
||||||
echo "[__partition_msdos_apply] $@" >&2
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
debug() {
|
|
||||||
#echo "[__partition_msdos_apply] $@" >&2
|
|
||||||
:
|
|
||||||
}
|
|
||||||
|
|
||||||
fdisk_command() {
|
|
||||||
local device="$1"
|
|
||||||
local cmd="$2"
|
|
||||||
|
|
||||||
debug fdisk_command "running fdisk command '${cmd}' on device ${device}"
|
|
||||||
printf "${cmd}\nw\n" | fdisk -c -u "$device"
|
|
||||||
# give disk some time
|
|
||||||
sleep 1
|
|
||||||
return $?
|
|
||||||
}
|
|
||||||
|
|
||||||
create_disklabel() {
|
|
||||||
local device=$1
|
|
||||||
|
|
||||||
debug create_disklabel "creating new msdos disklabel"
|
|
||||||
fdisk_command ${device} "o"
|
|
||||||
return $?
|
|
||||||
}
|
|
||||||
|
|
||||||
create_partition() {
|
|
||||||
local device="$1"
|
|
||||||
local minor="$2"
|
|
||||||
local size="$3"
|
|
||||||
local type="$4"
|
|
||||||
local primary_count="$5"
|
|
||||||
|
|
||||||
if [ "$type" = "extended" -o "$type" = "5" ]; then
|
|
||||||
# Extended partition
|
|
||||||
primary_extended="e\n"
|
|
||||||
first_minor="${minor}\n"
|
|
||||||
[ "${minor}" = "4" ] && first_minor=""
|
|
||||||
type_minor="${minor}\n"
|
|
||||||
[ "${minor}" = "1" ] && type_minor=""
|
|
||||||
type="5"
|
|
||||||
elif [ "${minor}" -lt "5" ]; then
|
|
||||||
primary_extended="p\n"
|
|
||||||
first_minor="${minor}\n"
|
|
||||||
[ "${minor}" = "4" ] && first_minor=""
|
|
||||||
type_minor="${minor}\n"
|
|
||||||
[ "${minor}" = "1" ] && type_minor=""
|
|
||||||
else
|
|
||||||
# Logical partitions
|
|
||||||
first_minor="${minor}\n"
|
|
||||||
type_minor="${minor}\n"
|
|
||||||
primary_extended="l\n"
|
|
||||||
[ "$primary_count" -gt "3" ] && primary_extended=""
|
|
||||||
fi
|
|
||||||
[ -n "${size}" ] && size="+${size}M"
|
|
||||||
fdisk_command ${device} "n\n${primary_extended}${first_minor}\n${size}\nt\n${type_minor}${type}\n"
|
|
||||||
return $?
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,138 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
#
|
|
||||||
# 2011 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/>.
|
|
||||||
#
|
|
||||||
|
|
||||||
die() {
|
|
||||||
echo "[__partition_msdos_apply] $@" >&2
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
debug() {
|
|
||||||
#echo "[__partition_msdos_apply] $@" >&2
|
|
||||||
:
|
|
||||||
}
|
|
||||||
|
|
||||||
# Convert a size specifier 1G 100M or 50% into the corresponding numeric MB.
|
|
||||||
size_to_mb() {
|
|
||||||
local size=$1
|
|
||||||
local available_size="$2"
|
|
||||||
|
|
||||||
local number_suffix="$(echo ${size} | sed -e 's:\.[0-9]\+::' -e 's:\([0-9]\+\)\([MmGg%]\)[Bb]\?:\1|\2:')"
|
|
||||||
local number="$(echo ${number_suffix} | cut -d '|' -f1)"
|
|
||||||
local suffix="$(echo ${number_suffix} | cut -d '|' -f2)"
|
|
||||||
|
|
||||||
case "$suffix" in
|
|
||||||
M|m)
|
|
||||||
size="$number"
|
|
||||||
;;
|
|
||||||
G|g)
|
|
||||||
size="$(( $number * 1024 ))"
|
|
||||||
;;
|
|
||||||
%)
|
|
||||||
size="$(( $available_size * $number / 100 ))"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
size="-1"
|
|
||||||
esac
|
|
||||||
echo "$size"
|
|
||||||
}
|
|
||||||
|
|
||||||
# include function library for use on target
|
|
||||||
cat "$__type/files/lib.sh"
|
|
||||||
|
|
||||||
partitions="$__object/explorer/partitions"
|
|
||||||
objects=$(find "$__global/object/__partition_msdos" -path "*.cdist")
|
|
||||||
current_device=""
|
|
||||||
available_device_size=
|
|
||||||
available_extended_size=
|
|
||||||
available_size=
|
|
||||||
primary_count=0
|
|
||||||
for object in $objects; do
|
|
||||||
device="$(cat "$object/parameter/device")"
|
|
||||||
if [ "$current_device" != "$device" ]; then
|
|
||||||
echo "create_disklabel \"$device\" || die 'Failed to create disklabel for $device'"
|
|
||||||
current_device="$device"
|
|
||||||
device_name=$(echo ${device} | sed -e 's:^/dev/::;s:/:\\/:g')
|
|
||||||
available_device_size=$(( $(awk "/${device_name}\$/ { print \$3; }" "$partitions") / 1024))
|
|
||||||
# make sure we don't go past the end of the drive
|
|
||||||
available_device_size=$((available_device_size - 2))
|
|
||||||
available_extended_size=0
|
|
||||||
primary_count=0
|
|
||||||
debug "----- $device"
|
|
||||||
debug "current_device=$current_device"
|
|
||||||
debug "available_device_size=$available_device_size"
|
|
||||||
fi
|
|
||||||
|
|
||||||
type="$(cat "$object/parameter/type")"
|
|
||||||
partition="$(cat "$object/parameter/partition")"
|
|
||||||
minor="$(cat "$object/parameter/minor")"
|
|
||||||
|
|
||||||
bootable="$(cat "$object/parameter/bootable")"
|
|
||||||
size="$(cat "$object/parameter/size")"
|
|
||||||
|
|
||||||
|
|
||||||
if [ "${minor}" -lt "5" ]; then
|
|
||||||
# Primary partitions
|
|
||||||
primary_count=$(( $primary_count + 1 ))
|
|
||||||
available_size=$available_device_size
|
|
||||||
else
|
|
||||||
# Logical partitions
|
|
||||||
available_size=$available_extended_size
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$size" = "+" ]; then
|
|
||||||
# use rest of device
|
|
||||||
partition_size=""
|
|
||||||
available_size=0
|
|
||||||
else
|
|
||||||
partition_size=$(size_to_mb "$size" "$available_size")
|
|
||||||
available_size="$(( $available_size - $partition_size ))"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "${minor}" -lt "5" ]; then
|
|
||||||
# Primary partitions
|
|
||||||
available_device_size=$available_size
|
|
||||||
if [ "$type" = "extended" -o "$type" = "5" ]; then
|
|
||||||
# Extended partition
|
|
||||||
available_extended_size=$partition_size
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
# Logical paritions
|
|
||||||
available_extended_size=$available_size
|
|
||||||
fi
|
|
||||||
|
|
||||||
[ "$partition_size" = "-1" ] && die "could not translate size '$size' to a usable value"
|
|
||||||
debug "----- $partition"
|
|
||||||
debug "primary_count=$primary_count"
|
|
||||||
debug "current_device=$current_device"
|
|
||||||
debug "device=$device"
|
|
||||||
debug "type=$type"
|
|
||||||
debug "partition=$partition"
|
|
||||||
debug "minor=$minor"
|
|
||||||
debug "bootable=$bootable"
|
|
||||||
debug "size=$size"
|
|
||||||
debug "partition_size=$partition_size"
|
|
||||||
debug "available_size=$available_size"
|
|
||||||
debug "available_device_size=$available_device_size"
|
|
||||||
debug "available_extended_size=$available_extended_size"
|
|
||||||
debug "----------"
|
|
||||||
|
|
||||||
echo "create_partition '$device' '$minor' '$partition_size' '$type' '$primary_count' \
|
|
||||||
|| die 'Failed to create partition: $partition'"
|
|
||||||
done
|
|
||||||
|
|
|
@ -1,42 +0,0 @@
|
||||||
cdist-type__partition_msdos_apply(7)
|
|
||||||
====================================
|
|
||||||
Steven Armstrong <steven-cdist--@--armstrong.cc>
|
|
||||||
|
|
||||||
|
|
||||||
NAME
|
|
||||||
----
|
|
||||||
cdist-type__partition_msdos_apply - Apply dos partition settings
|
|
||||||
|
|
||||||
|
|
||||||
DESCRIPTION
|
|
||||||
-----------
|
|
||||||
Create the partitions defined with __partition_msdos
|
|
||||||
|
|
||||||
|
|
||||||
REQUIRED PARAMETERS
|
|
||||||
-------------------
|
|
||||||
None
|
|
||||||
|
|
||||||
|
|
||||||
OPTIONAL PARAMETERS
|
|
||||||
-------------------
|
|
||||||
None.
|
|
||||||
|
|
||||||
|
|
||||||
EXAMPLES
|
|
||||||
--------
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
__partition_msdos_apply
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
SEE ALSO
|
|
||||||
--------
|
|
||||||
- cdist-type(7)
|
|
||||||
- cdist-type__partition_msdos_apply(7)
|
|
||||||
|
|
||||||
COPYING
|
|
||||||
-------
|
|
||||||
Copyright \(C) 2011 Steven Armstrong. Free use of this software is
|
|
||||||
granted under the terms of the GNU General Public License version 3 (GPLv3).
|
|
Loading…
Reference in a new issue