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
19
Issues
19
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
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
5531beb0
Commit
5531beb0
authored
Sep 17, 2009
by
Natanael Copa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
setup-disk: use uuid in fstab and extlinux.conf
This helps us avoid the issues when disk changes from sda to hda
parent
43de4035
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
3 deletions
+28
-3
setup-disk.in
setup-disk.in
+28
-3
No files found.
setup-disk.in
View file @
5531beb0
...
...
@@ -15,12 +15,37 @@ in_list() {
return
1
}
# wrapper to only show given device
_blkid
()
{
blkid |
grep
"^
$1
:"
}
# if given device have an UUID display it, otherwise return the device
uuid_or_device
()
{
local
i
=
for
i
in
$(
_blkid
"
$1
"
)
;
do
case
"
$i
"
in
UUID
=
*
)
eval
$i
;;
esac
done
if
[
-n
"
$UUID
"
]
;
then
echo
"UUID=
$UUID
"
else
echo
"
$1
"
fi
}
# generate an fstab from a given mountpoint. Convert to UUID if possible
enumerate_fstab
()
{
local
mnt
=
"
$1
"
local
fs_spec
=
fs_file
=
fs_vfstype
=
fs_mntops
=
fs_freq
=
fs_passno
=
[
-z
"
$mnt
"
]
&&
return
local
escaped_mnt
=
$(
echo
$mnt
|
sed
's:/:\\/:g'
)
awk
"
\$
2 ~ /^
$escaped_mnt
/ {print
\$
0}"
/proc/mounts |
\
sed
"s:
$mnt
:/:g; s: :
\t
:g"
|
sed
's:/\+:/:g'
sed
"s:
$mnt
:/:g; s: :
\t
:g"
|
sed
's:/\+:/:g'
|
\
while
read
fs_spec fs_file fs_vfstype fs_mntops fs_freq fs_passno
;
do
echo
-e
"
$(
uuid_or_device
$fs_spec
)
\t
${
fs_file
}
\t
${
fs_vfstype
}
\t
${
fs_mntops
}
${
fs_freq
}
${
fs_passno
}
"
done
}
is_vmware
()
{
...
...
@@ -89,7 +114,7 @@ prompt 1
default grsec
label grsec
kernel /grsec
append initrd=/grsec.gz root=
$
rootdev
modules=sd-mod,usb-storage,ext3
$raidmod
${
pax_nouderef
}
quiet
append initrd=/grsec.gz root=
$
(
uuid_or_device
$rootdev
)
modules=sd-mod,usb-storage,ext3
$raidmod
${
pax_nouderef
}
quiet
EOF
# fix the fstab
enumerate_fstab
"
$mnt
"
>>
"
$mnt
"
/etc/fstab
...
...
@@ -247,7 +272,7 @@ EOF
rc-update
--quiet
add swap boot
# the func to generate fstab does not detect swap. add it manually
sed
-i
-e
'/swap/d'
/etc/fstab
echo
-e
"
$
swap_dev
\t
swap
\t\t
swap
\t
defaults 0 0"
>>
/etc/fstab
echo
-e
"
$
(
uuid_or_device
$swap_dev
)
\t
swap
\t\t
swap
\t
defaults 0 0"
>>
/etc/fstab
install_mounted_root /mnt
}
...
...
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