update/update.c
author J. Ali Harlow <ali@juiblex.co.uk>
Sat Feb 20 12:11:02 2010 +0000 (2010-02-20)
changeset 9 8d3b1ddf789c
child 13 b0a35bae4961
permissions -rw-r--r--
First cut at an applications manager
ali@3
     1
/*
ali@3
     2
 * Copyright (C) 2009  J. Ali Harlow <ali@juiblex.co.uk>
ali@3
     3
 *
ali@3
     4
 * This program is free software; you can redistribute it and/or modify
ali@3
     5
 * it under the terms of the GNU General Public License as published by
ali@3
     6
 * the Free Software Foundation; either version 2 of the License, or
ali@3
     7
 * (at your option) any later version.
ali@3
     8
 *
ali@3
     9
 * This program is distributed in the hope that it will be useful,
ali@3
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
ali@3
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
ali@3
    12
 * GNU General Public License for more details.
ali@3
    13
 *
ali@3
    14
 * You should have received a copy of the GNU General Public License along
ali@3
    15
 * with this program; if not, write to the Free Software Foundation, Inc.,
ali@3
    16
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
ali@3
    17
 */
ali@3
    18
ali@3
    19
#include <stdlib.h>
ali@3
    20
#include <lua.h>
ali@3
    21
#include "config.h"
ali@3
    22
#include "plover/plover.h"
ali@3
    23
#include "whelk/whelk.h"
ali@3
    24
ali@3
    25
LUALIB_API int luaopen_posix(lua_State *L);
ali@3
    26
ali@3
    27
void update(const char *argv0)
ali@3
    28
{
ali@3
    29
    char *path,*s,*prefix;
ali@3
    30
    struct comps *comps;
ali@3
    31
    path=plover_get_program_directory(argv0);
ali@3
    32
    s=plover_strconcat(path,"/repodata/comps.xml",NULL);
ali@3
    33
    comps=plover_comps_new_from_file(s);
ali@3
    34
    if (!comps)
ali@3
    35
    {
ali@3
    36
	perror(s);
ali@3
    37
	exit(1);
ali@3
    38
    }
ali@3
    39
    free(s);
ali@3
    40
    prefix=plover_default_prefix_for_vendor(comps->vendor);
ali@3
    41
    plover_comps_free(comps);
ali@3
    42
    plover_update(path,prefix,NULL);
ali@3
    43
    free(prefix);
ali@3
    44
    free(path);
ali@3
    45
}
ali@3
    46
ali@3
    47
int main(int argc,char **argv)
ali@3
    48
{
ali@3
    49
    razor_set_lua_loader("posix",luaopen_posix);
ali@3
    50
    razor_set_lua_loader("whelk",luaopen_whelk);
ali@3
    51
    update(argv[0]);
ali@3
    52
}