svn commit: r449094 - in head/sysutils: . unetbootin unetbootin/files

Alexey Dokuchaev danfe at FreeBSD.org
Fri Sep 1 18:23:09 UTC 2017


Author: danfe
Date: Fri Sep  1 18:23:06 2017
New Revision: 449094
URL: https://svnweb.freebsd.org/changeset/ports/449094

Log:
  UNetbootin allows to create bootable Live USB drives for Ubuntu, Fedora,
  and other Linux distributions without burning a CD.  This is useful when
  supplied ISO image cannot be directly written to USB drive or SD card.
  
  WWW: http://unetbootin.sourceforge.net/

Added:
  head/sysutils/unetbootin/
  head/sysutils/unetbootin/Makefile   (contents, props changed)
  head/sysutils/unetbootin/distinfo   (contents, props changed)
  head/sysutils/unetbootin/files/
  head/sysutils/unetbootin/files/patch-main.cpp   (contents, props changed)
  head/sysutils/unetbootin/files/patch-unetbootin.cpp   (contents, props changed)
  head/sysutils/unetbootin/files/patch-unetbootin.h   (contents, props changed)
  head/sysutils/unetbootin/pkg-descr   (contents, props changed)
  head/sysutils/unetbootin/pkg-plist   (contents, props changed)
Modified:
  head/sysutils/Makefile

Modified: head/sysutils/Makefile
==============================================================================
--- head/sysutils/Makefile	Fri Sep  1 18:21:10 2017	(r449093)
+++ head/sysutils/Makefile	Fri Sep  1 18:23:06 2017	(r449094)
@@ -1229,6 +1229,7 @@
     SUBDIR += ufs_copy
     SUBDIR += uhidd
     SUBDIR += uif2iso
+    SUBDIR += unetbootin
     SUBDIR += unieject
     SUBDIR += uniutils
     SUBDIR += unquote

Added: head/sysutils/unetbootin/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sysutils/unetbootin/Makefile	Fri Sep  1 18:23:06 2017	(r449094)
@@ -0,0 +1,46 @@
+# Created by: Alexey Dokuchaev <danfe at FreeBSD.org>
+# $FreeBSD$
+
+PORTNAME=	unetbootin
+PORTVERSION=	655
+CATEGORIES=	sysutils
+MASTER_SITES=	SF/${PORTNAME}/UNetbootin/${PORTVERSION}
+DISTNAME=	${PORTNAME}-source-${PORTVERSION}
+
+MAINTAINER=	danfe at FreeBSD.org
+COMMENT=	Bootable Live USB creator for various Linux distributions
+
+LICENSE=	GPLv2+
+
+RUN_DEPENDS=	7z:archivers/p7zip \
+		syslinux:sysutils/syslinux \
+		mke2fs:sysutils/e2fsprogs
+
+NO_WRKSUBDIR=	yes
+
+USE_QT4=	moc_build qmake_build linguisttools_build uic_build \
+		corelib gui network
+QMAKE_ARGS=	DEFINES+=LOCALBASE=\\\\\\\"${LOCALBASE}\\\\\\\"
+
+post-patch:
+	@${REINPLACE_CMD} -e 's,/usr/share,${PREFIX}/share,g' \
+		${WRKSRC}/main.cpp
+
+do-configure:
+	${LUPDATE} ${WRKSRC}/unetbootin.pro
+	${LRELEASE} ${WRKSRC}/unetbootin.pro
+	cd ${WRKSRC} && ${QMAKE_ENV} ${QMAKE} ${QMAKE_ARGS}
+
+do-install:
+	${INSTALL_PROGRAM} ${WRKSRC}/unetbootin ${STAGEDIR}${PREFIX}/bin
+	${INSTALL_DATA} ${WRKSRC}/unetbootin.xpm \
+		${STAGEDIR}${PREFIX}/share/pixmaps
+	@${MKDIR} ${STAGEDIR}${DATADIR}
+	${INSTALL_DATA} ${WRKSRC}/unetbootin_*.qm ${STAGEDIR}${DATADIR}
+.for n in 16 22 24 32 48 64 128 192 256 512
+	@${MKDIR} ${STAGEDIR}${PREFIX}/share/icons/hicolor/${n}x${n}/apps
+	${INSTALL_DATA} ${WRKSRC}/unetbootin_${n}.png \
+		${STAGEDIR}${PREFIX}/share/icons/hicolor/${n}x${n}/apps/unetbootin.png
+.endfor
+
+.include <bsd.port.mk>

Added: head/sysutils/unetbootin/distinfo
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sysutils/unetbootin/distinfo	Fri Sep  1 18:23:06 2017	(r449094)
@@ -0,0 +1,3 @@
+TIMESTAMP = 1500449397
+SHA256 (unetbootin-source-655.tar.gz) = 700125b0ea45805a22f729986c59377b1ff0c0a66ea6f01b29cd3cf60bfbaa79
+SIZE (unetbootin-source-655.tar.gz) = 749246

Added: head/sysutils/unetbootin/files/patch-main.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sysutils/unetbootin/files/patch-main.cpp	Fri Sep  1 18:23:06 2017	(r449094)
@@ -0,0 +1,32 @@
+--- main.cpp.orig	2017-04-21 04:57:18 UTC
++++ main.cpp
+@@ -292,9 +292,9 @@ int main(int argc, char **argv)
+ 			}
+             argsconc += "\"rootcheck=no\"";
+             argsconcSingleQuote += "'rootcheck=no'";
+-#ifdef Q_OS_LINUX
++#ifdef Q_OS_UNIX
+             QString gksuarg1;
+-            gksuarg1 += QString("bash -c 'QT_X11_NO_MITSHM=1 ");
++            gksuarg1 += QString("sh -c 'QT_X11_NO_MITSHM=1 ");
+             gksuarg1 += QString("%1 %2").arg(app.applicationFilePath()).arg(argsconc);
+             gksuarg1 += QString("'");
+             QStringList gksuargs;
+@@ -370,7 +370,7 @@ int main(int argc, char **argv)
+ 	#ifdef Q_OS_WIN32
+ 	QSettings chkinst("HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\UNetbootin", QSettings::NativeFormat);
+ 	#endif
+-	#ifdef Q_OS_LINUX
++	#ifdef Q_OS_UNIX
+ 	QSettings chkinst(QSettings::SystemScope, "UNetbootin");
+ 	#endif
+ #ifndef Q_OS_MAC
+@@ -405,7 +405,7 @@ int main(int argc, char **argv)
+ 	icon.addFile(":/unetbootin_24.png", QSize(24,24));
+ 	icon.addFile(":/unetbootin_32.png", QSize(32,32));
+ 	icon.addFile(":/unetbootin_48.png", QSize(48,48));
+-#ifdef Q_OS_LINUX
++#ifdef Q_OS_UNIX
+ 	icon.addFile("/usr/share/pixmaps/unetbootin.png");
+ 	icon.addFile("/usr/share/pixmaps/unetbootin.xpm");
+ #endif

Added: head/sysutils/unetbootin/files/patch-unetbootin.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sysutils/unetbootin/files/patch-unetbootin.cpp	Fri Sep  1 18:23:06 2017	(r449094)
@@ -0,0 +1,229 @@
+--- unetbootin.cpp.orig	2017-07-14 08:54:12 UTC
++++ unetbootin.cpp
+@@ -301,8 +301,13 @@ bool unetbootin::ubninitialize(QList<QPair<QString, QS
+ 	#endif
+ 	sevzcommand = locatecommand("7z", tr("either"), "p7zip-full");
+ #endif // Q_OS_LINUX
++#ifdef Q_OS_FREEBSD
++	syslinuxcommand = locatecommand("syslinux", tr("FAT32-formatted USB drive"), "syslinux");
++	sevzcommand = locatecommand("7z", tr("either"), "p7zip");
++	mke2fscommand = locatecommand("mke2fs", tr("LiveUSB persistence"), "e2fsprogs");
++#endif // Q_OS_FREEBSD
+ 	ubntmpf = QDir::toNativeSeparators(QString("%1/").arg(QDir::tempPath()));
+-    #ifdef Q_OS_LINUX
++    #ifdef Q_OS_UNIX
+     if (ubntmpf.isEmpty() || ubntmpf == "/")
+     {
+         ubntmpf = "/tmp/";
+@@ -649,6 +654,57 @@ QStringList unetbootin::listsanedrives()
+ 				}
+ 				*/
+ 		#endif
++#ifdef Q_OS_FREEBSD
++		struct xvfsconf fsconf;
++		struct statfs *fslist;
++
++		/*
++		 * Find out VFS number assigned by kernel for MSDOSFS,
++		 * because it's faster to compare numbers than strings.
++		 * This also helps to ensure that it is configured in
++		 * the kernel.
++		 */
++		if (getvfsbyname("msdosfs", &fsconf) == -1)
++			goto out;
++
++		/*
++		 * Quick sanity check of the number of active mountpoints
++		 * using the filesystem (we need mounted storage to work).
++		 */
++		if (fsconf.vfc_refcount < 1)
++			goto out;
++
++		int numfs = getmntinfo(&fslist, MNT_NOWAIT);
++		if (numfs < 1)
++			goto out;
++
++		QRegExp pendrives_sdcards("^/dev/(da|mmcsd)\\d+");
++
++		for (int i = 0; i < numfs; ++i)
++		{
++			/*
++			 * We're interested in MSDOSFS (FAT) filesystems
++			 * that are mounted off removable storage (e.g.,
++			 * USB memsticks, SD cards).  Assume that device
++			 * names for those are /dev/da* and /dev/mmcsd*.
++			 * (Perhaps not entirely accurate assumption.)
++			 */
++			if ((int)fslist[i].f_type == fsconf.vfc_typenum &&
++				QString(fslist[i].f_mntfromname)
++				.contains(pendrives_sdcards))
++			{
++				/*
++				 * Unlike other implementations above, we
++				 * append tuples of device name *and* the
++				 * mount point, so we do not have to find
++				 * mount point separately later.
++				 */
++				fulldrivelist.append(QString("%1:%2")
++					.arg(fslist[i].f_mntfromname)
++					.arg(fslist[i].f_mntonname));
++			}
++		}
++#endif
+ #ifdef Q_OS_MAC
+ QString systemprofilertext = callexternapp("system_profiler", "SPStorageDataType");
+ QRegExp filesystemregex("File System: (.+)\\n");
+@@ -669,6 +725,7 @@ for (int i = 0; i < filesystemlist.size(); ++i)
+ }
+ #endif
+ 	}
++out:
+ 	return fulldrivelist;
+ }
+ 
+@@ -3412,21 +3469,36 @@ void unetbootin::instIndvfl(QString srcfName, QString 
+ 				srcF.setFileName(QFile::exists("/usr/share/syslinux/memdisk") ? "/usr/share/syslinux/memdisk" : "/usr/lib/syslinux/memdisk");
+ 	else if (srcfName == "menu.c32")
+ 	{
++#ifdef Q_OS_LINUX
+ 				srcF.setFileName(QFile::exists("/usr/share/syslinux/menu.c32") ? "/usr/share/syslinux/menu.c32" : "/usr/lib/syslinux/menu.c32");
+ 				if (QFile::exists("/usr/lib/syslinux/modules/bios/menu.c32"))
+ 					srcF.setFileName("/usr/lib/syslinux/modules/bios/menu.c32");
++#endif
++#ifdef Q_OS_FREEBSD
++		srcF.setFileName(LOCALBASE "/share/syslinux/bios/com32/menu/menu.c32");
++#endif
+ 	}
+     else if (srcfName == "libutil.c32")
+ 	{
++#ifdef Q_OS_LINUX
+                 srcF.setFileName(QFile::exists("/usr/share/syslinux/libutil.c32") ? "/usr/share/syslinux/libutil.c32" : "/usr/lib/syslinux/libutil.c32");
+ 		if (QFile::exists("/usr/lib/syslinux/modules/bios/libutil.c32"))
+ 			srcF.setFileName("/usr/lib/syslinux/modules/bios/libutil.c32");
++#endif
++#ifdef Q_OS_FREEBSD
++		srcF.setFileName(LOCALBASE "/share/syslinux/bios/com32/libutil/libutil.c32");
++#endif
+ 	}
+     else if (srcfName == "libcom32.c32")
+ 	{
++#ifdef Q_OS_LINUX
+                 srcF.setFileName(QFile::exists("/usr/share/syslinux/libcom32.c32") ? "/usr/share/syslinux/libcom32.c32" : "/usr/lib/syslinux/libcom32.c32");
+ 		if (QFile::exists("/usr/lib/syslinux/modules/bios/libcom32.c32"))
+ 			srcF.setFileName("/usr/lib/syslinux/modules/bios/libcom32.c32");
++#endif
++#ifdef Q_OS_FREEBSD
++		srcF.setFileName(LOCALBASE "/share/syslinux/bios/com32/lib/libcom32.c32");
++#endif
+ 	}
+     else if (srcfName == "mbr.bin")
+ 	{
+@@ -3516,11 +3588,19 @@ void unetbootin::runinst()
+ 	}
+ 	if (installType == tr("USB Drive"))
+ 	{
++#ifdef Q_OS_LINUX
+ 		targetDev = driveselect->currentText();
+ 		devluid = getdevluid(targetDev);
+ 		ginstallDir = "";
+ 		installDir = ginstallDir;
+ 		targetDrive = QString("%1/").arg(locatemountpoint(targetDev));
++#endif
++#ifdef Q_OS_FREEBSD
++		QStringList driveinfo = driveselect->currentText().split(":");
++		targetDev = driveinfo.at(0);
++		installDir = ginstallDir = "";
++		targetDrive = QString("%1/").arg(driveinfo.at(1));
++#endif
+ 	}
+ #ifdef Q_OS_LINUX
+ 	if (targetDev.contains(QRegExp("p\\d$")))
+@@ -3528,7 +3608,7 @@ void unetbootin::runinst()
+ 	else
+ 		rawtargetDev = QString(targetDev).remove(QRegExp("\\d$"));
+ #endif
+-#ifdef Q_OS_MAC
++#ifdef Q_OS_UNIX
+ 	rawtargetDev = QString(targetDev).remove(QRegExp("s\\d$"));
+ #endif
+ 	#endif
+@@ -4281,21 +4361,47 @@ void unetbootin::runinstusb()
+             instIndvfl("libutil.c32", QString("%1libutil.c32").arg(targetPath));
+             instIndvfl("libcom32.c32", QString("%1libcom32.c32").arg(targetPath));
+         }
++	setuppersspace();
++#ifdef Q_OS_FREEBSD
++		/*
++		 * On FreeBSD, we only support installing on MSDOSFS (no
++		 * extlinux in the ports).  This also simplifies things
++		 * a bit, and that's what most users usually want anyway.
++		 *
++		 * Because of syslinux' stupidity, we have to remove any
++		 * existing ldlinux.c32 and ldlinux.sys files, otherwise
++		 * it will fail to install loader (even with -f switch).
++		 * Then we have to unmount the filesystem to avoid the
++		 * "Operation not permitted" error, and must enforce it
++		 * because syslinux expects a block device, and, well,
++		 * there are no "block devices" in FreeBSD.
++		 */
++		rmFile(targetPath + "ldlinux.c32");
++		rmFile(targetPath + "ldlinux.sys");
++		callexternapp("umount", targetDev);
++		callexternapp(syslinuxcommand, "-i -f " + targetDev);
++
++		if (rawtargetDev != targetDev)
++		{
++			/*
++			 * We have partition table (not operating on raw
++			 * disk), so we need to install MBR and mark our
++			 * partition as active.  Assume our targetDev is
++			 * /dev/{da,mmcsd}XsY and use the last digit as
++			 * partition index for gpart(8).
++			 */
++			QString idx = targetDev.right(1);
++			callexternapp("gpart",
++				"bootcode -b /boot/mbr " + rawtargetDev);
++			callexternapp("gpart", "set -a "
++				"active -i " + idx + " " + rawtargetDev);
++		}
++#endif
+ 	fininstall();
+ }
+ 
+-void unetbootin::killApplication()
++void unetbootin::setuppersspace()
+ {
+-	exit(0);
+-}
+-
+-void unetbootin::fininstall()
+-{
+-	#ifdef Q_OS_UNIX
+-	this->tprogress->setValue(this->tprogress->maximum()*2/3);
+-	pdesc1->setText(tr("Syncing filesystems"));
+-	callexternapp("sync", "");
+-	#endif
+ 	if (this->persistenceSpaceMB > 0)
+ 	{
+ 		pdesc1->setText(tr("Setting up persistence"));
+@@ -4334,6 +4440,20 @@ void unetbootin::fininstall()
+ 		rmFile(mke2fscommand);
+ #endif
+ 	}
++}
++
++void unetbootin::killApplication()
++{
++	exit(0);
++}
++
++void unetbootin::fininstall()
++{
++	#ifdef Q_OS_UNIX
++	this->tprogress->setValue(this->tprogress->maximum()*2/3);
++	pdesc1->setText(tr("Syncing filesystems"));
++	callexternapp("sync", "");
++	#endif
+ 	pdesc1->setText("");
+ 	progresslayer->setEnabled(false);
+ 	progresslayer->hide();

Added: head/sysutils/unetbootin/files/patch-unetbootin.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sysutils/unetbootin/files/patch-unetbootin.h	Fri Sep  1 18:23:06 2017	(r449094)
@@ -0,0 +1,21 @@
+--- unetbootin.h.orig	2017-07-14 05:31:37 UTC
++++ unetbootin.h
+@@ -35,6 +35,10 @@ This program is distributed in the hope that it will b
+ #include <sys/vfs.h>
+ #endif
+ 
++#ifdef Q_OS_FREEBSD
++#include <sys/mount.h>
++#endif
++
+ #ifdef AUTOSUPERGRUBDISK
+ #define UNETBOOTINB "Auto Super Grub Disk"
+ #define NOEXTERN
+@@ -333,6 +337,7 @@ class unetbootin : public QWidget, private Ui::unetboo
+     void logText(const QString &text);
+     void finishLogging();
+     void writeTextToFile(const QString &text, const QString &filePath);
++	void setuppersspace();
+ 	void fininstall();
+ 	void rmFile(const QString &fn);
+ 	void rmFile(QFile &fn);

Added: head/sysutils/unetbootin/pkg-descr
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sysutils/unetbootin/pkg-descr	Fri Sep  1 18:23:06 2017	(r449094)
@@ -0,0 +1,5 @@
+UNetbootin allows to create bootable Live USB drives for Ubuntu, Fedora,
+and other Linux distributions without burning a CD.  This is useful when
+supplied ISO image cannot be directly written to USB drive or SD card.
+
+WWW: http://unetbootin.sourceforge.net/

Added: head/sysutils/unetbootin/pkg-plist
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sysutils/unetbootin/pkg-plist	Fri Sep  1 18:23:06 2017	(r449094)
@@ -0,0 +1,63 @@
+bin/unetbootin
+share/icons/hicolor/16x16/apps/unetbootin.png
+share/icons/hicolor/22x22/apps/unetbootin.png
+share/icons/hicolor/24x24/apps/unetbootin.png
+share/icons/hicolor/32x32/apps/unetbootin.png
+share/icons/hicolor/48x48/apps/unetbootin.png
+share/icons/hicolor/64x64/apps/unetbootin.png
+share/icons/hicolor/128x128/apps/unetbootin.png
+share/icons/hicolor/192x192/apps/unetbootin.png
+share/icons/hicolor/256x256/apps/unetbootin.png
+share/icons/hicolor/512x512/apps/unetbootin.png
+share/pixmaps/unetbootin.xpm
+%%DATADIR%%/unetbootin_am.qm
+%%DATADIR%%/unetbootin_ar.qm
+%%DATADIR%%/unetbootin_ast.qm
+%%DATADIR%%/unetbootin_be.qm
+%%DATADIR%%/unetbootin_bg.qm
+%%DATADIR%%/unetbootin_bn.qm
+%%DATADIR%%/unetbootin_ca.qm
+%%DATADIR%%/unetbootin_cs.qm
+%%DATADIR%%/unetbootin_da.qm
+%%DATADIR%%/unetbootin_de.qm
+%%DATADIR%%/unetbootin_el.qm
+%%DATADIR%%/unetbootin_eo.qm
+%%DATADIR%%/unetbootin_es.qm
+%%DATADIR%%/unetbootin_et.qm
+%%DATADIR%%/unetbootin_eu.qm
+%%DATADIR%%/unetbootin_fa.qm
+%%DATADIR%%/unetbootin_fi.qm
+%%DATADIR%%/unetbootin_fo.qm
+%%DATADIR%%/unetbootin_fr.qm
+%%DATADIR%%/unetbootin_gl.qm
+%%DATADIR%%/unetbootin_he.qm
+%%DATADIR%%/unetbootin_hr.qm
+%%DATADIR%%/unetbootin_hu.qm
+%%DATADIR%%/unetbootin_id.qm
+%%DATADIR%%/unetbootin_it.qm
+%%DATADIR%%/unetbootin_ja.qm
+%%DATADIR%%/unetbootin_lt.qm
+%%DATADIR%%/unetbootin_lv.qm
+%%DATADIR%%/unetbootin_ml.qm
+%%DATADIR%%/unetbootin_ms.qm
+%%DATADIR%%/unetbootin_nan.qm
+%%DATADIR%%/unetbootin_nb.qm
+%%DATADIR%%/unetbootin_nl.qm
+%%DATADIR%%/unetbootin_nn.qm
+%%DATADIR%%/unetbootin_pl.qm
+%%DATADIR%%/unetbootin_pt.qm
+%%DATADIR%%/unetbootin_pt_BR.qm
+%%DATADIR%%/unetbootin_ro.qm
+%%DATADIR%%/unetbootin_ru.qm
+%%DATADIR%%/unetbootin_si.qm
+%%DATADIR%%/unetbootin_sk.qm
+%%DATADIR%%/unetbootin_sl.qm
+%%DATADIR%%/unetbootin_sr.qm
+%%DATADIR%%/unetbootin_sv.qm
+%%DATADIR%%/unetbootin_sw.qm
+%%DATADIR%%/unetbootin_tr.qm
+%%DATADIR%%/unetbootin_uk.qm
+%%DATADIR%%/unetbootin_ur.qm
+%%DATADIR%%/unetbootin_vi.qm
+%%DATADIR%%/unetbootin_zh_CN.qm
+%%DATADIR%%/unetbootin_zh_TW.qm


More information about the svn-ports-head mailing list