From 71117b2fcd16c9261861b4acac92da89c3e37972 Mon Sep 17 00:00:00 2001 From: Liam Waldron Date: Mon, 16 Dec 2024 12:55:26 -0500 Subject: [PATCH] progress 12/16 --- etc/glacier.cfg | 41 ++++++++ etc/profile.cfg | 24 +++++ src/glacier-mkprofile | Bin 0 -> 32072 bytes src/glacier-mkprofile.c | 185 +++++++++++++++++++++++++++++++++++++ src/glacier-update-pkgdb | Bin 0 -> 15728 bytes src/glacier-update-pkgdb.c | 79 ++++++++++++++++ src/glacier.h | 25 +++++ src/gpkg | Bin 0 -> 20320 bytes src/gpkg.c | 105 ++++++++++++--------- src/log.c | 7 ++ 10 files changed, 424 insertions(+), 42 deletions(-) create mode 100644 etc/glacier.cfg create mode 100644 etc/profile.cfg create mode 100755 src/glacier-mkprofile create mode 100644 src/glacier-mkprofile.c create mode 100755 src/glacier-update-pkgdb create mode 100644 src/glacier-update-pkgdb.c create mode 100644 src/glacier.h create mode 100755 src/gpkg create mode 100644 src/log.c diff --git a/etc/glacier.cfg b/etc/glacier.cfg new file mode 100644 index 0000000..02f0481 --- /dev/null +++ b/etc/glacier.cfg @@ -0,0 +1,41 @@ +# +# glacier.cfg +# The settings defined in this file will be loaded when Glacier is called. +# For more information on this file, see https://www.everestlinux.org/docs/intro-to-glacier +# + +# Services +# Whether Glacier will allow external service files to be called +# WARNING: Services may pose a security risk to your system. Only use services you trust. +GLACIER_ALLOW_SERVICES = false; + +# Permitted software licenses +# When installing a package, Glacier will check its license. If said license is listed here, +# it will proceed with the installation. Otherwise, it'll return an error. +# For more information on licenses listed below, see https://www.everestlinux.org/docs/intro-to-glacier +# Some common license names with their designation codes are: +# - GNU General Public License (GPL) +# - MIT License (MIT) +# - BSD License (BSD) +# - Apache license (APACHE) +# - Binary-redistributable software (BIN-REDIST) +# - End-user-license-agreement (EULA) +# If, for any reason, a package uses a custom license, you can simply add it to this list. +GLACIER_ALLOWED_LICENSES = [ "GPL", "MIT", "BSD", "APACHE" ]; + +# Package integrity checking +# WARNING: It is strongly recommended to keep this enabled. +# This ensures all incoming packages are not tampered with. +GLACIER_DO_INT_CHECK = true; + +# Verbose logging +# Enable this option to see exta verbosity. +GLACIER_VERBOSE = false; + +# Profile-specific settings +# WARNING: The settings below are tied into the system's profile. Changing any of these manually +# will certainly cause breakage. +# If, for any reason, you must change any of these settings, use `glacier-mkprofile`. +# Profile migration may cause breakage. Doing a clean install is the preferred method for changing profiles. + +@include "/etc/glacier/profile.cfg"; diff --git a/etc/profile.cfg b/etc/profile.cfg new file mode 100644 index 0000000..74e4df2 --- /dev/null +++ b/etc/profile.cfg @@ -0,0 +1,24 @@ +# +# profile.cfg +# The settings defined in this file descirbe the system's profile. +# For more information on this file, see https://www.everestlinux.org/docs/intro-to-glacier +# + +# Package Repository +# This is the URL which glacier-update-pkgdb will clone to the localdb +GLACIER_REPO = ""; + +# System architecture +# The architecture of your system's CPU +GLACIER_ARCH = ""; + +# Target compulation triplet +# The triplet to be used during compilation, if cross compilation must be invoked +GLACIER_TARGET = ""; + +# System profile +# This variable tells Glacier about your system and which packages can be installed. +# This setting depends on the three above and should not be changed manually. +# If you wixh to migrate system profiles, see https://www.everestlinux.org/docs/musl-or-glibc +GLACIER_SYSTEM_PROFILE = ""; + diff --git a/src/glacier-mkprofile b/src/glacier-mkprofile new file mode 100755 index 0000000000000000000000000000000000000000..9f7b00677e55bc0a2bfe721436d27e3b10ea48dd GIT binary patch literal 32072 zcmeHwd3apKm2cf{U8yBmix+vpfUh?!60~^17%y0|ExQ%G2w4Wq)^2yVq>ftMO)p-E zjRmq2grdYI2_X{_mXHwUCHV-+WXJ*-NH8W7;v@{?BuwIDFlk|6oIr>MJm~$-sjAlP zi#nMv?~nJr_o?*ho_p3hb#7JNy47{-9%$OQ-enjRf zCz+xDWy-D-Hh@Q|fsaBs_4a6g9B`eI*O2m{wDnXf`1j=3qV#qwmv)@++mb9a)cIWj zJ&Mc!H0jISs`7KjU*ip`erl+~E9xTQolBS0MS?Yva5TNAX3w&vHA|P&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S1aBA@ZsW5mk?$K&Pov1jNaq@Krp{p^e;qxaFemF`R`W%M+-QfUo z#dH-NYB>XG3>8-3{pW6)x`MNzo#_tf`J)|}I#4KeSNhz)b0?;=G{#eAN(#}llj*|Q zZ-amLISq4YjD}$$CmIh^(ohXUB@stGp3{W6IKdAkS^Z^7U&971sGuI7YBCKI?fQF^ zzJ~L(pn@2FRl(P0;%V~Hs__Vf8 z<9dCah7C&J>Axb2L7Y%bwZ2~8r=ecor}KA~|FcSejWT$If{CP|USCN1w5HIhe;;TR z6Ky{`K2+mGHH?RZOwQ|nH^_E^q2lWfeLcUS zVVM?G(CPoTlz!IDdL^i!uO!!ij-RG}-=VMP&ounD7F5ug|1pRD^c7N2!yjZFlXPeP zzW^COFbma8vfruG>tLPo8rSf*(5-Di3YB`8-(zu4FL8ZE*^Vjo=8lF)Nj_N-p zt*0;RTcDAM)<3d^q)>kqtd?l@sP#4cFL3PodY)3lYL&k>p!GC#fp6E>^EMhT(~1ge zzctwdWwNFH*U#trIq`%RRM2wZG!IGn>uRUjT3<~AXfn$ZLOPUaF{3`06nVT^JBux z&)bvM*YL_b`X3HRElUe3BO0|sM-f@_P*5rySMi$zl)4ffPJRC>22Ix;sUeR$x+T0B b&*%1}^VPJ8I2lX-H)?o8-<7o|2P*zI01i*~ literal 0 HcmV?d00001 diff --git a/src/glacier-mkprofile.c b/src/glacier-mkprofile.c new file mode 100644 index 0000000..6132e7e --- /dev/null +++ b/src/glacier-mkprofile.c @@ -0,0 +1,185 @@ +/* + * glacier-mkprofile.c - Create and modify the system profile + * + * This file is part of Glacier. + * + * Glacier is free software: you can redistribute it and/or modify it under the terms of the + * GNU General Public License as published by the Free Software Foundation, either + * version 3 of the License, or (at your option) any later version. + * + * Glacier is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Glacier. If + * not, see . + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "glacier.h" + +const wchar_t w_check = 0x2713; + +int iprofile; + +static void +usage(int argc, char *argv[]) +{ + printf(COL_BLUE "[*] " COL_RESET "%s - create and modify the system profile\n", argv[0]); + printf(COL_BLUE "[?] " COL_RESET "usage: %s [-h] [-v] [-f] [-u] [-x]\n", argv[0]); + printf("\n"); + printf("%s {-h} Show this message\n", argv[0]); + printf("%s {-v} Show the current version\n", argv[0]); + printf("%s {-l} List available system profiles\n", argv[0]); + printf("%s {-p} PROFILE Create or update the system profile PROFILE at /etc/glacier/profile.cfg\n", argv[0]); + printf("\n"); + printf("Glacier is free software.\n"); + printf("See the GNU GPL version 3 for details.\n"); +} + +static void +usage_small(int argc, char *argv[]) +{ + printf(COL_RED "[x] " COL_RESET "usage: %s [-h] [-v] [-l] [-p]\n", argv[0]); +} + +int +main(int argc, char *argv[]) +{ + if (argc < 2) { + printf(COL_RED "[x] " COL_RESET "%s: not enough arguments (expected 1, got %i)\n", argv[0], argc - 1); + usage_small(argc, argv); + exit(1); + } + + setlocale(LC_CTYPE, ""); + + int opt; + + while ((opt = getopt(argc, argv, "hvlp:")) != -1) { + switch (opt) { + case 'h': + usage(argc, argv); + return 0; + break; + case 'v': + printf(GLACIER_VERSION "\n"); + return 0; + break; + case 'l': + infolog("Available profiles:"); + printf("1)\tx86_64-musl\n"); + printf("\t"); + return 0; + break; + case 'p': + if (argc < 3) { errlog("No system profile specified."); + return 1; + } + + is_process_root("Cannot access the system profile: permission denied. Are you root?"); + + if (strcmp(optarg, "x86_64-musl") == 0) { + infolog ("Using system profile \"x86_64-musl\""); + iprofile = 1; + } else { + fprintf(stderr, COL_RED "[x] " COL_RESET "System profile %s is unknown or not supported.\n", optarg); + return 1; + } + + if (access("/etc/glacier/profile.cfg", F_OK != 0)) { + infolog("No profile exists, skipping backup..."); + } else if (access("/etc/glacier/profile.cfg", F_OK == 0) && access("/etc/glacier/profile.old", F_OK != 0)) { + infolog("Creating backup of old system profile at /etc/glacier/profile.old..."); + + if (remove("/etc/glacier/profile.old") == 0) { + infolog("Removed old backup."); + } + + FILE *oldprofile, *oldprofile_back; + char filename[128], contents; + oldprofile = fopen("/etc/glacier/profile.cfg", "r"); + oldprofile_back = fopen("/etc/glacier/profile.old", "a+"); + contents = fgetc(oldprofile); + + while (contents != EOF) { + fputc(contents, oldprofile_back); + contents = fgetc(oldprofile); + } + + fclose(oldprofile); + fclose(oldprofile_back); + + successlog("Successfully created backup."); + } + + infolog("Creating new profile configuration file..."); + static const char *newprofile = "/etc/glacier/profile.cfg"; + config_t pprofile; + config_setting_t *setting, *root; + + config_init(&pprofile); + + root = config_root_setting(&pprofile); + + if (iprofile == 1) { + infolog("Writing configuration to file..."); + + setting = config_setting_add(root, "GLACIER_REPO", CONFIG_TYPE_STRING); + config_setting_set_string(setting, "https://git.everestlinux.org/EverestLinux/epkgs-x86_64-musl"); + printf("\tGLACIER_REPO = \"https://git.everestlinux.org/EverestLinux/epkgs-x86_64-musl\";\n"); + + setting = config_setting_add(root, "GLACIER_ARCH", CONFIG_TYPE_STRING); + config_setting_set_string(setting, "x86_64"); + printf("\tGLACIER_ARCH = \"x86_64\";\n"); + + setting = config_setting_add(root, "GLACIER_TARGET", CONFIG_TYPE_STRING); + config_setting_set_string(setting, "x86_64-linux-musl"); + printf("\tGLACIER_TARGET = \"x86_64-linux-musl\";\n"); + + setting = config_setting_add(root, "GLACIER_LOCALDB", CONFIG_TYPE_STRING); + config_setting_set_string(setting, "/glacier/localdb/epkgs-x86_64-musl"); + printf("\tGLACIER_LOCALDB = \"/glacier/localdb/epkgs-x86_64-musl\";\n"); + + setting = config_setting_add(root, "GLACIER_SYSTEM_PROFILE", CONFIG_TYPE_STRING); + config_setting_set_string(setting, "x86_64-musl"); + printf("\tGLACIER_SYSTEM_PROFILE = \"x86_64-musl\";\n"); + } + + if (! config_write_file(&pprofile, newprofile)) { + errlog("Error while applying new profile to configuration."); + config_destroy(&pprofile); + return(EXIT_FAILURE); + } + + successlog("Successfully updated system profile."); + config_destroy(&pprofile); + return(EXIT_SUCCESS); + break; + case '?': + printf(COL_RED "[x] " COL_RESET "%s: Unknown argument '%s'.\n", argv[0], argv[1]); + usage_small(argc, argv); + return 1; + break; + } + + } + + printf(COL_RED "[x] " COL_RESET "%s: Unknown argument '%s'.\n", argv[0], argv[1]); + usage_small(argc, argv); + return 1; +} diff --git a/src/glacier-update-pkgdb b/src/glacier-update-pkgdb new file mode 100755 index 0000000000000000000000000000000000000000..699da3afbb39abe7d7637e96c90601568525bdb6 GIT binary patch literal 15728 zcmeHOYit}>6~4P}8YhioCp3+TA(^Ie0 zXB{UHYA^*EzYt4_F9AedC1#4?ha@c+xrd0TTPjs7mlj4r<3QaqG*Q`& z8uf#b?RI+#iXkc1-o`UDK1QbwV>4YV{ij?fAlFml#5ZVbjo){C{ zT4)?@41o<($l43x){T(PjUD9Ah;3l%d&7+WJMA4L-P!wPJ#K82v|!}+9tIu8=R{dtt+{qki+F)33%4{Px)|#~yj}z~aT1SM`1Gk}eZW7CxoS7B+NW#QiB(51kRpA&%)U2r)raGi0QX;0C>5K`6$cUy6CQ@25aZ(o< zBat!(1v=yLZx-FXJ#Fo3eW0Py&ejK-gxb@;PmSt^9!q3R-RR%fo=m6oer+JBLzS_i zbc)(irE5_~A^dPo_+SrbjJ?NW>=$h?3_h=a^wc*XG$o>!xZH-s3e-M=V}-=`8@|pn zYa~BI_Y>w7;)5Y+XP(PbdnAv?fi4w`__>3pTZhF@J9yM^nsM;ZQ9I2#_?0#bnUE~t z?HtcBPNgB4L*98ER5*C+J}=!wrGuxR2Fs#2cpfuJJn$mmMZk-I7XdEx%7fH?tIfLKU!t zXWdlY?Fd@cg=Os^~Hef`ilH)`KD3y zyFdv34_p3C4*mp5}WzoDBDtMJDD9z6fmT&5~rN{n_ww8fb z&qZJ`7nfaytncWBTm8K-cq@WDcKSu# z)^9qkU2f~MPHTmUc{M2=b#O&Cq z>%Q`@J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#f0S^*RpXDh@MD66B12BTIj80K|uwZ zp(iyIP%e`+MZoH2z|=<|Z-qZ#q^*My(BtZ$p$+M3JPKMaNrkEzh6Wu)1?Qn+Z730e zR?|=y>;hH;vNAXXA`nRr;Y&vQeEknII3IvZ!Tv8mCH=55@_c}sL0@Nj01EgU%)i?$ zq-P8{ogvS^&rCN%#;G46JtMxqbSAzpG1mhbr~VA-85MRUbnEf|74N`rI`^OFIgC7h zp69sxuYn%tIIQP+5MwC?4Eu;#*7JNM0UUOj^*pa)JPS5wa>xHuV8l5K>v^8Scpr(m z|Ln*3S+L_Ah|4?=Vhobr-G8D5{vKjXSMz?t0bUk0O7KYPFQX8fsB z40(6^uLB3m@2qP8UHN}b{Qo|;KbIN*2%2(-o}Xi8YO%KWx5qlhYv66f7jr^$%-VeAX{ lhwq;&faAV9^&$BnAil;8kvZDZ=MuPz;$K?|BE. + */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "glacier.h" + +static void +usage(int argc, char *argv[]) +{ + printf(COL_BLUE "[*] " COL_RESET "%s - update the local package database\n", argv[0]); + printf(COL_BLUE "[?] " COL_RESET "usage: %s [-h] [-v] [-u]\n", argv[0]); + printf("\n"); + printf("%s {-h} Show this messsage\n", argv[0]); + printf("%s {-v} Show the current version\n", argv[0]); + printf("%s {-u} Update the local database\n", argv[0]); + printf("\n"); + printf("Glacier is free software.\n"); + printf("See the GNU GPL version 3 for details.\n"); +} + +static void +usage_small(int argc, char *argv[]) +{ + printf(COL_RED "[x] " COL_RESET "usage: %s [-h] [-v] [-u]\n", argv[0]); +} + +int +main(int argc, char *argv[]) +{ + if (argc < 2) { + printf(COL_RED "[x] " COL_RESET "%s: not enough arguments (expected 1, got %i)\n", argv[0], argc - 1); + usage_small(argc, argv); + exit(1); + } + + int opt; + + while ((opt = getopt(argc, argv, "hvu:")) != -1) { + switch (opt) { + case 'h': + usage(argc, argv); + return 0; + break; + case 'v': + printf(GLACIER_VERSION "\n"); + return 0; + break; + case 'u': + return 0; + break; + } + } +} diff --git a/src/glacier.h b/src/glacier.h new file mode 100644 index 0000000..5f5c5c2 --- /dev/null +++ b/src/glacier.h @@ -0,0 +1,25 @@ +/* + * glacier.h - Operate on the user package index + * + * This file is patr of Glacier. + * + * Glacier is free software: you can redistribute it and/or modify it under the terms of the + * GNU General Public License as published by the Free Software Foundation, either + * version 3 of the License, or (at your option) any later version. + * + * Glacier is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Glacier. If + * not, see . + */ + +#ifndef GLACIER_H_ +#define GLACIER_H_ + +#define GLACIER_VERSION "4.0.0rc" + +#endif + + diff --git a/src/gpkg b/src/gpkg new file mode 100755 index 0000000000000000000000000000000000000000..5b44d78a3b83d33e3bfbfaf4fe911d7f2773500b GIT binary patch literal 20320 zcmeHPdwf*Yoj)_lBoiV@cv%oF7a@X=OcGuKicCl*Of*1Df=JaJCNp=EG099i4+xeN zG-8c0N_VZLm5*T8*2mV5*7~uwYb8o0;C9=z-MX~f2W_Q0BiP3JXjHbd-`{!M+_`4D z-Tt$m?#GkQ+~4_qe~g9ow-E4|XLeCd4Q&i=UDB0x-*H0A^MOm5P$<9Gh$y;f4 zsnAnY$&K_hA!invKSkh*n(e4=hAV`8cuh9FUX@!FM&^sEi|j_F-Kexvbc`~Dps1=( zaznqB(yx`eA*0~tSH`S%z0%G~>!iM-lm>;CQ;FbTlU|dw+jo)hW2Mgsm?^5#yB2m- zFMnxJ&D<>0%he8U**_JP)ypco!fh*-Rdxj{y26oUZ$yLCScpAe}bKsW&*YLB37XeIG-mN+C zMabucRwv-60iVX^Fs()i)i}z04Xqn|K|Q9ohvNx7*1Dm#D;m*T{cT-3^ZDAlqY+;` z;g2PJKA}3PVjvm`h1-2y(P(F~$JZ8(b}`u{-Kkiq0W2J8S71!{2YsP15|l>a zNI1bl?Rp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Y4Bh_773UHEXcVH45}h9f>4T?wi$W6fXK ziZ5BSlJVh7)DOKLAa_36s`SxTrBO=D{`H49x@F(X{$jV))6$9z(&w)Do)&e}hL;fj zeXw{hn)IDPRczy?+M33?b@B_@tc>@>^d1}@@L~SXa2h2-P0T;#&C(K+{wzrErH^~F zAn~DZ7R29(dulpiVyy5WMa?&rO zkr{lRoaI|qtokxK`_tkqP4O*q7Q|ffo!!`d2TjBT?NBki)akJv=EAPM?rM)DU3g2x zNteV<6V#SO=c>SG%0jDVT|-5}-_E#thd89E-rNtbRqDTK`GZOL}n`6KN*aKX}8q2m6wwwS(MaroaDx{9OrRFq)!=9u{b z^H;`cnqb2Z(ViHp^K3q6uHJM?RzP0?Hm-g$VL$!~jsM>cTdz!jh?H>Y0Nhtruyi3l% zB3Rp>*1XO3nzU2&q|CpvSJOI0AFnEn1h97v{`1wNdGn>g?OvYu$zYr{K$*X>+ lo?nEiz9THeRdWk^!ZKi}bd~NjL?*KzuM-*}i-Cn@{|!xO3i1E| literal 0 HcmV?d00001 diff --git a/src/gpkg.c b/src/gpkg.c index cc6363b..9c8d5b2 100644 --- a/src/gpkg.c +++ b/src/gpkg.c @@ -1,7 +1,7 @@ /* * gpkg.c - Operate on the user package index * - * This file is patr of Glacier. + * This file is part of Glacier. * * Glacier is free software: you can redistribute it and/or modify it under the terms of the * GNU General Public License as published by the Free Software Foundation, either @@ -15,30 +15,31 @@ * not, see . */ +#include +#include #include #include +#include #include -/* -#include -#include -#include -#include +#include +#include +#include +#include -#include "gpkg.h" -*/ +#include "glacier.h" static void usage(int argc, char *argv[]) { - printf("%s - operate on the user package index\n", argv[0]); - printf("usage: %s [-h] [-v] [-f] [-u] [-x]\n", argv[0]); + printf(COL_BLUE "[*] " COL_RESET "%s - operate on the user package index\n", argv[0]); + printf(COL_BLUE "[?] " COL_RESET "usage: %s [-h] [-v] [-f] [-u] [-x]\n", argv[0]); printf("\n"); printf("%s {-h} Show this message\n", argv[0]); - printf("%s {-v} Show the current version\n", argv[0]); - printf("%s {-f} PKG Install package PKG\n", argv[0]); - printf("%s {-u} PKG Update package PKG\n", argv[0]); - printf("%s {-x} PKG Remove package PKG\n", argv[0]); + printf("%s {-v} Show the current version\n", argv[0]); + printf("%s {-f} PKG Install package PKG\n", argv[0]); + printf("%s {-u} PKG Update package PKG\n", argv[0]); + printf("%s {-x} PKG Remove package PKG\n", argv[0]); printf("\n"); printf("Glacier is free software.\n"); printf("See the GNU GPL version 3 for details.\n"); @@ -47,45 +48,65 @@ usage(int argc, char *argv[]) static void usage_small(int argc, char *argv[]) { - printf("usage: %s [-h] [-v] [-f] [-u] [-x]\n", argv[0]); + printf(COL_RED "[x] " COL_RESET "usage: %s [-h] [-v] [-f] [-u] [-x]\n", argv[0]); } int main(int argc, char *argv[]) { if (argc < 2) { + printf(COL_RED "[x] " COL_RESET "%s: not enough arguments (expected 1, got %i)\n", argv[0], argc - 1); usage_small(argc, argv); - return 1; + exit(1); } int opt; - while ((opt = getopt(argc, argv, ":if:hvfux")) != -1) { - switch(opt) { - case 'h': - usage(argc, argv); - return 0; - break; - case 'v': - /* printf(GPKG_VERSION "\n"); */ - printf("v4.0.0\n"); - return 0; - break; - case 'f': - return 0; - break; - case 'u': - return 0; - break; - case 'x': - return 0; - break; - case '?': - usage_small(argc, argv); - return 1; - break; + while ((opt = getopt(argc, argv, "hvfux:")) != -1) { + switch(opt) { + case 'h': + usage(argc, argv); + return 0; + break; + case 'v': + printf(GLACIER_VERSION "\n"); + return 0; + break; + case 'f': + if (argc < 3) { errlog("No package(s) specified."); return 1; } + if (is_process_root() == 0) { + errlog("Failed to open package index: permission denied. Are you root?"); + return(EXIT_FAILURE); } + runtime_exists(); + if (errno != 0) { exit(1); } + init_config(); + load_all_from_config(); + mkworkspace(); + die_config(); + return 0; + break; + case 'u': + if (argc < 3) { errlog("No package(s) specified."); return 1; } + is_process_root("Failed to open package index: permission denied. Are you root?"); + mkworkspace(); + return 0; + break; + case 'x': + if (argc < 3) { errlog("No package(s) specified."); return 1; } + is_process_root("Failed to open package index: permission denied. Are you root?"); + mkworkspace(); + return 0; + break; + case '?': + printf(COL_RED "[x] " COL_RESET "%s: Unknown argument '%s'.\n", argv[0], argv[1]); + usage_small(argc, argv); + return 1; + break; + } } - - return 0; + + printf(COL_RED "[x] " COL_RESET "%s: Unknown argument '%s'.\n", argv[0], argv[1]); + usage_small(argc, argv); + return 1; } diff --git a/src/log.c b/src/log.c new file mode 100644 index 0000000..0a24a95 --- /dev/null +++ b/src/log.c @@ -0,0 +1,7 @@ +#include + +int +main() +{ + successlog("hi"); +}