Browse Source

Benjamin Schieder:


			
			
				rocklinux
			
			
		
Benjamin Schieder 17 years ago
parent
commit
cbde69b76a
24 changed files with 1142 additions and 258 deletions
  1. +27
    -0
      package/base/e2fsprogs/stone_mod_install_filesystems_e2fsprogs.sh
  2. +24
    -0
      package/base/installer/installer.conf
  3. +39
    -0
      package/base/installer/installer.desc
  4. +8
    -0
      package/base/installer/parse-config
  5. +92
    -0
      package/base/installer/stone_mod_install.sh
  6. +252
    -0
      package/base/installer/stone_mod_install_filesystems.sh
  7. +1
    -8
      package/base/installer/stone_mod_setup.sh
  8. +3
    -0
      package/base/mdadm/etc_conf_initrd_initrd_mdadm
  9. +3
    -0
      package/base/mdadm/etc_conf_mdadm_initrd_mdadm
  10. +6
    -0
      package/base/mdadm/etc_stone.d_setup_50-mdadm.sh
  11. +11
    -1
      package/base/mdadm/mdadm.conf
  12. +179
    -0
      package/base/mdadm/stone_mod_install_filesystems_mdadm.sh
  13. +26
    -0
      package/base/reiser4progs/stone_mod_install_filesystems_reiser4progs.sh
  14. +26
    -0
      package/base/reiserfsprogs/stone_mod_install_filesystems_reiserfsprogs.sh
  15. +5
    -0
      package/base/rockinitrd/stone_setup_99-rockinitrd.sh
  16. +0
    -247
      package/base/stone/stone_mod_install.sh
  17. +57
    -0
      package/base/util-linux/stone_mod_install_filesystems_util-linux.sh
  18. +26
    -0
      package/base/xfsprogs/stone_mod_install_filesystems_xfsprogs.sh
  19. +32
    -0
      package/blindcoder/cryptsetup-luks/cryptsetup-luks.conf
  20. +1
    -2
      package/blindcoder/cryptsetup-luks/cryptsetup-luks.desc
  21. +3
    -0
      package/blindcoder/cryptsetup-luks/etc_conf_initrd_initrd_luks
  22. +72
    -0
      package/blindcoder/cryptsetup-luks/etc_conf_luks_initrd_luks
  23. +130
    -0
      package/blindcoder/cryptsetup-luks/etc_stone.d_mod_luks.sh.disabled
  24. +119
    -0
      package/blindcoder/cryptsetup-luks/stone_mod_install_filesystems_cryptsetup-luks.sh

+ 27
- 0
package/base/e2fsprogs/stone_mod_install_filesystems_e2fsprogs.sh

@ -0,0 +1,27 @@
#!/bin/bash
# --- ROCK-COPYRIGHT-NOTE-BEGIN ---
#
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
# Please add additional copyright information _after_ the line containing
# the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
# the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
#
# ROCK Linux: rock-src/package/base/e2fsprogs/stone_mod_install_e2fsprogs.sh
# ROCK Linux is Copyright (C) 1998 - 2006 Clifford Wolf
#
# This program 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 2 of the License, or
# (at your option) any later version. A copy of the GNU General Public
# License can be found at Documentation/COPYING.
#
# Many people helped and are helping developing ROCK Linux. Please
# have a look at http://www.rocklinux.org/ and the Documentation/TEAM
# file for details.
#
# --- ROCK-COPYRIGHT-NOTE-END ---
#
# [INSTALLER] 10 mdadm ROCK Linux Operation System Installer V2 - e2fsprogs partitioning module
MKFS_PROGRAMS="${MKFS_PROGRAMS} 'Create an Ext2 Filesystem' 'mkfs.ext2 PART'
'Create an Ext3 Filesystem' 'mkfs.ext3 PART'"

+ 24
- 0
package/base/installer/installer.conf

@ -0,0 +1,24 @@
# --- ROCK-COPYRIGHT-NOTE-BEGIN ---
#
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
# Please add additional copyright information _after_ the line containing
# the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
# the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
#
# ROCK Linux: rock-src/package/base/installer/installer.conf
# ROCK Linux is Copyright (C) 1998 - 2006 Clifford Wolf
#
# This program 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 2 of the License, or
# (at your option) any later version. A copy of the GNU General Public
# License can be found at Documentation/COPYING.
#
# Many people helped and are helping developing ROCK Linux. Please
# have a look at http://www.rocklinux.org/ and the Documentation/TEAM
# file for details.
#
# --- ROCK-COPYRIGHT-NOTE-END ---
autoextract=0

+ 39
- 0
package/base/installer/installer.desc

@ -0,0 +1,39 @@
[COPY] --- ROCK-COPYRIGHT-NOTE-BEGIN ---
[COPY]
[COPY] This copyright note is auto-generated by ./scripts/Create-CopyPatch.
[COPY] Please add additional copyright information _after_ the line containing
[COPY] the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
[COPY] the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
[COPY]
[COPY] ROCK Linux: rock-src/package/base/installer/installer.desc
[COPY] ROCK Linux is Copyright (C) 1998 - 2006 Clifford Wolf
[COPY]
[COPY] This program is free software; you can redistribute it and/or modify
[COPY] it under the terms of the GNU General Public License as published by
[COPY] the Free Software Foundation; either version 2 of the License, or
[COPY] (at your option) any later version. A copy of the GNU General Public
[COPY] License can be found at Documentation/COPYING.
[COPY]
[COPY] Many people helped and are helping developing ROCK Linux. Please
[COPY] have a look at http://www.rocklinux.org/ and the Documentation/TEAM
[COPY] file for details.
[COPY]
[COPY] --- ROCK-COPYRIGHT-NOTE-END ---
[I] ROCK Linux Operation System Installer
[T] This is the ROCK Linux Operation System Installer V2
[U] http://www.rocklinux.org/wiki/Abstract_New_Installer
[A] Benjamin Schieder <blindcoder@rocklinux.org>
[M] Benjamin Schieder <blindcoder@rocklinux.org>
[C] base/system
[L] GPL
[S] Alpha
[V] 001
[P] X -----5---9 100.000

+ 8
- 0
package/base/installer/parse-config

@ -0,0 +1,8 @@
stone_mod_install_installer(){
for x in $( cd ${confdir} ; echo stone_mod_install*.sh ) ; do
[ -e "${confdir}/${x}" ] || continue
cp -v ${confdir}/${x} ${root}/etc/stone.d/${x#stone_}
done
}
hook_add postinstall 9 stone_mod_install_installer

+ 92
- 0
package/base/installer/stone_mod_install.sh

@ -0,0 +1,92 @@
#!/bin/bash
# --- ROCK-COPYRIGHT-NOTE-BEGIN ---
#
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
# Please add additional copyright information _after_ the line containing
# the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
# the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
#
# ROCK Linux: rock-src/package/base/installer/stone_mod_install.sh
# ROCK Linux is Copyright (C) 1998 - 2006 Clifford Wolf
#
# This program 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 2 of the License, or
# (at your option) any later version. A copy of the GNU General Public
# License can be found at Documentation/COPYING.
#
# Many people helped and are helping developing ROCK Linux. Please
# have a look at http://www.rocklinux.org/ and the Documentation/TEAM
# file for details.
#
# --- ROCK-COPYRIGHT-NOTE-END ---
#
# [INSTALL] 10 installer ROCK Linux Operation System Installer V2
MAIN_MENU="'Start Installation!' 'main_start_installation' "
# The main menu, displayed when 'stone install' is called
POSTINSTALL_BEFORE_CHROOT=""
# Commands to execute before doing the postinstall chroot
# Format is:
# function_1 function_2 function_3 ... function_n
main_start_installation() {
stone packages
grep ' /mnt/target[/ ]' /proc/mounts | \
sed 's,/mnt/target/\?,/,' > /mnt/target/etc/mtab
for x in ${POSTINSTALL_BEFORE_CHROOT} ; do
$x
done
mount --rbind /dev /mnt/target/dev
mount -v -t proc proc /mnt/target/proc
mount -v -t sysfs sysfs /mnt/target/sys
chroot /mnt/target sh -c ". /etc/profile ; stone setup"
umount -v /mnt/target/{dev,proc,sys}
if gui_yesno "Do you want to un-mount the filesystems and reboot now?"
then
cd /
sync
shutdown -r now
else
echo
echo "You might want to umount all filesystems now and reboot"
echo "the system now using the commands:"
echo
echo " umount -adrv"
echo " reboot -f"
echo
echo "Or by executing 'shutdown -r now' which will run the above commands."
echo
fi
}
main() {
# Stuff we need to set up
# filesystems
# raids
# encryption
# lvm
# keyboard layout
# package selection
# after-install stuff will be done by '# stone setup'
for subscript in ${SETUPD}/mod_install_*.sh ; do
subscript="${subscript#${SETUPD}/}"
if [ "${subscript%_*}" == "mod_install" ] ; then
. ${SETUPD}/${subscript}
fi
done
local run=1
while [ "${run}" == "1" ] ; do
eval gui_menu MAIN_MENU "'ROCK Linux Installer'" ${MAIN_MENU}
if [ "${?}" == "1" ] ; then # Cancel was pressed
run=0
fi
done
}

+ 252
- 0
package/base/installer/stone_mod_install_filesystems.sh

@ -0,0 +1,252 @@
#!/bin/bash
MAIN_MENU="'Setup Filesystems' 'main_setup_filesystems' ${MAIN_MENU}"
DISKS_MENU=""
# Additional items to show in the disk menu (main_setup_filesystems)
# Intended for setup of RAID or similiar
ADDITIONAL_DISK_DETECTOR=""
# Functions to call from main_setup_filesystems for additional disk detections
# Intended for listing existing RAID arrays
PARTITIONING_MENU=""
# STONE formatted menu for partitioning a harddisk
# use DISK as parameter
MKFS_PROGRAMS=""
# STONE formatted menu for filesystem creation
# use PART as parameter
REREAD_INFORMATION=0
# If 1, then main_setup_filesystems is started from scratch
main_edit_part(){
local partition="${1}"
realmenu="${MKFS_PROGRAMS//PART/${partition}}"
local run=1
while [ ${run} -eq 1 ] ; do
eval gui_menu MAIN_EDIT_PART "'Create a filesystem'" ${realmenu}
if [ "${?}" == "1" ] ; then # Cancel was pressed
run=0
else
REREAD_INFORMATION=1
fi
done
}
main_edit_disk(){
local disk="${1}"
realmenu="${PARTITIONING_MENU//DISK/${disk}}"
local run=1
while [ ${run} -eq 1 ] ; do
eval gui_menu MAIN_EDIT_DISK "'Partitioning ${disk}'" ${realmenu}
if [ "${?}" == "1" ] ; then # Cancel was pressed
run=0
else
REREAD_INFORMATION=1
fi
done
}
main_mount_do_mount(){
local disk="${1}"
local mountpoint="${2}"
if [ ! -e "/mnt/target/${mountpoint}" ] ; then
gui_yesno "'${mountpoint}' does not exist. Create it?"
rval="${?}"
if [ "${rval}" == "0" ] ; then
mkdir -p "/mnt/target/${mountpoint}"
else
return 1
fi
fi
if [ ! -d "/mnt/target/${mountpoint}" ] ; then
gui_message "'${mountpoint}' exists but is not a directory!"
return 1
fi
numfiles=0
while read file ; do
numfiles=$(( ${numfiles} + 1 ))
done < <( ls "/mnt/target/${mountpoint}" )
if [ ${numfiles} -gt 2 ] ; then # . and .. directories only is considered empty
gui_yesno "'${mountpoint}' contains files! Mount anyway?"
rval="${?}"
if [ "${rval}" == "1" ] ; then
return 1
fi
fi
mount "${disk}" "/mnt/target/${mountpoint}"
REREAD_INFORMATION=1
}
main_mount_partition_other(){
local disk="${1}"
gui_input "Where do you want to mount '${disk}'?" '/data' mountpoint
[ -z "${mountpoint}" ] && return 1
main_mount_do_mount "${disk}" "${mountpoint}"
return 0
}
main_mount_partition(){
local disk="${1}"
local mountpoint="${2}"
local fstype="${3}"
menu=""
if [ "${mountpoint}" == "nowhere" ] ; then
if [ "${fstype}" == "Swap" ] ; then
gui_yesno "Do you want to activate the SWAP on '${disk}'"
rval=${?}
if [ ${rval} -eq 0 ] ; then
swapon "${disk}"
REREAD_INFORMATION=1
fi
else
for x in / /boot /home /var /usr /srv ; do
menu="${menu} 'Mount on ${x}' 'main_mount_do_mount ${disk} ${x#}'"
done
menu="${menu} 'Other mountpoint' 'main_mount_partition_other \"${disk}\"'"
eval gui_menu MAIN_MOUNT_PARTITION "'Where do you want to mount ${disk}?'" ${menu}
fi
elif [ "${mountpoint}" == "SWAP" ] ; then
gui_yesno "Do you want to deactivate the SWAP on '${disk}'?"
rval=${?}
if [ ${rval} -eq 0 ] ; then
swapoff "${disk}"
REREAD_INFORMATION=1
fi
else
gui_yesno "Do you want to umount '${disk}' from '${mountpoint}'?"
rval=${?}
if [ ${rval} -eq 0 ] ; then
umount "/mnt/target/${mountpoint}"
REREAD_INFORMATION=1
fi
fi
}
main_setup_filesystems_add_part(){
# is a partition
local disk="${1}"
local size="${2}"
local tmp="$(mktemp)"
disktype "${disk}" > "${tmp}"
if [ -z "${size}" ] ; then
read a b c d e g h < <( grep ^Block\ device "${tmp}" )
size="${g#(}"
fi
read fstype rest < <( grep " file system" "${tmp}" )
grep -q "^Linux swap" "${tmp}" && fstype="Swap"
grep -q 'RAID set UUID' "${tmp}" && fstype="RAID"
fstype="${fstype:-Unknown}"
if grep -q 'Type 0x05 (Extended)' "${tmp}" && [ ${size} -eq 1024 ] ; then
continue
# Is a DOS extended partition. We don't want this to show up here
fi
DISKS="${DISKS} ' ${fstype} Partition ($(( ${size} / 1024 / 1024)) MB)' 'main_edit_part ${disk}'"
realdisk="${disk}"
while [ -L "${realdisk}" ] ; do
realdisk="$( readlink -f ${disk} )"
done
mountpoint="$( mount | grep ^${realdisk} | cut -f 3 -d' ' )"
[ -n "${mountpoint}" ] && mountpoint="${mountpoint}/";
mountpoint="${mountpoint#/mnt/target}"
[ -n "${mountpoint}" ] && mountpoint="/${mountpoint#/}" # necessary to do this way because rootfs will be "/mnt/target"
swapon -s | grep -q ^${realdisk} && mountpoint="SWAP"
if [ -z "${mountpoint}" ] ; then
if [ "${fstype}" == "Swap" ] ; then
DISKS="${DISKS} ' Inactive Swap'"
elif [ "${fstype}" == "RAID" ] ; then
DISKS="${DISKS} ' Part of a RAID'"
else
DISKS="${DISKS} ' Not mounted'"
fi
elif [ "${mountpoint}" == "SWAP" ] ; then
DISKS="${DISKS} ' Active Swapspace'"
else
DISKS="${DISKS} ' Mounted on ${mountpoint}'"
fi
DISKS="${DISKS} 'main_mount_partition \"${disk}\" \"${mountpoint:-nowhere}\" \"${fstype}\"'"
rm -f "${tmp}"
}
main_setup_filesystems() {
DISKS=""
# Array of disks, /dev/disk/by-id/ata-* (without partitions!), formerly /dev/[hs]d[a-z]
# Format: DISKS="/dev/sda 'SCSI Disk (description; size)'"
for disk in /dev/disk/by-id/* ; do
type="${disk##*/}"
type="${type%%-*}"
if [ "${type}" == "ata" -o "${type}" == "usb" ] ; then
tmp="$(mktemp)"
disktype "${disk}" > "${tmp}"
[ -f "${tmp}" ] || smartctl -d ata -i "${disk}" > "${tmp}"
if [ "${type}" == "ata" ] ; then
read a b model < <( grep ^Device\ Model "${tmp}" )
read a b serial < <( grep ^Serial\ Number "${tmp}" )
type="ATA"
elif [ "${type}" == "usb" ] ; then
model="USB Device"
serial="${disk%-*}"
serial="${serial##*-}"
type="USB"
else
type="UNKNOWN"
unset model serial
fi
if [ "${disk%-part*}" != "${disk}" ] ; then
# is a partition
main_setup_filesystems_add_part "${disk}" ""
else
# is a disk
if [ -z "${size}" ] ; then
read a b c d e g h < <( grep ^Block\ device "${tmp}" )
size="${g#(}"
fi
DISKS="${DISKS} '${type} Disk (${model:-Unknown Model} - ${serial:-Unknown Serial Number} - $(( ${size} / 1024 / 1024 )) MB)' 'main_edit_disk ${disk}'"
fi
rm -f "${tmp}"
else
# unknown type
DISKS="${DISKS} 'Unknown Type of disk (${disk}) Please contact the Developers!' ''"
fi
done
for x in ${ADDITIONAL_DISK_DETECTOR} ; do
eval ${x}
done
local run=1
while [ ${run} -eq 1 ] ; do
eval gui_menu SETUP_FILESYSTEMS '"Filesystem Setup"' ${DISKS_MENU} ${DISKS_MENU:+"'' ''"} "${DISKS}" "'' ''" ${PARTITIONS}
if [ "${?}" == "1" ] ; then # Cancel was pressed
run=0
fi
if [ ${REREAD_INFORMATION} -eq 1 ] ; then
run=0
fi
done
if [ ${REREAD_INFORMATION} -eq 1 ] ; then
REREAD_INFORMATION=0
main_setup_filesystems
fi
}
for subscript in ${SETUPD}/mod_install_*.sh ; do
subscript="${subscript#${SETUPD}/}"
if [ "${subscript%_*}" == "mod_install_filesystems" ] ; then
. ${SETUPD}/${subscript}
fi
done

package/base/stone/stone_mod_setup.sh → package/base/installer/stone_mod_setup.sh

@ -31,7 +31,7 @@ proc /proc proc defaults 0 0
devpts /dev/pts devpts defaults 0 0
tmpfs /dev/shm tmpfs defaults 0 0
sysfs /sys sysfs defaults 0 0
usbfs /proc/bus/usb usbfs defaults 0 0
/dev/bus/usb /proc/bus/usb bind bind 0 0
#tmpfs /tmp tmpfs defaults 0 0
EOT
@ -74,12 +74,6 @@ EOT
rm -f $tmp1 $tmp2
}
set_hostname() {
gui_input "Set a hostname (without domain part)" "localhost" hn
echo "$hn" > /etc/HOSTNAME
hostname "$hn"
}
set_rootpw() {
if [ "$SETUPG" = dialog ] ; then
tmp1="`mktemp`" ; tmp2="`mktemp`" ; rc=0
@ -108,7 +102,6 @@ main() {
make_fstab
$STONE general set_keymap
set_hostname
while ! set_rootpw; do :; done
$STONE general set_tmarea
$STONE general set_dtime

+ 3
- 0
package/base/mdadm/etc_conf_initrd_initrd_mdadm

@ -0,0 +1,3 @@
/etc/conf/mdadm/initrd_mdadm /etc/conf/mdadm
/etc/mdadm.conf /etc/mdadm.conf
/sbin/mdadm /sbin/mdadm

+ 3
- 0
package/base/mdadm/etc_conf_mdadm_initrd_mdadm

@ -0,0 +1,3 @@
#!/bin/bash
/sbin/mdadm -As --auto=yes --symlink=yes

+ 6
- 0
package/base/mdadm/etc_stone.d_setup_50-mdadm.sh

@ -0,0 +1,6 @@
#!/bin/bash
echo "DEVICE partitions" > /etc/mdadm.conf
echo "MAIL root@localhost" >> /etc/mdadm.conf
/sbin/mdadm -Ebsc partitions >> /etc/mdadm.conf

+ 11
- 1
package/base/mdadm/mdadm.conf

@ -28,4 +28,14 @@
STRIP=""
CC_WRAPPER_REMOVE="-Werror"
postinstall="install_init mdadm $confdir/mdadm.init"
mdadm_postinstall() {
mkdir -p ${root}/etc/conf/mdadm/
cp ${confdir}/etc_conf_mdadm_initrd_mdadm ${root}/etc/conf/mdadm/initrd_mdadm
mkdir -p ${root}/etc/conf/initrd
cp ${confdir}/etc_conf_initrd_initrd_mdadm ${root}/etc/conf/initrd/initrd_mdadm
# cp ${confdir}/etc_stone.d_mod_mdadm.sh ${root}/etc/stone.d/mod_mdadm.sh
# TODO XXX
cp ${confdir}/etc_stone.d_setup_50-mdadm.sh ${root}/etc/stone.d/setup_50-mdadm.sh
install_init mdadm ${confdir}/mdadm.init
}
postinstall="mdadm_postinstall"

+ 179
- 0
package/base/mdadm/stone_mod_install_filesystems_mdadm.sh

@ -0,0 +1,179 @@
#!/bin/bash
# --- ROCK-COPYRIGHT-NOTE-BEGIN ---
#
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
# Please add additional copyright information _after_ the line containing
# the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
# the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
#
# ROCK Linux: rock-src/package/base/mdadm/stone_mod_install_mdadm.sh
# ROCK Linux is Copyright (C) 1998 - 2006 Clifford Wolf
#
# This program 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 2 of the License, or
# (at your option) any later version. A copy of the GNU General Public
# License can be found at Documentation/COPYING.
#
# Many people helped and are helping developing ROCK Linux. Please
# have a look at http://www.rocklinux.org/ and the Documentation/TEAM
# file for details.
#
# --- ROCK-COPYRIGHT-NOTE-END ---
#
# [INSTALLER] 10 mdadm ROCK Linux Operation System Installer V2 - mdadm RAID module
DISKS_MENU="${DISKS_MENU} 'Setup Software-RAID' 'mdadm_setup_software_raid'"
ADDITIONAL_DISK_DETECTOR="${ADDITIONAL_DISK_DETECTOR} mdadm_disk_detector"
mdadm_setup_software_raid_new(){ # {{{
local level=""
local menu=""
for x in 1 2 3 4 5 6 0 ; do
menu="${menu} 'Level ${x}' 'level=${x}'"
done
eval gui_menu MENU_mdadm_setup_software_raid_new "'Select RAID Level'" ${menu}
[ -z "${level}" ] && return
local selected=""
local all=""
local oldselected=""
while : ; do
local end=0
menu=""
read selected < <( sed -e 's,^ *,,g' -e 's, *$,,g' -e 's, *, ,g' <<< "${selected}" )
while read major minor blocks name ; do
# TODO XXX This really needs different handling, eg everything on the DEVICES line of /etc/mdadm.conf, but this will suffice for the time being
[ "${name}" == "name" ] && continue
[ -z "${name}" ] && continue
if [[ ${selected} = ${name} || ${selected} = *\ ${name}\ * || ${selected} = *\ ${name} || ${selected} = ${name}\ * ]] ; then
menu="${menu} '[X] ${name} ($((${blocks}/1024)) MB)'"
menu="${menu} 'selected=\"\$( sed -e \"s,${name} , ,g\" -e \"s,${name}\$,,g\" <<< \"${selected}\" )\"'"
else
menu="${menu} '[ ] ${name} ($((${blocks}/1024)) MB)'"
menu="${menu} 'selected=\"${selected} ${name}\"'"
fi
done < /proc/partitions
eval gui_menu MENU_mdadm_setup_software_raid_new "'Select Partitions to use in the array'" ${menu} "'Build Array!' 'end=1'"
[ "${end}" == "1" ] && break
[ "${selected}" == "${oldselected}" ] && return # indicates 'Cancel'
oldselected="${selected}"
done
tmp="$(mktemp)"
mdadm -Ebsc partitions > "${tmp}"
for x in `seq 0 255` none ; do
grep -q 'md/\?'"${x}" "${tmp}" || break
done
rm -f "${tmp}"
if [ "${x}" == "none" ] ; then
gui_message "There is no free RAID device available!"
return
fi
gui_yesno "Really create /dev/md/${x} from disks ${selected}? All data on the disks will be deleted!"
rval=${?}
if [ ${rval} -eq 0 ] ; then
mdadm -C /dev/md/${x} -l ${level} -n $( wc -w <<< "${selected}" ) --auto=yes --symlink=yes $( for x in ${selected} ; do find /dev -name $x ; done )
echo "Remember to recreate /etc/mdadm.conf!"
read -p "Press enter to continue"
fi
} # }}}
mdadm_setup_software_raid(){
#/etc/mdadm.conf:
#DEVICE partitions
#MAIL root@localhost
#
#ARRAY /dev/md0 level=raid1 num-devices=4 UUID=3559ffcf:14eb9889:3826d6c2:c13731d7
#ARRAY /dev/md1 level=raid5 num-devices=4 UUID=649fc7cc:d4b52c31:240fce2c:c64686e7
#ARRAY /dev/md2 level=raid5 num-devices=4 UUID=9a3bf634:58f39e44:27ba8087:d5189766
#ARRAY /dev/md3 level=raid5 num-devices=4 UUID=719401e0:65d2e3bf:aabaa5cd:79bdde46
#ARRAY /dev/md4 level=raid5 num-devices=4 UUID=d4799be3:5b157884:e38718c2:c05ab840
#ARRAY /dev/md5 level=raid5 num-devices=4 UUID=ca4a6110:4533d8d5:0e2ed4e1:2f5805b2
local menu
while : ; do
menu="'Recreate /etc/mdadm.conf' 'echo DEVICE partitions > /etc/mdadm.conf; mdadm -Ebs >> /etc/mdadm.conf; REREAD_INFORMATION=1'"
menu="${menu} 'Start all RAIDs in /etc/mdadm.conf' 'mdadm -As --auto=yes --symlink=yes; REREAD_INFORMATION=1'"
menu="${menu} 'Create a new RAID' 'mdadm_setup_software_raid_new'"
menu="${menu} 'Existing Arrays in /etc/mdadm.conf:' ''"
while read ARRAY dev rest ; do
level="${rest#*level=}"
level="${level%% *}"
level="${level:-unknown}"
menu="${menu} '${dev} (RAID level ${level})' ''"
#md5 : active raid5 hdb8[0] hdf8[3] hdc8[2] hda8[1]
read line < <( grep '^md/\?'"${dev##*md}" /proc/mdstat )
line="${line#*:}"
read status level devices <<< "${line}"
menu="${menu} ' Devices: ${devices}' ''"
done < <( grep ^ARRAY /etc/mdadm.conf )
eval gui_menu MENU_mdadm_setup_software_raid "'RAID Configuration (mdadm)'" ${menu}
[ "${?}" == "1" ] && break # Cancel was pressed
done
}
mdadm_disk_detector(){
export DISKS="${DISKS} '' '' 'Software RAID Devices' ''"
tmp="$( mktemp )"
[ -e /etc/mdadm.conf ] || return
cat /etc/mdadm.conf > "${tmp}"
# ARRAY /dev/md1 level=raid5 num-devices=4 UUID=649fc7cc:d4b52c31:240fce2c:c64686e7
while read ARRAY md level numdev uuid ; do
[ "${ARRAY}" != "ARRAY" ] && continue
level="${level#*=}"
numdev="${numdev#*=}"
uuid="${uuid#*=}"
active=""
size=0
fstype="Unknown"
tmp2="$(mktemp)"
mdadm -Q --detail "${md}" > "${tmp2}"
if grep -q "${uuid}" "${tmp2}" ; then
active="(active)"
tmp3="$(mktemp)"
disktype "${md}" > "${tmp3}"
read fstype rest < <( grep " file system" "${tmp3}" )
grep -q "^Linux swap" "${tmp3}" && fstype="Swap"
fstype="${fstype:-Unknown}"
read a b c d e g h < <( grep ^Block\ device "${tmp3}" )
size="${g#(}"
rm -f "${tmp3}"
fi
rm -f "${tmp2}"
export DISKS="${DISKS} '${md}${active:+ }${active} RAID Level ${level#raid}, ${numdev} devices, $(( ${size} / 1024 / 1024 )) MB' 'mdadm_edit_raid ${uuid}'"
export DISKS="${DISKS} ' ${fstype} Filesystem' 'main_edit_part ${md}'"
mountpoint="$( mount | grep ^${md} | cut -f3 -d' ')"
[ -n "${mountpoint}" ] && mountpoint="${mountpoint}/";
mountpoint="${mountpoint#/mnt/target}"
[ -n "${mountpoint}" ] && mountpoint="/${mountpoint#/}" # necessary to do this way because rootfs will be "/mnt/target"
if [ -L "${md}" ] ; then
realdisk="$( readlink -f ${md} )"
else
realdisk="${md}"
fi
swapon -s | grep -q ^${realdisk} && mountpoint="SWAP"
if [ -z "${mountpoint}" ] ; then
if [ "${fstype}" == "Swap" ] ; then
export DISKS="${DISKS} ' Inactive Swap'"
elif [ "${fstype}" == "RAID" ] ; then
export DISKS="${DISKS} ' Part of a RAID'"
else
export DISKS="${DISKS} ' Not mounted'"
fi
elif [ "${mountpoint}" == "SWAP" ] ; then
export DISKS="${DISKS} ' Active Swapspace'"
else
export DISKS="${DISKS} ' Mounted on ${mountpoint}'"
fi
export DISKS="${DISKS} 'main_mount_partition \"${disk}\" \"${mountpoint:-nowhere}\" \"${fstype}\"'"
done < "${tmp}"
rm -f "${tmp}"
}

+ 26
- 0
package/base/reiser4progs/stone_mod_install_filesystems_reiser4progs.sh

@ -0,0 +1,26 @@
#!/bin/bash
# --- ROCK-COPYRIGHT-NOTE-BEGIN ---
#
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
# Please add additional copyright information _after_ the line containing
# the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
# the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
#
# ROCK Linux: rock-src/package/base/reiser4progs/stone_mod_install_reiser4progs.sh
# ROCK Linux is Copyright (C) 1998 - 2006 Clifford Wolf
#
# This program 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 2 of the License, or
# (at your option) any later version. A copy of the GNU General Public
# License can be found at Documentation/COPYING.
#
# Many people helped and are helping developing ROCK Linux. Please
# have a look at http://www.rocklinux.org/ and the Documentation/TEAM
# file for details.
#
# --- ROCK-COPYRIGHT-NOTE-END ---
#
# [INSTALLER] 10 mdadm ROCK Linux Operation System Installer V2 - reiser4progs partitioning module
MKFS_PROGRAMS="${MKFS_PROGRAMS} 'Create a ReiserFS v4 Filesystem' 'mkfs.reiser4 PART'"

+ 26
- 0
package/base/reiserfsprogs/stone_mod_install_filesystems_reiserfsprogs.sh

@ -0,0 +1,26 @@
#!/bin/bash
# --- ROCK-COPYRIGHT-NOTE-BEGIN ---
#
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
# Please add additional copyright information _after_ the line containing
# the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
# the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
#
# ROCK Linux: rock-src/package/base/reiserfsprogs/stone_mod_install_reiserfsprogs.sh
# ROCK Linux is Copyright (C) 1998 - 2006 Clifford Wolf
#
# This program 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 2 of the License, or
# (at your option) any later version. A copy of the GNU General Public
# License can be found at Documentation/COPYING.
#
# Many people helped and are helping developing ROCK Linux. Please
# have a look at http://www.rocklinux.org/ and the Documentation/TEAM
# file for details.
#
# --- ROCK-COPYRIGHT-NOTE-END ---
#
# [INSTALLER] 10 mdadm ROCK Linux Operation System Installer V2 - reiserfsprogs partitioning module
MKFS_PROGRAMS="${MKFS_PROGRAMS} 'Create a ReiserFS v3 Filesystem' 'mkfs.reiserfs PART'"

+ 5
- 0
package/base/rockinitrd/stone_setup_99-rockinitrd.sh

@ -0,0 +1,5 @@
#!/bin/bash
for x in /lib/modules/* ; do
mkinitrd ${x##*/}
done

+ 0
- 247
package/base/stone/stone_mod_install.sh

@ -1,247 +0,0 @@
# --- ROCK-COPYRIGHT-NOTE-BEGIN ---
#
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
# Please add additional copyright information _after_ the line containing
# the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
# the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
#
# ROCK Linux: rock-src/package/base/sysfiles/stone_mod_install.sh
# ROCK Linux is Copyright (C) 1998 - 2006 Clifford Wolf
#
# This program 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 2 of the License, or
# (at your option) any later version. A copy of the GNU General Public
# License can be found at Documentation/COPYING.
#
# Many people helped and are helping developing ROCK Linux. Please
# have a look at http://www.rocklinux.org/ and the Documentation/TEAM
# file for details.
#
# --- ROCK-COPYRIGHT-NOTE-END ---
part_mounted_action() {
if gui_yesno "Do you want to un-mount the filesystem on $1/$2?"
then umount /dev/$1/$2; fi
}
part_swap_action() {
if gui_yesno "Do you want to de-activate the swap space on $1/$2?"
then swapoff /dev/$1/$2; fi
}
part_mount() {
local dir
gui_input "Mount device $1/$2 on directory
(for example /, /home, /var, ...)" '/' dir
if [ "$dir" ] ; then
dir="$( echo $dir | sed 's,^/*,,; s,/*$,,' )"
if [ -z "$dir" ] || grep -q " /mnt/target " /proc/mounts
then
mkdir -p /mnt/target/$dir
mount /dev/$1/$2 /mnt/target/$dir
else
gui_message "Please mount a root filesystem first."
fi
fi
}
part_mkfs() {
cmd="gui_menu part_mkfs 'Create filesystem on $1/$2'"
cmd="$cmd 'ext3fs (journaling filesystem)'"
cmd="$cmd 'mke2fs -j /dev/$1/$2'"
cmd="$cmd 'ext2fs (non-journaling fs)'"
cmd="$cmd 'mke2fs /dev/$1/$2'"
cmd="$cmd 'reiserfs (journaling filesystem)'"
cmd="$cmd 'mkreiserfs /dev/$1/$2'"
if type -p jfs_mkfs > /dev/null ; then
cmd="$cmd 'IBM JFS (journaling filesystem)'"
cmd="$cmd 'jfs_mkfs /dev/$1/$2'"
fi
if type -p mkfs.xfs > /dev/null ; then
cmd="$cmd 'SGI XFS (journaling filesystem)'"
cmd="$cmd 'mkfs.xfs -f /dev/$1/$2'"
fi
eval "$cmd" && part_mount $1 $2
}
part_unmounted_action() {
gui_menu part "$1/$2" \
"Create a filesystem on the partition" \
"part_mkfs $1 $2" \
"Mount an existing filesystem from the partition" \
"part_mount $1 $2" \
"Create a swap space on the partition" \
"mkswap /dev/$1/$2; swapon /dev/$1/$2" \
"Activate an existing swap space on the partition" \
"swapon /dev/$1/$2"
}
part_add() {
local action="unmounted" location="currently not mounted"
# Devices in /proc/swaps are listed with their real device file name,
# while in /proc/mounts they are listed with the device file name that
# was actually used for the mount (which may have been a symlink).
if grep -q "^`readlink -fn /dev/$1/$2` " /proc/swaps; then
action=swap ; location="swap <no mount point>"
elif grep -q "^/dev/$1/$2 " /proc/mounts; then
action=mounted
location="`grep "^/dev/$1/$2 " /proc/mounts | cut -d ' ' -f 2 | \
sed "s,^/mnt/target,," `"
[ "$location" ] || location="/"
fi
# save partition information
disktype /dev/$1/$2 > /tmp/stone-install
type="`grep /tmp/stone-install -v -e '^ ' -e '^Block device' \
-e '^Partition' -e '^---' | \
sed -e 's/[,(].*//' -e '/^$/d' -e 's/ $//' | tail -n 1`"
size="`grep 'Block device, size' /tmp/stone-install | \
sed 's/.* size \(.*\) (.*/\1/'`"
[ "$type" ] || type="undetected"
cmd="$cmd '`printf "%-6s %-24s %-10s" $2 "$location" "$size"` $type' 'part_${action}_action $1 $2'"
}
disk_action() {
if grep -q "^/dev/$1/" /proc/swaps /proc/mounts; then
gui_message "Partitions from $1 are currently in use, so you
can't modify this disks partition table."
return
fi
cmd="gui_menu disk 'Edit partition table of $1'"
for x in cfdisk fdisk pdisk mac-fdisk ; do
fn=""
[ -f /bin/$x ] && fn="/bin/$x"
[ -f /sbin/$x ] && fn="/sbin/$x"
[ -f /usr/bin/$x ] && fn="/usr/bin/$x"
[ -f /usr/sbin/$x ] && fn="/usr/sbin/$x"
[ "$fn" ] && \
cmd="$cmd \"Edit partition table using '$x'\" \"$x /dev/$1/disc\""
done
eval $cmd
}
vg_action() {
cmd="gui_menu vg 'Volume Group $1'"
if [ -e /proc/lvm/VGs/$1 ]; then
cmd="$cmd 'Display attributes of $1' 'gui_cmd \"display $1\" vgdisplay $1'"
if grep -q "^/dev/$1/" /proc/swaps /proc/mounts; then
cmd="$cmd \"LVs of $1 are currently in use, so you can't
de-activate it.\" ''"
else
cmd="$cmd \"De-activate VG '$1'\" 'vgchange -an $1'"
fi
else
cmd="$cmd 'Display attributes of $1' 'gui_cmd \"display $1\" vgdisplay -D $1'"
cmd="$cmd \"Activate VG '$1'\" 'vgchange -ay $1'"
fi
eval $cmd
}
disk_add() {
local x y=0
cmd="$cmd 'Edit partition table of $1' 'disk_action $1'"
for x in $( cd /dev/$1 ; ls part* 2> /dev/null )
do
part_add $1 $x ; y=1
done
if [ $y = 0 ]; then
cmd="$cmd 'This disks partition table is empty.' ''"
fi
cmd="$cmd '' ''"
}
vg_add() {
local x y=0
cmd="$cmd 'Logical volumes of $1:' 'vg_action $1'"
if [ -e /proc/lvm/VGs/$1 ] ; then
for x in $( cd /proc/lvm/VGs/$1/LVs; ls -1 )
do
part_add $1 $x ; y=1
done
if [ $y = 0 ]; then
cmd="$cmd 'No logical volumes.' ''"
fi
else
cmd="$cmd 'Volume Group is not active.' ''"
fi
cmd="$cmd '' ''"
}
main() {
local cmd install_now=0
while
cmd="gui_menu install 'Partitioning your discs
This dialog allows you to modify your discs partition layout and to create filesystems and swap space - as well as mounting / activating it. Everything you can do using this tool can also be done manually on the command line.'"
# protect for the case no discs are present ...
if [ -e /dev/discs ] ; then
for x in $( cd /dev/ ; ls discs/*/disc 2> /dev/null )
do
disk_add ${x%/disc}
done
for x in $( cat /etc/lvmtab 2> /dev/null )
do
vg_add "$x"
done
else
cmd="$cmd 'No hard-disc found!' ''"
fi
cmd="$cmd 'Install the system ...' 'install_now=1'"
eval "$cmd" && [ "$install_now" -eq 0 ]
do : ; done
if [ "$install_now" -ne 0 ] ; then
$STONE packages
cat > /mnt/target/tmp/stone_postinst.sh << EOT
#!/bin/sh
mount -v -t proc proc /proc
mount -v -t sysfs sysfs /sys
. /etc/profile
stone setup
umount -v /sys
umount -v /proc
EOT
chmod +x /mnt/target/tmp/stone_postinst.sh
grep ' /mnt/target[/ ]' /proc/mounts | \
sed 's,/mnt/target/\?,/,' > /mnt/target/etc/mtab
mount --bind /dev /mnt/target/dev
cd /mnt/target ; chroot . ./tmp/stone_postinst.sh
rm -fv ./tmp/stone_postinst.sh
if gui_yesno "Do you want to un-mount the filesystems and reboot now?"
then
cd /
sync
umount -adrv
shutdown -r now
else
echo
echo "You might want to umount all filesystems now and reboot"
echo "the system now using the commands:"
echo
echo " umount -adrv"
echo " reboot -f"
echo
echo "Or by executing 'shutdown -r now' which will run the above commands."
echo
fi
fi
}

+ 57
- 0
package/base/util-linux/stone_mod_install_filesystems_util-linux.sh

@ -0,0 +1,57 @@
#!/bin/bash
# --- ROCK-COPYRIGHT-NOTE-BEGIN ---
#
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
# Please add additional copyright information _after_ the line containing
# the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
# the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
#
# ROCK Linux: rock-src/package/base/util-linux/stone_mod_install_util-linux.sh
# ROCK Linux is Copyright (C) 1998 - 2006 Clifford Wolf
#
# This program 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 2 of the License, or
# (at your option) any later version. A copy of the GNU General Public
# License can be found at Documentation/COPYING.
#
# Many people helped and are helping developing ROCK Linux. Please
# have a look at http://www.rocklinux.org/ and the Documentation/TEAM
# file for details.
#
# --- ROCK-COPYRIGHT-NOTE-END ---
#
# [INSTALLER] 10 mdadm ROCK Linux Operation System Installer V2 - util-linux partitioning module
PARTITIONING_MENU="${PARTITIONING_MENU} 'Partition disk using menu-based cfdisk' 'cfdisk DISK'
'Partition disk using commandline based fdisk' 'fdisk DISK'
'Dump partition table to file' 'utillinux_dump_sfdisk DISK'
'Restore previously dumped partition table' 'utillinux_read_sfdisk DISK'"
MKFS_PROGRAMS="${MKFS_PROGRAMS} 'Create an SCO BFS Filesystem' 'mkfs.bfs PART'
'Create a MINIX Filesystem' 'mkfs.minix PART'
'Create a Swapspace' 'mkswap PART'"
utillinux_dump_sfdisk(){
disk="${1}"
gui_input "Please specify the filename to dump partition table to" "/tmp/${disk##*/}.partitiontable" "dump_path"
if [ -n "${dump_path}" ] ; then
sfdisk --dump "${disk}" > "${dump_path}"
fi
}
utillinux_read_sfdisk(){
disk="${1}"
gui_input "Please specify the filename to restore partition table from" "/tmp/${disk##*/}.partitiontable" "dump_path"
if [ -f "${dump_path}" ] ; then
gui_yesno "WARNING! This will erase the existing partition table and CAN NOT be undone! Are you sure?"
rval=${?}
if [ ${rval} -eq 0 ] ; then
sfdisk "${disk}" < "${dump_path}"
echo -n "Press Return to continue."
read
fi
else
gui_message "File does not exist: ${dump_path}"
fi
}

+ 26
- 0
package/base/xfsprogs/stone_mod_install_filesystems_xfsprogs.sh

@ -0,0 +1,26 @@
#!/bin/bash
# --- ROCK-COPYRIGHT-NOTE-BEGIN ---
#
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
# Please add additional copyright information _after_ the line containing
# the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
# the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
#
# ROCK Linux: rock-src/package/base/xfsprogs/stone_mod_install_xfsprogs.sh
# ROCK Linux is Copyright (C) 1998 - 2006 Clifford Wolf
#
# This program 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 2 of the License, or
# (at your option) any later version. A copy of the GNU General Public
# License can be found at Documentation/COPYING.
#
# Many people helped and are helping developing ROCK Linux. Please
# have a look at http://www.rocklinux.org/ and the Documentation/TEAM
# file for details.
#
# --- ROCK-COPYRIGHT-NOTE-END ---
#
# [INSTALLER] 10 mdadm ROCK Linux Operation System Installer V2 - xfsprogs partitioning module
MKFS_PROGRAMS="${MKFS_PROGRAMS} 'Create an XFS Filesystem' 'mkfs.xfs PART'"

+ 32
- 0
package/blindcoder/cryptsetup-luks/cryptsetup-luks.conf

@ -0,0 +1,32 @@
# --- ROCK-COPYRIGHT-NOTE-BEGIN ---
#
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
# Please add additional copyright information _after_ the line containing
# the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
# the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
#
# ROCK Linux: rock-src/package/base/device-mapper/device-mapper.conf
# ROCK Linux is Copyright (C) 1998 - 2006 Clifford Wolf
#
# This program 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 2 of the License, or
# (at your option) any later version. A copy of the GNU General Public
# License can be found at Documentation/COPYING.
#
# Many people helped and are helping developing ROCK Linux. Please
# have a look at http://www.rocklinux.org/ and the Documentation/TEAM
# file for details.
#
# --- ROCK-COPYRIGHT-NOTE-END ---
cryptsetupluks_pm() {
mkdir -p $root/etc/conf/luks
cp $confdir/etc_conf_luks_initrd_luks $root/etc/conf/luks/initrd_luks
mkdir -p $root/etc/conf/initrd
cp $confdir/etc_conf_initrd_initrd_luks $root/etc/conf/initrd/initrd_luks
# cp $confdir/etc_stone.d_mod_luks.sh $root/etc/stone.d/mod_luks.sh
touch $root/etc/conf/luks/mounts
}
postmake="cryptsetupluks_pm"

+ 1
- 2
package/blindcoder/cryptsetup-luks/cryptsetup-luks.desc

@ -45,7 +45,6 @@
[L] GPL
[S] Stable
[V] 1.0.4
[P] X -----5---9 281.400
[P] X -----5---9 800.000
[D] 475393035 cryptsetup-luks-1.0.4.tar.bz2 http://luks.endorphin.org/source/

+ 3
- 0
package/blindcoder/cryptsetup-luks/etc_conf_initrd_initrd_luks

@ -0,0 +1,3 @@
/etc/conf/luks/initrd_luks /etc/conf/luks
/etc/conf/luks/mounts /etc/luks/mounts
/usr/sbin/cryptsetup /sbin/cryptsetup

+ 72
- 0
package/blindcoder/cryptsetup-luks/etc_conf_luks_initrd_luks

@ -0,0 +1,72 @@
#!/bin/bash
while read device status ; do
[ "${status}" == "plain" ] && continue
if [ "${status}" == "encrypt" ] ; then # {{{
break
echo "Make sure that your filesystem on ${device} is at least 2 MegaByte smaller"
echo "than the partition it resides on! Otherwise this procedure will kill your"
echo "data FOREVER!"
echo
echo "You can achieve this with the 'resize' commands:"
echo "- resize2fs for ext2 filesystems"
echo "- resize_reiserfs for reiserfs filesystems"
echo
echo "Enter YES (all capitals) now to start the encryption process or anything"
echo "else to cancel."
read -p confirm
# XXX TODO finish this.
blocksize="$( blockdev --getsize ${device} )"
echo " 0 $(( ${blocksize} - 1032 )) linear ${device} 1032 " | dmsetup create ${device//\//_}
for x in $( seq $(( ${blocksize} / 1032 - 2 )) -1 0 ) ; do
echo -en "\r$(( ( ${blocksize} / 1032 - 2 ) - ${x} )) / $(( ${blocksize} / 1032 - 2 ))"
dd if=${device} of=/dev/mapper/${device//\//_} bs=$(( 1032 * 512 )) count=1 skip=${x} seek=${x} 2>/dev/null
done
echo
echo
echo "I'm now going to start the LUKS encryption. You will need to enter a passphrase"
echo "three times:"
echo "First for setting up LUKS"
echo "Second for confirmation of the passphrase"
echo "Third to actually start up the encrypted device"
cryptsetup luksFormat ${device}
cryptsetup luksOpen ${device} ${device//\//_}_encrypted
dd if=/dev/mapper/${device//\//_} of=/dev/mapper/${device//\//_}_encrypted bs=1M
dmsetup remove ${device//\//_}
echo "Your encrypted filesystem is now ready in"
echo "/dev/mapper/${device//\//_}_encrypted and can be used according to the"
echo "LUKS documentation."
echo
fi # }}}
if [ "${status}" == "decrypt" ] ; then # {{{
: "Dito."
fi # }}}
if [ "${status}" == "swap" ] ; then # {{{
: "Will I even do this?"
fi # }}}
if [ "${status}" == "encrypted" ] ; then # {{{
run=1
encryptedname="${device#/}"
encryptedname="${device//\//_}"
while [ ${run} -eq 1 ] ; do
if cryptsetup luksOpen ${device} ${encryptedname} ; then
run=0
echo "Success"
else
echo "Couldn't open encryption on ${device}."
echo -n "Continue without it [y/n] ? "
read -n 1 yn < /dev/console
echo
[ "${yn}" == "y" ] && run=0
fi
done
continue
fi # }}}
done < /etc/dm/mounts

+ 130
- 0
package/blindcoder/cryptsetup-luks/etc_stone.d_mod_luks.sh.disabled

@ -0,0 +1,130 @@
#!/bin/bash
# --- ROCK-COPYRIGHT-NOTE-BEGIN ---
#
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
# Please add additional copyright information _after_ the line containing
# the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
# the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
#
# ROCK Linux: rock-src/package/base/device-mapper/etc_stone.d_mod_dm.sh
# ROCK Linux is Copyright (C) 1998 - 2006 Clifford Wolf
#
# This program 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 2 of the License, or
# (at your option) any later version. A copy of the GNU General Public
# License can be found at Documentation/COPYING.
#
# Many people helped and are helping developing ROCK Linux. Please
# have a look at http://www.rocklinux.org/ and the Documentation/TEAM
# file for details.
#
# --- ROCK-COPYRIGHT-NOTE-END ---
#
# [MAIN] 60 dm DeviceMapper configuration (encrypted filesystems)
# TODO XXX This needs a complete overhaul!
# TODO XXX kick blindcoder in the gnats to do it.
dm_edit_status () {
# Here, BROKEN indicates NOT IMPLEMENTED
gui_menu dm_edit_status "Please select new status of $device" \
"Is encrypted" "status=encrypted" \
"Decrypt (BROKEN)" "status=decrypt" \
"Encrypt (BROKEN)" "status=encrypt" \
"Encrypted Swap (read documentation) (BROKEN)" "status=swap" \
"not encrypted" "status=plain"
}
dm_edit_dev () {
cmd=""
for x in /dev/{ide,scsi}/host*/bus*/target*/lun*/{disc,part*} ; do
[ -b $x ] || continue
cmd="$cmd '$x' 'device=$x'"
done
eval "gui_menu dm_edit_dev \"Please select new device to mount on $mountpoint\" $cmd"
}
dm_edit () {
device=$1
while read olddevice oldmountpoint oldstatus ; do
[ "$olddevice" == "$device" ] && break
done < /etc/conf/dm/mounts
mountpoint=$oldmountpoint
status=$oldstatus
run=0
while [ $run -eq 0 ] ; do
gui_menu dm_edit "Edit encryption for $device" "Device: $device" "dm_edit_dev $mountpoint" \
"Mountpoint: $mountpoint" "gui_input 'Please enter new mountpoint' '$mountpoint' mountpoint" \
"Status: $status" "dm_edit_status"
run=$?
done
sed -e "s,^$olddevice.*$oldmountpoint.*$oldstatus$,$device\t$mountpoint\t$status," -i /etc/conf/dm/mounts
recreate_initrd=1
return 0
}
dm_add () {
cmd=""
for x in /dev/{ide,scsi}/host*/bus*/target*/lun*/{disc,part*} ; do
[ -b $x ] || continue
grep -q $x /etc/conf/dm/mounts && continue
cmd="$cmd '$x' 'device=$x'"
done
eval "gui_menu dm_add1 'Please select the device to use' $cmd" || return
cmd=""
gui_input "Please enter mountpoint of $device" "/data" mountpoint || return
gui_menu dm_add2 "Please enter current state of $device" \
"is encrypted" "status=encrypted" \
"Decrypt" "status=decrypt" \
"Encrypt" "status=encrypt" \
"Encrypted Swap (read documentation)" "status=swap" \
"not encrypted" "status=plain" || return
echo -e "$device\t$mountpoint\t$status" >>/etc/conf/dm/mounts
recreate_initrd=1
}
main() {
run=0
if [ ! -f /etc/conf/dm/mounts ] ; then
mkdir -p /etc/conf/dm
touch /etc/conf/dm/mounts
fi
while [ $run -eq 0 ] ; do
cmd=""
while read device mountpoint status ; do
cmd="$cmd 'Edit device $device ($status on $mountpoint)' 'dm_edit $device'"
done < /etc/conf/dm/mounts
cmd="$cmd 'Add new device' 'dm_add'"
eval "gui_menu dm 'encrypted filesystems' $cmd"
run=$?
done
tmp="`mktemp`"
grep -v "added by mod_dm" /etc/conf/kernel >$tmp
while read device mountpoint status ; do
if [ "$status" == "swap" -o "$status" == "encrypted" -o "$status" == "encrypt" -o "$status" == "decrypt" ] ; then
for x in aes-i586 dm-mod dm-crypt ; do
grep -q $x $tmp || cat >> $tmp <<-EOF
### $x ### added by mod_dm
modprobe $x # added by mod_dm
EOF
done
fi
done < /etc/conf/dm/mounts
rm -f /etc/conf/kernel
mv $tmp /etc/conf/kernel
chmod 644 /etc/conf/kernel
tmp=`mktemp`
rm -rf ${tmp}
grep -v fsck /etc/conf/initrd/initrd_dm > ${tmp}
rm -f /etc/conf/initrd/initrd_dm
mv ${tmp} /etc/conf/initrd/initrd_dm
while read dev a mnt b fs c ; do
[ -e "/sbin/fsck.${fs}" ] && echo "/sbin/fsck.${fs} /sbin/fsck.${fs}"
done < <( mount ) | sort | uniq >>/etc/conf/initrd/initrd_dm
echo "/sbin/fsck /sbin/fsck" >>/etc/conf/initrd/initrd_dm
}

+ 119
- 0
package/blindcoder/cryptsetup-luks/stone_mod_install_filesystems_cryptsetup-luks.sh

@ -0,0 +1,119 @@
#!/bin/bash
# --- ROCK-COPYRIGHT-NOTE-BEGIN ---
#
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
# Please add additional copyright information _after_ the line containing
# the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
# the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
#
# ROCK Linux: rock-src/package/base/util-linux/stone_mod_install_util-linux.sh
# ROCK Linux is Copyright (C) 1998 - 2006 Clifford Wolf
#
# This program 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 2 of the License, or
# (at your option) any later version. A copy of the GNU General Public
# License can be found at Documentation/COPYING.
#
# Many people helped and are helping developing ROCK Linux. Please
# have a look at http://www.rocklinux.org/ and the Documentation/TEAM
# file for details.
#
# --- ROCK-COPYRIGHT-NOTE-END ---
#
# [INSTALLER] 10 cryptsetup-luks ROCK Linux Operation System Installer V2 - cryptsetup-luks partitioning module
MKFS_PROGRAMS="${MKFS_PROGRAMS} 'Create/Edit Encryption using LUKS' 'cryptsetupluks_create_mapping PART'"
POSTINSTALL_BEFORE_CHROOT="${POSTINSTALL_BEFORE_CHROOT} cryptsetupluks_before_chroot"
ADDITIONAL_DISK_DETECTOR="${ADDITIONAL_DISK_DETECTOR} cryptsetup_luks_disk_detector"
touch /tmp/cryptsetup_luks
cryptsetupluks_before_chroot(){
mkdir -p /mnt/target/etc/conf/luks/
cp /tmp/cryptsetup_luks /mnt/target/etc/conf/luks/mounts
}
cryptsetup_luks_disk_detector() {
# we'll go the mdadm way and just loop through /proc/partitions
DISKS="${DISKS} '' '' 'Encrypted Filesystems' ''"
while read major minor blocks name ; do
[ -z "${name}" -o "${name}" == "name" ] && continue
read disk < <( find /dev -name ${name} )
[ -z "${disk}" ] && continue
disktype "${disk}" | grep -q RAID && continue # if it's a RAID partition, the encryption is on the RAID metadevice, not on the physical device
if cryptsetup isLuks "${disk}" >/dev/null 2>&1 ; then
encname="${disk#/}"
encname="${encname//\//_}"
encname="${encname#_}"
[ -b /dev/mapper/${encname} ] || continue
DISKS="${DISKS} 'Encryption on ${disk}' ''"
main_setup_filesystems_add_part "/dev/mapper/${encname}"
fi
done < /proc/partitions
}
cryptsetupluks_delkey(){
local disk="${1}"
#Key Slot 0: ENABLED
local menu=""
cryptsetup luksDump | grep ENABLED | while read key slot number enabled ; do
number="${number%:}"
menu="${menu} 'Delete Key ${number}' 'cryptsetup luksDelKey ${disk} ${number}'; return 1'"
done
while eval gui_menu CRYPTSETUP_LUKS_DEL_KEY "'Delete a Key from LUKS'" ${menu} ; do : ; done
}
cryptsetupluks_luksclose(){
local disk="${1}"
cryptsetup luksClose "${disk}"
tmp="$(mktemp)"
grep -v "^${disk}" /tmp/cryptsetup_luks > "${tmp}"
mv "${tmp}" /tmp/cryptsetup_luks
}
cryptsetupluks_luksopen(){
local disk="${1}"
local encname="${2}"
if cryptsetup luksOpen "${disk}" "${encname}" ; then
echo "${disk} encrypted" >> /tmp/cryptsetup_luks
fi
}
cryptsetupluks_edit_mapping(){
local disk="${1}"
encname="${disk#/}"
encname="${encname//\//_}"
encname="${encname#_}"
while : ; do
local menu
if [ -b /dev/mapper/${encname} ] ; then
menu="'Add a new key' 'cryptsetup luksAddKey ${disk}'
'Delete a key' 'cryptsetupluks_delkey ${disk}'"
menu="${menu} 'Close this mapping' 'cryptsetupluks_luksclose ${encname};'"
else
menu="${menu} 'Open this mapping' 'cryptsetupluks_luksopen ${disk} ${encname};'"
fi
menu="${menu} 'Dump LUKS information' 'cryptsetup luksDump ${disk}; echo -n Press Enter to continue; read'"
eval gui_menu CRYPTSETUP_LUKS_EDIT_MAPPING "'Edit LUKS mapping ${disk}'" ${menu}
[ ${?} -eq 1 ] && break # Cancel
done
}
cryptsetupluks_create_mapping(){
local disk="${1}"
if cryptsetup isLuks "${disk}" >/dev/null 2>&1 ; then
cryptsetupluks_edit_mapping "${disk}"
else
encname="${disk#/}"
encname="${encname//\//_}"
encname="${encname#_}"
if cryptsetup luksFormat "${disk}" ; then
cryptsetupluks_luksopen "${disk}" "${encname}"
fi
fi
}

Loading…
Cancel
Save