From 36d6ed03552f912ad82c36dc37036766c5da93c8 Mon Sep 17 00:00:00 2001 From: "Ruan K. F" Date: Tue, 13 Jan 2015 06:59:44 +0700 Subject: [PATCH] system/winusb: Added (USB Stick Windows Installer Creator). Signed-off-by: Willy Sudiarto Raharjo --- system/winusb/README | 9 ++ .../winusb/com.slackware.pkexec.winusb.policy | 20 ++++ system/winusb/doinst.sh | 3 + system/winusb/slack-desc | 23 ++++ system/winusb/winusb-1.0.11-nogksudo1.patch | 20 ++++ system/winusb/winusb.SlackBuild | 112 ++++++++++++++++++ system/winusb/winusb.info | 10 ++ system/winusb/winusbgui_polkit | 6 + 8 files changed, 203 insertions(+) create mode 100644 system/winusb/README create mode 100644 system/winusb/com.slackware.pkexec.winusb.policy create mode 100644 system/winusb/doinst.sh create mode 100644 system/winusb/slack-desc create mode 100644 system/winusb/winusb-1.0.11-nogksudo1.patch create mode 100644 system/winusb/winusb.SlackBuild create mode 100644 system/winusb/winusb.info create mode 100644 system/winusb/winusbgui_polkit diff --git a/system/winusb/README b/system/winusb/README new file mode 100644 index 0000000000..d43ae00417 --- /dev/null +++ b/system/winusb/README @@ -0,0 +1,9 @@ +WinUSB is a simple tool that enable you to create your own usb stick windows installer from an iso image or a real DVD. + +This package contains two programs: +- WinUSB-gui: a graphical interface which is very easy to use. +- winusb: the command line tool. + +Supported images: Windows Vista, Seven, 8 installer for any language and any version (home, pro...) and Windows PE. + +NOTE: this application requires a grub from official slackware packages. diff --git a/system/winusb/com.slackware.pkexec.winusb.policy b/system/winusb/com.slackware.pkexec.winusb.policy new file mode 100644 index 0000000000..dc8f349813 --- /dev/null +++ b/system/winusb/com.slackware.pkexec.winusb.policy @@ -0,0 +1,20 @@ + + + + + + Run WinUSB + Authentication is required to run WinUSB + winusbgui-icon + + auth_admin + auth_admin + auth_admin + + /usr/bin/winusbgui + true + + + diff --git a/system/winusb/doinst.sh b/system/winusb/doinst.sh new file mode 100644 index 0000000000..5fb28930db --- /dev/null +++ b/system/winusb/doinst.sh @@ -0,0 +1,3 @@ +if [ -x /usr/bin/update-desktop-database ]; then + /usr/bin/update-desktop-database -q usr/share/applications >/dev/null 2>&1 +fi diff --git a/system/winusb/slack-desc b/system/winusb/slack-desc new file mode 100644 index 0000000000..2c69554cfd --- /dev/null +++ b/system/winusb/slack-desc @@ -0,0 +1,23 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. +# Line up the first '|' above the ':' following the base package name, and +# the '|' on the right side marks the last column you can put a character in. +# You must make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':' except on otherwise blank lines. + + |-----handy-ruler------------------------------------------------------| +winusb: WinUSB (make a bootable windows install usb) +winusb: +winusb: WinUSB is a simple tool that enable you to create your own usb stick +winusb: windows installer from an iso image or a real DVD. +winusb: +winusb: This package contains two programs: +winusb: - WinUSB-gui: a graphical interface which is very easy to use. +winusb: - winusb: the command line tool. +winusb: +winusb: Supported images: Windows Vista, Seven, 8. +winusb: +winusb: Homepage: http://en.congelli.eu/prog_info_winusb.html +winusb: +winusb: +winusb: diff --git a/system/winusb/winusb-1.0.11-nogksudo1.patch b/system/winusb/winusb-1.0.11-nogksudo1.patch new file mode 100644 index 0000000000..e2b85c96aa --- /dev/null +++ b/system/winusb/winusb-1.0.11-nogksudo1.patch @@ -0,0 +1,20 @@ +--- src/MainPanel.cpp 2013-03-27 18:57:44.000000000 -0300 ++++ winusb-1.0.11-nogksudo1.cpp 2015-01-12 17:01:26.274398856 -0200 +@@ -240,8 +240,15 @@ + iso = m_dvdDriveDevList.at(m_dvdDriveList->GetSelection()); + } + +- PipeManager pipe(std::string("gksudo --description 'WinUSB' -- sh -c 'winusb --noColor --forGui --format \"") + iso + "\" \"" + device + "\" 2>&1'"); +- ++ //PipeManager pipe(std::string("gksudo --description 'WinUSB' -- sh -c 'winusb --noColor --forGui --format \"") + iso + "\" \"" + device + "\" 2>&1'"); ++ ++ if(getuid() != 0) { ++ wxMessageBox(_("WinUSB must be run by the root user !"), _("Error"), wxOK | wxICON_ERROR, this); ++ return; ++ } ++ ++ PipeManager pipe(std::string("winusb --noColor --forGui --format \"") + iso + "\" \"" + device + "\" 2>&1"); ++ + wxProgressDialog *dialog = new wxProgressDialog(_("Installing..."), _("Please wait..."), 100, GetParent(), wxPD_APP_MODAL | wxPD_SMOOTH | wxPD_CAN_ABORT); + + wxString log; diff --git a/system/winusb/winusb.SlackBuild b/system/winusb/winusb.SlackBuild new file mode 100644 index 0000000000..458576d261 --- /dev/null +++ b/system/winusb/winusb.SlackBuild @@ -0,0 +1,112 @@ +#!/bin/sh + +# Slackware build script for winusb + +# Copyright 2015 Ruan K. F, Brazil +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +PRGNAM=winusb +VERSION=${VERSION:-1.0.11} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +DOCS="AUTHORS ChangeLog COPYING INSTALL README" + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i486 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; + esac +fi + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i486" ]; then + SLKCFLAGS="-O2 -march=i486 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +else + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +fi + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $PRGNAM-$VERSION +tar -zxvf $CWD/$PRGNAM-$VERSION.tar.gz +cd $PRGNAM-$VERSION +chown -R root:root . +find -L . \ + \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ + -o -perm 511 \) -exec chmod 755 {} \; -o \ + \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ + -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; + +# patch to avoid gksudo and use pkexec from official polkit pkg +patch src/MainPanel.cpp < $CWD/winusb-1.0.11-nogksudo1.patch + +CFLAGS="$SLKCFLAGS" \ +CXXFLAGS="$SLKCFLAGS" \ +./configure \ + --prefix=/usr \ + --libdir=/usr/lib${LIBDIRSUFFIX} \ + --sysconfdir=/etc \ + --localstatedir=/var \ + --mandir=/usr/man \ + --docdir=/usr/doc/$PRGNAM-$VERSION \ + --build=$ARCH-slackware-linux + +make +make install DESTDIR=$PKG + +find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ + | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true + +find $PKG/usr/man -type f -exec gzip -9 {} \; +for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a $DOCS $PKG/usr/doc/$PRGNAM-$VERSION +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild + +# For pkexec configuration +mkdir -p $PKG/usr/share/polkit-1/actions +sed -i 's/^\(Exec\)=winusbgui$/\1=winusbgui_polkit/' $PKG/usr/share/applications/winusbgui.desktop +install -m0755 -o 0:0 $CWD/winusbgui_polkit $PKG/usr/bin +install -m0644 -o 0:0 $CWD/com.slackware.pkexec.winusb.policy $PKG/usr/share/polkit-1/actions + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc +cat $CWD/doinst.sh > $PKG/install/doinst.sh + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} diff --git a/system/winusb/winusb.info b/system/winusb/winusb.info new file mode 100644 index 0000000000..cde55f2f06 --- /dev/null +++ b/system/winusb/winusb.info @@ -0,0 +1,10 @@ +PRGNAM="winusb" +VERSION="1.0.11" +HOMEPAGE="http://en.congelli.eu/prog_info_winusb.html" +DOWNLOAD="http://ftp.cc.uoc.gr/mirrors/linux/frugalware/frugalware-current/source/xapps-extra/winusb/winusb-1.0.11.tar.gz" +MD5SUM="08a5de928f510d383b7bca0a31adb2d6" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="wxPython" +MAINTAINER="Ruan K. F" +EMAIL="ruan.klein@gmail.com" diff --git a/system/winusb/winusbgui_polkit b/system/winusb/winusbgui_polkit new file mode 100644 index 0000000000..3474d9c9fd --- /dev/null +++ b/system/winusb/winusbgui_polkit @@ -0,0 +1,6 @@ +#!/bin/sh +if (which pkexec >/dev/null 2>&1); then + pkexec --disable-internal-agent /usr/bin/winusbgui "$@" +else + /usr/bin/winusbgui "$@" +fi