summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2011-04-08 15:15:36 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2011-04-08 15:15:36 +0000
commitf500a80b194ad4740cf956447490043c66b527ce (patch)
treec3c768444341a9efd9e3c782c5f4c3fd57af8e42
parenta76208ce74af0384ca92acff88f9f93ae1dde2db (diff)
downloadalpine-conf-f500a80b194ad4740cf956447490043c66b527ce.zip
setup-disk: remove obsolete code
-rw-r--r--setup-disk.in122
1 files changed, 0 insertions, 122 deletions
diff --git a/setup-disk.in b/setup-disk.in
index 913416e..cddf3c4 100644
--- a/setup-disk.in
+++ b/setup-disk.in
@@ -375,128 +375,6 @@ stop_all_raid() {
done
}
-# obsolete
-old_native_disk_install() {
- local rootdisk_dev="$1"
- local i size
- local boot_size=100 boot_part_type="83"
- local swap_size="$SWAP_SIZE" swap_part_type="82"
- local root_part_type="83"
- local raidpkg= partitions=
- local minimum_root_size=$(($boot_size * 2))
- local rootfs=ext4 bootfs=ext4
-
- if [ -n "$USE_RAID" ]; then
- boot_part_type="fd"
- swap_part_type="fd"
- root_part_type="fd"
- raidpkg="mdadm"
- fi
-
- dmesg -n1
- apk_add -q sfdisk e2fsprogs $raidpkg || return 1
- local root_size=$(( $(sfdisk -s $rootdisk_dev) / 1024 - $swap_size - $boot_size))
- if [ "$root_size" -lt "$minimum_root_size" ]; then
- echo "The $rootdisk_dev is too small. At least $(( $boot_size + $swap_size + $minimum_root_size)) is needed." >&2
- return 1
- fi
-
- echo ""
- echo "Creating the following partitions on $rootdisk_dev:"
- echo " /boot ${boot_size}MB"
- echo " swap ${swap_size}MB"
- echo " / ${root_size}MB"
- echo ""
- if [ -n "$APKOVL" ]; then
- echo "System from $APKOVL will be restored"
- fi
- echo -n "WARNING: All contents of $rootdisk_dev will be erased. Continue? [y/N]: "
- read i
- case "$i" in
- y*|Y*);;
- *) return 1;;
- esac
-
- echo "Initializing partitions..."
- [ -n "$USE_RAID" ] && stop_all_raid
-
- # new disks does not have an DOS signature in sector 0
- # this makes sfdisk complain. We can workaround this by letting
- # fdisk create that DOS signature, by just do a "w", a write.
- # http://bugs.alpinelinux.org/issues/show/145
- echo "w" | fdisk $rootdisk_dev >/dev/null
-
- # create new partitions
- (cat <<EOF
-0,$boot_size,$boot_part_type,*
-,$swap_size,$swap_part_type
-,,$root_part_type
-EOF
- ) | sfdisk -q -L -uM $rootdisk_dev >>/tmp/sfdisk.out || return 1
-
- # create device nodes if not exist
- mdev -s
-
- if [ -n "$USE_RAID" ]; then
- local p= rd=
- for p in $(sfdisk -l $rootdisk_dev 2>/dev/null \
- | awk '/Linux raid/ {print $1}'); do
- local opt="--metadata=0.90"
- case "$p" in
- *1) rd=/dev/md0; boot_dev=/dev/md0;;
- *2) rd=/dev/md1; swap_dev=/dev/md1
- opt= ;;
- *3) rd=/dev/md2; root_dev=/dev/md2;;
- esac
- mdadm --create $rd --level=1 --raid-devices=2 \
- $opt --quiet --run $p missing
- done
- else
- local p=
- for p in $(sfdisk -l $rootdisk_dev 2>/dev/null \
- | awk '$1 ~ /^\/dev/ {print $1}'); do
- case "$p" in
- *1) boot_dev=$p;;
- *2) swap_dev=$p;;
- *3) root_dev=$p;;
- esac
- done
- fi
- mkfs.$bootfs -q $boot_dev >/dev/null \
- && mkswap $swap_dev >/dev/null \
- && mkfs.$rootfs -q >/dev/null $root_dev \
- || return 1
-
- mkdir -p /mnt
- mount -t $rootfs $root_dev /mnt || return 1
- mkdir -p /mnt/boot
- mount -t $bootfs $boot_dev /mnt/boot || return 1
- if [ -n "$USE_RAID" ]; then
- mdadm --detail --scan > /etc/mdadm.conf
- rc-update --quiet add mdadm-raid boot
- fi
-
- # manually add swap to local fstab and swapon (in case the install needs swap)
- sed -i -e '/swap/d' /etc/fstab
- echo -e "$(uuid_or_device $swap_dev)\tswap\t\tswap\tdefaults 0 0" >> /etc/fstab
- swapon -a
-
- install_mounted_root /mnt || return 1
-
- # manually add swap to mounted fstab and add the swap service to the boot runlevel
- echo -e "$(uuid_or_device $swap_dev)\tswap\t\tswap\tdefaults 0 0" >> /mnt/etc/fstab
- chroot /mnt rc-update --quiet add swap boot
- chroot /mnt rc-update --quiet add urandom boot
-
- unmount_partitions /mnt
- swapoff -a
- fix_mbr_all_disks
-
- echo ""
- echo "Installation is done. Please reboot."
- apk del -q syslinux
-}
-
# install needed programs
init_progs() {
local raidpkg=