[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


Something to think about?  Here's the only chunk of source I've written,
if someone wants to help the idea, speak up.  I need to figure out what
format the package info should be stored in on the disk, and I need
someone to write a parser for it.  BTW, I'm giving serious thought to
installing Debian on my 386.(Which, AAMOF, will by the end of the year be
mounted inside a small submarine I'm building as a control computer)

                        Paul Anderson
		   paul @ geeky1.ebtech.net
    Author of Star Spek(a tongue in cheek pun on Star trek)
e-mail: starspek-request@lowdown.com with subscribe as the subject
I hear it's hilarious.               Maintainer of the Tips-HOWTO.
     Diplomacy is saying "nice doggy" until you find a rock.
// The OPPIUM package manager's package class
#ifndef PACKAGE_H
#define PACKAGE_H  // Prevent multiple inclusions

#include <sys/vfs.h>
#include <sys/utsname.h>
#include <fstream.h>

class Error {	// Universal error handler mechanism
    enum err {	// Various errors to be had
	err_allclear = 0,	// No error, all's clear
	err_filenothere,	// File not found
	err_filebadperms,	// Bad perms
	err_cantdetect,		// Can't detect file format
	err_unk,		// I don't know...
	err_nospace		// No free disk space!
    virtual int Error(err e);

class ThisSystem {	// System info, used for a number of purposes
    statfs * root;	// Statistics on the root fs - obtained with statfs()
    utsname * kernelinfo// Kernel info from uname()
    // Need to figure out what format package data should be stored in
    // FIXME: Put in db access

enum {		// Package types we know of
    RPM = 1,	// RPM
    DPKG,	// Debian Package Manager
    TGZ		// Tarball

class Package {		// The package itself
    friend ThisSystem;
    template<class T> int become(T name, int packagetype);
    int become(char * fname, int packagetype);
    int become(fstream openfile, int packagetype);
    int become(char * fname);
    int become(String fname);
    int become(String fname, int packagetype);
    // Using a function template allows me to write the code once, a nice feature
    int operator=(char * fname);
    int operator=(String fname);
    int operator=(fstream openfile);
    // The above initiate another nicety, that ability to say: package="what"
    int checkInstalled(); 	// Check if it's installed, after becoming
    int installPkg(); 		// Install the package which I am
    int removePkg(int pkgid);	// Remove package of certain ID
    int listContents;		// List package contents
    int checkNeeds();		// Insure libraries program may need are installed
    // TODO: Put some of these things in private.
    // Perhaps have installPkg take ThisSystem arg?  
    // Would allow installing over network with ease...  Nifty...