-rw-r--r-- | config.in | 1 | ||||
-rw-r--r-- | core/launcher/server.cpp | 2 | ||||
-rw-r--r-- | core/symlinker/Makefile | 160 | ||||
-rw-r--r-- | core/symlinker/config.in | 5 | ||||
-rw-r--r-- | core/symlinker/main.cpp | 160 | ||||
-rw-r--r-- | core/symlinker/opie-symlinker.control | 9 | ||||
-rw-r--r-- | core/symlinker/symlinker.pro | 15 | ||||
-rw-r--r-- | packages | 1 |
8 files changed, 352 insertions, 1 deletions
@@ -1,254 +1,255 @@ mainmenu "Opie Configuration" menu "Build Parameters" choice prompt "Target Machine" default TARGET_X86 help Please select the architecture of the machine you will be building the OpenZaurus buildroot for. config TARGET_X86 boolean "Intel X86" config TARGET_MACOSX boolean "Mac OS X (DARWIN)" config TARGET_SHARP boolean "Sharp Zaurus" config TARGET_IPAQ boolean "iPAQ" config TARGET_RAMSES boolean "Ramses" config TARGET_SIMPAD boolean "SIMpad" config TARGET_YOPY boolean "Yopy 3500/3700" endchoice config OPTIMIZE boolean "Use optimizations" default "y" if ! TARGET_X86 config DEBUG boolean "Enable debug builds" default n config RELEASE bool default y depends !DEBUG config QUICK_LAUNCH boolean "Enable Quick Launch" default n config QUICKLAUNCH_PATH string "Path to quicklauncher" default "./quicklauncher" if TARGET_X86 default "/opt/QtPalmtop/bin/quicklauncher" if ! TARGET_X86 config SPECFILE string default "qws/linux-generic-g++" if TARGET_X86 && (! X11) default "linux-g++" if TARGET_X86 && X11 default "qws/linux-sharp-g++" if TARGET_SHARP && (! X11) default "linux-g++" if TARGET_SHARP && X11 default "qws/linux-ipaq-g++" if TARGET_IPAQ && (! X11) default "linux-g++" if TARGET_IPAQ && X11 default "qws/linux-ramses-g++" if TARGET_RAMSES && (! X11) default "linux-g++" if TARGET_RAMSES && X11 default "qws/linux-simpad-g++" if TARGET_SIMPAD && (! X11) default "linux-g++" if TARGET_SIMPAD && X11 default "qws/linux-yopy-g++" if TARGET_YOPY && (! X11) default "qws/macx-generic-g++" if TARGET_MACOSX && (! X11) config CUSTOMFILE string default "custom-ipaq.h" if TARGET_IPAQ default "custom-sharp.h" if TARGET_SHARP default "custom-ramses.h" if TARGET_RAMSES default "custom-ipaq.h" if TARGET_SIMPAD default "custom-yopy.h" if TARGET_YOPY config OPTIMIZATIONS string "Optimization flags" depends OPTIMIZE default "-march=armv4 -mtune=strongarm1100 -mapcs-32 -fexpensive-optimizations -fomit-frame-pointer -O2" if TARGET_IPAQ default "-march=armv4 -mtune=strongarm1100 -mapcs-32 -fexpensive-optimizations -fomit-frame-pointer -O2" if TARGET_YOPY default "-march=armv4 -mtune=strongarm1100 -mapcs-32 -fexpensive-optimizations -fomit-frame-pointer -O2" if TARGET_SHARP default "-march=armv4 -mtune=strongarm1100 -mapcs-32 -fexpensive-optimizations -fomit-frame-pointer -O2" if TARGET_RAMSES default "-march=armv4 -mtune=strongarm1100 -mapcs-32 -fexpensive-optimizations -fomit-frame-pointer -O2" if TARGET_SIMPAD config EXPERIMENTAL bool "Prompt for development and/or incomplete items" default y endmenu menu "Configuration" config OPIE_NO_OVERRIDE_QT boolean "Build Opie against an unpatched version of Qt" default n config OPIE_NO_BUILTIN_SHUTDOWN boolean "Disable the built in shutdown application" default n config OPIE_NO_BUILTIN_CALIBRATE boolean "Disable the built in calibrate application" default y if TARGET_YOPY default n config OPIE_SOUND_FRAGMENT_SHIFT string "The sound fragment used in Opie Player I" default "14" if TARGET_IPAQ default "16" if (!TARGET_IPAQ) config USE_REALTIME_AUDIO_THREAD boolean "Use a realtime thread in Opie Player I" default y if TARGET_IPAQ || TARGET_SIMPAD || TARGET_RAMSES || TARGET_SHARP default n config QT_QWS_ALLOW_OVERCLOCK boolean "Allow the user to overclock the device" depends TARGET_RAMSES default n config OPIE_HIGH_RES_SMALL_PHY boolean "Resolution is bigger than physical screen" default y if TARGET_C700 default n config OPIE_NEW_ALLOC boolean "Use malloc and free for the implementation" default y if TARGET_RAMSES || TARGET_IPAQ || TARGET_SIMPAD || TARGET_SHARP default n config OPIE_NO_SOUND_PCM_READ_BITS boolean "There is not a pcm_read_bits io control" default y if TARGET_SHARP default n config OPIE_WE_VERSION string "The wireless extension (WE) version to build against" default "15" if ! TARGET_X86 default "16" if TAGET_X86 endmenu menu "Base" choice prompt "Qpe Library Selection" default LIBQPE source library/config.in source x11/config.in endchoice source libopie/config.in source core/opie-login/config.in source core/opiealarm/config.in source core/tools/quicklauncher/config.in source core/launcher/config.in source core/qws/config.in + source core/symlinker/config.in endmenu comment "" menu "Applets" source core/applets/config.in source noncore/applets/config.in endmenu menu "Apps" source core/apps/config.in source noncore/apps/config.in endmenu menu "Communications and Networking" source noncore/comm/config.in source noncore/net/config.in endmenu menu "Games" source noncore/games/config.in endmenu menu "Graphics and Multimedia" source freetype/config.in source noncore/graphics/config.in source core/multimedia/config.in source noncore/multimedia/config.in endmenu menu "Input methods" source inputmethods/config.in endmenu menu "Pim" source core/pim/config.in menu "Today Plugins" source noncore/todayplugins/config.in source core/pim/today/plugins/config.in endmenu endmenu menu "Settings" source core/settings/config.in source noncore/settings/config.in endmenu menu "Theming" source noncore/decorations/config.in source noncore/styles/config.in endmenu menu "Tools" source noncore/tools/config.in endmenu menu "Development" source development/keyview/config.in #source development/debugviewer/config.in endmenu menu "Examples" config EXAMPLES boolean "Compile Example Application" source examples/config.in endmenu comment "" menu "Unsupported / Unmaintained" source noncore/unsupported/config.in endmenu comment "" depends on EXPERIMENTAL menu "Experimental" depends on EXPERIMENTAL source libopie2/config.in source libqtaux/config.in source libslcompat/config.in config SQL_PIM_BACKEND bool "Add SQL-Backend support" default n help This adds the SQL-Support, using SQLite. Which database is used by the backends is defined by the file "pimaccess.conf" in the directory "Settings". There currently do exist to groups "[contact]" and "[todo]". You can select the used backend by the variable "usebackend=<type>", where <type> is "sql" or "xml". "xml" is the default ! Important: The SQLite-library "libsqlite.so" must be installed ! depends ( LIBOPIE2DB ) comment "SQL-Support needs libopie2db!" depends !( LIBOPIE2DB ) endmenu diff --git a/core/launcher/server.cpp b/core/launcher/server.cpp index 634082b..9a86a80 100644 --- a/core/launcher/server.cpp +++ b/core/launcher/server.cpp @@ -455,275 +455,275 @@ void Server::systemMsg(const QCString &msg, const QByteArray &data) QString mice; stream >> mice; setenv("QWS_MOUSE_PROTO",mice.latin1(),1); qwsServer->openMouse(); } else if ( msg == "setKeyboard(QString)" ) { QString kb; stream >> kb; setenv("QWS_KEYBOARD",kb.latin1(),1); qwsServer->openKeyboard(); } else if ( msg == "setKeyboardAutoRepeat(int,int)" ) { int delay, period; stream >> delay >> period; qwsSetKeyboardAutoRepeat( delay, period ); Config cfg( "qpe" ); cfg.setGroup("Keyboard"); cfg.writeEntry( "RepeatDelay", delay ); cfg.writeEntry( "RepeatPeriod", period ); } else if ( msg == "setKeyboardLayout(QString)" ) { QString kb; stream >> kb; setKeyboardLayout( kb ); Config cfg( "qpe" ); cfg.setGroup("Keyboard"); cfg.writeEntry( "Layout", kb ); } else if ( msg == "autoStart(QString)" ) { QString appName; stream >> appName; Config cfg( "autostart" ); cfg.setGroup( "AutoStart" ); if ( appName.compare("clear") == 0){ cfg.writeEntry("Apps", ""); } } else if ( msg == "autoStart(QString,QString)" ) { QString modifier, appName; stream >> modifier >> appName; Config cfg( "autostart" ); cfg.setGroup( "AutoStart" ); if ( modifier.compare("add") == 0 ){ // only add if appname is entered if (!appName.isEmpty()) { cfg.writeEntry("Apps", appName); } } else if (modifier.compare("remove") == 0 ) { // need to change for multiple entries // actually remove is right now simular to clear, but in future there // should be multiple apps in autostart possible. QString checkName; checkName = cfg.readEntry("Apps", ""); if (checkName == appName) { cfg.writeEntry("Apps", ""); } } // case the autostart feature should be delayed } else if ( msg == "autoStart(QString,QString,QString)") { QString modifier, appName, delay; stream >> modifier >> appName >> delay; Config cfg( "autostart" ); cfg.setGroup( "AutoStart" ); if ( modifier.compare("add") == 0 ){ // only add it appname is entered if (!appName.isEmpty()) { cfg.writeEntry("Apps", appName); cfg.writeEntry("Delay", delay); } } else { } } #endif } void Server::receiveTaskBar(const QCString &msg, const QByteArray &data) { QDataStream stream( data, IO_ReadOnly ); if ( msg == "reloadApps()" ) { docList->reloadAppLnks(); } else if ( msg == "soundAlarm()" ) { ServerApplication::soundAlarm(); } else if ( msg == "setLed(int,bool)" ) { int led, status; stream >> led >> status; QValueList <OLed> ll = ODevice::inst ( )-> ledList ( ); if ( ll. count ( )) { OLed l = ll. contains ( Led_Mail ) ? Led_Mail : ll [0]; bool canblink = ODevice::inst ( )-> ledStateList ( l ). contains ( Led_BlinkSlow ); ODevice::inst ( )-> setLedState ( l, status ? ( canblink ? Led_BlinkSlow : Led_On ) : Led_Off ); } } } void Server::cancelSync() { #ifndef QT_NO_COP QCopEnvelope e( "QPE/Desktop", "cancelSync()" ); #endif delete syncDialog; syncDialog = 0; } bool Server::mkdir(const QString &localPath) { QDir fullDir(localPath); if (fullDir.exists()) return true; // at this point the directory doesn't exist // go through the directory tree and start creating the direcotories // that don't exist; if we can't create the directories, return false QString dirSeps = "/"; int dirIndex = localPath.find(dirSeps); QString checkedPath; // didn't find any seps; weird, use the cur dir instead if (dirIndex == -1) { //qDebug("No seperators found in path %s", localPath.latin1()); checkedPath = QDir::currentDirPath(); } while (checkedPath != localPath) { // no more seperators found, use the local path if (dirIndex == -1) checkedPath = localPath; else { // the next directory to check checkedPath = localPath.left(dirIndex) + "/"; // advance the iterator; the next dir seperator dirIndex = localPath.find(dirSeps, dirIndex+1); } QDir checkDir(checkedPath); if (!checkDir.exists()) { //qDebug("mkdir making dir %s", checkedPath.latin1()); if (!checkDir.mkdir(checkedPath)) { qDebug("Unable to make directory %s", checkedPath.latin1()); return FALSE; } } } return TRUE; } void Server::styleChange( QStyle &s ) { QWidget::styleChange( s ); } void Server::startTransferServer() { if ( !qcopBridge ) { // start qcop bridge server qcopBridge = new QCopBridge( 4243 ); if ( qcopBridge->ok() ) { // ... OK connect( qcopBridge, SIGNAL(connectionClosed(const QHostAddress&)), this, SLOT(syncConnectionClosed(const QHostAddress&)) ); } else { delete qcopBridge; qcopBridge = 0; } } if ( !transferServer ) { // start transfer server transferServer = new TransferServer( 4242 ); if ( transferServer->ok() ) { // ... OK } else { delete transferServer; transferServer = 0; } } if ( !transferServer || !qcopBridge ) tid_xfer = startTimer( 2000 ); } void Server::timerEvent( QTimerEvent *e ) { if ( e->timerId() == tid_xfer ) { killTimer( tid_xfer ); tid_xfer = 0; startTransferServer(); } /* ### FIXME today startin */ #if 0 else if ( e->timerId() == tid_today ) { QDate today = QDate::currentDate(); if ( today != last_today_show ) { last_today_show = today; Config cfg("today"); cfg.setGroup("Start"); #ifndef QPE_DEFAULT_TODAY_MODE #define QPE_DEFAULT_TODAY_MODE "Never" #endif if ( cfg.readEntry("Mode",QPE_DEFAULT_TODAY_MODE) == "Daily" ) { QCopEnvelope env(Service::channel("today"),"raise()"); } } } #endif } void Server::terminateServers() { delete transferServer; delete qcopBridge; transferServer = 0; qcopBridge = 0; } void Server::syncConnectionClosed( const QHostAddress & ) { qDebug( "Lost sync connection" ); delete syncDialog; syncDialog = 0; } void Server::pokeTimeMonitors() { #if 0 // inform all TimeMonitors QStrList tms = Service::channels("TimeMonitor"); for (const char* ch = tms.first(); ch; ch=tms.next()) { QString t = getenv("TZ"); QCopEnvelope e(ch, "timeChange(QString)"); e << t; } #endif } void Server::applicationLaunched(int, const QString &app) { serverGui->applicationStateChanged( app, ServerInterface::Launching ); } void Server::applicationTerminated(int pid, const QString &app) { serverGui->applicationStateChanged( app, ServerInterface::Terminated ); #if 0 tsmMonitor->applicationTerminated( pid ); #endif } void Server::applicationConnected(const QString &app) { serverGui->applicationStateChanged( app, ServerInterface::Running ); } void Server::storageChanged() { - system( "qtopia-update-symlinks" ); + system( "opie-update-symlinks" ); serverGui->storageChanged( storage->fileSystems() ); docList->storageChanged(); } void Server::preloadApps() { Config cfg("Launcher"); cfg.setGroup("Preload"); QStringList apps = cfg.readListEntry("Apps",','); for (QStringList::ConstIterator it=apps.begin(); it!=apps.end(); ++it) { #ifndef QT_NO_COP QCopEnvelope e("QPE/Application/"+(*it).local8Bit(), "enablePreload()"); #endif } } diff --git a/core/symlinker/Makefile b/core/symlinker/Makefile new file mode 100644 index 0000000..f35292c --- a/dev/null +++ b/core/symlinker/Makefile @@ -0,0 +1,160 @@ +############################################################################# +# Makefile for building: $(OPIEDIR)/bin/opie-update-symlinks +# Generated by qmake (1.05a) (Qt 3.1.2) on: Tue Mar 16 10:46:29 2004 +# Project: symlinker.pro +# Template: app +# Command: $(QMAKE) -o Makefile symlinker.pro +############################################################################# + +####### Compiler, tools and options + +CC = arm-linux-gcc +CXX = arm-linux-g++ -DQT_QWS_IPAQ +LEX = flex +YACC = yacc +CFLAGS = -pipe $(CFLAGS_EXTRA) -Wall -W $(if $(CFLAGS_RELEASE),$(CFLAGS_RELEASE), -O2) -DUSE_REALTIME_AUDIO_THREAD -DOPIE_NEW_MALLOC -DOPIE_SOUND_FRAGMENT_SHIFT=14 -DOPIE_WE_VERSION=15 -DQT_NO_DEBUG +CXXFLAGS = -pipe $(CFLAGS_EXTRA) -DQWS -fno-exceptions -fno-rtti $(CXXFLAGS_EXTRA) -Wall -W $(if $(CFLAGS_RELEASE),$(CFLAGS_RELEASE), -O2) -DUSE_REALTIME_AUDIO_THREAD -DOPIE_NEW_MALLOC -DOPIE_SOUND_FRAGMENT_SHIFT=14 -DOPIE_WE_VERSION=15 -DQT_NO_DEBUG +LEXFLAGS = +YACCFLAGS= -d +INCPATH = -I/opt/arm/opie//mkspecs/qws/linux-ipaq-g++ -I. -I$(OPIEDIR)/include -I$(QTDIR)/include -I.moc/$(PLATFORM)/ +LINK = arm-linux-gcc +LFLAGS = $(LFLAGS_EXTRA) -Wl,-rpath=$(OPIEDIR)/lib +LIBS = $(SUBLIBS) -Wl,-rpath-link,$(OPIEDIR)/lib -L$(OPIEDIR)/lib -Wl,-rpath-link,$(QTDIR)/lib -L$(QTDIR)/lib $(LIBS_EXTRA) -lqpe -lopie -lqte +AR = ar cqs +RANLIB = +MOC = $(QTDIR)/bin/moc +UIC = $(QTDIR)/bin/uic +QMAKE = qmake +TAR = tar -cf +GZIP = gzip -9f +COPY = cp -f +COPY_FILE= $(COPY) -p +COPY_DIR = $(COPY) -pR +DEL_FILE = rm -f +SYMLINK = ln -sf +DEL_DIR = rmdir +MOVE = mv -f +PRO = symlinker.pro +CHK_DIR_EXISTS= test -d +MKDIR = mkdir -p + +####### Output directory + +OBJECTS_DIR = .obj/$(PLATFORM)/ + +####### Files + +HEADERS = +SOURCES = main.cpp +OBJECTS = .obj/$(PLATFORM)/main.o +FORMS = +UICDECLS = +UICIMPLS = +SRCMOC = +OBJMOC = +DIST = ../../gen.pro \ + ../../include.pro \ + symlinker.pro +QMAKE_TARGET = opie-update-symlinks +DESTDIR = $(OPIEDIR)/bin/ +TARGET = $(OPIEDIR)/bin/opie-update-symlinks + +first: all +####### Implicit rules + +.SUFFIXES: .c .cpp .cc .cxx .C + +.cpp.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< + +.cc.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< + +.cxx.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< + +.C.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< + +.c.o: + $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< + +####### Build rules + +all: Makefile $(TARGET) + +$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) + test -d $(OPIEDIR)/bin/ || mkdir -p $(OPIEDIR)/bin/ + $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS) + +mocables: $(SRCMOC) + +$(MOC): + ( cd $(QTDIR)/src/moc ; $(MAKE) ) + +Makefile: symlinker.pro /opt/arm/opie//mkspecs/qws/linux-ipaq-g++/qmake.conf ../../gen.pro \ + ../../include.pro + $(QMAKE) -o Makefile symlinker.pro +qmake: + @$(QMAKE) -o Makefile symlinker.pro + +dist: + @mkdir -p .obj/$(PLATFORM)/opie-update-symlinks && $(COPY_FILE) --parents $(SOURCES) $(HEADERS) $(FORMS) $(DIST) .obj/$(PLATFORM)/opie-update-symlinks/ && ( cd `dirname .obj/$(PLATFORM)/opie-update-symlinks` && $(TAR) opie-update-symlinks.tar opie-update-symlinks && $(GZIP) opie-update-symlinks.tar ) && $(MOVE) `dirname .obj/$(PLATFORM)/opie-update-symlinks`/opie-update-symlinks.tar.gz . && $(DEL_FILE) -r .obj/$(PLATFORM)/opie-update-symlinks + +mocclean: + +uiclean: + +yaccclean: +lexclean: +clean: + -$(DEL_FILE) $(OBJECTS) + -$(DEL_FILE) *~ core *.core + + +####### Sub-libraries + +distclean: clean + -$(DEL_FILE) $(OPIEDIR)/bin/$(TARGET) $(TARGET) + + +lupdate: + lupdate -noobsolete $(PRO) + +lrelease: + lrelease $(PRO) + +ipk: + tmp=`mktemp -d /tmp/ipkg-opie.XXXXXXXXXX` && ( $(MAKE) INSTALL_ROOT="" install && ipkg-build ; rm -rf ; ) + +opie-lupdate: + opie-lupdate $(PRO) + +opie-lrelease: + opie-lrelease $(PRO) + +messages: + xgettext -C -n -ktr -kQT_TRANSLATE_NOOP main.cpp -o '$(OPIEDIR)/messages-$(QMAKE_TARGET)-tr.po' && xgettext -C -n -a main.cpp -o '$(OPIEDIR)/messages-$(QMAKE_TARGET)-allstrings.po' + +FORCE: + +####### Compile + +.obj/$(PLATFORM)/main.o: main.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/$(PLATFORM)/main.o main.cpp + +####### Install + +install_target: + @$(CHK_DIR_EXISTS) "$(INSTALL_ROOT)$(OPIEDIR)/bin/" || $(MKDIR) "$(INSTALL_ROOT)$(OPIEDIR)/bin/" + -$(COPY) "$(OPIEDIR)/bin/$(QMAKE_TARGET)" "$(INSTALL_ROOT)$(OPIEDIR)/bin/$(QMAKE_TARGET)" + +uninstall_target: + -$(DEL_FILE) "$(INSTALL_ROOT)$(OPIEDIR)/bin/$(QMAKE_TARGET)" + -$(DEL_DIR) "$(INSTALL_ROOT)$(OPIEDIR)/bin/" + + +install: all install_target + +uninstall: uninstall_target + diff --git a/core/symlinker/config.in b/core/symlinker/config.in new file mode 100644 index 0000000..a378d3a --- a/dev/null +++ b/core/symlinker/config.in @@ -0,0 +1,5 @@ + config SYMLINKER + boolean "Opie Symlinker for external media" + default "y" + depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE && LAUNCHER + diff --git a/core/symlinker/main.cpp b/core/symlinker/main.cpp new file mode 100644 index 0000000..73d5166 --- a/dev/null +++ b/core/symlinker/main.cpp @@ -0,0 +1,160 @@ +#include <qapplication.h> +#include <qfile.h> +#include <qfileinfo.h> +#include <qdir.h> +#include <qtextstream.h> +#include <qstringlist.h> + +#include <stdlib.h> +#include <unistd.h> //symlink() +#include <sys/stat.h> // mkdir() + +#include <sys/vfs.h> +#include <mntent.h> + +static const char *listDir = "/usr/lib/ipkg/externinfo/"; + +static void createSymlinks( const QString &location, const QString &package ) +{ + QFile inFile( location + "/usr/lib/ipkg/info/" + package + ".list" ); + mkdir( "/usr/lib/ipkg", 0777 ); + mkdir( listDir, 0777 ); + + QFile outFile( listDir + package + ".list"); + + //qDebug( "createSymlinks %s -> %s", inFile.name().ascii(), outFile.name().ascii() ); + + + + if ( inFile.open(IO_ReadOnly) && outFile.open(IO_WriteOnly)) { + QTextStream in(&inFile); + QTextStream out(&outFile); + + QString s; + while ( !in.eof() ) { // until end of file... + s = in.readLine(); // line of text excluding '\n' + //qDebug( "Read: %s", s.ascii() ); + // for s, do link/mkdir. + if ( s.right(1) == "/" ) { + //qDebug("do mkdir for %s", s.ascii()); + mkdir( s.ascii(), 0777 ); + //possible optimization: symlink directories + //that don't exist already. -- Risky. + } else { + //qDebug("do symlink for %s", s.ascii()); + QFileInfo ffi( s ); + //Don't try to symlink if a regular file exists already + if ( !ffi.exists() || ffi.isSymLink() ) { + symlink( (location+s).ascii(), s.ascii() ); +// qDebug ( "Created %s" ,s.ascii() ); + out << s << "\n"; + } //else { + // qDebug( "%s exists already, not symlinked", s.ascii() ); +// } + } + } + inFile.close(); + outFile.close(); + } +} + + + +static void removeSymlinks( const QString &package ) +{ + QFile inFile( listDir + package + ".list" ); + + if ( inFile.open(IO_ReadOnly) ) { + QTextStream in(&inFile); + + QString s; + while ( !in.eof() ) { // until end of file... + s = in.readLine(); // line of text excluding '\n' + //qDebug("remove symlink %s", s.ascii()); + QFileInfo ffi( s ); + //Confirm that it's still a symlink. + if ( ffi.isSymLink() ) + unlink( s.ascii() ); +// qDebug ( "Removed %s", s.ascii() ); +// else +// qDebug( "Not removed %s", s.ascii() ); + } + inFile.close(); + inFile.remove(); + } +} + + + +/* + Slightly hacky: we can't use StorageInfo, since we don't have a + QApplication. We look for filesystems that have the directory + /usr/lib/ipkg/info, and assume that they are removable media + with packages installed. This is safe even if eg. /usr is on a + separate filesystem, since then we would be testing for + /usr/usr/lib/ipkg/info, which should not exist. (And if it + does they deserve to have it treated as removable.) + */ + +static void updateSymlinks() +{ + QDir lists( listDir ); + QStringList knownPackages = lists.entryList( "*.list" ); // No tr + + struct mntent *me; + FILE *mntfp = setmntent( "/etc/mtab", "r" ); + + if ( mntfp ) { + while ( (me = getmntent( mntfp )) != 0 ) { + QString root = me->mnt_dir; + if ( root == "/" ) + continue; + + QString info = root + "/usr/lib/ipkg/info"; + QDir infoDir( info ); + //qDebug( "looking at %s", info.ascii() ); + if ( infoDir.isReadable() ) { + const QFileInfoList *packages = infoDir.entryInfoList( "*.list" ); // No tr + QFileInfoListIterator it( *packages ); + QFileInfo *fi; + while (( fi = *it )) { + ++it; + if ( knownPackages.contains( fi->fileName() ) ) { + //qDebug( "found %s and we've seen it before", fi->fileName().latin1() ); + knownPackages.remove( fi->fileName() ); + } else { + //it's a new one + createSymlinks( root, fi->baseName() ); + } + + } + + } + } + endmntent( mntfp ); + } + + for ( QStringList::Iterator it = knownPackages.begin(); + it != knownPackages.end(); ++it ) { + // strip ".info" off the end. + removeSymlinks( (*it).left((*it).length()-5) ); + } +} + + + +int main( int argc, char *argv[] ) +{ + QApplication a( argc, argv, QApplication::Tty ); + + QString command = argc > 1 ? argv[1] : "update"; // No tr + + if ( command == "update" ) // No tr + updateSymlinks(); + else if ( command == "create" && argc > 3 ) // No tr + createSymlinks( argv[2], argv[3] ); + else if ( command == "remove" && argc > 2 ) // No tr + removeSymlinks( argv[2] ); + else + qWarning( "Argument error" ); +} diff --git a/core/symlinker/opie-symlinker.control b/core/symlinker/opie-symlinker.control new file mode 100644 index 0000000..6378653 --- a/dev/null +++ b/core/symlinker/opie-symlinker.control @@ -0,0 +1,9 @@ +Package: opie-symlinker +Files: bin/opie-update-symlinks +Priority: optional +Section: opie/system +Maintainer: Project Opie <opie@handhelds.org> +Architecture: arm +Version: $QPE_VERSION-$SUB_VERSION.3 +Depends: task-opie-minimal +Description: Enables apps on external media diff --git a/core/symlinker/symlinker.pro b/core/symlinker/symlinker.pro new file mode 100644 index 0000000..9558b3e --- a/dev/null +++ b/core/symlinker/symlinker.pro @@ -0,0 +1,15 @@ +TEMPLATE = app +CONFIG += qtopia warn_on release +DESTDIR = $(OPIEDIR)/bin + +HEADERS = +SOURCES = main.cpp +INTERFACES = + +TARGET = opie-update-symlinks +INCLUDEPATH += $(OPIEDIR)/include +DEPENDPATH += $(OPIEDIR)/include . +LIBS += -lqpe -lopie + +include ( $(OPIEDIR)/include.pro ) + @@ -1,209 +1,210 @@ CONFIG_ABOUTAPPLET core/applets/aboutapplet aboutapplet.pro CONFIG_ADDRESSBOOK core/pim/addressbook addressbook.pro CONFIG_ADVANCEDFM noncore/apps/advancedfm advancedfm.pro CONFIG_APPEARANCE2 noncore/settings/appearance2 appearance2.pro CONFIG_APPLET_EXAMPLE examples/applet example.pro CONFIG_APPSKEY noncore/settings/appskey appskey.pro CONFIG_AQPKG noncore/settings/aqpkg aqpkg.pro CONFIG_AUTOROTATEAPPLET noncore/applets/autorotateapplet autorotateapplet.pro CONFIG_BACKGAMMON noncore/games/backgammon backgammon.pro CONFIG_BACKUP noncore/settings/backup backup.pro CONFIG_BARTENDER noncore/apps/opie-bartender bartender.pro CONFIG_BATTERYAPPLET core/applets/batteryapplet batteryapplet.pro CONFIG_BEND noncore/unsupported/mail2/bend bend.pro CONFIG_BIGSCREEN_EXAMPLE libopie/big-screen/example osplitter_mail.pro CONFIG_BINARY noncore/tools/calc2/binary binary.pro CONFIG_BLUE-PIN noncore/net/opietooth/blue-pin blue-pin.pro CONFIG_BOUNCE noncore/games/bounce bounce.pro CONFIG_BUTTON-SETTINGS core/settings/button button.pro CONFIG_BUZZWORD noncore/games/buzzword buzzword.pro CONFIG_CALC2 noncore/tools/calc2 calc.pro CONFIG_CALCULATOR noncore/tools/calculator calculator.pro CONFIG_CALIBRATE core/apps/calibrate calibrate.pro CONFIG_CAMERA noncore/multimedia/camera camera.pro CONFIG_CARDMON core/applets/cardmon cardmon.pro CONFIG_CHECKBOOK noncore/apps/checkbook checkbook.pro CONFIG_CITYTIME core/settings/citytime citytime.pro CONFIG_CLIPBOARDAPPLET core/applets/clipboardapplet clipboardapplet.pro CONFIG_CLOCKAPPLET core/applets/clockapplet clockapplet.pro CONFIG_CLOCK noncore/tools/clock clock.pro CONFIG_CONFEDIT noncore/apps/confedit confedit.pro CONFIG_DASHER inputmethods/dasher dasher.pro CONFIG_DATEBOOK core/pim/datebook datebook.pro CONFIG_DECO_FLAT noncore/decorations/flat flat.pro CONFIG_DECO_LIQUID noncore/decorations/liquid liquid.pro CONFIG_DECO_POLISHED noncore/decorations/polished polished.pro CONFIG_DICTIONARY noncore/apps/dictionary dictionary.pro CONFIG_DOCTAB noncore/settings/doctab doctab.pro CONFIG_DRAWPAD noncore/graphics/drawpad drawpad.pro CONFIG_DVORAK inputmethods/dvorak dvorak.pro CONFIG_EMBEDDEDKONSOLE core/apps/embeddedkonsole embeddedkonsole.pro CONFIG_EUROCONV noncore/tools/euroconv/ euroconv.pro CONFIG_EXAMPLE_BOARD examples/inputmethod example.pro CONFIG_EXAMPLE_MENU examples/menuapplet menuapplet.pro CONFIG_EXAMPLE_VPN examples/networksettings example.pro CONFIG_FIFTEEN noncore/games/fifteen fifteen.pro CONFIG_FILEBROWSER noncore/unsupported/filebrowser filebrowser.pro CONFIG_FLAT noncore/styles/flat flat.pro CONFIG_FORMATTER noncore/tools/formatter formatter.pro CONFIG_FREETYPE freetype freetype.pro CONFIG_FRESH noncore/styles/fresh fresh.pro CONFIG_FTPLIB noncore/net/ftplib ftplib.pro CONFIG_GO noncore/games/go go.pro CONFIG_GSMTOOL noncore/unsupported/gsmtool gsmtool.pro CONFIG_HANDWRITING inputmethods/handwriting handwriting.pro CONFIG_HELPBROWSER core/apps/helpbrowser helpbrowser.pro CONFIG_HOMEAPPLET core/applets/homeapplet homeapplet.pro CONFIG_INTERFACES noncore/settings/networksettings/interfaces interfaces.pro CONFIG_IRDAAPPLET core/applets/irdaapplet irdaapplet.pro CONFIG_JUMPX inputmethods/jumpx jumpx.pro CONFIG_KBILL noncore/games/kbill kbill.pro CONFIG_KCHECKERS noncore/games/kcheckers kcheckers.pro CONFIG_KEYBOARD inputmethods/keyboard keyboard.pro CONFIG_KEYPEBBLE noncore/comm/keypebble keypebble.pro CONFIG_KEYVIEW development/keyview keyview.pro CONFIG_KEYZCFG noncore/apps/keyz-cfg keyz-cfg.pro CONFIG_KJUMPX inputmethods/kjumpx kjumpx.pro CONFIG_KPACMAN noncore/games/kpacman kpacman.pro CONFIG_LANGUAGE noncore/settings/language language.pro CONFIG_LAUNCHER_CORE core/launcher server.pro CONFIG_LAUNCHER-SETTINGS core/settings/launcher launcher.pro CONFIG_LIBFFMPEG core/multimedia/opieplayer/libffmpeg libffmpeg.pro CONFIG_LIBFLASH core/multimedia/opieplayer/libflash libflash.pro CONFIG_LIBKATE noncore/apps/tinykate/libkate libkate.pro CONFIG_LIBMAD core/multimedia/opieplayer/libmad libmad.pro CONFIG_LIBMAIL noncore/unsupported/mail2/libmail libmail.pro CONFIG_LIBMAILWRAPPER noncore/net/mail/libmailwrapper libmailwrapper.pro CONFIG_LIBMPEG3 core/multimedia/opieplayer/libmpeg3 libmpeg3.pro CONFIG_LIBOPIE2CORE libopie2/opiecore opiecore.pro CONFIG_LIBOPIE2DB libopie2/opiedb opiedb.pro CONFIG_LIBOPIE2EXAMPLES libopie2/examples examples.pro CONFIG_LIBOPIE2MM libopie2/opiemm opiemm.pro CONFIG_LIBOPIE2NET libopie2/opienet opienet.pro CONFIG_LIBOPIE2PIM libopie2/opiepim opiepim.pro CONFIG_LIBOPIE2UI libopie2/opieui opieui.pro CONFIG_LIBOPIE libopie libopie.pro CONFIG_LIBOPIE_PIM libopie/pim pim.pro CONFIG_LIBOPIETOOTH noncore/net/opietooth/lib lib.pro CONFIG_LIBQPE library library.pro CONFIG_LIBQPE-X11 x11/libqpe-x11 libqpe-x11.pro CONFIG_LIBQTAUX libqtaux libqtaux.pro CONFIG_LIBSQL libsql libsql.pro CONFIG_LIBSLCOMPAT libslcompat libslcompat.pro CONFIG_LIBTREMOR core/multimedia/opieplayer/vorbis/tremor tremor.pro CONFIG_LIBTREMORPLUGIN core/multimedia/opieplayer/vorbis libtremor.pro CONFIG_LIGHT-AND-POWER core/settings/light-and-power light-and-power.pro CONFIG_LIQUID noncore/styles/liquid liquid.pro CONFIG_LOGOUTAPPLET core/applets/logoutapplet logoutapplet.pro CONFIG_MAIL3 noncore/net/mail mail.pro CONFIG_MAILAPPLET noncore/net/mail/taskbarapplet taskbarapplet.pro CONFIG_MAILIT noncore/unsupported/mailit mailit.pro CONFIG_MAIN_TAB_EXAMPLE examples/main-tab example.pro CONFIG_MEDIUMMOUNT noncore/settings/mediummount mediummount.pro CONFIG_MEMORYAPPLET noncore/applets/memoryapplet memoryapplet.pro CONFIG_METAL noncore/styles/metal metal.pro CONFIG_MINDBREAKER noncore/games/mindbreaker mindbreaker.pro CONFIG_MINESWEEP noncore/games/minesweep minesweep.pro CONFIG_MOBILEMSG noncore/comm/mobilemsg mobilemsg.pro CONFIG_MODPLUG core/multimedia/opieplayer/modplug modplug.pro CONFIG_MULTIKEYAPPLET core/applets/multikeyapplet multikeyapplet.pro CONFIG_MULTIKEY inputmethods/multikey multikey.pro CONFIG_NETSYSTEMTIME noncore/settings/netsystemtime netsystemtime.pro CONFIG_NETWORKAPPLET noncore/applets/networkapplet networkapplet.pro CONFIG_NETWORKSETUP noncore/settings/networksettings networksettings.pro CONFIG_NOTESAPPLET noncore/applets/notesapplet notesapplet.pro CONFIG_OAPP core/apps/oapp oapp.pro CONFIG_OBEX core/applets/obex2 obex.pro CONFIG_ODICT noncore/apps/odict odict.pro CONFIG_OIPKG noncore/unsupported/oipkg oipkg.pro CONFIG_OPIEALARM core/opiealarm CONFIG_OPIE-CONSOLE noncore/apps/opie-console opie-console.pro CONFIG_OPIEFTP noncore/net/opieftp opieftp.pro CONFIG_OPIEIRC noncore/net/opieirc opieirc.pro CONFIG_OPIE-LOGIN core/opie-login opie-login.pro CONFIG_OPIEMAIL2 noncore/unsupported/mail2 mail.pro CONFIG_OPIEPLAYER2 noncore/multimedia/opieplayer2 opieplayer2.pro CONFIG_OPIEPLAYER core/multimedia/opieplayer opieplayer.pro CONFIG_OPIE-RDESKTOP noncore/net/opierdesktop opierdesktop.pro CONFIG_OPIE-READER noncore/apps/opie-reader opie-reader.pro CONFIG_OPIEREC noncore/multimedia/opierec opierec.pro CONFIG_OPIE-SHEET noncore/apps/opie-sheet opie-sheet.pro CONFIG_OPIE-SH noncore/tools/opie-sh opie-sh.pro CONFIG_OPIETOOTH-APPLET noncore/net/opietooth/applet applet.pro CONFIG_OPIETOOTH-MANAGER noncore/net/opietooth/manager manager.pro CONFIG_OPIE-WRITE noncore/apps/opie-write opie-write.pro CONFIG_OSEARCH core/pim/osearch osearch.pro CONFIG_OXYGEN noncore/apps/oxygen oxygen.pro CONFIG_PACKAGEMANAGER noncore/settings/packagemanager packagemanager.pro CONFIG_PARASHOOT noncore/games/parashoot parashoot.pro CONFIG_PICKBOARD inputmethods/pickboard pickboard.pro CONFIG_POWERCHORD noncore/multimedia/powerchord powerchord.pro CONFIG_PPP noncore/settings/networksettings/ppp ppp.pro CONFIG_QASHMONEY noncore/apps/qashmoney qashmoney.pro CONFIG_QASTEROIDS noncore/games/qasteroids qasteroids.pro CONFIG_QCOP core/apps/qcop qcop.pro CONFIG_QPDF noncore/unsupported/qpdf qpdf.pro CONFIG_QUICKLAUNCHER core/tools/quicklauncher quicklauncher.pro CONFIG_QWS core/qws qws.pro CONFIG_REMOTE noncore/tools/remote remote.pro CONFIG_RESTARTAPPLET2 core/applets/restartapplet2 restartapplet2.pro CONFIG_RESTARTAPPLET core/applets/restartapplet restartapplet.pro CONFIG_ROTATEAPPLET core/applets/rotateapplet rotateapplet.pro CONFIG_ROTATION noncore/settings/rotation rotation.pro CONFIG_RUNAPPLET core/applets/runapplet runapplet.pro CONFIG_SCREENSHOTAPPLET core/applets/screenshotapplet screenshotapplet.pro CONFIG_SECURITY core/settings/security security.pro CONFIG_SFCAVE noncore/games/sfcave sfcave.pro CONFIG_SFCAVE-SDL noncore/games/sfcave-sdl sfcave-sdl.pro CONFIG_SHOWIMG noncore/multimedia/showimg showimg.pro CONFIG_SIMPLE_EXAMPLE examples/simple example.pro CONFIG_SIMPLE_ICON examples/simple-icon example.pro CONFIG_SIMPLE_MAIN examples/simple-main example.pro CONFIG_SIMPLE noncore/tools/calc2/simple simple.pro CONFIG_SIMPLE_PIM examples/simple-pim example.pro CONFIG_SINGLE single single.pro CONFIG_SNAKE noncore/games/snake snake.pro CONFIG_SOLITAIRE noncore/games/solitaire solitaire.pro CONFIG_SOUND noncore/settings/sound sound.pro CONFIG_SSHKEYS noncore/settings/sshkeys sshkeys.pro CONFIG_SUSPENDAPPLET core/applets/suspendapplet suspendapplet.pro +CONFIG_SYMLINKER core/symlinker symlinker.pro CONFIG_SYSINFO noncore/settings/sysinfo sysinfo.pro CONFIG_TABLEVIEWER noncore/apps/tableviewer tableviewer.pro CONFIG_TABMANAGER noncore/settings/tabmanager tabmanager.pro CONFIG_TABOAPP core/apps/taboapp taboapp.pro CONFIG_TEST libsql/test test.pro CONFIG_TEST noncore/apps/opie-console/test test.pro CONFIG_TETRIX noncore/games/tetrix tetrix.pro CONFIG_TEXTEDIT core/apps/textedit textedit.pro CONFIG_THEME noncore/styles/theme theme.pro CONFIG_TICTAC noncore/games/tictac tictac.pro CONFIG_TINYKATE noncore/apps/tinykate tinykate.pro CONFIG_TODAY_ADDRESSBOOK core/pim/today/plugins/addressbook addressbook.pro CONFIG_TODAY core/pim/today today.pro CONFIG_TODAY_DATEBOOK core/pim/today/plugins/datebook datebook.pro CONFIG_TODAY_EXAMPLE examples/todayplugin example.pro CONFIG_TODAY_FORTUNE noncore/todayplugins/fortune fortune.pro CONFIG_TODAY_MAIL core/pim/today/plugins/mail mail.pro CONFIG_TODAY_STOCKTICKERLIB noncore/todayplugins/stockticker/stocktickerlib stocktickerlib.pro CONFIG_TODAY_STOCKTICKER noncore/todayplugins/stockticker/stockticker stockticker.pro CONFIG_TODAY_TODOLIST core/pim/today/plugins/todolist todolist.pro CONFIG_TODAY_WEATHER noncore/todayplugins/weather weather.pro CONFIG_TODO core/pim/todo todo.pro CONFIG_TONLEITER noncore/multimedia/tonleiter tonleiter.pro CONFIG_TRACKER noncore/multimedia/tracker tracker.pro CONFIG_UBROWSER noncore/net/ubrowser ubrowser.pro CONFIG_UNIKEYBOARD inputmethods/unikeyboard unikeyboard.pro CONFIG_USERMANAGER noncore/settings/usermanager usermanager.pro CONFIG_VMEMO core/applets/vmemo vmemo.pro CONFIG_VOLUMEAPPLET core/applets/volumeapplet volumeapplet.pro CONFIG_VTAPPLET core/applets/vtapplet vtapplet.pro CONFIG_WAVPLUGIN core/multimedia/opieplayer/wavplugin wavplugin.pro CONFIG_WELLENREITER noncore/net/wellenreiter wellenreiter.pro CONFIG_WIRELESSAPPLET noncore/applets/wirelessapplet wirelessapplet.pro CONFIG_WLAN noncore/settings/networksettings/wlan wlan.pro CONFIG_WORDGAME noncore/games/wordgame wordgame.pro CONFIG_YATZEE noncore/games/oyatzee oyatzee.pro CONFIG_ZKBAPPLET noncore/applets/zkbapplet zkbapplet.pro CONFIG_ZLINES noncore/games/zlines zlines.pro CONFIG_ZSAFE noncore/apps/zsafe zsafe.pro CONFIG_ZSAME noncore/games/zsame zsame.pro |