The following changes since commit 868c474546ba68e9e448734e1833f873fd50ec0a:
diskstart: Add a pointer to the syslinux_banner to the EPA (2011-04-04
17:40:59 -0700)
are available in the git repository at:
git://github.com/pcacjr/syslinux.git syslinux-update-for-hpa
Paulo Alcantara (4):
libinstaller: implement syslinux_already_installed
extlinux: use syslinux_already_installed instead of already_installed
extlinux: remove already_installed
syslinux: check --update option properly
extlinux/main.c | 15 +--------------
libinstaller/syslxcom.c | 13 +++++++++++++
libinstaller/syslxcom.h | 1 +
linux/syslinux.c | 4 ++++
4 files changed, 19 insertions(+), 14 deletions(-)
diff --git a/extlinux/main.c b/extlinux/main.c
index 21369e4..e5212a9 100755
--- a/extlinux/main.c
+++ b/extlinux/main.c
@@ -503,19 +503,6 @@ int install_file(const char *path, int devfd, struct
stat *rst)
return 1;
}
-/*
- * SYSLINUX installs the string 'SYSLINUX' at offset 3 in the boot
- * sector; this is consistent with FAT filesystems. Earlier versions
- * would install the string "EXTLINUX" instead, handle both.
- */
-int already_installed(int devfd)
-{
- char buffer[8];
-
- xpread(devfd, buffer, 8, 3);
- return !memcmp(buffer, "SYSLINUX", 8) || !memcmp(buffer,
"EXTLINUX",
8);
-}
-
#ifdef __KLIBC__
static char devname_buf[64];
@@ -766,7 +753,7 @@ int install_loader(const char *path, int update_only)
if (devfd < 0)
return 1;
- if (update_only && !already_installed(devfd)) {
+ if (update_only && !syslinux_already_installed(devfd)) {
fprintf(stderr, "%s: no previous syslinux boot sector found\n",
program);
close(devfd);
diff --git a/libinstaller/syslxcom.c b/libinstaller/syslxcom.c
index b176f6d..1de85aa 100644
--- a/libinstaller/syslxcom.c
+++ b/libinstaller/syslxcom.c
@@ -284,3 +284,16 @@ int sectmap(int fd, sector_t *sectors, int nsectors)
return sectmap_fib(fd, sectors, nsectors);
}
+
+/*
+ * SYSLINUX installs the string 'SYSLINUX' at offset 3 in the boot
+ * sector; this is consistent with FAT filesystems. Earlier versions
+ * would install the string "EXTLINUX" instead, handle both.
+ */
+int syslinux_already_installed(int dev_fd)
+{
+ char buffer[8];
+
+ xpread(dev_fd, buffer, 8, 3);
+ return !memcmp(buffer, "SYSLINUX", 8) || !memcmp(buffer,
"EXTLINUX",
8);
+}
diff --git a/libinstaller/syslxcom.h b/libinstaller/syslxcom.h
index 39ca09d..bf186ca 100644
--- a/libinstaller/syslxcom.h
+++ b/libinstaller/syslxcom.h
@@ -18,5 +18,6 @@ ssize_t xpwrite(int fd, const void *buf, size_t count,
off_t offset);
void clear_attributes(int fd);
void set_attributes(int fd);
int sectmap(int fd, sector_t *sectors, int nsectors);
+int syslinux_already_installed(int dev_fd);
#endif
diff --git a/linux/syslinux.c b/linux/syslinux.c
index 97b6a30..c7a9ecc 100755
--- a/linux/syslinux.c
+++ b/linux/syslinux.c
@@ -382,6 +382,10 @@ int main(int argc, char *argv[])
sync();
rmdir(mntpath);
exit(0);
+ } else if (opt.update_only && !syslinux_already_installed(dev_fd))
{
+ fprintf(stderr, "%s: no previous syslinux boot sector
found\n",
+ argv[0]);
+ exit(1);
} else {
fprintf(stderr, "%s: please specify --install or --update for the
future\n", argv[0]);
opt.update_only = 0;