mirror of
https://github.com/arcan1s/netctl-gui.git
synced 2025-04-24 23:47:21 +00:00
added pkgbuilds for different builds
This commit is contained in:
parent
4bb5d4925d
commit
2cf91930f8
39
PKGBUILD-qt4
Normal file
39
PKGBUILD-qt4
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
# Maintainer: Evgeniy "arcanis" Alexeev <arcanis.arch at gmail dot com>
|
||||||
|
|
||||||
|
pkgname=netctl-gui-qt4
|
||||||
|
_pkgname=netctl-gui
|
||||||
|
pkgver=1.0.4
|
||||||
|
pkgrel=1
|
||||||
|
pkgdesc="Qt4 graphical front-end for netctl. A part of netctl-gui"
|
||||||
|
arch=('i686' 'x86_64')
|
||||||
|
url="http://arcanis.name/projects/netctl-gui"
|
||||||
|
license=('GPLv3')
|
||||||
|
depends=('netctl' 'qt4')
|
||||||
|
makedepends=('automoc4' 'cmake' 'desktop-file-utils' 'xdg-utils')
|
||||||
|
optdepends=('kdebase-runtime: sudo support'
|
||||||
|
'kdeplasma-applets-netctl-gui: KDE widget'
|
||||||
|
'sudo: sudo support'
|
||||||
|
'wpa_supplicant: wifi support')
|
||||||
|
provides=('netctl-gui')
|
||||||
|
conflicts=('netctl-gui')
|
||||||
|
source=("https://github.com/arcan1s/netctl-gui/releases/download/V.${pkgver}/${_pkgname}-${pkgver}-src.tar.xz")
|
||||||
|
install="${_pkgname}.install"
|
||||||
|
md5sums=('04ec09228a54fa4fe9e13a7a8e325bcb')
|
||||||
|
|
||||||
|
_cmakekeys="-DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DUSE_QT5:BOOL=0 -DBUILD_DATAENGINE:BOOL=0 -DBUILD_PLASMOID:BOOL=0"
|
||||||
|
|
||||||
|
prepare() {
|
||||||
|
rm -rf "${srcdir}/build"
|
||||||
|
mkdir "${srcdir}/build"
|
||||||
|
}
|
||||||
|
|
||||||
|
build() {
|
||||||
|
cd "${srcdir}/build"
|
||||||
|
cmake ${_cmakekeys} "../${_pkgname}"
|
||||||
|
make
|
||||||
|
}
|
||||||
|
|
||||||
|
package() {
|
||||||
|
cd "${srcdir}/build"
|
||||||
|
make DESTDIR="${pkgdir}" install
|
||||||
|
}
|
@ -1,35 +1,23 @@
|
|||||||
# Maintainer: Evgeniy "arcanis" Alexeev <arcanis.arch at gmail dot com>
|
# Maintainer: Evgeniy "arcanis" Alexeev <arcanis.arch at gmail dot com>
|
||||||
|
|
||||||
# comment out needed line if you dont need this component
|
|
||||||
#_use_qt5=0
|
|
||||||
#_build_gui=0
|
|
||||||
#_build_plasmoid=0
|
|
||||||
|
|
||||||
pkgname=netctl-gui
|
pkgname=netctl-gui
|
||||||
pkgver=1.0.4
|
pkgver=1.0.4
|
||||||
pkgrel=3
|
pkgrel=4
|
||||||
pkgdesc="Qt4/Qt5 GUI for netctl. Provides a plasmoid for KDE4"
|
pkgdesc="Qt5 graphical front-end for netctl. A part of netctl-gui"
|
||||||
arch=('i686' 'x86_64')
|
arch=('i686' 'x86_64')
|
||||||
url="http://arcanis.name/projects/netctl-gui"
|
url="http://arcanis.name/projects/netctl-gui"
|
||||||
license=('GPLv3')
|
license=('GPLv3')
|
||||||
depends=('netctl' 'qt5-base')
|
depends=('netctl' 'qt5-base')
|
||||||
makedepends=('automoc4' 'cmake' 'qt5-tools')
|
makedepends=('automoc4' 'cmake' 'qt5-tools')
|
||||||
optdepends=('kdebase-runtime: sudo support'
|
optdepends=('kdebase-runtime: sudo support'
|
||||||
|
'kdeplasma-applets-netctl-gui: KDE widget'
|
||||||
'sudo: sudo support'
|
'sudo: sudo support'
|
||||||
'wpa_supplicant: wifi support')
|
'wpa_supplicant: wifi support')
|
||||||
source=("https://github.com/arcan1s/netctl-gui/releases/download/V.${pkgver}/${pkgname}-${pkgver}-src.tar.xz")
|
source=("https://github.com/arcan1s/netctl-gui/releases/download/V.${pkgver}/${pkgname}-${pkgver}-src.tar.xz")
|
||||||
install="${pkgname}.install"
|
install="${pkgname}.install"
|
||||||
md5sums=('110dc309d0b35df8a9801ac3f4ffd931')
|
md5sums=('04ec09228a54fa4fe9e13a7a8e325bcb')
|
||||||
|
|
||||||
# flags
|
_cmakekeys="-DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DBUILD_DATAENGINE:BOOL=0 -DBUILD_PLASMOID:BOOL=0"
|
||||||
_cmakekeys="-DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release"
|
|
||||||
if [[ ${_use_qt5} == 0 ]]; then
|
|
||||||
_cmakekeys=${_cmakekeys}" -DUSE_QT5:BOOL=0"
|
|
||||||
depends=('netctl' 'qt4')
|
|
||||||
makedepends=('automoc4' 'cmake' 'desktop-file-utils' 'xdg-utils')
|
|
||||||
fi
|
|
||||||
[[ ${_build_gui} == 0 ]] && _cmakekeys=${_cmakekeys}" -DBUILD_GUI:BOOL=0"
|
|
||||||
[[ ${_build_plasmoid} == 0 ]] && _cmakekeys=${_cmakekeys}" -DBUILD_DATAENGINE:BOOL=0 -DBUILD_PLASMOID:BOOL=0" || depends+=('kdebase-workspace')
|
|
||||||
|
|
||||||
prepare() {
|
prepare() {
|
||||||
rm -rf "${srcdir}/build"
|
rm -rf "${srcdir}/build"
|
36
PKGBUILD-widget
Normal file
36
PKGBUILD-widget
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
# Maintainer: Evgeniy "arcanis" Alexeev <arcanis.arch at gmail dot com>
|
||||||
|
|
||||||
|
pkgname=kdeplasma-applets-netctl-gui
|
||||||
|
_pkgname=netctl-gui
|
||||||
|
pkgver=1.0.4
|
||||||
|
pkgrel=1
|
||||||
|
pkgdesc="A plasmoid for KDE4 whih interacts with netctl. A part of netctl-gui"
|
||||||
|
arch=('i686' 'x86_64')
|
||||||
|
url="http://arcanis.name/projects/netctl-gui"
|
||||||
|
license=('GPLv3')
|
||||||
|
depends=('netctl' 'kdebase-workspace')
|
||||||
|
makedepends=('automoc4' 'cmake')
|
||||||
|
optdepends=('kdebase-runtime: sudo support'
|
||||||
|
'netctl-gui: graphical front-end'
|
||||||
|
'sudo: sudo support')
|
||||||
|
source=("https://github.com/arcan1s/netctl-gui/releases/download/V.${pkgver}/${_pkgname}-${pkgver}-src.tar.xz")
|
||||||
|
install="${_pkgname}.install"
|
||||||
|
md5sums=('04ec09228a54fa4fe9e13a7a8e325bcb')
|
||||||
|
|
||||||
|
_cmakekeys="-DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DBUILD_GUI:BOOL=0"
|
||||||
|
|
||||||
|
prepare() {
|
||||||
|
rm -rf "${srcdir}/build"
|
||||||
|
mkdir "${srcdir}/build"
|
||||||
|
}
|
||||||
|
|
||||||
|
build() {
|
||||||
|
cd "${srcdir}/build"
|
||||||
|
cmake ${_cmakekeys} "../${_pkgname}"
|
||||||
|
make
|
||||||
|
}
|
||||||
|
|
||||||
|
package() {
|
||||||
|
cd "${srcdir}/build"
|
||||||
|
make DESTDIR="${pkgdir}" install
|
||||||
|
}
|
@ -17,5 +17,9 @@ tar cJf "${ARCHIVE}-${VERSION}-src.tar.xz" "${ARCHIVE}"
|
|||||||
rm -rf "${ARCHIVE}"
|
rm -rf "${ARCHIVE}"
|
||||||
# update md5sum
|
# update md5sum
|
||||||
MD5SUMS=$(md5sum ${ARCHIVE}-${VERSION}-src.tar.xz | awk '{print $1}')
|
MD5SUMS=$(md5sum ${ARCHIVE}-${VERSION}-src.tar.xz | awk '{print $1}')
|
||||||
sed -i "/md5sums=('[0-9A-Fa-f]*/s/[^'][^)]*/md5sums=('${MD5SUMS}'/" PKGBUILD
|
sed -i "/md5sums=('[0-9A-Fa-f]*/s/[^'][^)]*/md5sums=('${MD5SUMS}'/" PKGBUILD-qt4
|
||||||
sed -i "s/pkgver=[0-9.]*/pkgver=${VERSION}/" PKGBUILD
|
sed -i "s/pkgver=[0-9.]*/pkgver=${VERSION}/" PKGBUILD-qt4
|
||||||
|
sed -i "/md5sums=('[0-9A-Fa-f]*/s/[^'][^)]*/md5sums=('${MD5SUMS}'/" PKGBUILD-qt5
|
||||||
|
sed -i "s/pkgver=[0-9.]*/pkgver=${VERSION}/" PKGBUILD-qt5
|
||||||
|
sed -i "/md5sums=('[0-9A-Fa-f]*/s/[^'][^)]*/md5sums=('${MD5SUMS}'/" PKGBUILD-widget
|
||||||
|
sed -i "s/pkgver=[0-9.]*/pkgver=${VERSION}/" PKGBUILD-widget
|
||||||
|
@ -18,6 +18,8 @@
|
|||||||
#include "netctl.h"
|
#include "netctl.h"
|
||||||
|
|
||||||
#include <Plasma/DataContainer>
|
#include <Plasma/DataContainer>
|
||||||
|
#include <KDE/KGlobal>
|
||||||
|
#include <KDE/KStandardDirs>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
@ -49,40 +51,60 @@ QStringList Netctl::sources() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Netctl::readConfiguration()
|
void Netctl::readConfiguration()
|
||||||
{
|
{
|
||||||
// default configuration
|
// default configuration
|
||||||
configuration[QString("CMD")] = QString("/usr/bin/netctl");
|
QMap<QString, QString> rawConfig;
|
||||||
configuration[QString("EXTIP")] = QString("false");
|
rawConfig[QString("CMD")] = QString("/usr/bin/netctl");
|
||||||
configuration[QString("EXTIPCMD")] = QString("wget -qO- http://ifconfig.me/ip");
|
rawConfig[QString("EXTIP")] = QString("false");
|
||||||
configuration[QString("IPCMD")] = QString("/usr/bin/ip");
|
rawConfig[QString("EXTIPCMD")] = QString("wget -qO- http://ifconfig.me/ip");
|
||||||
configuration[QString("NETDIR")] = QString("/sys/class/net/");
|
rawConfig[QString("IPCMD")] = QString("/usr/bin/ip");
|
||||||
|
rawConfig[QString("NETDIR")] = QString("/sys/class/net/");
|
||||||
|
|
||||||
QString fileStr;
|
QString fileName = KGlobal::dirs()->findResource("config", "netctl.conf");
|
||||||
// FIXME: define configuration file
|
QFile confFile(fileName);
|
||||||
QFile confFile(QString(getenv("HOME")) + QString("/.kde4/share/config/netctl.conf"));
|
bool ok = confFile.open(QIODevice::ReadOnly);
|
||||||
bool exists = confFile.open(QIODevice::ReadOnly);
|
if (!ok) {
|
||||||
if (!exists) {
|
configuration = updateConfiguration(rawConfig);
|
||||||
confFile.setFileName("/usr/share/config/netctl.conf");
|
return;
|
||||||
exists = confFile.open(QIODevice::ReadOnly);
|
|
||||||
if (!exists)
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
QString fileStr;
|
||||||
|
QStringList value;
|
||||||
while (true) {
|
while (true) {
|
||||||
fileStr = QString(confFile.readLine());
|
fileStr = QString(confFile.readLine()).trimmed();
|
||||||
if (fileStr[0] != '#') {
|
if (fileStr[0] == QChar('#')) continue;
|
||||||
if (fileStr.contains(QString("=")))
|
if (fileStr[0] == QChar(';')) continue;
|
||||||
configuration[fileStr.split(QString("="))[0]] = fileStr.split(QString("="))[1]
|
if (fileStr.contains(QChar('='))) {
|
||||||
.remove(QString(" "))
|
value.clear();
|
||||||
.trimmed();
|
for (int i=1; i<fileStr.split(QChar('=')).count(); i++)
|
||||||
|
value.append(fileStr.split(QChar('='))[i]);
|
||||||
|
rawConfig[fileStr.split(QChar('='))[0]] = value.join(QChar('='));
|
||||||
}
|
}
|
||||||
if (confFile.atEnd())
|
if (confFile.atEnd())
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
confFile.close();
|
confFile.close();
|
||||||
return true;
|
configuration = updateConfiguration(rawConfig);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QMap<QString, QString> Netctl::updateConfiguration(const QMap<QString, QString> rawConfig)
|
||||||
|
{
|
||||||
|
QMap<QString, QString> config;
|
||||||
|
QString key, value;
|
||||||
|
// remove spaces and copy source map
|
||||||
|
for (int i=0; i<rawConfig.keys().count(); i++) {
|
||||||
|
key = rawConfig.keys()[i];
|
||||||
|
value = rawConfig[key];
|
||||||
|
key.remove(QChar(' '));
|
||||||
|
if ((key != QString("CMD")) &&
|
||||||
|
(key != QString("EXTIPCMD")) &&
|
||||||
|
(key != QString("IPCMD")))
|
||||||
|
value.remove(QChar(' '));
|
||||||
|
config[key] = value;
|
||||||
|
}
|
||||||
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -29,7 +29,6 @@ public:
|
|||||||
Netctl(QObject *parent, const QVariantList &args);
|
Netctl(QObject *parent, const QVariantList &args);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool readConfiguration();
|
|
||||||
bool sourceRequestEvent(const QString &name);
|
bool sourceRequestEvent(const QString &name);
|
||||||
bool updateSourceEvent(const QString &source);
|
bool updateSourceEvent(const QString &source);
|
||||||
QStringList sources() const;
|
QStringList sources() const;
|
||||||
@ -37,6 +36,8 @@ protected:
|
|||||||
private:
|
private:
|
||||||
// configuration
|
// configuration
|
||||||
QMap<QString, QString> configuration;
|
QMap<QString, QString> configuration;
|
||||||
|
void readConfiguration();
|
||||||
|
QMap<QString, QString> updateConfiguration(const QMap<QString, QString> rawConfig);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ Name=Netctl
|
|||||||
Comment=Data engine for netctl
|
Comment=Data engine for netctl
|
||||||
ServiceTypes=Plasma/DataEngine
|
ServiceTypes=Plasma/DataEngine
|
||||||
Type=Service
|
Type=Service
|
||||||
Icon=netctl-gui
|
Icon=netctl-gui-widget
|
||||||
|
|
||||||
X-KDE-ServiceTypes=Plasma/DataEngine
|
X-KDE-ServiceTypes=Plasma/DataEngine
|
||||||
X-KDE-Library=plasma_engine_netctl
|
X-KDE-Library=plasma_engine_netctl
|
||||||
|
@ -2,6 +2,11 @@
|
|||||||
set (SUBPROJECT netctl-gui-icons)
|
set (SUBPROJECT netctl-gui-icons)
|
||||||
message (STATUS "Subproject ${SUBPROJECT}")
|
message (STATUS "Subproject ${SUBPROJECT}")
|
||||||
|
|
||||||
install (FILES network-idle-64x64.png DESTINATION share/icons/hicolor/64x64/apps RENAME netctl-idle.png)
|
if (BUILD_GUI)
|
||||||
install (FILES network-offline-64x64.png DESTINATION share/icons/hicolor/64x64/apps RENAME netctl-offline.png)
|
install (FILES network-idle-128-128.png DESTINATION share/pixmaps RENAME netctl-gui.png)
|
||||||
install (FILES network-idle-128-128.png DESTINATION share/pixmaps RENAME netctl-gui.png)
|
endif ()
|
||||||
|
if (BUILD_DATAENGINE OR BUILD_PLASMOID)
|
||||||
|
install (FILES network-idle-128-128.png DESTINATION share/pixmaps RENAME netctl-gui-widget.png)
|
||||||
|
install (FILES network-idle-64x64.png DESTINATION share/icons/hicolor/64x64/apps RENAME netctl-idle.png)
|
||||||
|
install (FILES network-offline-64x64.png DESTINATION share/icons/hicolor/64x64/apps RENAME netctl-offline.png)
|
||||||
|
endif ()
|
||||||
|
@ -3,7 +3,7 @@ Encoding=UTF-8
|
|||||||
Name=Netctl
|
Name=Netctl
|
||||||
Comment=Plasmoid for netctl
|
Comment=Plasmoid for netctl
|
||||||
Type=Service
|
Type=Service
|
||||||
Icon=netctl-gui
|
Icon=netctl-gui-widget
|
||||||
|
|
||||||
X-KDE-ServiceTypes=Plasma/Applet
|
X-KDE-ServiceTypes=Plasma/Applet
|
||||||
X-KDE-Library=plasma_applet_netctl
|
X-KDE-Library=plasma_applet_netctl
|
||||||
|
Loading…
Reference in New Issue
Block a user