code:
--- reaver-1.4.org/src/Makefile.in
+++ reaver-1.4/src/Makefile.in
@@ -84,11 +84,10 @@
 globule.o:
 	$(CC) $(CFLAGS) globule.c -c

-install: cleanbin
-	if [ ! -d $(CONFDIR) ]; then mkdir -p $(CONFDIR); fi
-	if [ ! -e $(CONFDIR)/reaver.db ]; then cp reaver.db $(CONFDIR)/reaver.db && chmod -R a+rw $(CONFDIR); fi
-	if [ -e wash ]; then cp wash @bindir@/wash; fi
-	if [ -e reaver ]; then cp reaver @bindir@/reaver; fi
+install: wash reaver reaver.db
+	install -D -m 644 reaver.db $(DESTDIR)$(CONFDIR)/reaver.db
+	install -D -m 755 wash $(DESTDIR)$(exec_prefix)/bin/wash
+	install -D -m 755 reaver $(DESTDIR)$(exec_prefix)/bin/reaver

 clean:
 	rm -f *~ *.o reaver wash

repo_name: aarf/bkauler

license: unknown


code:
--- reaver-1.4.org/src/libwps/libwps.h
+++ reaver-1.4/src/libwps/libwps.h
@@ -17,6 +17,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <arpa/inet.h>
+#include <sys/types.h> /* u_char */

 #define LIBWPS_MAX_STR_LEN 256


code:
diff --git a/redis.conf b/redis.conf
index 6efb6ac..344e021 100644
--- a/redis.conf
+++ b/redis.conf
@@ -61,7 +61,7 @@ tcp-backlog 511
 # Examples:
 #
 # bind 192.168.1.100 10.0.0.1
-# bind 127.0.0.1
+bind 127.0.0.1

 # Specify the path for the Unix socket that will be used to listen for
 # incoming connections. There is no default, so Redis will not listen
@@ -87,7 +87,7 @@ timeout 0
 # On other kernels the period depends on the kernel configuration.
 #
 # A reasonable value for this option is 60 seconds.
-tcp-keepalive 0
+tcp-keepalive 60

 # Specify the server verbosity level.
 # This can be one of:
@@ -184,7 +184,7 @@ dbfilename dump.rdb
 # The Append Only File will also be created inside this directory.
 #
 # Note that you must specify a directory here, not a file name.
-dir ./
+dir /var/lib/redis/

 ################################# REPLICATION #################################


code:
From b7cb91e8800f9c9d9b64cd4477b668b41cbed3fc Mon Sep 17 00:00:00 2001
From: Nicola Fontana <ntd@entidi.it>
Date: Sat, 18 Feb 2012 15:14:03 +0100
Subject: [PATCH 1/2] Add explicit dependency on libm and libdl

Math and dynamic loading functions could be defined in external
libraries not directly included by default, so explicit checking is
required at configure level.

An alternative approach to AC_CHECK_LIB would be AC_SEARCH_LIBS, a not
so conventional method with possibly some advantage:
http://www.flameeyes.eu/autotools-mythbuster/autoconf/finding.html
---
 ROX-Filer/src/configure.in |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/ROX-Filer/src/configure.in b/ROX-Filer/src/configure.in
index cc5ff87..44759f3 100644
--- a/ROX-Filer/src/configure.in
+++ b/ROX-Filer/src/configure.in
@@ -173,6 +173,9 @@ AC_TYPE_SIZE_T

 dnl Checks for library functions.
 AC_CHECK_FUNCS(gethostname unsetenv mkdir rmdir strdup strtol statvfs statfs mbrtowc)
+dnl Math functions and dlsym() could be defined outside the standard C library
+AC_CHECK_LIB(m, floor)
+AC_CHECK_LIB(dl, dlsym)
 dnl Since we're using libintl.h, check if libintl needs to be linked in
 AC_CHECK_LIB(intl, gettext)

--
1.7.9.1


code:
From 7b7ad9f3e8dc91d08050c7b24ecae603b64ca52f Mon Sep 17 00:00:00 2001
From: Nicola Fontana <ntd@entidi.it>
Date: Sat, 18 Feb 2012 15:14:22 +0100
Subject: [PATCH 2/2] Extend commit #c2232d50 to "Send to..."

---
 ROX-Filer/src/menu.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/ROX-Filer/src/menu.c b/ROX-Filer/src/menu.c
index bf4bae3..a9ec107 100644
--- a/ROX-Filer/src/menu.c
+++ b/ROX-Filer/src/menu.c
@@ -1674,7 +1674,7 @@ static void show_send_to_menu(GList *paths, GdkEvent *event)

 	send_to_paths = paths;

-	g_signal_connect(menu, "unmap_event", G_CALLBACK(menu_closed), NULL);
+	g_signal_connect(menu, "selection-done", G_CALLBACK(menu_closed), NULL);

 	popup_menu = menu;
 	show_popup_menu(menu, event, 0);
--
1.7.9.1


code:
--- a/ROX-Filer/src/view_details.cORIG	2011-10-23 01:48:50.000000000 +0800
+++ b/ROX-Filer/src/view_details.c	2011-10-20 18:17:34.000000000 +0800
@@ -1059,26 +1059,39 @@
 	ADD_TEXT_COLUMN(_("_Name"), COL_LEAF);
 	gtk_tree_view_column_set_sort_column_id(column, COL_LEAF);
 	gtk_tree_view_column_set_resizable(column, TRUE);
+	gtk_tree_view_column_set_reorderable(column, TRUE);
+
 	ADD_TEXT_COLUMN(_("_Type"), COL_TYPE);
 	gtk_tree_view_column_set_sort_column_id(column, COL_TYPE);
 	gtk_tree_view_column_set_resizable(column, TRUE);
+	gtk_tree_view_column_set_reorderable(column, TRUE);
+
+	ADD_TEXT_COLUMN(_("_Size"), COL_SIZE);
+	g_object_set(G_OBJECT(cell), "xalign", 1.0, "font", "monospace", NULL);
+	g_signal_connect_after(object, "realize",
+			       G_CALLBACK(set_column_mono_font),
+			       G_OBJECT(cell));
+	gtk_tree_view_column_set_sort_column_id(column, COL_SIZE);
+	gtk_tree_view_column_set_reorderable(column, TRUE);
+
+	ADD_TEXT_COLUMN(_("Last _Modified"), COL_MTIME);
+	gtk_tree_view_column_set_sort_column_id(column, COL_MTIME);
+	gtk_tree_view_column_set_reorderable(column, TRUE);
+
 	ADD_TEXT_COLUMN(_("_Permissions"), COL_PERM);
+	gtk_tree_view_column_set_reorderable(column, TRUE);
 	g_object_set(G_OBJECT(cell), "font", "monospace", NULL);
 	g_signal_connect_after(object, "realize",
 			       G_CALLBACK(set_column_mono_font),
 			       G_OBJECT(cell));
+
 	ADD_TEXT_COLUMN(_("_Owner"), COL_OWNER);
 	gtk_tree_view_column_set_sort_column_id(column, COL_OWNER);
+	gtk_tree_view_column_set_reorderable(column, TRUE);
+
 	ADD_TEXT_COLUMN(_("_Group"), COL_GROUP);
 	gtk_tree_view_column_set_sort_column_id(column, COL_GROUP);
-	ADD_TEXT_COLUMN(_("_Size"), COL_SIZE);
-	g_object_set(G_OBJECT(cell), "xalign", 1.0, "font", "monospace", NULL);
-	g_signal_connect_after(object, "realize",
-			       G_CALLBACK(set_column_mono_font),
-			       G_OBJECT(cell));
-	gtk_tree_view_column_set_sort_column_id(column, COL_SIZE);
-	ADD_TEXT_COLUMN(_("Last _Modified"), COL_MTIME);
-	gtk_tree_view_column_set_sort_column_id(column, COL_MTIME);
+	gtk_tree_view_column_set_reorderable(column, TRUE);
 }

 /* Create the handers for the View interface */


code:
diff -rupN rox-filer-orig//ROX-Filer/src/display.c rox-filer//ROX-Filer/src/display.c
--- rox-filer-orig//ROX-Filer/src/display.c	2011-01-02 07:01:36.074000002 +0200
+++ rox-filer//ROX-Filer/src/display.c	2011-01-02 07:01:42.375999996 +0200
@@ -90,11 +90,11 @@ static void display_set_actual_size_real
 void display_init()
 {
 	option_add_int(&o_display_caps_first, "display_caps_first", FALSE);
-	option_add_int(&o_display_dirs_first, "display_dirs_first", FALSE);
-	option_add_int(&o_display_size, "display_icon_size", AUTO_SIZE_ICONS);
+	option_add_int(&o_display_dirs_first, "display_dirs_first", TRUE);
+	option_add_int(&o_display_size, "display_icon_size", 0);
 	option_add_int(&o_display_details, "display_details", DETAILS_NONE);
 	option_add_int(&o_display_sort_by, "display_sort_by", SORT_NAME);
-	option_add_int(&o_large_width, "display_large_width", 155);
+	option_add_int(&o_large_width, "display_large_width", 90);
 	option_add_int(&o_small_width, "display_small_width", 250);
 	option_add_int(&o_display_show_hidden, "display_show_hidden", FALSE);
 	option_add_int(&o_display_show_thumbs, "display_show_thumbs", FALSE);
@@ -105,7 +105,7 @@ void display_init()
 	option_add_int(&o_filer_change_size_num, "filer_change_size_num", 30);
 	option_add_int(&o_vertical_order_small, "vertical_order_small", FALSE);
 	option_add_int(&o_vertical_order_large, "vertical_order_large", FALSE);
-	option_add_int(&o_xattr_show, "xattr_show", TRUE);
+	option_add_int(&o_xattr_show, "xattr_show", FALSE);

 	option_add_notify(options_changed);
 }
diff -rupN rox-filer-orig//ROX-Filer/src/dnd.c rox-filer//ROX-Filer/src/dnd.c
--- rox-filer-orig//ROX-Filer/src/dnd.c	2011-01-02 07:01:36.050000002 +0200
+++ rox-filer//ROX-Filer/src/dnd.c	2011-01-02 07:01:42.379000008 +0200
@@ -167,7 +167,7 @@ void dnd_init(void)
 	option_add_int(&o_dnd_middle_menu, "dnd_middle_menu", TRUE);

 	option_add_string(&o_dnd_uri_handler, "dnd_uri_handler",
-			"xterm -e wget $1");
+			"rxvt -e wget $1");
 }

 /*			SUPPORT FUNCTIONS			*/
diff -rupN rox-filer-orig//ROX-Filer/src/main.c rox-filer//ROX-Filer/src/main.c
--- rox-filer-orig//ROX-Filer/src/main.c	2011-01-02 07:01:36.077000002 +0200
+++ rox-filer//ROX-Filer/src/main.c	2011-01-02 07:06:50.173999979 +0200
@@ -338,7 +338,7 @@ int main(int argc, char **argv)
 	option_add_int(&o_override_redirect, "override_redirect", FALSE);

 	option_add_int(&o_session_panel_or_pin, "session_panel_or_pin",
-		       SESSION_BOTH);
+		       1);
 	option_add_string(&o_session_panel_name, "session_panel_name",
 			  "Default");
 	option_add_string(&o_session_pinboard_name, "session_pinboard_name",
diff -rupN rox-filer-orig//ROX-Filer/src/pinboard.c rox-filer//ROX-Filer/src/pinboard.c
--- rox-filer-orig//ROX-Filer/src/pinboard.c	2011-01-02 07:01:36.084000003 +0200
+++ rox-filer//ROX-Filer/src/pinboard.c	2011-01-02 07:03:36.100000009 +0200
@@ -238,8 +238,8 @@ static void pinboard_set_backdrop_box(vo

 void pinboard_init(void)
 {
-	option_add_string(&o_pinboard_fg_colour, "pinboard_fg_colour", "#fff");
-	option_add_string(&o_pinboard_bg_colour, "pinboard_bg_colour", "#888");
+	option_add_string(&o_pinboard_fg_colour, "pinboard_fg_colour", "#ffffffffffff");
+	option_add_string(&o_pinboard_bg_colour, "pinboard_bg_colour", "#d000d000d000");
 	option_add_string(&o_pinboard_shadow_colour, "pinboard_shadow_colour",
 			"#000");
 	option_add_string(&o_label_font, "label_font", "");
@@ -248,10 +248,10 @@ void pinboard_init(void)
 	option_add_int(&o_pinboard_clamp_icons, "pinboard_clamp_icons", 1);
 	option_add_int(&o_pinboard_grid_step, "pinboard_grid_step",
 							GRID_STEP_COARSE);
-	option_add_int(&o_pinboard_tasklist, "pinboard_tasklist", TRUE);
+	option_add_int(&o_pinboard_tasklist, "pinboard_tasklist", FALSE);
 	option_add_int(&o_pinboard_tasklist_per_workspace, "pinboard_tasklist_per_workspace", FALSE);
 	option_add_int(&o_forward_buttons_13, "pinboard_forward_buttons_13",
-			FALSE);
+			TRUE);

 	option_add_int(&o_iconify_start, "iconify_start", CORNER_TOP_RIGHT);
 	option_add_int(&o_iconify_dir, "iconify_dir", DIR_VERT);
diff -rupN rox-filer-orig//ROX-Filer/src/run.c rox-filer//ROX-Filer/src/run.c
--- rox-filer-orig//ROX-Filer/src/run.c	2011-01-02 07:01:36.047000002 +0200
+++ rox-filer//ROX-Filer/src/run.c	2011-01-02 07:01:42.383000002 +0200
@@ -659,7 +659,7 @@ static gboolean run_desktop(const char *
 	expanded = g_ptr_array_new();

 	if (terminal && g_strcasecmp(terminal, "true") == 0) {
-		g_ptr_array_add(expanded, g_strdup("xterm"));
+		g_ptr_array_add(expanded, g_strdup("rxvt"));
 		g_ptr_array_add(expanded, g_strdup("-e"));
 	}

diff -rupN rox-filer-orig//ROX-Filer/src/xtypes.c rox-filer//ROX-Filer/src/xtypes.c
--- rox-filer-orig//ROX-Filer/src/xtypes.c	2011-01-02 07:01:36.047000002 +0200
+++ rox-filer//ROX-Filer/src/xtypes.c	2011-01-02 07:08:44.555000074 +0200
@@ -73,7 +73,7 @@ void xattr_init(void)
 	dyn_getxattr = (void *) dlsym(libc, "getxattr");
 	dyn_listxattr = (void *) dlsym(libc, "listxattr");

-	option_add_int(&o_xattr_ignore, "xattr_ignore", FALSE);
+	option_add_int(&o_xattr_ignore, "xattr_ignore", TRUE);
 }

 int xattr_supported(const char *path)


code:
From 37a0c90d8a7e69cedf94cee6e84eafd945ffd02f Mon Sep 17 00:00:00 2001
From: Dima Krasner <dima@dimakrasner.com>
Date: Sun, 20 May 2012 15:47:59 +0100
Subject: [PATCH] Set a default size for the log window

The bug is just a small annoyance with the log window - it gets squashed
because no size (or automatic expanding) is specified.
---
 ROX-Filer/Templates.ui |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/ROX-Filer/Templates.ui b/ROX-Filer/Templates.ui
index dc68801..9c492b8 100644
--- a/ROX-Filer/Templates.ui
+++ b/ROX-Filer/Templates.ui
@@ -2,6 +2,8 @@
 <interface>
   <!-- interface-requires gtk+ 2.12 -->
   <object class="GtkDialog" id="Log viewer">
+    <property name="width_request">640</property>
+    <property name="height_request">300</property>
     <property name="visible">True</property>
     <property name="can_focus">False</property>
     <property name="title" translatable="yes">ROX-Filer log viewer</property>
--
1.6.5.GIT


code:
diff -Naur rox-filerPREV/ROX-Filer/src/pinboard.c rox-filer/ROX-Filer/src/pinboard.c
--- rox-filerPREV/ROX-Filer/src/pinboard.c	2014-12-23 08:18:12.000000000 +0800
+++ rox-filer/ROX-Filer/src/pinboard.c	2014-12-23 08:30:41.000000000 +0800
@@ -1363,7 +1363,9 @@
 	{
 		xev.type = ButtonPress;
 		if (!o_blackbox_hack.int_value)
-			XUngrabPointer(gdk_display, event->time);
+			/*XUngrabPointer(gdk_display, event->time);*/
+			/*npierce jwm menu fix, refer: murga-linux.com/puppy/viewtopic.php?t=72258&start=345  */
+			gdk_display_pointer_ungrab( gdk_x11_lookup_xdisplay( gdk_display ), event->time ) ;
 	}
 	else
 		xev.type = ButtonRelease;


code:
diff -Naur rox-filerPREV2/ROX-Filer/src/menu.c rox-filer/ROX-Filer/src/menu.c
--- rox-filerPREV2/ROX-Filer/src/menu.c	2014-12-23 08:10:25.000000000 +0800
+++ rox-filer/ROX-Filer/src/menu.c	2014-12-23 08:38:04.000000000 +0800
@@ -216,7 +216,7 @@
 {">" N_("Delete"),	    	"<Ctrl>X", file_op, FILE_DELETE, "<StockItem>", GTK_STOCK_DELETE},
 {">",				NULL, NULL, 0, "<Separator>"},
 {">" N_("Shift Open"),   	NULL, file_op, FILE_OPEN_FILE},
-{">" N_("Send To..."),		NULL, file_op, FILE_SEND_TO, NULL},
+{">" N_("Open With..."),		NULL, file_op, FILE_SEND_TO, NULL},
 {">",				NULL, NULL, 0, "<Separator>"},
 {">" N_("Set Run Action..."),	"asterisk", file_op, FILE_RUN_ACTION, "<StockItem>", GTK_STOCK_EXECUTE},
 {">" N_("Set Icon..."),		NULL, file_op, FILE_SET_ICON, NULL},
@@ -712,7 +712,7 @@
 		filer_window->temp_item_selected = FALSE;
 	}

-	/* Short-cut to the Send To menu */
+	/* Short-cut to the Open With menu */
 	if (state & GDK_SHIFT_MASK)
 	{
 		GList *paths;
@@ -1495,10 +1495,10 @@
 		mkdir(save, 0777);

 	info_message(
-		_("The `Send To' menu provides a quick way to send some files "
+		_("The `Open With' menu provides a quick way to send some files "
 		"to an application. The applications listed are those in "
 		"the following directories:\n\n%s\n%s\n"
-		"The `Send To' menu may be opened by Shift+Menu clicking "
+		"The `Open With' menu may be opened by Shift+Menu clicking "
 		"over a file.\n\n"
 		"Advanced use:\n"
 		"You can also create subdirectories called "
@@ -1596,7 +1596,7 @@
 	choices_free_list(paths);
 }

-/* Scan the SendTo dir and create and show the Send To menu.
+/* Scan the SendTo dir and create and show the Open With menu.
  * The 'paths' list and every path in it is claimed, and will be
  * freed later -- don't free it yourself!
  */


code:
diff -Naur rox-filerPREV3/ROX-Filer/src/main.c rox-filer/ROX-Filer/src/main.c
--- rox-filerPREV3/ROX-Filer/src/main.c	2014-12-23 08:18:12.000000000 +0800
+++ rox-filer/ROX-Filer/src/main.c	2014-12-23 08:43:56.000000000 +0800
@@ -529,9 +529,9 @@

 	tooltips = gtk_tooltips_new();

-	if (euid == 0 || show_user)
+	/*if (euid == 0 || show_user)
 		show_user_message = g_strdup_printf(_("Running as user '%s'"),
-						    user_name(euid));
+						    user_name(euid));*/

 	/* Add each remaining (non-option) argument to the list of files
 	 * to run.


code:
--- a/Makefile.in
+++ b/Makefile.in
@@ -205,7 +205,7 @@
 proto.h: proto.h-tstamp
        @if test -f proto.h; then :; else cp -p $(srcdir)/proto.h .; fi

-proto.h-tstamp: $(srcdir)/*.c $(srcdir)/lib/compat.c config.h
+proto.h-tstamp: $(srcdir)/*.c $(srcdir)/lib/compat.c
        perl $(srcdir)/mkproto.pl $(srcdir)/*.c $(srcdir)/lib/compat.c

 man: rsync.1 rsyncd.conf.5 man-copy


code:
--- rsyslog-7.4.9-old/tools/omfile.c
+++ rsyslog-7.4.9/tools/omfile.c
@@ -48,9 +48,7 @@
 #include <libgen.h>
 #include <unistd.h>
 #include <sys/file.h>
-#ifdef OS_SOLARIS
-#	include <fcntl.h>
-#endif
+#include <fcntl.h>
 #ifdef HAVE_ATOMIC_BUILTINS
 #	include <pthread.h>
 #endif
--- rsyslog-7.4.9-old/tools/pidfile.c
+++ rsyslog-7.4.9/tools/pidfile.c
@@ -36,9 +36,7 @@
 #include <string.h>
 #include <errno.h>
 #include <signal.h>
-#ifdef __sun
 #include <fcntl.h>
-#endif

 #include "srUtils.h"


code:
--- rsyslog-7.6.6.org/runtime/nsd_gtls.c
+++ rsyslog-7.6.6/runtime/nsd_gtls.c
@@ -234,13 +234,21 @@
 gtlsClientCertCallback(gnutls_session session,
               __attribute__((unused)) const gnutls_datum* req_ca_rdn, int __attribute__((unused)) nreqs,
               __attribute__((unused)) const gnutls_pk_algorithm* sign_algos, int __attribute__((unused)) sign_algos_length,
-              gnutls_retr_st *st)
+#if HAVE_GNUTLS_CERTIFICATE_SET_RETRIEVE_FUNCTION
+	      gnutls_retr2_st* st
+#else
+	      gnutls_retr_st *st
+#endif
+	)
 {
 	nsd_gtls_t *pThis;

 	pThis = (nsd_gtls_t*) gnutls_session_get_ptr(session);
-
+#if HAVE_GNUTLS_CERTIFICATE_SET_RETRIEVE_FUNCTION
+	st->cert_type = GNUTLS_CRT_X509;
+#else
 	st->type = GNUTLS_CRT_X509;
+#endif
 	st->ncerts = 1;
 	st->cert.x509 = &pThis->ourCert;
 	st->key.x509 = pThis->ourKey;
@@ -1627,7 +1635,11 @@
 	gnutls_session_set_ptr(pThis->sess, (void*)pThis);
 	iRet = gtlsLoadOurCertKey(pThis); /* first load .pem files */
 	if(iRet == RS_RET_OK) {
+#		if HAVE_GNUTLS_CERTIFICATE_SET_RETRIEVE_FUNCTION
+		gnutls_certificate_set_retrieve_function(xcred, gtlsClientCertCallback);
+#		else
 		gnutls_certificate_client_set_retrieve_function(xcred, gtlsClientCertCallback);
+#	endif
 	} else if(iRet != RS_RET_CERTLESS) {
 		FINALIZE; /* we have an error case! */
 	}


code:
$ModLoad imuxsock
$ModLoad imklog
$template TraditionalFormat,"%timegenerated% %HOSTNAME% %syslogtag%%msg:::drop-last-lf%\n"
*.*     /var/log/rsyslog/current;TraditionalFormat


code:
.\" This manpage has been automatically generated by docbook2man
.\" from a DocBook document.  This tool can be found at:
.\" <http://shell.ipoline.com/~elmert/comp/docbook2X/>
.\" Please send any bug reports, improvements, comments, patches,
.\" etc. to Steve Cheng <steve@ggi-project.org>.
.TH "RTORRENT" "1" "14 May 2009" "BitTorrent client for ncurses" ""

.SH NAME
rtorrent \- a BitTorrent client for ncurses
.SH SYNOPSIS

\fBrtorrent\fR [ \fB-h\fR ] [ \fB-n\fR ] [ \fB-o key1=opt1,...\fR ] [ \fB-O key=opt\fR ] [ \fBURL | FILE\fR\fI ...\fR ]

.SH "DESCRIPTION"
.PP
\fBrtorrent\fR is a BitTorrent client for ncurses, using
the \fBlibtorrent\fR library. The client and library is
written in C++ with emphasis on speed and efficiency, while delivering
equivalent features to those found in GUI based clients in an ncurses
client.
.PP
Most of the options below have their own default unit in addition to
supporting B, K, M and G suffixes.
.SH "KEYBOARD CONTROL"
.PP
.SS "GLOBAL KEYS"
.TP
\fB^q\fR
Initiate shutdown, press again to force the shutdown and
skip sending the stop signal to trackers.
.TP
\fBup | down | left | right arrow keys\fR
.TP
\fB^P | ^N | ^B | ^F\fR
Select entries or change windows. The right arrow key or ^F is often
used for viewing details about the selected entry, while the left
arrow key or ^B often returns to the previous screen.
.TP
\fBa | s | d\fR
Increase the upload throttle by 1/5/50 KB.
.TP
\fBA | S | D\fR
Increase the download throttle by 1/5/50 KB.
.TP
\fBz | x | c\fR
Decrease the upload throttle by 1/5/50 KB.
.TP
\fBZ | X | C\fR
Decrease the download throttle by 1/5/50 KB.
.SS "MAIN VIEW KEYS"
.TP
\fB->\fR
View download.
.TP
\fB1 - 7\fR
Change view.
.TP
\fB^S\fR
Start download.
.TP
\fB^D\fR
Stop an active download, or remove a stopped download.
.TP
\fB^K\fR
Close a torrent and its files.
.TP
\fB^E\fR
Set the 'create/resize queued' flags on all files in a torrent. This
is necessary if the underlying files in a torrent have been deleted or
truncated, and thus rtorrent must recreate them.
.TP
\fB^R\fR
Initiate hash check of torrent.
.TP
\fB^O\fR
Change the destination directory of the download. The torrent must be
closed.
.TP
\fB^X\fR
Call commands or change settings.
.TP
\fB^B\fR
Set download to perform initial seeding. Only use when
you are the first and only seeder so far for the download.
.TP
\fB+ | -\fR
Change the priority of the download.
.TP
\fBbackspace\fR
Add torrent using an URL or file path. Use
\fBtab\fR to view directory content and do
auto-complete.
.TP
\fBl\fR
View log. Exit by pressing the space-bar.
.TP
\fBU\fR
Delete the file the torrent is tied to, and clear the association.
.TP
\fBI\fR
Toggle whether torrent ignores ratio settings.
.SS "DOWNLOAD VIEW KEYS"
.TP
\fB->\fR
View torrent file list. Use the space-bar to change the file priority
and \fB*\fR to change the priority of all
files. Use \fB/\fR to collapse the directories. OUTDATED
.TP
\fB1 | 2\fR
Adjust max uploads.
.TP
\fB3 | 4\fR
Adjust min peers.
.TP
\fB5 | 6\fR
Adjust max peers.
.TP
\fBu\fR
Display transfering blocks.
.TP
\fBi\fR
Display chunk rarity.
.TP
\fBo\fR
Display the tracker list. Cycle the trackers in a group with the
space-bar.
.TP
\fBp\fR
View peer and torrent information.
.TP
\fBt | T\fR
Initiate tracker request. Use capital T to force the request, ignoring
the "min interval" set by the tracker.
.TP
\fBk\fR
Disconnect peer.
.TP
\fB*\fR
Choke/Snub peer.
.SH "OPTIONS"
.TP
\fB-b \fIa.b.c.d\fB\fR
Bind listening socket and outgoing connections to this network
interface address.
.TP
\fB-d \fIdirectory\fB\fR
Set the default download directory. Defaults to "./".
.TP
\fB-h\fR
Display help and exit.
.TP
\fB-i \fIa.b.c.d\fB\fR
Set the address reported to the tracker.
.TP
\fB-n\fR
Don't load ~/.rtorrent.rc on startup.
.TP
\fB-o key1=opt1,...\fR
.TP
\fB-O key=opt\fR
Set any number of options, see the SETTINGS section. The options given
here override the resource files. Use capital \fB-O\fR
to allow comma in the option.
.TP
\fB-p \fIa-b\fB\fR
Try to open a listening port in the range \fBa\fR up to
and including \fBb\fR\&.
.TP
\fB-s \fIdirectory\fB\fR
Session management will be enabled and the torrent files for all open
downloads will be stored in this directory. Only one instance of
rtorrent should be used with each session directory, though at the
moment no locking is done. An empty string will disable the session
directory.
.SH "GENERAL SETTINGS"
.PP
.TP
\fBbind = \fIa.b.c.d\fB\fR
Bind listening socket and outgoing connections to this network
interface address.
.TP
\fBip = \fIa.b.c.d\fB\fR
.TP
\fBip = \fIhostname\fB\fR
Set the address reported to the tracker.
.TP
\fBport_range = \fIa-b\fB\fR
Try to open a listening port in the range \fBa\fR up to
and including \fBb\fR\&.
.TP
\fBport_random = \fIyes | no\fB\fR
Open the listening port at a random position in the port range.
.TP
\fBcheck_hash = \fIyes | no\fB\fR
Perform hash check on torrents that have finished downloading.
.TP
\fBdirectory = \fIdirectory\fB\fR
Set the default download directory. Defaults to "./".
.TP
\fBsession = \fIdirectory\fB\fR
Session management will be enabled and the torrent files for all open
downloads will be stored in this directory. Only one instance of
rtorrent can be used per session directory. An empty string will
disable the session directory.
.TP
\fBhttp_proxy = \fIurl\fB\fR
Use a http proxy. Use an empty string to disable.
.TP
\fBencoding_list = \fIencoding\fB\fR
Add a preferred filename encoding to the list. The encodings are
attempted in the order they are inserted, if none match the torrent
default is used.
.TP
\fBencryption = \fIoption\fB,\fI\&...\fB\fR
Set how rtorrent should deal with encrypted Bittorrent connections. By
default, encryption is disabled, equivalent to specifying the option
\fBnone\fR\&. Alternatively, any number of the following
options may be specified:

\fBallow_incoming\fR (allow incoming encrypted connections),
\fBtry_outgoing\fR (use encryption for outgoing connections),
\fBrequire\fR (disable unencrypted handshakes),
\fBrequire_RC4\fR (also disable plaintext transmission after the
initial encrypted handshake),
\fBenable_retry\fR (if the initial outgoing connection fails, retry
with encryption turned on if it was off or off if it was on),
\fBprefer_plaintext\fR (choose plaintext when peer offers a choice
between plaintext transmission and RC4 encryption, otherwise RC4 will be used).
.TP
\fBpeer_exchange = \fIyes | no\fB\fR
Enable/disable peer exchange for torrents that aren't marked private. Disabled by default.
.TP
\fBschedule = \fIid\fB,\fIstart\fB,\fIinterval\fB,\fIcommand\fB\fR
Call \fBcommand\fR every \fBinterval\fR
seconds, starting from \fBstart\fR\&. An
\fBinterval\fR of zero calls the task once, while a
\fBstart\fR of zero calls it immediately. Currently
\fBcommand\fR is forwarded to the option handler.
\fBstart\fR and \fBinterval\fR may
optionally use a time format, \fBdd:hh:mm:ss\fR\&. F.ex to
start a task every day at \fB18:00\fR, use
\fB18:00:00,24:00:00\fR\&.
.TP
\fBschedule_remove = \fIid\fB\fR
Delete \fBid\fR from the scheduler.
.TP
\fBstart_tied =\fR
Start torrents that are tied to filenames that have been re-added.
.TP
\fBstop_untied =\fR
.TP
\fBclose_untied =\fR
.TP
\fBremove_untied =\fR
Stop, close or remove the torrents that are tied to filenames that
have been deleted. Clear the association with the 'U' key.
.TP
\fBclose_low_diskspace = \fIspace\fB\fR
Close any active torrents on filesystems with less than
\fBspace\fR diskspace left. Use with
the \fBschedule\fR option. A default scheduled event
with id \fBlow_diskspace\fR is set to 500Mb.
.TP
\fBload = \fIfile\fB\fR
.TP
\fBload_verbose = \fIfile\fB\fR
.TP
\fBload_start = \fIfile\fB\fR
.TP
\fBload_start_verbose = \fIfile\fB\fR
Load and possibly start a file, or possibly multiple files by using the
wild-card "*". This is meant for use with
\fBschedule\fR, though ensure that the
\fBstart\fR is non-zero. The loaded file will be tied
to the filename provided.
.TP
\fBimport = \fIfile\fB\fR
.TP
\fBtry_import = \fIfile\fB\fR
Load a resource file. \fBtry_import\fR does not throw
torrent::input_error exception on bad input.
.TP
\fBstop_on_ratio = \fImin_ratio\fB\fR
.TP
\fBstop_on_ratio = \fImin_ratio\fB,\fImin_upload\fB\fR
.TP
\fBstop_on_ratio = \fImin_ratio\fB,\fImin_upload\fB,\fImax_ratio\fB\fR
Stop torrents when they reach the given upload ratio
\fBmin_ratio\fR in percent. If the optional
\fBmin_upload\fR is given, require a total
upload amount of this many bytes as well. If the optional
\fBmax_ratio\fR is given, stop the torrent
when reaching this ratio regardless of the total upload
amount. Exclude certain torrent by pressing
\fBShift+I\fR in the downlist list.
Use with the \fBschedule\fR option.
.TP
\fBon_insert = \fIid\fB,\fIcommand\fB\fR
.TP
\fBon_erase = \fIid\fB,\fIcommand\fB\fR
.TP
\fBon_open = \fIid\fB,\fIcommand\fB\fR
.TP
\fBon_close = \fIid\fB,\fIcommand\fB\fR
.TP
\fBon_start = \fIid\fB,\fIcommand\fB\fR
.TP
\fBon_stop = \fIid\fB,\fIcommand\fB\fR
.TP
\fBon_hash_queued = \fIid\fB,\fIcommand\fB\fR
.TP
\fBon_hash_removed = \fIid\fB,\fIcommand\fB\fR
.TP
\fBon_hash_done = \fIid\fB,\fIcommand\fB\fR
.TP
\fBon_finished = \fIid\fB,\fIcommand\fB\fR
Call a command on a download when its state changes. Only a subset of
commands are available.
.SH "THROTTLE SETTINGS"
.TP
\fBupload_rate = \fIKB\fB\fR
.TP
\fBdownload_rate = \fIKB\fB\fR
Set the maximum global uploand and download rates.
.TP
\fBmin_peers = \fIvalue\fB\fR
.TP
\fBmax_peers = \fIvalue\fB\fR
Set the minimum and maximum number of peers to allow in each download.
.TP
\fBmin_peers_seed = \fIvalue\fB\fR
.TP
\fBmax_peers_seed = \fIvalue\fB\fR
Set the minimum nad maximum number of peers to allow while seeding, or
-1 (default) to use max_peers.
.TP
\fBmax_uploads = \fIvalue\fB\fR
Set the maximum number of simultaneous uploads per download.
.TP
\fBmax_uploads_div = \fIvalue\fB\fR
.TP
\fBmax_downloads_div = \fIvalue\fB\fR
Change the divider used to calculate the max upload and download slots
to use when the throttle is changed. Disable by
setting \fB0\fR\&.
.TP
\fBmax_uploads_global = \fIvalue\fB\fR
.TP
\fBmax_downloads_global = \fIvalue\fB\fR
Max upload and download slots allowed. Disable by
setting \fB0\fR\&.
.TP
\fBthrottle_up = \fIname\fB, \fIupload_rate\fB\fR
.TP
\fBthrottle_down = \fIname\fB, \fIdownload_rate\fB\fR
Define secondary throttle and/or set the given upload or download rate. Attach to a download with the d.set_throttle_name=name command
or switch throttles with Ctrl-T. Download must be stopped when changing throttles. Note that secondary throttles only work if the
global upload/download is throttled. Setting a download to use the \fBNULL\fR throttle makes the download unthrottled
even when there is a global throttle. Note that this special case bypasses the global throttle entirely, and as such its rate and
transfer amounts are not included in the global statistics.
.TP
\fBthrottle_ip = \fIname\fB, \fIhost\fB\fR
.TP
\fBthrottle_ip = \fIname\fB, \fInetwork/prefix\fB\fR
.TP
\fBthrottle_ip = \fIname\fB, \fIstart\fB, \fIend\fB\fR
Use the given secondary throttle for a host, CIDR network or IP range. All peers with a matching IP will use this throttle instead
of the global throttle or a custom download throttle. The name may be \fBNULL\fR to make these peers unthrottled, with
the same caveats as explained above.
.SH "TRACKER RELATED SETTINGS"
.PP
Tracker related settings.
.TP
\fBenable_trackers = \fIyes\fB\fR
Set to \fBno\fR to disable all tracker requests. Useful
for disabling rtorrent with the \fBschedule\fR command.
.TP
\fBtracker_dump = \fIfilename\fB\fR
Dump tracker requests to \fBfilename\fR, disable by
supplying an empty string. Only torrents loaded while
\fBtracker_dump\fR contains a non-empty string will be
logged at the moment, although disabling it will work as expected.
.TP
\fBtracker_numwant = \fInumber\fB\fR
Set the numwant field sent to the tracker, which indicates how many
peers we want. A negative value disables this feature.
.TP
\fBuse_udp_trackers = \fIyes\fB\fR
Use UDP trackers. Disable if you are behind a firewall, etc, that does
not allow connections to UDP trackers.
.TP
\fBdht = \fIdisabled|off|auto|on\fB\fR
Support for querying the distributed hash table (DHT) to find peers for trackerless
torrents or when all trackers are down. Set to \fBdisable\fR to completely
disable DHT, \fBoff\fR (default) to enable DHT but to not start the
DHT server, \fBauto\fR to automatically start and stop the DHT server
as needed or \fBon\fR for permanently keeping the DHT server running.
When set to automatic, the DHT server will start up when the first non-private torrent
is started, and will stop 15-30 minutes after the last non-private torrent is
stopped (or when rTorrent quits). For DHT to work, a session directory must be set (for
saving the DHT cache).
.TP
\fBdht_port = \fInumber\fB\fR
Set the UDP listen port for DHT. Defaults to 6881.
.TP
\fBdht_add_node = \fIhost[:port]\fB\fR
Not intended for use in the configuration file but as one-time option in the
client or on the command line to bootstrap an empty DHT node table. Contacts
the given node and attempts to bootstrap from it if it replies.
The port is optional, with port 6881 being used by default.
.TP
\fBhttp_capath = \fIpath\fB\fR
.TP
\fBhttp_cacert = \fIfilename\fB\fR
Set the certificates to use in http requests. See Curl's
CURLOPT_CAPATH and CURLOPT_CAINFO options for further information.
.SH "USER-INTERFACE SETTINGS"
.PP
Display related settings.
.TP
\fBview_add = \fIname\fB\fR
Create a new view.
.TP
\fBview_sort = \fIname\fB\fR
.TP
\fBview_sort = \fIname\fB,\fIseconds\fB\fR
Sort a view according the the criteria set by
\fBview_sort_current\fR\&. If the optional argument is
supplied, the view is not sorted if a change happened during the last
\fBseconds\fR\&. This command is meant to be used with
\fBschedule\fR\&.
.TP
\fBview_sort_new = \fIname\fB,\fI\&...\fB\fR
.TP
\fBview_sort_current = \fIname\fB,\fI\&...\fB\fR
Set the sorting criteria for when new elements inserted or
\fBview_sort\fR is called. The list can contain any
number of criteria, including zero, from the following:

\fBname\fR, \fBname_reverse\fR,
\fBstopped\fR, \fBstarted\fR,
\fBcomplete\fR, \fBincomplete\fR,
\fBstate_changed\fR,
\fBstate_changed_reverse\fR
.TP
\fBkey_layout = \fIqwerty|azerty|qwertz|dvorak\fB\fR
Change the key-bindings.
.SH "FILE-SYSTEM SETTINGS"
.PP
File-system related settings.
.TP
\fBmax_file_size = \fIsize\fB\fR
Set the maximum size a file can have. Disable by
passing \fB-1\fR\&.
.TP
\fBsplit_file_size = \fIsize\fB\fR
Split files in a torrent larger than \fBsize\fR into
seperate files. Disable by passing \fB-1\fR\&.
.TP
\fBsplit_suffix = \fIstring\fB\fR
Set the suffix used on split files. Defaults
to \fB\&.part\fR\&.
.SH "DOWNLOAD SETTINGS"
.PP
Settings that require a download as a target, the options need to be
called through f.ex \fBon_finished\fR\&.
.TP
\fBcreate_link = \fItype\fB,\fIpath\fB,\fIsuffix\fB\fR
.TP
\fBdelete_link = \fItype\fB,\fIpath\fB,\fIsuffix\fB\fR
Create or delete a symbolic link. The link path is the concatenation
of \fBpath\fR, the result of
the \fBtype\fR on the download,
and \fBsuffix\fR\&.

Available types are; \fBbase_path\fR uses the base path
of the download, \fBbase_filename\fR uses the base
filename of the download, \fBtied\fR uses the path of
the file the download is tied to, see \fBstart_tied\fR\&.
.SH "ADVANCED SETTINGS"
.PP
This list contains settings users shouldn't need to touch, some may
even cause crashes or similar if incorrectly set.
.TP
\fBhash_read_ahead = \fIMB\fB\fR
Configure how far ahead we ask the kernel to read when doing hash
checking. The hash checker uses madvise(..., MADV_WILLNEED) for the
requests.
.TP
\fBhash_interval = \fIms\fB\fR
Interval between attempts to check the hash when the chunk is not in
memory, in milliseconds.
.TP
\fBhash_max_tries = \fItries\fB\fR
Number of attempts to check the hash while using the mincore status,
before forcing. Overworked systems might need lower values to get a
decent hash checking rate.
.TP
\fBsafe_sync = \fIyes|no\fB\fR
Always use MS_SYNC rather than MS_ASYNC when syncing chunks. This may
be nessesary in case of filesystem bugs like NFS in linux ~2.6.13.
.TP
\fBmax_open_files = \fIvalue\fB\fR
Number of files to simultaneously keep open. LibTorrent dynamically
opens and closes files as necessary when mapping files to
memory. Default is based on sysconf(_SC_OPEN_MAX).
You probably only think you know what this option does, so don't touch
it.
.TP
\fBmax_open_sockets = \fIvalue\fB\fR
Number of network sockets to simultaneously keep open. This value is
set to a reasonable value based on \fBsysconf(_SC_OPEN_MAX)\fR\&.
.TP
\fBmax_open_http = \fIvalue\fB\fR
Number of sockets to simultaneously keep open. This value is set
to \fB32\fR by default.
.TP
\fBmax_memory_usage = \fIbytes\fB\fR
Set the max amount of memory space used to mapping file chunks. This
may also be set using \fBulimit -m\fR where 3/4 will be
allocated to file chunks.
.TP
\fBsend_buffer_size = \fIvalue\fB\fR
.TP
\fBreceive_buffer_size = \fIvalue\fB\fR
Adjust the send and receive buffer size for socket.
.TP
\fBumask = \fI0022\fB\fR
Set the umask for this process, which is applied to all files created
by the program.
.TP
\fBcwd = \fIdirectory\fB\fR
Changes the working directory of the process using
\fBchdir\fR\&.
.TP
\fBsession_on_completion = \fIyes\fB\fR
Controls if the session torrent is saved when a torrent finishes. By
default on.
.TP
\fBsession_lock = \fIyes\fB\fR
Controls if a lock file is created in the session directory on startup.
.TP
\fBsession_save = \fR
Save the session files for all downloads.
.TP
\fBtos = \fIdefault|lowdelay|throughput|reliability|mincost\fB\fR
.TP
\fBtos = \fIhex\fB\fR
Change the TOS of peer connections, by default set to
\fBthroughput\fR\&. If the option is set to
\fBdefault\fR then the system default TOS is used. A
hex value may be used for non-standard settings.
.TP
\fBhandshake_log = \fIyes\fB\fR
Enable logging of the peer handshake. This generates a large number of
log messages, but may be useful to debug connection problems.
.SH "AUTHORS"
.PP

Jari "Rakshasa" Sundell <jaris@ifi.uio.no>


code:
--- a/ext/openssl/ossl_rand.c
+++ b/ext/openssl/ossl_rand.c
@@ -159,9 +159,14 @@
 {
     SafeStringValue(filename);

+    #ifdef HAVE_SSL_RAND_EGD
+
     if(!RAND_egd(RSTRING_PTR(filename))) {
 	ossl_raise(eRandomError, NULL);
     }
+
+    #endif
+
     return Qtrue;
 }

@@ -181,9 +186,14 @@

     SafeStringValue(filename);

+    #ifdef HAVE_SSL_RAND_EGD
+
     if (!RAND_egd_bytes(RSTRING_PTR(filename), n)) {
 	ossl_raise(eRandomError, NULL);
     }
+
+    #endif
+
     return Qtrue;
 }


code:
--- screen-4.2.1.org/Makefile.in
+++ screen-4.2.1/Makefile.in
@@ -15,6 +15,7 @@
 exec_prefix = @exec_prefix@
 datarootdir = @datarootdir@
 datadir = @datadir@
+libdir = $(prefix)/lib

 # don't forget to change mandir and infodir in doc/Makefile.
 bindir  = $(exec_prefix)/bin
@@ -96,9 +97,9 @@
 ###############################################################################
 install: installdirs install_bin
 	cd doc ; $(MAKE) install
-	-if [ -d /usr/lib/terminfo ]; then \
+	-if [ -d $(DESTDIR)$(libdir)/terminfo ]; then \
 		PATH="$$PATH:/usr/5bin" tic ${srcdir}/terminfo/screeninfo.src; \
-		chmod 644 /usr/lib/terminfo/s/screen*; \
+		chmod 644 $(DESTDIR)$(libdir)/terminfo/s/screen*; \
 	fi
 # Better do this by hand. E.g. under RCS...
 #	cat ${srcdir}/terminfo/screencap >> /etc/termcap


code:
--- screen-4.2.1.orig/configure	2014-04-26 12:58:46.000000000 +0200
+++ screen-4.2.1/configure	2014-05-01 13:04:48.000000000 +0200
@@ -414,7 +414,7 @@ as_fn_error ()
     $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
   fi
   $as_echo "$as_me: error: $2" >&2
-  as_fn_exit $as_status
+  # as_fn_exit $as_status
 } # as_fn_error

 if expr a : '\(a\)' >/dev/null 2>&1 &&
@@ -5941,8 +5941,6 @@ else
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-test -f /lib/libsec.a || test -f /usr/lib/libsec.a && LIBS="$LIBS -lsec"
-test -f /lib/libshadow.a || test -f /usr/lib/libshadow.a && LIBS="$LIBS -lshadow"
 oldlibs="$LIBS"
 LIBS="$LIBS -lsun"
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking IRIX sun library..." >&5
@@ -7023,7 +7021,7 @@ as_fn_error ()
     $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
   fi
   $as_echo "$as_me: error: $2" >&2
-  as_fn_exit $as_status
+  # as_fn_exit $as_status
 } # as_fn_error


code:
--- screen-4.0.3.org/screen.c	2013-09-24 14:07:50.595849001 +0000
+++ screen-4.0.3/screen.c	2013-09-24 14:36:40.817786893 +0000
@@ -1020,8 +1020,11 @@
   else
 #endif
     {
+#ifdef SOCKDIR /* if SOCKDIR is not defined, the socket is in $HOME.
+                  in that case it does not make sense to compare uids. */
       if ((int)st.st_uid != real_uid)
 	Panic(0, "You are not the owner of %s.", SockPath);
+#endif
     }
   if ((st.st_mode & 0777) != 0700)
     Panic(0, "Directory %s must have mode 700.", SockPath);
--- screen-4.2.1/socket.c
+++ screen-4.2.1-patched/socket.c
@@ -230,8 +230,11 @@
 #endif

       debug2("st.st_uid = %d, real_uid = %d\n", st.st_uid, real_uid);
+#ifdef SOCKDIR /* if SOCKDIR is not defined, the socket is in $HOME.
+                  in that case it does not make sense to compare uids. */
       if ((int)st.st_uid != real_uid)
 	continue;
+#endif
       mode = (int)st.st_mode & 0777;
       debug1("  has mode 0%03o\n", mode);
 #ifdef MULTIUSER
@@ -450,8 +453,11 @@
       Msg(0, "There is already a screen running on %s.", Filename(SockPath));
       if (stat(SockPath, &st) == -1)
 	Panic(errno, "stat");
+#ifdef SOCKDIR /* if SOCKDIR is not defined, the socket is in $HOME.
+                  in that case it does not make sense to compare uids. */
       if ((int)st.st_uid != real_uid)
 	Panic(0, "Unfortunately you are not its owner.");
+#endif
       if ((st.st_mode & 0700) == 0600)
 	Panic(0, "To resume it, use \"screen -r\"");
       else
@@ -542,8 +548,11 @@
       Msg(0, "There is already a screen running on %s.", Filename(SockPath));
       if (stat(SockPath, &st) == -1)
 	Panic(errno, "stat");
+#ifdef SOCKDIR /* if SOCKDIR is not defined, the socket is in $HOME.
+                  in that case it does not make sense to compare uids. */
       if (st.st_uid != real_uid)
 	Panic(0, "Unfortunately you are not its owner.");
+#endif
       if ((st.st_mode & 0700) == 0600)
 	Panic(0, "To resume it, use \"screen -r\"");
       else


code:
--- SDL-1.2.15.org/src/video/SDL_stretch.c	2013-10-24 01:43:01.303623924 +0000
+++ SDL-1.2.15/src/video/SDL_stretch.c	2013-10-24 01:45:21.346618897 +0000
@@ -42,6 +42,9 @@
 /*#define USE_ASM_STRETCH*/
 #endif

+#undef USE_ASM_STRETCH
+#undef HAVE_MPROTECT
+
 #ifdef USE_ASM_STRETCH

 #ifdef HAVE_MPROTECT


code:
--- SDL-1.2.15.org/src/thread/pthread/SDL_systhread.c	2013-08-06 23:08:47.255000002 +0000
+++ SDL-1.2.15/src/thread/pthread/SDL_systhread.c	2013-08-06 23:25:06.662000002 +0000
@@ -22,6 +22,7 @@
 #include "SDL_config.h"

 #include <pthread.h>
+#include <limits.h>
 #include <signal.h>

 #include "SDL_thread.h"
@@ -49,6 +50,9 @@
 	return((void *)0);		/* Prevent compiler warning */
 }

+static size_t getminstacksize(size_t minimum) {
+	return (minimum < PTHREAD_STACK_MIN) ? PTHREAD_STACK_MIN : minimum;
+}
 int SDL_SYS_CreateThread(SDL_Thread *thread, void *args)
 {
 	pthread_attr_t type;
@@ -58,6 +62,8 @@
 		SDL_SetError("Couldn't initialize pthread attributes");
 		return(-1);
 	}
+
+	pthread_attr_setstacksize(&type, getminstacksize(128*1024));
 	pthread_attr_setdetachstate(&type, PTHREAD_CREATE_JOINABLE);

 	/* Create the thread and go! */


code:
--- libseccomp-2.1.1.old/macros.mk
+++ libseccomp-2.1.1/macros.mk
@@ -193,7 +193,7 @@
 		$(INSTALL) -o $(INSTALL_OWNER) -g $(INSTALL_GROUP) \
 			-d "$(INSTALL_LIB_DIR)/pkgconfig"; \
 		$(INSTALL) -o $(INSTALL_OWNER) -g $(INSTALL_GROUP) -m 0644 \
-			"$$(cat /proc/$$$$/cmdline | awk '{print $$(NF)}')" \
+			"$$(cat /proc/$$$$/cmdline | awk '{print $$(NF)}' |tail -1)" \
 			"$(INSTALL_LIB_DIR)/pkgconfig"; \#

 ifeq ($(V),0)


code:
--- serf-1.3.2.org/buckets/bwtp_buckets.c
+++ serf-1.3.2/buckets/bwtp_buckets.c
@@ -228,7 +228,7 @@
     req_len = apr_snprintf(ctx->req_line, sizeof(ctx->req_line),
                            "%s %d " "%" APR_UINT64_T_HEX_FMT " %s%s\r\n",
                            (ctx->type ? "BWM" : "BWH"),
-                           ctx->channel, calc_header_size(ctx->headers),
+                           ctx->channel, (long long) calc_header_size(ctx->headers),
                            (ctx->open ? "OPEN " : ""),
                            ctx->phrase);
     new_bucket = serf_bucket_simple_copy_create(ctx->req_line, req_len,


code:
#!/bin/sh
[ "$1" = "--prereqs" ] && exit 0
exec /bin/chronyd -d 2>&1

path: KEEP/services/chrony


code:
#!/bin/sh
[ "$1" = "--prereqs" ] && exit 0
exec crond -f -d8  2>&1

path: KEEP/services/crond


code:
#!/bin/sh
[ "$1" = "--prereqs" ] && exit 0
exec svlogd -tt /var/log/dmesg </proc/kmsg

path: KEEP/services/dmesg


code:
#!/bin/sh
[ "$1" = "--prereqs" ] && exit 0
exec /bin/dnsmasq -k -log-facility='-' 2>&1

path: KEEP/services/dnsmasq


code:
#!/bin/sh
DOVECOT_HOME=/var/run/dovecot/login
SRVDIR=/var/lib/dovecot
if [ ! -d "$DOVECOT_HOME" ] ; then
  mkdir -p "$(dirname $DOVECOT_HOME)"
  busybox addgroup -S dovecot
  busybox adduser -h "$DOVECOT_HOME" -s /bin/nologin -S -D -G dovecot dovecot
  busybox addgroup -S dovenull
  busybox adduser -h "$DOVECOT_HOME" -s /bin/nologin -S -D -G dovenull dovenull
  install -D -d -m 755 "$SRVDIR"
  chown -R dovecot "$SRVDIR"
  chgrp -R dovecot "$SRVDIR"
fi
if [ ! -f /etc/dovecot/dovecot.key ] ; then
  openssl req -new -x509 -days 3650 -nodes -out /etc/dovecot/dovecot.crt \
     -subj '/C=US/ST=Oregon/L=Portland/CN=invalid.org' \
     -keyout /etc/dovecot/dovecot.key && chmod o= /etc/dovecot/dovecot.key || exit 1
  chgrp -R dovecot /etc/dovecot/
  chmod -R 640 /etc/dovecot/
fi
[ "$1" = "--prereqs" ] && exit 0
exec dovecot -F 2>&1

path: KEEP/services/dovecot


code:
#!/bin/sh

[ ! -d /etc/dropbear ] && mkdir -p /etc/dropbear
make_key_if_needed() {
	local key=$1
	local filename=/etc/dropbear/dropbear_${key}_host_key
	if [ ! -f "$filename" ] ; then
		local bits=1024
		[ "$key" = "rsa" ] && bits=2048
		dropbearkey -s $bits -t $key -f "$filename" | tail -n2 > ${filename}.pub
	fi
}
make_key_if_needed rsa
make_key_if_needed dss
[ "$1" = "--prereqs" ] && exit 0

exec /bin/dropbear -F 2>&1

path: KEEP/services/dropbear


code:
#!/bin/sh
svc=ffclient
if ! grep -q '^'$svc':' /etc/passwd ; then
  busybox adduser -h /dev/null/$svc -s /bin/false -S -D -G video $svc 2>/dev/null
fi
[ "$1" = "--prereqs" ] && exit 0
res=640x480
fps=15
dev=/dev/video0
url=http://localhost:8091/cam1.ffm
exec chpst -u $svc ffmpeg -nostats -f v4l2 -s $res -r $fps -i $dev $url 2>&1

path: KEEP/services/ffclient


code:
#!/bin/sh
svc=ffserver
if ! grep -q '^'$svc':' /etc/passwd ; then
  busybox addgroup -S $svc
  busybox adduser -h /dev/null/$svc -s /bin/false -S -D -G $svc $svc 2>/dev/null
fi
[ "$1" = "--prereqs" ] && exit 0
exec chpst -u $svc $svc -d -f /etc/$svc.conf 2>&1

path: KEEP/services/ffserver


code:
#!/bin/sh
CONFDIR=/etc/h2o
SRVDIR=/var/www
CONF="$CONFDIR"/h2o.conf

if ! grep -q '^www-data:' /etc/passwd ; then
	busybox addgroup -S www-data
	busybox adduser -h "$SRVDIR" -s /bin/nologin -S -D -H -G www-data www-data
	if [ ! -d "$SRVDIR" ] ; then
		install -D -d -m 755 "$SRVDIR"
		chown -R www-data "$SRVDIR"
		chgrp -R www-data "$SRVDIR"
	fi
fi
if [ ! -f "$CONF" ] ; then
	mkdir -p "$CONFDIR"
	cat << 'EOF' > "$CONF"
user: www-data
pid-file: /var/run/h2o.pid
listen:
  port: 80
hosts:
  "Default":
    paths:
      /:
        file.dir: /var/www
        file.dirlisting: ON
EOF
fi
exec h2o -m master -c "$CONF" 2>&1


code:
#!/bin/sh
[ "$1" = "--prereqs" ] && exit 0
exec haveged -w 1024 -F 2>&1

path: KEEP/services/haveged


code:
#!/bin/sh

SRVDIR=/var/www

if ! grep -q '^www-data:' /etc/passwd ; then
	busybox addgroup -S www-data
	busybox adduser -h "$SRVDIR" -s /bin/nologin -S -D -H -G www-data www-data
fi

if [ ! -d "$SRVDIR" ] ; then
	install -D -d -m 755 "$SRVDIR"
	chown -R www-data "$SRVDIR"
	chgrp -R www-data "$SRVDIR"
fi

[ "$1" = "--prereqs" ] && exit 0

hiawatha -d

path: KEEP/services/hiawatha


code:
#!/bin/sh

#[ -f /etc/ssh/ssh_host_key ]       || ssh-keygen -t rsa1  -N "" -b 2048 -f /etc/ssh/ssh_host_key
[ -f /etc/ssh/ssh_host_rsa_key ]   || ssh-keygen -t rsa   -N "" -b 2048 -f /etc/ssh/ssh_host_rsa_key
#[ -f /etc/ssh/ssh_host_dsa_key ]   || ssh-keygen -t dsa   -N "" -b 1024 -f /etc/ssh/ssh_host_dsa_key
#[ -f /etc/ssh/ssh_host_ecdsa_key ] || ssh-keygen -t ecdsa -N "" -b 521  -f /etc/ssh/ssh_host_ecdsa_key
[ -f /etc/ssh/ssh_host_ed25519_key ] || ssh-keygen -t ed25519 -N "" -f /etc/ssh/ssh_host_ed25519_key
[ "$1" = "--prereqs" ] && exit 0

exec /bin/sshd -De 2>&1

path: KEEP/services/openssh


code:
#!/bin/sh
SRVDIR=/var/spool/postfix
CONFDIR=/etc/postfix
if ! grep -q '^postfix:' /etc/passwd ; then
  busybox addgroup -S postfix
  busybox addgroup -S postdrop
  busybox adduser -h "$SRVDIR" -s /bin/false -S -D -G postfix postfix
  chgrp -R postfix "$SRVDIR"
  chown -R postfix "$SRVDIR"
  chgrp -R postfix "$CONFDIR"
  chown -R postfix "$CONFDIR"
  chmod -R o= "$SRVDIR"
  chmod -R o= "$CONFDIR"
fi
if [ ! -f "$CONFDIR"/postfix.key ] ; then
  openssl req -new -x509 -days 3650 -nodes -out /etc/postfix/postfix.crt \
    -subj '/C=US/ST=Oregon/L=Portland/CN=invalid.org' \
    -keyout /etc/postfix/postfix.key || exit 1
fi
[ ! -f /etc/aliases ] && touch /etc/aliases
postalias /etc/aliases
postmap "$CONFDIR"/virtual
[ "$1" = "--prereqs" ] && exit 0
exec /lib/postfix/master -d 2>&1

path: KEEP/services/postfix


code:
#!/bin/sh
SRVDIR=/srv/postgres
if [ ! -d "$SRVDIR" ] ; then
  busybox addgroup -S postgres && busybox adduser -h "$SRVDIR" -S -G postgres postgres
  echo postgres > /tmp/pgpw
  su -s /bin/sh -c \
    "initdb --locale=C --auth=\"md5\" --pwfile=/tmp/pgpw $SRVDIR/data >$SRVDIR/initlog 2>&1" \
    postgres
  rm /tmp/pgpw
fi
[ "$1" = "--prereqs" ] && exit 0
exec chpst -u postgres postgres -i -h 127.0.0.1 -D "$SRVDIR"/data 2>&1

path: KEEP/services/postgres


code:
#!/bin/sh

DBDIR=/var/lib/redis

if ! grep -q '^redis:' /etc/passwd ; then
        busybox addgroup -S redis
        busybox adduser -h "$DBDIR" -s /bin/nologin -S -D -H -G redis redis
	chown redis:redis /etc/redis.conf
fi

if [ ! -d "$DBDIR" ] ; then
        install -D -d -m 755 "$DBDIR"
        chown -R redis "$DBDIR"
        chgrp -R redis "$DBDIR"
fi

[ "$1" = "--prereqs" ] && exit 0

# http://redis.io/topics/latency
echo 'never' > /sys/kernel/mm/transparent_hugepage/enabled

# see tcp-backlog in redis.conf
echo 511 > /proc/sys/net/core/somaxconn

chpst -vP -u redis:redis -U redis:redis /bin/redis-server /etc/redis.conf

path: KEEP/services/redis


code:
#!/bin/sh
[ "$1" = "--prereqs" ] && exit 0
exec /bin/rsyslogd -n 2>&1

path: KEEP/services/rsyslog


code:
#!/bin/sh
# sshd starts whatever ssh service is installed, preferably openssh... if you still want
# to use dropbear after you installed openssh, run the dropbear service instead
MYDIR=$(dirname "$(readlink -f "$0")")
if [ -x "$MYDIR"/../openssh/run ]; then
  exec "$MYDIR"/../openssh/run "$@"
elif [ -x "$MYDIR"/../dropbear/run ]; then
  exec "$MYDIR"/../dropbear/run "$@"
else
  exit 1
fi

path: KEEP/services/sshd


code:
#!/bin/sh
TORHOME=/var/run/tor
if [ ! -d "$TORHOME" ] ; then
  mkdir -p "$(dirname $TORHOME)"
  busybox addgroup -S tor && busybox adduser -h "$TORHOME" -S -G tor tor
  su -s /bin/sh - tor -c "mkdir -p env ; echo $TORHOME > env/HOME"
fi
[ "$1" = "--prereqs" ] && exit 0
exec chpst -e $TORHOME/env -u tor tor 2>&1

path: KEEP/services/tor


code:
#!/bin/sh
[ "$1" = "--prereqs" ] && exit 0
exec getty -L 38400 tty1 linux


code:
#!/bin/sh
[ "$1" = "--prereqs" ] && exit 0
exec getty -L 38400 tty2 linux


code:
#!/bin/sh
[ "$1" = "--prereqs" ] && exit 0
exec getty -L 38400 tty3 linux


code:
#!/bin/sh
[ "$1" = "--prereqs" ] && exit 0
exec getty -L 38400 tty4 linux


code:
#!/bin/sh
[ "$1" = "--prereqs" ] && exit 0
exec getty -L 38400 ttyS0 vt100


code:
#!/bin/sh
[ "$1" = "--prereqs" ] && exit 0

exec wpa_supplicant -Dnl80211,wext,hostapd,wired -iwlan0 -c/etc/wpa_supplicant.conf


code:
.TH "CRYPTTAB" "5" "10/17/2013" "[FIXME: source]" "[FIXME: manual]"
.SH "NAME"
crypttab \- static information about dm\-crypt filesystems
.SH "SYNOPSIS"
.sp
/etc/crypttab
.SH "DESCRIPTION"
.sp
The file \fBcrypttab\fR contains information about encrypted volumes\&. \fBcrypttab\fR is intended to be read by \fBcryptmount\fR, and only written to by human administrators\&. Each \fIvolume\fR is described on a separate line by four fields\&. Fields are separated by whitespace\&. Empty lines and lines beginning with a \fB#\fR are ignored\&.
.sp
The fields are \fIname\fR \fIdevice\fR [\fIkey\fR [\fIoptions\fR]]
.PP
\fIname\fR
.RS 4
The name of the
\fIvolume\fR
which will appear at
\fB/dev/mapper/\fR\fIname\fR\&. This must be a plain filename without any directory components\&.
.RE
.PP
\fIdevice\fR
.RS 4
An absolute path, UUID, PARTUUID, or LABEL to a device or file which will be mapped to
\fB/dev/mapper/\fR\fIname\fR\&.
.RE
.PP
\fIkey\fR := \fB\-\fR | \fIkeydevice\fR[\e[\fB:\fR\fIfstype\fR] \fB:\fR\fIkeyfile\fR]
.RS 4
This field may be blank or a
\fB\-\fR
for interactive passwords\&.
\fIkeydevice\fR
may be an absolute path, UUID, PARTUUID, or LABEL to a device or file which contains the passphrase\&. If
\fIkeyfile\fR
(and
\fIfstype\fR) are given,
\fIkeydevice\fR
will be mounted if it isn\(cqt already\&.
\fIkeyfile\fR
is an absolute path relative to the root of the file system on
\fIkeydevice\fR\&.
.sp
For compatibility with other formats,
\fBASK\fR
and
\fBnone\fR
may be used in place of
\fB\-\fR
and
\fBSWAP\fR
is an idiom for
\fB/dev/urandom\fR
and the
\fBswap\fR
option\&. See
\fBOPTIONS\fR\&.
.sp
\fBNote:\fR
A literal password in this field is
\fBnot\fR
supported\&.
.RE
.PP
\fIoptions\fR := \fIkey\fR[\fB=\fR\fIvalue\fR] | \fB%\fR\fItag\fR | \fIoptions\fR\fB,\fR\fIoptions\fR
.RS 4
The
\fIoptions\fR
field is a comma separated list\&. It is described in detail below\&.
.sp
For compatibility with other formats, if the first character is
\fB\-\fR
then the entire field is interpretted as a literal command line for
\fBcryptsetup\fR\&.
.RE
.SH "OPTIONS"
.sp
Most options have a one\-to\-one correspondence to \fBcryptsetup\fR command line options and are simply reformatted\&. For example to use \fBcryptsetup \-\-cipher/\-c\fR \fIcipher\fR the options \fBcipher\fR=\fIcipher\fR or \fBc\fR=\fIcipher\fR may be used\&. Other options which are used by \fBcryptmount\fR are:
.PP
\fBswap\fR
.RS 4
Run
\fBmkswap\fR(8) on
\fB/dev/mapper/\fR\fIname\fR\&.
.RE
.PP
\fBtmp\fR[=\fIfs\fR]
.RS 4
Run
\fBmkfs\fR(8) with the file system type of
\fIfs\fR
on
\fB/dev/mapper/\fR\fIname\fR\&. The default
\fIfs\fR
is
\fBext4\fR\&.
.RE
.PP
\fBnoauto\fR
.RS 4
Do not automatically map this
\fIvolume\fR\&.
.RE
.PP
\fBsize\fR=\fIsize\fR
.RS 4
See
\fBcryptsetup(8) \-\-key\-size\fR\&. Other formats for
\fBcrypttab\fR
use
\fBsize\fR
for the amount of bytes to read from
\fBkey\fR\&.
.RE
.PP
\fBdevice\-size\fR=\fIsize\fR
.RS 4
See
\fBcryptsetup(8) \-\-size\fR\&. This accounts for the quirk with
\fBsize\fR\&.
.RE
.PP
\fB%\fR\fItag\fR
.RS 4
Tags can be used to include or exclude a group of volumes when running
\fBcryptmount(8)\fR\&. Additionally,
\fBcryptmount\fR
automatically adds to
\fIvolumes\fR, with a key of
\fB/dev/urandom\fR, a
\fB%random\fR
tag\&. This tag is used by the Arch Linux initscripts to delay the mapping of these volumes until after the random seed has been restored during boot\&.
.RE
.SH "SEE ALSO"
.sp
\fBcryptmount\fR(8), \fBcryptsetup\fR(8)
.SH "AUTHORS"
.sp
Matt Monaco <dgbaley27@0x01b\&.net>


code:
'\" t
.\"     Title: cryptmount
.\"    Author: [see the "Authors" section]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
.\"      Date: 10/17/2013
.\"    Manual: [FIXME: manual]
.\"    Source: [FIXME: source]
.\"  Language: English
.\"
.TH "CRYPTMOUNT" "8" "10/17/2013" "[FIXME: source]" "[FIXME: manual]"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
cryptmount \- parse *crypttab* for use by *cryptsetup*
.SH "SYNOPSIS"
.sp
\fBcryptmount\fR [\fIoptions\fR] [\fB\-L\fR]
.sp
\fBcryptmount\fR [\fIoptions\fR] \fB\-M\fR [\fIname\fR|\fIdevice\fR]
.sp
\fBcryptmount\fR [\fIoptions\fR] \fB\-M\fR \fIname\fR \fIdevice\fR [\fIkey\fR]
.sp
\fBcryptmount\fR [\fIoptions\fR] \fB\-U\fR [\fIname\fR[\fB,\fR\&...]]
.SH "DESCRIPTION"
.sp
\fBcryptmount\fR uses \fBcrypttab(5)\fR for calling \fBcryptsetup(8)\fR; it can also be used to define a \fIvolume\fR on the command line without \fBcrypttab\fR\&.
.SH "ACTIONS"
.PP
\fB\-L\fR
.RS 4
List the
\fInames\fR
(first column) of
\fIvolumes\fR
from
\fBcrypttab\fR\&. Use with
\fB\-O\fR
to manipulate which
\fInames\fR
are listed\&.
.RE
.PP
\fB\-M\fR
.RS 4
Perform a mapping\&. The first form of this command finds a
\fIvolume\fR
from
\fBcrypttab\fR
either by its
\fIname\fR
or
\fIdevice\fR, or if nothing is given then map all
\fIvolumes\fR
(use with
\fB\-O\fR
to manipulate which
\fIvolumes\fR
are mapped)\&. The second form defines a
\fIvolume\fR
entirely on the command line,
\fBcrypttab\fR
is not used\&.
.RE
.PP
\fB\-U\fR
.RS 4
Unmap
\fIvolume(s)\fR\&. If a list of
\fInames\fR
is given, unmap them\&. Otherwise unmap all
\fIvolumes\fR
from
\fBcrypttab\fR
(with
\fB\-O\fR
to manipulate which
\fIvolumes\fR
are unmapped)\&.
.RE
.SH "OPTIONS"
.PP
\fB\-c\fR \fIfile\fR
.RS 4
Override the default
\fBcrypttab\fR
location\&.
.RE
.PP
\fB\-f\fR
.RS 4
Force potentially destructive mappings\&. For plain mappings (which are used with the
\fBswap\fR
and
\fBtmp\fR
options), there is a lot of potential to accidentally lose data\&. Because of this,
\fBcryptmount\fR
performs a check with
\fBblkid(8)\fR
to see if there is anything identifiable on
\fIdevice\fR\&. Use
\fB\-f\fR
to bypass this check\&.
.RE
.PP
\fB\-w\fR \fInum\fR
.RS 4
Time (in seconds) to wait for
\fIdevice\fR
if it is not already available\&. If
\fBudevd(8)\fR
is not running, then
\fBcryptmount\fR
does not bother to wait and this option is a no\-op\&. This also affects the wait time for
\fIkeydevice\fR
if your key is a block device or a file on a block device\&.
.RE
.PP
\fB\-n\fR
.RS 4
Dry run, useful with
\fB\-v\fR
to see how
\fBcryptsetup\fR
will be called\&.
.RE
.PP
\fB\-v\fR
.RS 4
Increase verbosity\&. This prints the commands which are being called (eg:
\fBcryptsetup\fR,
\fBmkswap\fR)\&.
.RE
.PP
\fB\-q\fR
.RS 4
Decrease verbosity\&.
.RE
.PP
\fB\-h\fR
.RS 4
Print a short usage message and exit\&.
.RE
.PP
\fB\-o\fR \fIoptions\fR
.RS 4
An options list with items such as
\fBswap\fR,
\fBcipher\fR, etc\&. This may be given multiple times with a cumulative effect\&. See
\fBcrypttab(5)\fR
for the full syntax
\fIoptions\fR\&.
.RE
.PP
\fB\-O\fR \fIfilters\fR
.RS 4
Similar to
\fIoptions\fR, this is used to manipulate which
\fIvolumes\fR
are used with
\fI\-L\fR
and with
\fI\-M\fR/\fI\-U\fR
without arguments\&. If an option is present in
\fIfilters\fR, then the
\fIvolume\fR
in
\fBcrypttab\fR
must contain the option\&. For example
\fB\-O swap,size\fR
matches all
\fIvolumes\fR
with the
\fBswap\fR
option
\fBand\fR
any
\fBsize=\fR\fIsize\fR
option; or
\fB\-O swap,size=512\fR
matches only those
\fIvolumes\fR
with the
\fBswap\fR
option and specifically
\fBsize=512\fR\&.
.sp
A filter option may also be negated by prefixing it with a
\fB!\fR\&. For example,
\fB\-O swap,!size\fR
includes all
\fIvolumes\fR
with the
\fBswap\fR
option but
\fBwithout\fR
the
\fIsize\fR
option\&. There is a built\-in filter
\fB!noauto\fR\&.
.sp
Filters are especially useful with
\fB%\fR\fItag\fR
options\&. For example,
\fB\-O !%random\fR
can be used to map all
\fIvolumes\fR
which don\(cqt use
\fB/dev/urandom\fR
for a password and
\fB\-O %random\fR
to map the remainder once your system\(cqs random seed has been restored\&.
.sp
The
\fB\-O\fR
option has
\fBno effect\fR
when calling
\fBcryptmount\fR
in a way that does not use
\fBcrypttab\fR\&.
.RE
.SH "SEE ALSO"
.sp
\fBcrypttab\fR(5), \fBcryptsetup\fR(8)
.SH "AUTHORS"
.sp
Matt Monaco <dgbaley27@0x01b\&.net>


code:
$OpenBSD: patch-doc_xio_help,v 1.1 2014/04/24 15:17:08 sthen Exp $
--- doc/xio.help.orig	Sun Jun 23 07:16:48 2013
+++ doc/xio.help	Sat Apr 19 15:47:37 2014
@@ -4566,19 +4566,6 @@ must contain certificates in PEM format and their hash
 documentation)

-Option: openssl-egd=file
-Aliases: egd
-
-Type: FILENAME
-Option group: OPENSSL
-Phase: SPEC
-Platforms: (depends on openssl installation)
-
-On some systems, openssl requires an explicit source of random data. Specify
-the socket name where an entropy gathering daemon like egd provides random
-data, e.g. /dev/egd-pool.
-
-
 Option: openssl-pseudo
 Aliases: pseudo

$OpenBSD: patch-sslcls_c,v 1.2 2014/07/12 14:30:20 pascal Exp $
--- sslcls.c.orig	Sat Feb  8 20:23:33 2014
+++ sslcls.c	Sat Jul 12 16:01:25 2014
@@ -275,14 +275,6 @@ void sycSSL_free(SSL *ssl) {
    return;
 }

-int sycRAND_egd(const char *path) {
-   int result;
-   Debug1("RAND_egd(\"%s\")", path);
-   result = RAND_egd(path);
-   Debug1("RAND_egd() -> %d", result);
-   return result;
-}
-
 DH *sycPEM_read_bio_DHparams(BIO *bp, DH **x, pem_password_cb *cb, void *u) {
    DH *result;
    Debug4("PEM_read_bio_DHparams(%p, %p, %p, %p)",
@@ -319,7 +311,7 @@ int sycFIPS_mode_set(int onoff) {
 }
 #endif /* WITH_FIPS */

-#if OPENSSL_VERSION_NUMBER >= 0x00908000L
+#if (OPENSSL_VERSION_NUMBER >= 0x00908000L) && !defined(OPENSSL_NO_COMP)
 const COMP_METHOD *sycSSL_get_current_compression(SSL *ssl) {
    const COMP_METHOD *result;
    Debug1("SSL_get_current_compression(%p)", ssl);
$OpenBSD: patch-sslcls_h,v 1.2 2014/07/12 14:30:20 pascal Exp $
--- sslcls.h.orig	Sun Jun 23 08:16:48 2013
+++ sslcls.h	Sat Jul 12 15:59:58 2014
@@ -41,7 +41,6 @@ X509 *sycSSL_get_peer_certificate(SSL *ssl);
 int sycSSL_shutdown(SSL *ssl);
 void sycSSL_CTX_free(SSL_CTX *ctx);
 void sycSSL_free(SSL *ssl);
-int sycRAND_egd(const char *path);

 DH *sycPEM_read_bio_DHparams(BIO *bp, DH **x, pem_password_cb *cb, void *u);

@@ -49,7 +48,7 @@ BIO *sycBIO_new_file(const char *filename, const char

 int sycFIPS_mode_set(int onoff);

-#if OPENSSL_VERSION_NUMBER >= 0x00908000L
+#if (OPENSSL_VERSION_NUMBER >= 0x00908000L) && !defined(OPENSSL_NO_COMP)
 const COMP_METHOD *sycSSL_get_current_compression(SSL *ssl);
 const COMP_METHOD *sycSSL_get_current_expansion(SSL *ssl);
 const char *sycSSL_COMP_get_name(const COMP_METHOD *comp);
@@ -92,7 +91,6 @@ const char *sycSSL_COMP_get_name(const COMP_METHOD *co
 #define sycSSL_shutdown(s) SSL_shutdown(s)
 #define sycSSL_CTX_free(c) SSL_CTX_free(c)
 #define sycSSL_free(s) SSL_free(s)
-#define sycRAND_egd(p) RAND_egd(p)

 #define sycPEM_read_bio_DHparams(b,x,p,u) PEM_read_bio_DHparams(b,x,p,u)

$OpenBSD: patch-xio-openssl_c,v 1.2 2014/07/12 14:30:20 pascal Exp $
--- xio-openssl.c
+++ xio-openssl.c
@@ -108,7 +108,6 @@
 const struct optdesc opt_openssl_dhparam     = { "openssl-dhparam",     "dh",    OPT_OPENSSL_DHPARAM,     GROUP_OPENSSL, PH_SPEC, TYPE_FILENAME, OFUNC_SPEC };
 const struct optdesc opt_openssl_cafile      = { "openssl-cafile",     "cafile", OPT_OPENSSL_CAFILE,      GROUP_OPENSSL, PH_SPEC, TYPE_FILENAME, OFUNC_SPEC };
 const struct optdesc opt_openssl_capath      = { "openssl-capath",     "capath", OPT_OPENSSL_CAPATH,      GROUP_OPENSSL, PH_SPEC, TYPE_FILENAME, OFUNC_SPEC };
-const struct optdesc opt_openssl_egd         = { "openssl-egd",        "egd",    OPT_OPENSSL_EGD,         GROUP_OPENSSL, PH_SPEC, TYPE_FILENAME, OFUNC_SPEC };
 const struct optdesc opt_openssl_pseudo      = { "openssl-pseudo",     "pseudo", OPT_OPENSSL_PSEUDO,      GROUP_OPENSSL, PH_SPEC, TYPE_BOOL,     OFUNC_SPEC };
 #if OPENSSL_VERSION_NUMBER >= 0x00908000L
 const struct optdesc opt_openssl_compress    = { "openssl-compress",   "compress", OPT_OPENSSL_COMPRESS,  GROUP_OPENSSL, PH_SPEC, TYPE_STRING,   OFUNC_SPEC };
@@ -147,7 +146,7 @@
 static void openssl_conn_loginfo(SSL *ssl) {
    Notice1("SSL connection using %s", SSL_get_cipher(ssl));

-#if OPENSSL_VERSION_NUMBER >= 0x00908000L
+#if (OPENSSL_VERSION_NUMBER >= 0x00908000L) && !defined(OPENSSL_NO_COMP)
    {
       const COMP_METHOD *comp, *expansion;

@@ -722,7 +721,6 @@
    char *opt_dhparam = NULL;	/* file name of DH params */
    char *opt_cafile = NULL;	/* certificate authority file */
    char *opt_capath = NULL;	/* certificate authority directory */
-   char *opt_egd = NULL;	/* entropy gathering daemon socket path */
 #if OPENSSL_VERSION_NUMBER >= 0x00908000L
    char *opt_compress = NULL;	/* compression method */
 #endif
@@ -741,7 +739,6 @@
    retropt_string(opts, OPT_OPENSSL_CAPATH, &opt_capath);
    retropt_string(opts, OPT_OPENSSL_KEY, &opt_key);
    retropt_string(opts, OPT_OPENSSL_DHPARAM, &opt_dhparam);
-   retropt_string(opts, OPT_OPENSSL_EGD, &opt_egd);
    retropt_bool(opts,OPT_OPENSSL_PSEUDO, &opt_pseudo);
 #if OPENSSL_VERSION_NUMBER >= 0x00908000L
    retropt_string(opts, OPT_OPENSSL_COMPRESS, &opt_compress);
@@ -877,10 +874,6 @@
       }
    }

-   if (opt_egd) {
-      sycRAND_egd(opt_egd);
-   }
-
    if (opt_pseudo) {
       long int randdata;
       /* initialize libc random from actual microseconds */
@@ -1105,7 +1098,7 @@
       if (e == ((ERR_LIB_RAND<<24)|
 		(RAND_F_SSLEAY_RAND_BYTES<<12)|
 		(RAND_R_PRNG_NOT_SEEDED)) /*0x24064064*/) {
-	 Error("too few entropy; use options \"egd\" or \"pseudo\"");
+	 Error("too few entropy; use option \"pseudo\"");
 	 stat = STAT_NORETRY;
       } else {
 	 Msg2(level, "%s(): %s", funcname, ERR_error_string(e, buf));
$OpenBSD: patch-xio-openssl_h,v 1.1 2014/04/24 15:17:08 sthen Exp $
--- xio-openssl.h.orig	Sun Jun 23 07:16:48 2013
+++ xio-openssl.h	Sat Apr 19 15:58:21 2014
@@ -21,7 +21,6 @@ extern const struct optdesc opt_openssl_key;
 extern const struct optdesc opt_openssl_dhparam;
 extern const struct optdesc opt_openssl_cafile;
 extern const struct optdesc opt_openssl_capath;
-extern const struct optdesc opt_openssl_egd;
 extern const struct optdesc opt_openssl_pseudo;
 #if OPENSSL_VERSION_NUMBER >= 0x00908000L
 extern const struct optdesc opt_openssl_compress;
$OpenBSD: patch-xioopts_c,v 1.1 2014/04/24 15:17:08 sthen Exp $
--- xioopts.c.orig	Sun Mar  9 14:51:39 2014
+++ xioopts.c	Sat Apr 19 15:43:29 2014
@@ -409,7 +409,6 @@ const struct optname optionnames[] = {
 #ifdef ECHOPRT
 	IF_TERMIOS("echoprt",	&opt_echoprt)
 #endif
-	IF_OPENSSL("egd",	&opt_openssl_egd)
 	IF_ANY    ("end-close",	&opt_end_close)
 	IF_TERMIOS("eof",	&opt_veof)
 	IF_TERMIOS("eol",	&opt_veol)
@@ -1098,7 +1097,6 @@ const struct optname optionnames[] = {
 	IF_OPENSSL("openssl-compress",	&opt_openssl_compress)
 #endif
 	IF_OPENSSL("openssl-dhparam",	&opt_openssl_dhparam)
-	IF_OPENSSL("openssl-egd",	&opt_openssl_egd)
 #if WITH_FIPS
 	IF_OPENSSL("openssl-fips",	&opt_openssl_fips)
 #endif
$OpenBSD: patch-xioopts_h,v 1.1 2014/04/24 15:17:08 sthen Exp $
--- xioopts.h.orig	Sun Jun 23 07:16:48 2013
+++ xioopts.h	Sat Apr 19 15:55:57 2014
@@ -477,7 +477,6 @@ enum e_optcode {
    OPT_OPENSSL_COMPRESS,
 #endif
    OPT_OPENSSL_DHPARAM,
-   OPT_OPENSSL_EGD,
    OPT_OPENSSL_FIPS,
    OPT_OPENSSL_KEY,
    OPT_OPENSSL_METHOD,


code:
--- sox-14.4.1.org/src/formats.c	2013-06-01 17:38:31.738000003 +0000
+++ sox-14.4.1/src/formats.c	2013-06-01 17:38:49.815000003 +0000
@@ -417,7 +417,6 @@
   /* To fix this #error, either simply remove the #error line and live without
    * file-type detection with pipes, or add support for your compiler in the
    * lines above.  Test with cat monkey.wav | ./sox --info - */
-  #error FIX NEEDED HERE
   #define NO_REWIND_PIPE
   (void)fp;
 #endif


code:
#!/bin/sh
# TODO: setuprw: copy files to a temporary place to install new packages and
#                  create new squashfs (something like do_chroot, but copy instead
#                  of mounting the squashfs
#       chroot: install_chroot
#                echo "/tmp/boot/squash-tool install $dev $size $rwfs $imgsize" | do_chroot
#       release: make a squash without running prereqs (make chroot rw)
#       src at install is by default missing tarballs and build dirs, make this configurable
#       fix infinite symlink loops in filesystem so copyrw doesn't need to dereference symlinks

sigs="SIGTERM SIGHUP SIGINT SIGQUIT SIGKILL SIGABRT SIGTSTP SIGTTIN SIGTTOU SIGEXIT ERR"
remove=""
mounts=""
loops=""
cryptlst=""

#transforms a string to hex
toelem() {
  local arg="${1:-}"
  [ -z "$arg" ] && return 1
  echo -n $arg |od -A n -t x1 |sed 's/ /_/g' |tr -d '\n'
}

#from hex back to string
fromelem() {
  local arg="${1:-}"
  [ -z "$arg" ] && return 1
  echo -e "$(echo -n $arg |sed -r 's,_,\\x,g')"
}

#space separated list of hex encoded string
push() {
  local list="${1:-}"
  local elem="${2:-}"
  [ -z "$elem" ] && return 1
  echo "$(toelem $elem) $list"
}

pop() { #TODO: if not element?
  local list="${1:-}"
  [ -z "$list" ] && return 1
  local elem="${2:-}"
  [ -z "$elem" ] && return 1
  local e="$(toelem $elem)"
  echo "$list" |sed -r "s,(^| )$e(|:|[^ ]+)?(\$| ),\3,"
}

last() {
  local list="${1:-}"
  fromelem $(echo "$list" |sed -r 's,(^|.* )([^ ]+)$,\2,g')
}

#lists for cleaning up on error/trap/finish
push_remove() {
  local elem="${1:-}"
  [ -z "$elem" ] && return 1
  remove=$(push "$remove" "$elem")
}

pop_remove() {
  local elem="${1:-}"
  [ -z "$elem" ] && return 1
  rm -rf "$elem"
  remove=$(pop "$remove" "$elem")
}

last_remove() {
  last "$remove"
}

push_mounts() {
  local elem="${1:-}"
  [ -z "$elem" ] && return 1
  mounts=$(push "$mounts" "$elem")
}

pop_mounts() {
  local elem="${1:-}"
  [ -z "$elem" ] && return 1
  sync
  if ! umount $elem; then
    if ! umount -f $elem; then
      if ! umount -l $elem; then
        mounts=$(pop "$mounts" "$elem")
        mounts=$(push "$mounts" "$elem")
        reloop
        return 1
      fi
    fi
  fi
  mounts=$(pop "$mounts" "$elem")
  reloop
}

last_mounts() {
  last "$mounts"
}

push_loops() {
  local lo="${1:-}"
  [ -z "$lo" ] && return 1
  local path="${2:-}"
  [ -z "$path" ] && return 1
  loops=$(push "$loops" "$lo|:|$path")
  sync
}

reloop() {
  local lo=""
  for lo in $loops; do
    local dev=$(fromelem "$lo" |sed 's,|:|.*,,g')
    local img=$(fromelem "$lo" |sed 's,.*|:|,,g')
    if ! losetup |grep -q "$dev"; then
      losetup "$dev" "$img"
      partx -d "$dev"
      partx -a "$dev"
      echo "Had to reloop $dev for $img"
    fi
  done
}

pop_loops() {
  local lo="${1:-}"
  [ -z "$lo" ] && return 1
  sync
  partx -d "$lo"
  losetup -d "$lo"
  loops=$(pop "$loops" "$lo")
}

last_loops() {
  last "$loops" |sed 's,|:|.*,,g'
}

push_crypt() {
  local elem="${1:-}"
  [ -z "$elem" ] && return 1
  cryptlst=$(push "$cryptlst" "$elem")
}

pop_crypt() {
  local elem="${1:-}"
  [ -z "$elem" ] && return 1
  if ! cryptsetup luksClose $elem; then
    if ! cryptsetup luksClose $elem; then
      cryptlst=$(pop "$cryptlst" "$elem")
      return 1
    fi
  fi
  cryptlst=$(pop "$cryptlst" "$elem")
}

last_crypt() {
  last "$cryptlst"
}

cleanup() {
  set +o errexit
  for sig in $sigs; do
    trap - $sig &>/dev/null
  done
  set +o pipefail
  set +o nounset
  while [ ! -z "$(last_mounts)" ]; do
    local e="$(last_mounts)"
    pop_mounts "$e" || pop_mounts "$e" || mounts=$(pop "$mounts" "$e")
  done
  while [ ! -z "$(last_crypt)" ]; do
    local e="$(last_crypt)"
    pop_crypt "$e"
  done
  while [ ! -z "$(last_loops)" ]; do
    local e="$(last_loops)"
    pop_loops "$e"
  done
  while [ ! -z "$(last_remove)" ]; do
    local e="$(last_remove)"
    pop_remove "$e"
  done
}

fail() {
  echo "Failure, cleaning up..."
  cleanup
  echo "$@"
  if [ -e /proc/sys/kernel/grsecurity ]; then
    echo 'If the script behaves weirdly or fails for no apparent reason'
    echo 'Make sure you disable chroot restrictions while the script is running'
    echo '(check dmesg for grsec errors)'
    echo 'quickfix: cd /proc/sys/kernel/grsecurity'
    echo '  for i in chroot_deny_*; do echo 0 > $i; done'
    echo '  echo 0 > chroot_restrict_nice'
  fi
  exit 1
}

usage() {
  echo "Usage: $0 chroot boot_dir"
  echo "Usage: $0 tarball dst.tar.xz (source|)"
  echo "Usage: $0 install device_path fat_size (n|rw_type [key_part])"
  echo "Usage: $0 install image_path fat_size (n|rw_type image_size [key_part])"
  echo "  rw_type can be btrfs; only rw is encrypted"
  echo "Usage: $0 in_chroot (install|tarball)..."
  echo "Usage: $0 mkinitramfs dst_initramfs"
  echo "Usage: $0 srctar dst.tar.xz do_tar_build (source_root|)"
  echo "  do_tar_build: whether to include tarballs and build dirs. defaults to no."
  echo "Usage: $0 update source_dir (boot_partition|boot_device) [key_part]"
  cleanup
  exit 1
}

setuptraps() {
  for sig in $sigs; do
    trap "fail Trapped signal $sig" $sig &>/dev/null
  done
  set -o pipefail
  set -o errexit
  set -o nounset
}

mksubvol() {
  local dev="${1:-}"
  local subname="${2:-}"
  local tmp="$(mktemp -d)"
  push_remove "$tmp"
  mount "$dev" "$tmp"
  push_mounts "$tmp"
  if [ ! -d "$tmp"/"$subname" ]; then
    btrfs subvolume create "$tmp"/"$subname"
  fi
  pop_mounts "$tmp"
  pop_remove "$tmp"
}

handle_fdisk() { #TODO: this is fugly. bug in busybox?
  local dev="${1:-}"
  [ -z "$dev" ] && return 1
  local fail=0
  local tmp="$(mktemp)"
  push_remove "$tmp"
  fdisk "$dev" 2> "$tmp" > /dev/null || fail=1
  if [ $fail -eq 1 ]; then
    if [ "$(cat $tmp |wc -l)" = "1" ]; then
      if egrep -q '^fdisk: WARNING: rereading partition table failed, kernel still uses old table: Invalid argument$' "$tmp"; then
        fail=0
      fi
    fi
  fi
  pop_remove "$tmp"
  return $fail
}

getuuid() {
  local part="${1:-}"
  [ -z "$part" ] && return 1
  blkid $part |sed -r 's,.*UUID="([^"]+)".*,\1,g'
}

runprereqs() {
  local src="${1:-}"
  if [ -z "${src}" ]; then
    src="/"
  elif [ "$(dirname ${src})" = "/" ]; then
    src="/"
  elif [ ! -d "${src}" ]; then
    return 1
  else
    mount -t proc procfs "${src}"/proc
    push_mounts "${src}"/proc
    mount -t sysfs sysfs "${src}"/sys
    push_mounts "${src}"/sys
    mount --bind /bin "${src}"/bin
    push_mounts "${src}"/bin
  fi
  (
    cd "${src}"
    for i in etc/service/*/run; do
      if [ ! -e "$(dirname $i)"/down ]; then
        chroot . /$i --prereqs || fail "Failed to run prereqs for $i"
      fi
    done
  )
  if [ "$src" != "/" ]; then
    pop_mounts "${src}"/bin
    pop_mounts "${src}"/sys
    pop_mounts "${src}"/proc
  fi
}

mktar_src() {
  local dst="${1:-}"
  [ -z "$dst" ] && return 1
  local dobuild="${2:-}"
  local src="${3:-}"
  if [ -z "${src}" ]; then
    src="/"
  elif [ ! -d "${src}" ]; then
    return 1
  fi
  local exclude='./tarballs/ ./build/'
  local tmp="$(mktemp)"
  push_remove "$tmp"
  if [ "$dobuild" != "yes" ]; then
    for e in $exclude; do
      echo "$e" >> "$tmp"
    done
  fi
  tar cJf "$dst" -X "$tmp" -C "${src}"/src .
  pop_remove "$tmp"
}

mksquash() {
  local dst="${1:-}"
  [ -z "$dst" ] && return 1
  local src="${2:-}"
  if [ -z "${src}" ]; then
    src="/"
  elif [ ! -d "${src}" ]; then
    return 1
  fi
  local exclude="proc sys dev boot tmp var/tmp src"
  rm -f "$dst"
  runprereqs "${src}"
  mkdir -p "${src}"/var/run "${src}"/rw
  set -f
  (
    cd "${src}"
    mksquashfs . "$dst" \
      -p 'bin/su m 4755 root root' -wildcards \
      -e $(echo $exclude |sed -r "s,([^ ]+),\1/**,g")
  )
  set +f
}

mkinitramfs() {
  local dst="${1:-}"
  [ -z "$dst" ] && return 1
  local src="${2:-}"
  if [ -z "${src}" ]; then
    src="/"
  elif [ ! -d "${src}" ]; then
    return 1
  fi
  local tmp=$(mktemp -d)
  push_remove $tmp
  (
    cd "$tmp"
    mkdir -p initramfs/bin initramfs/boot initramfs/newroot \
        initramfs/sbin initramfs/proc initramfs/sys initramfs/etc \
        initramfs/lib/modules initramfs/dev
    cp -L "${src}"/lib/libc.so initramfs/lib
    cp -L "${src}"/lib/ld-musl-x86_64.so.* initramfs/lib
    cp -L "${src}"/lib/libcryptsetup.* initramfs/lib
    cp -L "${src}"/lib/libpopt.* initramfs/lib
    cp -L "${src}"/lib/libdevmapper.* initramfs/lib
    cp -L "${src}"/lib/libssl.* initramfs/lib
    cp -L "${src}"/lib/libcrypto.* initramfs/lib
    cp -L "${src}"/opt/busybox/bin/busybox initramfs/bin
    ( cd initramfs/bin; ln -s busybox sh )
    mknod -m 622 initramfs/dev/console c 5 1
    mknod -m 622 initramfs/dev/tty0 c 4 0

    cp -L "${src}"/bin/fsck* initramfs/bin
    cp -L "${src}"/src/KEEP/initramfs.init initramfs/init
    cp -L -f "${src}"/etc/mdev.conf initramfs/etc/mdev.conf
    cp -L -f "${src}"/etc/passwd initramfs/etc/passwd
    cp -L -f "${src}"/etc/group initramfs/etc/group
    cp -L -f "${src}"/etc/fstab initramfs/etc/fstab
    cp -L "${src}"/bin/btrfs.static initramfs/bin/btrfs
    cp -L "${src}"/bin/mkfs.btrfs.static initramfs/bin/mkfs.btrfs
    cp -L "${src}"/bin/btrfs-zero-log.static initramfs/bin/btrfs-zero-log
    cp -L "${src}"/bin/cryptsetup initramfs/bin/cryptsetup
    if [ -e "${src}"/lib/modules/"$(uname -r)" ]; then
#FIXME: this is fugly
      mkdir -p initramfs/lib/modules/"$(uname -r)"
      (
        cd "${src}"/lib/modules/"$(uname -r)"
        for md in *; do
          if [ "$md" != "source" ]; then
            if [ "$md" != "build" ]; then
              echo "$md"
            fi
          fi
        done
      ) |while read md; do
        cp -L -a "${src}"/lib/modules/"$(uname -r)"/"$md" initramfs/lib/modules/"$(uname -r)"
      done
    elif [ "$(ls -1 ${src}/lib/modules |wc -l)" = "1" ]; then
      moddir="${src}"/lib/modules/*
      mkdir -p initramfs/"$moddir"
      (
        cd $moddir
        for md in *; do
          if [ "$md" != "source" ]; then
            if [ "$md" != "build" ]; then
              echo "$md"
            fi
          fi
        done
      ) |while read md; do
        cp -L -a $moddir/"$md" initramfs/"$moddir"
      done
    fi
    chmod +x initramfs/init
    cd initramfs
    find . | cpio -H newc -o > "$dst"
  )
  pop_remove "$tmp"
}

mkinitramfsgz() {
  local dst="${1:-}"
  [ -z "$dst" ] && return 1
  local src="${2:-}"
  if [ -z "${src}" ]; then
    src="/"
  elif [ ! -d "${src}" ]; then
    return 1
  fi
  local tmp="$(mktemp)"
  push_remove "$tmp"
  mkinitramfs "$tmp" "${src}"
  gzip --stdout "$tmp" > "$dst"
  pop_remove "$tmp"
}

mksyslinuxcfg() {
  local dst="${1:-}"
  [ -z "$dst" ] && return 1
  local bootmedia="${2:-}"
  local kuuid="${3:-}"
  local part=""
  local part_id=""
  if [ -z "$bootmedia" ]; then
    part="/dev/sda1"
  elif [ -b "$bootmedia"p1 ]; then
    part_id=$(getuuid ${bootmedia}p1)
  elif [ -b "$bootmedia" ]; then
    part_id=$(getuuid ${bootmedia})
  fi
  if [ -z "$part" ]; then
    if [ -z "$part_id" ]; then
      if [ ! -z "$bootmedia" ]; then
        part="$bootmedia"
      else
        return 1
      fi
    fi
  fi
  (
    echo "UI menu.c32"
    echo "PROMPT 0"
    echo "TIMEOUT 100"
    echo "DEFAULT default"
    for initramfs in /boot/*.cpio.gz; do
      fs=$(basename $initramfs)
      kernel=$(echo $fs |sed -r "s,\.cpio\.gz,,g")
      if [ ! -e /boot/"$kernel" ]; then
        continue
      fi
      echo "LABEL $kernel"
      echo "      MENU LABEL $kernel"
      echo "      KERNEL /$kernel"
      echo "      INITRD /$kernel.cpio.gz"
      local append="      APPEND"
      if [ -z "$part_id" ]; then
        append="$append boot=$part"
      else
        append="$append boot=UUID=$part_id"
      fi
      if [ -z "$kuuid" ]; then
        append="$append sqsh_root=$kernel.sqsh.img quiet"
      else
        append="$append sqsh_root=$kernel.sqsh.img keysdev=$kuuid quiet"
      fi
      echo "$append"
    done
  ) > $dst
}

copy_syslinux() {
  local menumods="menu.c32 libutil.c32"
  for i in ldlinux.c32 $menumods; do
    cp /lib/syslinux/bios/$i /boot
  done
  if [ -d /lib/syslinux/efi64 ]; then
    mkdir -p /boot/EFI/BOOT
    for i in ldlinux.e64 $menumods; do
      cp /lib/syslinux/efi64/$i /boot/EFI/BOOT
    done
    cp /lib/syslinux/efi64/syslinux.efi /boot/EFI/BOOT/bootx64.efi
  elif [ -d /lib/syslinux/efi32 ]; then
    mkdir -p /boot/EFI/BOOT
    for i in ldlinux.e32 $menumods; do
      cp /lib/syslinux/efi32/$i /boot/EFI/BOOT
    done
    cp /lib/syslinux/efi32/syslinux.efi /boot/EFI/BOOT/bootia32.efi
  fi
  if [ -e /boot/EFI/BOOT/ ]; then
    echo "INCLUDE /syslinux.cfg" > /boot/EFI/BOOT/syslinux.cfg
  fi
}

cryptpart() {
  local part="${1:-}"
  local keysdir="${2:-}"
  local dmname="${3:-}"
  [ -z "$dmname" ] && return 1
  [ -d "$keysdir" ] || return 1
  [ -b "$part" ] || return 1
  local keyfile="$keysdir"/LuksKey
  for i in $(seq 0 7); do
    dd if=/dev/urandom of="$keyfile"$i bs=1024 count=4
  done
  cryptsetup luksFormat -q --key-file="$keyfile"0 -c aes-xts-plain64 -s 512 -h sha512 -i 10000 --use-random -S 0 $part || return 1
#this makes the partition more robust
  for i in $(seq 1 7); do
    cryptsetup luksAddKey -q --key-file="$keyfile"0 -S $i $part "${keyfile}${i}" || return 1
  done
  local partid=$(getuuid $part)
  for i in $(seq 0 7); do
    mv "$keysdir"/LuksKey$i "$keysdir"/"$partid"_LuksKey$i
  done
  keyfile="$keysdir"/"$partid"_LuksKey0
  cryptsetup luksHeaderBackup $part --header-backup-file "$keysdir"/"$partid"_luksHeaderBackup
  cryptsetup luksOpen -q --key-file=$keyfile -S 0 $part $dmname || return 1
  [ -b /dev/mapper/"$dmname" ] || return 1
}

wipeptable() {
  local dev="${1:-}"
  [ -z "$dev" ] && return 1
  (
    echo "o"
    echo "w"
  ) | handle_fdisk "$dev" || fail "Failed to wipe partition table on device $dev"
  sync
  partx -d "$dev"
  return 0
}

addpart() {
  local dev="${1:-}"
  [ -z "$dev" ] && return 1
  local type="${2:-}"
  [ -z "$type" ] && return 1
  local boot="${3:-}"
  local size="${4:-}"
  local label="${5:-}"
  local keysdir="${6:-}"
  local dmname="${7:-}"
  local partnum=$(($(fdisk -l $dev |egrep ^$dev |wc -l)+1))
  (
    echo "n"
    echo "p"
    echo "$partnum"
    echo ""
    if [ -z "$size" ]; then
      echo ""
    else
      echo "+$size"
    fi
    echo "t"
    if [ "$partnum" != 1 ]; then
      echo "$partnum"
    fi
    case "$type" in
      "vfat") echo "b";;
      "btrfs") echo "83";;
      "crypt") echo "fd";;
    esac
    if [ "$boot" = "boot" ]; then
      echo "a"
      echo "$partnum"
    fi
    echo "w"
  ) | handle_fdisk "$dev" || fail "Failed to create partition #$partnum device $dev"
  sync
  sleep 2
  if ! partx -a "$dev"; then
    partx -d "$dev"
    partx -a "$dev"
  fi
  sleep 2
  if [ -b "$dev""$partnum" ]; then
    local p="$dev""$partnum"
  elif [ -b "$dev"p"$partnum" ]; then
    local p="$dev"p"$partnum"
  else
    return 1
  fi
  case "$type" in
    "vfat") mkfs."$type" "$p" &> /dev/null || fail "Failed to create fs $type on $p"
            [ -z "$label" ] && label="sbtg-boot"
            dosfslabel "$p" "$label";;
    "btrfs") [ -z "$label" ] && label="sbtg-rw"
             mkfs."$type" -f -L "$label" "$p";;
    "crypt") cryptpart "$p" "$keysdir" "$dmname" || fail "Can not set up encryption"
             [ -z "$label" ] && label="sbtg-rw"
             mkfs.btrfs -f -L "$label" /dev/mapper/"$dmname";;
  esac
  local uuid="$(getuuid ${p})"
  echo "$uuid"
  sync
}

installboot() {
  local src="${1:-}"
  local fatpart="${2:-}"
  local kuuid="${3:-}"
  [ -z "$fatpart" ] && return 1
  local bdir=""
  local tmp="$(mktemp -d)"
  push_remove $tmp
  local dev=$(echo $fatpart |sed 's,[0-9]$,,g')
  if [ ! -b "$dev" ]; then
    dev=$(echo "$dev" |sed 's,.$,,g')
    if [ ! -b "$dev" ]; then
      return 1
    fi
  fi
  local bootuuid=$(getuuid $fatpart)
  local rwpart=$(findfs "LABEL=${bootuuid}-rw" || echo -n '')
  mkdir -p "$tmp"/mount/boot "$tmp"/mount/bootstore
  if ! mount -t vfat "$fatpart" "$tmp"/mount/boot; then
    bdir=$(egrep "^$fatpart " /proc/mounts |awk '{print $2}')
    mount -o remount,rw "$bdir"
    mount --bind "$bdir" "$tmp"/mount/boot
  fi
  push_mounts "$tmp"/mount/boot
  cp -a "$src"/default "$tmp"/mount/boot
  if [ -e "$src"/default.cpio.gz ]; then
    cp -a "$src"/default.cpio.gz "$tmp"/mount/boot
  fi
  if [ ! -e "$tmp"/mount/boot/default ]; then
    cp /boot/vmlinuz "$tmp"/mount/boot/default || return 1
  fi
  pop_mounts "$tmp"/mount/boot
  if [ ! -z "$bdir" ]; then
    mount -o remount,ro $bdir
  fi
  dd conv=notrunc if=/lib/syslinux/bios/mbr.bin of="$dev" || return 1
  sync
  if [ ! -z "$bdir" ]; then
    mount -o remount,rw $bdir
    case "$bdir" in
      /boot|/boot/) ;;
      *)
        mount --bind "$bdir" /boot
        push_mounts /boot
        ;;
    esac
  else
    mount -t vfat "$fatpart" /boot || return 1
    push_mounts /boot
  fi
  copy_syslinux || return 1
  syslinux -i "$fatpart" || return 1
  if [ ! -e /boot/default.cpio.gz ]; then
    mkinitramfsgz /boot/default.cpio.gz || return 1
  fi
  local sqshdst=/boot
  if [ ! -z "$bdir" ]; then
    if [ -d "$bdir"/store ]; then
      sqshdst="$bdir"/store
    fi
  else
    if [ ! -z "$rwpart" ]; then
      mksubvol "$rwpart" sabotage
      mksubvol "$rwpart" sabotage/bootstore
      mount -o subvol=sabotage/bootstore "$rwpart" "$tmp"/mount/bootstore
      push_mounts "$tmp"/mount/bootstore
      sqshdst="$tmp"/mount/bootstore
    fi
  fi
  if [ ! -e "$sqshdst"/default.sqsh.img ]; then
    mksquash "$sqshdst"/default.sqsh.img || return 1
  fi
  if [ ! -e "$sqshdst"/src.tar.xz ]; then
    mktar_src "$sqshdst"/src.tar.xz || return 1
  fi
  rm -f /boot/syslinux.cfg
  mksyslinuxcfg /boot/syslinux.cfg "$fatpart" "$kuuid"
  sync
  mkdir -p /boot/store
  if [ ! -z "$bdir" ]; then
    mount -o remount,ro $bdir
    case "$bdir" in
      /boot|/boot/) ;;
      *)
        pop_mounts /boot
        ;;
    esac
  else
    pop_mounts /boot
  fi
  (
    echo 1
    echo 1
    echo y
  ) | dosfsck -a -r "$fatpart" || true
  dosfsck -a -r "$fatpart" || return 1
  sync
  if [ -z "$bdir" ]; then
    if [ ! -z "$rwpart" ]; then
      pop_mounts "$tmp"/mount/bootstore
    fi
  fi
  pop_remove "$tmp"
}

copyrw() {
  local part="${1:-}"
  [ -z "$part" ] && return 1
  local type="${2:-}"
  [ -z "$type" ] && return 1
  local tmp="$(mktemp -d)"
  push_remove "$tmp"
  local varw=""
  mkdir -p "$tmp"/mount/rw "$tmp"/mount/bootstore
  mksubvol "$part" sabotage
  mksubvol "$part" sabotage/rw-overlay
  mount -t "$type" -o subvol=sabotage/rw-overlay "$part" "$tmp"/mount/rw || return 1
  push_mounts "$tmp"/mount/rw
  mount -t "$type" -o subvol=sabotage/bootstore "$part" "$tmp"/mount/bootstore || return 1
  push_mounts "$tmp"/mount/bootstore
  mkdir -p "$tmp"/mount/squash
  mount -o loop -t squashfs "$tmp"/mount/bootstore/default.sqsh.img "$tmp"/mount/squash || return 1
  push_mounts "$tmp"/mount/squash
  cat /etc/fstab |while read fs mtpt type opt rest; do
    if echo "$opt" |grep -q "bind"; then
      fs=$(echo $fs |sed 's,^/rw/,,')
      if [ "$mtpt" = "/var" ]; then
        varw="$fs"
      fi
      if [ "$mtpt" = "/src" ]; then
        mkdir -p "$tmp"/mount/rw/"$fs"
        tar xf "$tmp"/mount/bootstore/src.tar.xz -C "$tmp"/mount/rw/"$fs"
      elif [ -d "$tmp"/mount/squash/"$mtpt" ]; then
        mkdir -p "$tmp"/mount/rw/"$fs"
        tar c -h -C "$tmp"/mount/squash/"$mtpt"/ . \
            |tar x -C "$tmp"/mount/rw/"$fs"
      elif [ -f "$tmp"/mount/squash/"$mtpt" ]; then
        mkdir -p "$tmp"/mount/rw/"$(dirname $fs)"
        cp -aL "$tmp"/mount/squash/"$mtpt" "$tmp"/mount/rw/"$fs"
      else
        mkdir -p "$tmp"/mount/rw/"$fs"
      fi
    fi
  done
  if [ ! -z "$varw" ]; then
    mkdir -p "$tmp"/mount/rw/$varw/spool/cron/crontabs "$tmp"/mount/rw/$varw/service "$tmp"/mount/rw/$varw/log "$tmp"/mount/rw/$varw/empty
    (
      cd "$tmp"/mount/squash/etc/service
    	for i in * ; do
    		mkdir -p "$tmp"/mount/rw/$varw/log/$i
    	done
    )
  fi
  sync
  pop_mounts "$tmp"/mount/squash
  pop_mounts "$tmp"/mount/rw
  pop_mounts "$tmp"/mount/bootstore
  pop_remove "$tmp"
}

mkimage_loop() {
  local img="${1:-}"
  [ -z "$img" ] && return 1
  local size="${2:-}"
  [ -z "$size" ] && return 1
  if ! dd if=/dev/zero of="$img" bs=1 count=0 seek="$size"; then
    fail "Could not create $img image"
  fi
  local lo="$(losetup -f)"
  losetup "$lo" "$img" || fail "Could not setup loop for $img image"
  echo "$lo"
}

do_install() {
  local dev="${1:-}"
  [ -z "$dev" ] && return 1
  local bsize="${2:-}"
  [ -z "$bsize" ] && return 1
  local rwfs="${3:-}"
  [ -z "$rwfs" ] && return 1
  local cryptkdev="${4:-}"
  local kuuid=""
  local tmp="$(mktemp -d)"
  push_remove "$tmp"
  wipeptable "$dev" || fail "Failed to wipe partition table of $dev"
  local uuid=$(addpart "$dev" vfat boot "$bsize" || fail "Failed to add fat partition boot of size $bsize to $dev")
  if [ -n "$cryptkdev" ]; then
    [ ! -x /bin/cryptsetup ] && fail 'Please install cryptsetup'
    kuuid=$(getuuid $cryptkdev)
    mkdir $tmp/kdir
    mount "$cryptkdev" "$tmp"/kdir
    push_mounts "$tmp"/kdir
    local cruuid=$(addpart "$dev" "crypt" '' '' "${uuid}-rw" "$tmp"/kdir sbtgrw || fail "Failed to add encrypted $rwfs partition rw to $dev")
    push_crypt "sbtgrw"
  elif [ "$rwfs" != "n" ]; then
    local rwuuid=$(addpart "$dev" "$rwfs" '' '' "${uuid}-rw" || fail "Failed to add $rwfs partition rw to $dev")
  fi

  if [ -b "$dev"1 ]; then
    boot_part="$dev"1
    rw_part="$dev"2
  elif [ -b "$dev"p1 ]; then
    boot_part="$dev"p1
    rw_part="$dev"p2
  else
    fail "Could not find boot partition"
  fi
  if [ -n "$cryptkdev" ]; then
    rw_part="/dev/mapper/sbtgrw"
  fi
  installboot /boot "$boot_part" "$kuuid" || fail "Failed to install boot partition $boot_part."
  if [ "$rwfs" != "n" ]; then
    if [ -b "$rw_part" ]; then
      mount -t vfat "$boot_part" /boot || return 1
      push_mounts /boot
      copyrw "$rw_part" "$rwfs" || fail "Failed to install rw partition $rw_part."
      pop_mounts /boot
    fi
  fi
}

installer() {
  local dev="${1:-}"
  [ -z "$dev" ] && usage
  local boot_size="${2:-}"
  [ -z "$boot_size" ] && usage
  local rwfs="${3:-}"
  [ -z "$rwfs" ] && usage
  size="${4:-}"
  local cryptkdev="${5:-}"

  if [ ! -b "$dev" ]; then
    if [ "$rwfs" = "n" ]; then
      size="$boot_size"
    else
      [ -z "$size" ] && usage
    fi
    img="$dev"
    dev=$(mkimage_loop "$img" "$size")
    push_loops "$dev" "$img"
  else
    cryptkdev="${4:-}"
  fi

  do_install "$dev" "$boot_size" "$rwfs" "$cryptkdev"
}

mkboottar() {
  local dst="${1:-}"
  [ -z "$dst" ] && return 1
  local src="${2:-}"
  if [ -z "${src}" ]; then
    src="/"
  elif [ ! -d "${src}" ]; then
    return 1
  fi
  local tmp="$(mktemp -d)"
  push_remove "$tmp"
  cp -a "${src}"/boot/System.map "$tmp"
  if [ ! -e "$tmp"/default.sqsh.img ]; then
    mksquash "$tmp"/default.sqsh.img "${src}"
  fi
  if [ ! -e "$tmp"/default.cpio.gz ]; then
    mkinitramfsgz "$tmp"/default.cpio.gz "${src}"
  fi
  if [ ! -e "$tmp"/default ]; then
    cp "${src}"/boot/vmlinuz "$tmp"/default
  fi
  if [ ! -e "$tmp"/syslinux.cfg ]; then
    mksyslinuxcfg  "$tmp"/syslinux.cfg
  fi
  mktar_src "$tmp"/src.tar.xz no "${src}"
  cp "$0" "$tmp"
  tar czf $dst -C "$tmp" .
  pop_remove "$tmp"
}

do_chroot() {
  local boot_dir="${1:-}"
  [ -z "$boot_dir" ] && return 1
  [ -e "$boot_dir"/default.sqsh.img ] || return 1
  local tmp="$(mktemp -d)"
  push_remove "$tmp"

  mount -o loop,ro -t squashfs "$boot_dir"/default.sqsh.img "$tmp"
  push_mounts "$tmp"

  mount -t proc procfs "$tmp"/proc
  push_mounts "$tmp"/proc

  mount -t sysfs sysfs "$tmp"/sys
  push_mounts "$tmp"/sys

  mount --bind /dev "$tmp"/dev
  push_mounts "$tmp"/dev

  mount -t tmpfs tmpfs "$tmp"/tmp
  push_mounts "$tmp"/tmp

  mkdir "$tmp"/tmp/boot
  push_remove "$tmp"/tmp/boot
  mount --bind "$boot_dir" "$tmp"/tmp/boot
  push_mounts "$tmp"/tmp/boot

  local tempboot="$(mktemp -d)"
  push_remove "$tempboot"
  mount --bind "$tempboot" "$tmp"/boot
  push_mounts "$tmp"/boot
  cp "$tmp"/tmp/boot/default "$tmp"/boot
  cp "$tmp"/tmp/boot/System.map "$tmp"/boot

  local srctmp="$(mktemp -d)"
  push_remove "$srctmp"

  mount --bind "$srctmp" "$tmp"/src
  push_mounts "$tmp"/src
  tar xf "$boot_dir"/src.tar.xz -C "$srctmp"

  echo "You are now in the chroot of the $boot_dir/default.sqsh.img image"
  echo "$boot_dir is /tmp/boot"
  chroot "$tmp" /bin/sh
  for mtpt in "$tmp"/dev "$tmp"/sys "$tmp"/proc "$tmp"/boot "$tmp"/tmp/boot "$tmp"/tmp "$tmp"/src; do
    pop_mounts "$mtpt"
  done
  pop_remove "$tmp"/tmp/boot
  pop_mounts "$tmp"
  pop_remove "$tempboot"
  pop_remove "$srctmp"
  pop_remove "$tmp"
}

in_chroot() {
  local boot="${1:-}"
  [ -z "$boot" ] && return 1
  shift
  local func="${1:-}"
  [ -z "$func" ] && return 1
  shift
  local out="${1:-}"
  [ -z "$out" ] && return 1
  shift
  local args="$@"
  local tmpout=/tmp/boot/"$(basename $out)"
  [ "$func" == "chroot" ] && return 1
  if [ -z "$args" ]; then
    echo "/tmp/boot/squash-tool $func $tmpout" | do_chroot "$boot"
  else
    echo "/tmp/boot/squash-tool $func $tmpout $args" | do_chroot "$boot"
  fi
  mv "$boot"/"$tmpout" "$out"
}

update() {
  local src="${1:-}"
  [ -z "$src" ] && return 1
  local bootdev="${2:-}"
  [ -z "$bootdev" ] && return 1
  local cryptkdev="${3:-}"
  local kuuid=""
  if [ -n "$cryptkdev" ]; then
    kuuid=$(getuuid $cryptkdev)
  fi
  local umount=true
  if [ -b "$bootdev" ]; then
    local bootdir="$(mktemp -d)"
    push_remove "$bootdir"
    local bootuuid=$(getuuid $bootdev)
    local rwpart=$(findfs "LABEL=${bootuuid}-rw" || echo -n '')
    mount "$bootdev" "$bootdir"
    push_mounts "$bootdir"
    if [ ! -z "$rwpart" ]; then
      mount -o subvol=sabotage/bootstore "$rwpart" "$bootdir"/store
      push_mounts "$bootdir"/store
    fi
  elif [ -d "$bootdev" ]; then
    local umount=false
    local bootdir="$(echo $bootdev |sed 's,/$,,g')"
    bootdev=$(egrep "^[^ ]+ +$bootdir/? " /proc/mounts |awk '{print $1}')
    local bootuuid=$(getuuid $bootdev)
    local rwpart=$(findfs "LABEL=${bootuuid}-rw" || echo -n '')
    mount -o remount,rw $bootdir
  else
    return 1
  fi
  if [ ! -z "$rwpart" ]; then
    mksubvol "$rwpart" /sabotage/prev
    local tmp=$(mktemp -d)
    push_remove "$tmp"
    mount -o subvol=sabotage "$rwpart" "$tmp"
    push_mounts "$tmp"
    if [ -e "$tmp"/bootstore ]; then
      btrfs subvolume delete "$tmp"/prev/bootstore || true
      btrfs subvolume snapshot "$tmp"/bootstore "$tmp"/prev/bootstore
    fi
    if [ -e "$tmp"/rw-overlay ]; then
      btrfs subvolume delete "$tmp"/prev/rw-overlay || true
      btrfs subvolume snapshot "$tmp"/bootstore "$tmp"/prev/rw-overlay
    fi
    pop_mounts "$tmp"
    pop_remove "$tmp"
  fi
  (
    cd "$bootdir"
    mv default old
    cp "$src"/default default
    mv default.cpio.gz old.cpio.gz
    cp "$src"/default.cpio.gz default.cpio.gz
    if [ ! -z "$rwpart" ]; then
      cd "$bootdir"/store
    fi
    mv default.sqsh.img old.sqsh.img
    mv src.tar.xz oldsrc.tar.xz
    if [ -d "$src"/store ]; then
      cp "$src"/store/default.sqsh.img default.sqsh.img
      cp "$src"/store/src.tar.xz src.tar.xz
    else
      cp "$src"/default.sqsh.img default.sqsh.img
      cp "$src"/src.tar.xz src.tar.xz
    fi
  )
  if $umount; then
    if [ ! -z "$rwpart" ]; then
      pop_mounts "$bootdir"/store
    fi
    pop_mounts "$bootdir"
    pop_remove "$bootdir"
  else
    mount -o remount,ro $bootdir
  fi
  installboot "$src" "$bootdev" "$kuuid"
  copyrw "$rwpart" btrfs
}

setuptraps
[ "$(id -u)" = "0" ] || fail "must be root"

[ "$(readlink /bin/sh)" = "dash" ] && \
  echo "this script is incompatible with dash. "\
       "Please use bash or busybox (dpkg-reconfigure dash)" && \
  exit 1

func="${1:-}"
[ -z "$func" ] && usage
shift

if [ "$func" = "chroot" ]; then
  type chroot || fail "Install chroot on host"
  bootdir="${1:-}"
  [ -z "$bootdir" ] && usage
  do_chroot "$bootdir"
  cleanup
  exit 0
fi

[ -e /src ] || fail "must run in sabotage (with source) environment"

([ ! -f /boot/vmlinuz ] && [ ! -f /boot/default ] )&& fail "Please install a kernel"
[ ! -x /bin/partx ] && fail 'Please install partx'
[ ! -x /bin/syslinux ] && fail 'Please install syslinux6'
[ ! -x /bin/mksquashfs ] && fail 'Please install squashfs-tools'
[ ! -x /bin/mkfs.vfat ] && fail 'Please install dosfstools'
[ ! -x /bin/blkid ] && fail 'Please install libblkid'
[ ! -x /bin/cpio ] && fail 'Please install cpio'

case "$func" in
  "install") installer "$@";; #TODO: efibootmgr
  "tarball") mkboottar "$@";;
  "in_chroot") in_chroot "$@";;
  "mkinitramfs") mkinitramfs "$@";;
  "update") update "$@";;
  "srctar") mktar_src "$@";;
  *) usage;;
esac

cleanup

path: KEEP/squash-tool


code:
--- squashfs4.2/squashfs-tools/pseudo.c
+++ squashfs4.2/squashfs-tools/pseudo.c
@@ -32,6 +32,7 @@
 #include <stdlib.h>
 #include <sys/types.h>
 #include <sys/wait.h>
+#include <sys/stat.h>

 #include "pseudo.h"


code:
#!/bin/rc
# ssam - stream interface to sam

flagfmt='n,e script,f sfile'
args='[ file ... ]'
if(! ifs=() eval `{getflags $*}){
	echo 'ssam [ -n ] [ -e script ] [ -f sfile ] [ file ...  ]'
	exit
}

if(~ $#flage 0 && ~ $#flagf 0) {
	if(~ $#* 0) {
		echo 'ssam [ -n ] [ -e script ] [ -f sfile ] [ file ...  ]'
		exit usage
	}
	flage=$1
	shift
}

if(~ $#TMPDIR 0)
	TMPDIR=/tmp
tmp=$TMPDIR/ssam.tmp.$USER.$pid
cat $* >$tmp

{
	# select entire file
	echo ',{'
	echo k
	echo '}'
	echo 0k

	# run scripts, print
	if(! ~ $#flagf 0)
		cat $flagf
	if(! ~ $#flage 0)
		echo $flage
	if(~ $#flagn 0)
		echo ,
} | sam -d $tmp >[2]/dev/null

rm -f $tmp

path: KEEP/ssam


code:
# sselp version
VERSION = 0.2

# Customize below to fit your system

# paths
PREFIX =
MANPREFIX = ${PREFIX}/share/man

X11INC = /usr/X11R6/include
X11LIB = /usr/X11R6/lib

# includes and libs
INCS = -I. -I/usr/include -I${X11INC}
LIBS = -L/usr/lib -lc -L${X11LIB} -lX11

# flags
CPPFLAGS = -DVERSION=\"${VERSION}\"
CFLAGS = -std=c99 -pedantic -Wall -Os ${INCS} ${CPPFLAGS}
LDFLAGS = -s ${LIBS}

# compiler and linker
CC = cc


code:
--- strace-4.8.org/process.c
+++ strace-4.8/process.c
@@ -91,6 +91,10 @@
 # include <asm/rse.h>
 #endif

+#ifdef __arm__
+#include <asm/ptrace.h>
+#endif
+
 #ifdef HAVE_PRCTL
 # include <sys/prctl.h>


code:
--- strace-4.8.org/process.c
+++ strace-4.8/process.c
@@ -55,19 +55,6 @@
 # endif
 #endif

-#ifdef HAVE_LINUX_PTRACE_H
-# undef PTRACE_SYSCALL
-# ifdef HAVE_STRUCT_IA64_FPREG
-#  define ia64_fpreg XXX_ia64_fpreg
-# endif
-# ifdef HAVE_STRUCT_PT_ALL_USER_REGS
-#  define pt_all_user_regs XXX_pt_all_user_regs
-# endif
-# include <linux/ptrace.h>
-# undef ia64_fpreg
-# undef pt_all_user_regs
-#endif
-
 #if defined(SPARC64)
 # define r_pc r_tpc
 # undef PTRACE_GETREGS
--- strace-4.8.org/resource.c
+++ strace-4.8/resource.c
@@ -360,6 +360,7 @@
 }
 #endif /* ALPHA */

+#include <sys/sysinfo.h>
 int
 sys_sysinfo(struct tcb *tcp)
 {