Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
alpine-conf
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
17
Issues
17
List
Boards
Labels
Service Desk
Milestones
Merge Requests
6
Merge Requests
6
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
alpine
alpine-conf
Commits
9cca5488
Commit
9cca5488
authored
May 21, 2009
by
Natanael Copa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
setup-disk: support for raid devices as root
parent
2d0772e8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
9 deletions
+31
-9
setup-disk.in
setup-disk.in
+31
-9
No files found.
setup-disk.in
View file @
9cca5488
...
@@ -15,20 +15,28 @@ in_list() {
...
@@ -15,20 +15,28 @@ in_list() {
}
}
enumerate_fstab
()
{
enumerate_fstab
()
{
[
-z
"
$1
"
]
&&
return
local
mnt
=
"
$1
"
grep
"/
$1
"
/proc/mounts |
\
[
-z
"
$mnt
"
]
&&
return
sed
"s-/
$1
-/-; s-//-/-"
awk
"
\$
2 ==
\"
$mnt
\"
{print
\$
0}"
/proc/mounts |
\
sed
"s-
$mnt
-/-; s-/+-/-; s: :
\t
:g"
}
}
install_mounted_root
()
{
install_mounted_root
()
{
local
mnt
=
"
$1
"
local
mnt
=
"
$1
"
local
features
=
"ata base bootchart cdrom ext2 ext3 ide scsi usb"
rootdev
=
$(
awk
"
\$
1 ==
\"
$mnt
\"
{ print
\$
1 }"
)
rootdev
=
$(
awk
"
\$
2 ==
\"
$mnt
\"
{ print
\$
1 }"
/proc/mounts
)
if
[
-z
"
$rootdev
"
]
;
then
if
[
-z
"
$rootdev
"
]
;
then
echo
"
$mnt
does not seem to be a mount point"
>
&2
echo
"
$mnt
does not seem to be a mount point"
>
&2
return
1
return
1
fi
fi
local
fs
=
$(
awk
"
\$
1 ==
\"
$rootdev
\"
{print
\$
3}"
/proc/mounts
)
if
[
"
$fs
"
!=
"ext2"
]
&&
[
"
$fs
"
!=
"ext3"
]
;
then
echo
"
$fs
is not supported. Only ext2 and ext3 are supported"
>
&2
return
1
fi
rootdisk
=
${
rootdev
%[0-9]*
}
rootdisk
=
${
rootdev
%[0-9]*
}
echon
"Installing system on
$rootdev
: "
echon
"Installing system on
$rootdev
: "
...
@@ -38,22 +46,36 @@ install_mounted_root() {
...
@@ -38,22 +46,36 @@ install_mounted_root() {
echo
""
echo
""
# make things bootable
# make things bootable
kernel
=
$(
ls
"
$mnt
"
/lib/modules
)
kernel
=
$(
ls
"
$mnt
"
/lib/modules
)
chroot
"
$mnt
"
/sbin/mkinitfs
-F
"ata base bootchart cdrom ext3 ide scsi usb"
$kernel
if
[
"
$rootdisk
"
=
"/dev/md"
]
;
then
local
md
=
${
rootdev
#/dev/
}
features
=
"
$features
raid"
raidmod
=
$(
cat
/sys/block/
$md
/md/level
)
raidmod
=
",
$raidmod
"
raidopt
=
"-r"
# get a list of slaves
rootdisk
=
for
i
in
/sys/block/
$md
/slaves/
*
;
do
rootdisk
=
"
$rootdisk
/dev/
${
i
##*/
}
"
done
fi
chroot
"
$mnt
"
/sbin/mkinitfs
-F
"
$features
"
$kernel
# create an extlinux.conf
# create an extlinux.conf
sed
'/append initrd/d'
/media/
*
/syslinux.cfg
>
"
$mnt
"
/boot/extlinux.conf
sed
'/append initrd/d'
/media/
*
/syslinux.cfg
>
"
$mnt
"
/boot/extlinux.conf
echo
-e
"
\t
append initrd=/boot/grsec.gz root=
$rootdev
modules=ext3 quiet"
>>
"
$mnt
"
/boot/extlinux.conf
echo
-e
"
\t
append initrd=/boot/grsec.gz root=
$rootdev
modules=ext3
$raidmod
quiet"
>>
"
$mnt
"
/boot/extlinux.conf
# fix the fstab
# fix the fstab
enumerate_fstab
"
$mnt
"
>>
"
$mnt
"
/etc/fstab
enumerate_fstab
"
$mnt
"
>>
"
$mnt
"
/etc/fstab
# install extlinux
# install extlinux
apk add
-q
syslinux
apk add
-q
syslinux
extlinux
-i
"
$mnt
"
/boot
extlinux
-i
$raidopt
"
$mnt
"
/boot
umount
"
$mnt
"
umount
"
$mnt
"
# fix mbr
# fix mbr for all disk devices
dd
if
=
/usr/share/syslinux/mbr.bin
of
=
$rootdisk
for
i
in
$rootdisk
;
do
dd
if
=
/usr/share/syslinux/mbr.bin
of
=
$i
done
echo
""
echo
""
echo
"Installation is done. Please reboot."
echo
"Installation is done. Please reboot."
apk del
-q
syslinux
apk del
-q
syslinux
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment