Skip to content

Commit

Permalink
ready for testing #3
Browse files Browse the repository at this point in the history
  • Loading branch information
javiroman committed Jan 11, 2018
1 parent 4841afd commit a7043bf
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 971 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ c.img
cd.iso
loader.tr
cscope*
a.out
loader.po
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ popt-devel \
libblkid-devel \
libX11-devel \
libnl3-devel \
newt-devel
newt-devel \
device-mapper-devel

- Instructions:

Expand Down
60 changes: 0 additions & 60 deletions addons/lang-table
Original file line number Diff line number Diff line change
@@ -1,61 +1 @@
Afrikaans af latarcyrheb-sun16 af_ZA.UTF-8 us Africa/Johannesburg
Arabic ar none ar_SA.UTF-8 us Asia/Riyadh
Assamese as none as_IN.UTF-8 us Asia/Kolkata
Bengali bn none bn_BD.UTF-8 us Asia/Dhaka
Bengali(India) bn none bn_IN.UTF-8 us Asia/Kolkata
Bulgarian bg latarcyrheb-sun16 bg_BG.UTF-8 bg_bds-utf8 Europe/Sofia
Catalan ca latarcyrheb-sun16 ca_ES.UTF-8 es Europe/Madrid
Chinese(Simplified) zh_CN none zh_CN.UTF-8 us Asia/Shanghai
Chinese(Traditional) zh_TW none zh_TW.UTF-8 us Asia/Taipei
Croatian hr latarcyrheb-sun16 hr_HR.UTF-8 croat Europe/Zagreb
Czech cs latarcyrheb-sun16 cs_CZ.UTF-8 cz-lat2 Europe/Prague
Danish da latarcyrheb-sun16 da_DK.UTF-8 dk Europe/Copenhagen
Dutch nl latarcyrheb-sun16 nl_NL.UTF-8 nl Europe/Amsterdam
English en latarcyrheb-sun16 en_US.UTF-8 us America/New_York
Estonian et latarcyrheb-sun16 et_EE.UTF-8 et Europe/Tallinn
Finnish fi latarcyrheb-sun16 fi_FI.UTF-8 fi Europe/Helsinki
French fr latarcyrheb-sun16 fr_FR.UTF-8 fr-latin9 Europe/Paris
German de latarcyrheb-sun16 de_DE.UTF-8 de-latin1-nodeadkeys Europe/Berlin
Greek el iso07u-16 el_GR.UTF-8 gr Europe/Athens
Gujarati gu none gu_IN.UTF-8 us Asia/Kolkata
Hebrew he none he_IL.UTF-8 us Asia/Jerusalem
Hindi hi none hi_IN.UTF-8 us Asia/Kolkata
Hungarian hu latarcyrheb-sun16 hu_HU.UTF-8 hu Europe/Budapest
Icelandic is latarcyrheb-sun16 is_IS.UTF-8 is-latin1 Atlantic/Reykjavik
Iloko ilo latarcyrheb-sun16 ilo_PH.UTF-8 us Asia/Manila
Indonesian id latarcyrheb-sun16 id_ID.UTF-8 us Asia/Jakarta
Italian it latarcyrheb-sun16 it_IT.UTF-8 it Europe/Rome
Japanese ja none ja_JP.UTF-8 jp106 Asia/Tokyo
Kannada kn none kn_IN.UTF-8 us Asia/Kolkata
Korean ko none ko_KR.UTF-8 us Asia/Seoul
Macedonian mk latarcyrheb-sun16 mk_MK.UTF-8 mk Europe/Skopje
Maithili mai none mai_IN.UTF-8 us Asia/Kolkata
Malay ms latarcyrheb-sun16 ms_MY.UTF-8 us Asia/Kuala_Lumpur
Malayalam ml none ml_IN.UTF-8 us Asia/Kolkata
Marathi mr none mr_IN.UTF-8 us Asia/Kolkata
Nepali ne none ne_NP.UTF-8 us Asia/Kathmandu
Norwegian(Bokmål) nb latarcyrheb-sun16 nb_NO.UTF-8 no Europe/Oslo
Northern Sotho nso latarcyrheb-sun16 nso_ZA.UTF-8 us Africa/Johannesburg
Oriya or none or_IN.UTF-8 us Asia/Kolkata
Persian fa none fa_IR.UTF-8 us Asia/Tehran
Polish pl latarcyrheb-sun16 pl_PL.UTF-8 pl2 Europe/Warsaw
Portuguese pt latarcyrheb-sun16 pt_PT.UTF-8 pt-latin1 Europe/Lisbon
Portuguese(Brazilian) pt_BR latarcyrheb-sun16 pt_BR.UTF-8 br-abnt2 America/Sao_Paulo
Punjabi pa none pa_IN.UTF-8 us Asia/Kolkata
Romanian ro Lat2-Terminus16 ro_RO.UTF-8 ro Europe/Bucharest
Russian ru none ru_RU.UTF-8 ru Europe/Moscow
Serbian sr latarcyrheb-sun16 sr_RS.UTF-8 sr-cy Europe/Belgrade
Serbian(Latin) sr@latin latarcyrheb-sun16 sr_RS.UTF-8@latin sr-latin Europe/Belgrade
Sinhala si none si_LK.UTF-8 us Asia/Colombo
Slovak sk latarcyrheb-sun16 sk_SK.UTF-8 sk-qwerty Europe/Bratislava
Slovenian sl latarcyrheb-sun16 sl_SI.UTF-8 slovene Europe/Ljubljana
Spanish es latarcyrheb-sun16 es_ES.UTF-8 es Europe/Madrid
Swedish sv latarcyrheb-sun16 sv_SE.UTF-8 sv-latin1 Europe/Stockholm
Tajik tg none tg_TG.UTF-8 tj Asia/Dushanbe
Tamil ta none ta_IN.UTF-8 us Asia/Kolkata
Telugu te none te_IN.UTF-8 us Asia/Kolkata
Turkish tr latarcyrheb-sun16 tr_TR.UTF-8 trq Europe/Istanbul
Ukrainian uk latarcyrheb-sun16 uk_UA.UTF-8 ua-utf Europe/Kiev
Vietnamese vi latarcyrheb-sun16 vi_VN.UTF-8 us Asia/Saigon
Welsh cy latarcyrheb-sun16 cy_GB.UTF-8 uk Europe/London
Zulu zu latarcyrheb-sun16 zu_ZA.UTF-8 us Africa/Johannesburg
35 changes: 20 additions & 15 deletions isys/iface.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
* Author(s): David Cantrell <[email protected]>
*/

/*
* Reference:
* https://www.infradead.org/~tgr/libnl/doc/core.html
*/

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
Expand Down Expand Up @@ -50,23 +55,23 @@
#include "str.h"

/* Internal-only function prototypes. */
static struct nl_handle *_iface_get_handle(void);
static struct nl_cache *_iface_get_link_cache(struct nl_handle **);
static struct nl_sock *_iface_get_handle(void);
static struct nl_cache *_iface_get_link_cache(struct nl_sock **);
static int _iface_have_valid_addr(void *addr, int family, int length);
static int _iface_redirect_io(char *device, int fd, int mode);

/*
* Return a libnl handle for NETLINK_ROUTE.
*/
static struct nl_handle *_iface_get_handle(void) {
struct nl_handle *handle = NULL;
static struct nl_sock *_iface_get_handle(void) {
struct nl_sock *handle = NULL;

if ((handle = nl_handle_alloc()) == NULL) {
if ((handle = nl_socket_alloc()) == NULL) {
return NULL;
}

if (nl_connect(handle, NETLINK_ROUTE)) {
nl_handle_destroy(handle);
nl_socket_free(handle);
return NULL;
}

Expand All @@ -77,16 +82,16 @@ static struct nl_handle *_iface_get_handle(void) {
* Return an NETLINK_ROUTE cache.
* https://bugzilla.redhat.com/show_bug.cgi?id=886862
*/
static struct nl_cache *_iface_get_link_cache(struct nl_handle **handle) {
struct nl_cache *cache = NULL;
static struct nl_cache *_iface_get_link_cache(struct nl_sock **handle) {
struct nl_cache **cache = NULL;

if ((*handle = _iface_get_handle()) == NULL) {
return NULL;
}

if ((cache = rtnl_link_alloc_cache(*handle)) == NULL) {
if ((cache = rtnl_link_alloc_cache(*handle, AF_UNSPEC, cache)) == NULL) {
nl_close(*handle);
nl_handle_destroy(*handle);
nl_socket_free(*handle);
return NULL;
}

Expand Down Expand Up @@ -297,7 +302,7 @@ char *iface_ip2str(char *ifname, int family) {
char *iface_mac2str(char *ifname) {
int buflen = 20;
char *buf = NULL;
struct nl_handle *handle = NULL;
struct nl_sock *handle = NULL;
struct nl_cache *cache = NULL;
struct rtnl_link *link = NULL;
struct nl_addr *addr = NULL;
Expand Down Expand Up @@ -327,12 +332,12 @@ char *iface_mac2str(char *ifname) {
}

mac2str_error4:
nl_addr_destroy(addr);
nl_addr_put(addr);
mac2str_error3:
rtnl_link_put(link);
mac2str_error2:
nl_close(handle);
nl_handle_destroy(handle);
nl_socket_free(handle);

return buf;
}
Expand Down Expand Up @@ -573,7 +578,7 @@ int iface_start_NetworkManager(DBusConnection *connection, char **error) {
*/
int iface_set_interface_mtu(char *ifname, int mtu) {
int ret = 0;
struct nl_handle *handle = NULL;
struct nl_sock *handle = NULL;
struct nl_cache *cache = NULL;
struct rtnl_link *link = NULL;
struct rtnl_link *request = NULL;
Expand Down Expand Up @@ -607,7 +612,7 @@ int iface_set_interface_mtu(char *ifname, int mtu) {
rtnl_link_put(link);
ifacemtu_error1:
nl_close(handle);
nl_handle_destroy(handle);
nl_socket_free(handle);

return ret;
}
2 changes: 1 addition & 1 deletion isys/iface.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

#include <resolv.h>
#include <net/if.h>
#include <libnl3/netlink/cache.h>
#include <netlink/cache.h>
#include <netlink/socket.h>

#include <dbus/dbus.h>
Expand Down
12 changes: 5 additions & 7 deletions stage-1/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ CFLAGS += $(shell pkg-config --cflags devmapper)
LIBS += $(shell pkg-config --libs libnl-3.0)
CFLAGS += $(shell pkg-config --cflags libnl-3.0)

# libnl-route
LIBS += $(shell pkg-config --libs libnl-route-3.0)
CFLAGS += $(shell pkg-config --cflags libnl-route-3.0)

# NetworkManager
CFLAGS += $(shell pkg-config --cflags NetworkManager)

Expand Down Expand Up @@ -77,13 +81,7 @@ LIBS +=
CFLAGS += -DUSE_LOGDEV -DVERSION='"$(VERSION)"' -g
REALCC=gcc

# linuxrc + shutdown on s390, init everywhere else
ifneq (,$(filter s390 s390x,$(ARCH)))
BINS += linuxrc.s390 shutdown
SHUTDOWNOPTS = -DAS_SHUTDOWN=1
else
BINS += init
endif

# translation stuff
LANGS = $(shell cut -f 2 ../addons/lang-table | egrep -v '(^en$$)')
Expand All @@ -93,7 +91,7 @@ TRFILES = $(patsubst %,%.tr,$(LANGS))

all: $(BINS) loader.tr

loader.tr: $(TR) ../lang-table
loader.tr: $(TR) ../addons/lang-table
(cd tr; ls $(TRFILES) | cpio --quiet -Hcrc -o |gzip -9) > $@

tr/%.tr: ../po/%.po loader.po
Expand Down
Loading

0 comments on commit a7043bf

Please sign in to comment.