Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
alpine
alpine-conf
Commits
1d006a11
Commit
1d006a11
authored
Nov 07, 2013
by
Natanael Copa
Browse files
setup-bootable: move syslinux.cfg to /boot/syslinux/ if needed
(cherry picked from commit
e8c99e12
)
parent
b8711d1c
Changes
1
Hide whitespace changes
Inline
Side-by-side
setup-bootable.in
View file @
1d006a11
...
...
@@ -175,7 +175,7 @@ parent_dev=$(find_disk_dev $dev)
# check if this files exist and not in upgrade mode
if
[
-z
"
$upgrade
"
]
&&
[
-z
"
$force
"
]
;
then
for
i
in
boot apks syslinux.cfg .alpine-release
;
do
[
-e
"
$destdir
"
/
$i
]
&&
die
"
$destdir
/
$i
already exists.
Aborting
"
[
-e
"
$destdir
"
/
$i
]
&&
die
"
$destdir
/
$i
already exists.
Use -u to upgrade.
"
done
fi
...
...
@@ -208,15 +208,17 @@ available_space=$(( $free_blocks / $blocks_per_mb ))
vecho
"Available space:
$available_space
MiB"
if
[
-n
"
$srcdir
"
]
;
then
needed_space
=
$(
cd
"
$srcdir
"
&&
du
-m
-s
-c
boot apks
syslinux.cfg
.alpine-release |
awk
'$2 == "total" {print $1}'
)
needed_space
=
$(
cd
"
$srcdir
"
&&
du
-m
-s
-c
boot apks .alpine-release |
awk
'$2 == "total" {print $1}'
)
vecho
"Needed space:
$needed_space
MiB"
[
$available_space
-lt
$needed_space
]
\
&&
die
"Not enough space on
$destdir
. Aborting."
# copy the files to .new
for
i
in
boot apks syslinux.cfg .alpine-release
;
do
vecho
"Copying
$srcdir
/
$i
to
$destdir
/.new/"
cp
-a
"
$srcdir
"
/
$i
"
$destdir
"
/.new/
if
[
-e
"
$srcdir
"
/
$i
]
;
then
vecho
"Copying
$srcdir
/
$i
to
$destdir
/.new/"
cp
-a
"
$srcdir
"
/
$i
"
$destdir
"
/.new/
fi
done
elif
[
-n
"
$srcurl
"
]
;
then
cd
"
$destdir
"
/.new
...
...
@@ -225,6 +227,19 @@ elif [ -n "$srcurl" ]; then
echo
""
fi
# find where new syslinux.cfg is
for
i
in
boot/syslinux/syslinux.cfg syslinux.cfg
;
do
if
[
-e
"
$destdir
"
/.new/
$i
]
;
then
syslinux_cfg
=
$i
vecho
"Found
$syslinux_cfg
"
break
fi
done
# abort early in case unexpected trouble
if
[
-z
"
$syslinux_cfg
"
]
;
then
die
"Could not find any syslinux.cfg on new iso?"
fi
# make sure files are really there before we replace existing
vecho
"Flushing cache..."
sync
...
...
@@ -232,18 +247,7 @@ sync
vecho
"Replacing existing files..."
mkdir
-p
"
$destdir
"
/.old
||
die
"Failed to create
$destdir
/.old"
# do we want keep existing syslinux.cfg?
tomove
=
"boot apks .alpine-release"
if
[
-n
"
$force
"
]
||
!
[
-e
"
$destdir
"
/syslinux.cfg
]
;
then
tomove
=
"
$tomove
syslinux.cfg"
# update syslinux.cfg unless device is on usb bus
# this is so we can boot from CF's and harddisk
if
!
on_usb_bus
$parent_dev
;
then
vecho
"Updating syslinux.cfg to use
$dest
"
sed
-i
-e
"s/usbdisk/
${
dest
##*/
}
/g"
\
"
$destdir
"
/.new/syslinux.cfg
fi
fi
tomove
=
"boot apks syslinux.cfg .alpine-release"
# move current files to .old
for
i
in
$tomove
;
do
...
...
@@ -252,14 +256,29 @@ for i in $tomove; do
fi
done
# keep any existing syslinux.cfg
if
[
-e
"
$destdir
"
/.old/
$syslinux_cfg
]
;
then
mv
"
$destdir
"
/.old/
$syslinux_cfg
"
$destdir
"
/.new/
$syslinux_cfg
elif
[
-e
"
$destdir
"
/.old/syslinux.cfg
]
\
&&
[
-e
"
$destdir
"
/.new/boot/syslinux/syslinux.cfg
]
;
then
echo
"Warning: moving syslinux.cfg to boot/syslinux/syslinux.cfg"
>
&2
mv
"
$destdir
"
/.old/syslinux.cfg
"
$destdir
"
/.new/boot/syslinux
if
[
-z
"
$syslinux
"
]
;
then
echo
" You might need run: syslinux
$dest
"
>
&2
fi
fi
# move .new to current
for
i
in
$tomove
;
do
mv
"
$destdir
"
/.new/
$i
"
$destdir
"
/
||
die
"Failed to move
$destdir
/.new/ to
$destdir
"
if
[
-e
"
$destdir
"
/.new/
$i
]
;
then
mv
"
$destdir
"
/.new/
$i
"
$destdir
"
/
\
||
die
"Failed to move
$destdir
/.new/ to
$destdir
"
fi
done
if
[
-z
"
$keep_alpine_dev
"
]
&&
[
-n
"
$UUID
"
]
;
then
sed
-i
-e
"s/alpine_dev=[^
\t
:]
\+
/alpine_dev=UUID=
$UUID
/"
\
"
$destdir
"
/syslinux
.
cfg
"
$destdir
"
/
$
syslinux
_
cfg
fi
# cleanup
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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