Bug#434875: cdebootstrap: Please consider adding support for ssh

2008-05-05 Thread Jörg Sommer
From 5b23544472bb59e5f3e4c0434700bce319b81693 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?J=C3=B6rg=20Sommer?= [EMAIL PROTECTED]
Date: Mon, 5 May 2008 18:37:43 +0200
Subject: [PATCH] Add new mirror scheme ssh://

---
 src/frontend/standalone/cdebootstrap.man |5 -
 src/frontend/standalone/main.c   |   21 +++--
 2 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/src/frontend/standalone/cdebootstrap.man 
b/src/frontend/standalone/cdebootstrap.man
index abe349a..1d3c951 100644
--- a/src/frontend/standalone/cdebootstrap.man
+++ b/src/frontend/standalone/cdebootstrap.man
@@ -6,7 +6,10 @@ cdebootstrap \- Bootstrap a Debian system
 [\fIOPTION\fR]... \fISUITE TARGET \fR[\fIMIRROR\fR]
 .SH DESCRIPTION
 \fBcdebootstrap\fR builds a basic Debian system of \fISUITE\fR (e.g. sarge, 
etch, lenny, sid) into \fITARGET\fR using the source specified in \fIMIRROR\fR.
-It supports http://, ftp:// and file:// URL and defaults to 
http://ftp.debian.org/debian.
+It supports http://, ftp://, ssh:// and file:// URL and defaults to 
http://ftp.debian.org/debian.
+The ssh:// scheme uses \fBcat\fR on the remote host to access the files.
+You have to setup a master connection and configure ssh to use it or use a
+key for authentication. No user interaction is possible.
 The complete log is saved as \fI/var/log/bootstrap.log\fR in the new system.
 .PP
 Mandatory arguments to long options are mandatory for short options too.
diff --git a/src/frontend/standalone/main.c b/src/frontend/standalone/main.c
index 304cd92..9288b7d 100644
--- a/src/frontend/standalone/main.c
+++ b/src/frontend/standalone/main.c
@@ -56,7 +56,13 @@
 const char *target_root;
 FILE *foreign_script;
 
-static enum { MIRROR_SCHEME_HTTP, MIRROR_SCHEME_FTP, MIRROR_SCHEME_FILE } 
mirror_scheme;
+static enum
+{
+MIRROR_SCHEME_HTTP,
+MIRROR_SCHEME_FTP,
+MIRROR_SCHEME_FILE,
+MIRROR_SCHEME_SSH
+} mirror_scheme;
 static char mirror_host[128];
 static char mirror_path[256];
 
@@ -125,6 +131,12 @@ int frontend_download (const char *source, const char 
*target)
 
 case MIRROR_SCHEME_FILE:
   snprintf (buf, sizeof buf, cp %s/%s %s, mirror_path, source, target);
+  break;
+
+case MIRROR_SCHEME_SSH:
+  snprintf (buf, sizeof buf, ssh -o BatchMode=yes %s 'cat %s/%s'  %s,
+mirror_host, mirror_path, source, target);
+  break;
   }
 
   ret = execute (buf);
@@ -148,6 +160,8 @@ static void check_mirror_scheme (const char **input)
 mirror_scheme = MIRROR_SCHEME_FTP;
   else if (!strncmp (*input, file, 4))
 mirror_scheme = MIRROR_SCHEME_FILE;
+  else if (!strncmp (*input, ssh, 3))
+mirror_scheme = MIRROR_SCHEME_SSH;
   else
 log_text (DI_LOG_LEVEL_ERROR, Invalid mirror: scheme not supported);
 
@@ -283,11 +297,14 @@ static int finish_etc (void)
   return 1;
   }
 
-  if (mirror_scheme == MIRROR_SCHEME_HTTP || mirror_scheme == 
MIRROR_SCHEME_FTP)
+  if (mirror_scheme == MIRROR_SCHEME_HTTP || mirror_scheme == 
MIRROR_SCHEME_FTP ||
+  mirror_scheme == MIRROR_SCHEME_SSH)
   {
 char *scheme = http;
 if (mirror_scheme == MIRROR_SCHEME_FTP)
   scheme = ftp;
+else if (mirror_scheme == MIRROR_SCHEME_SSH)
+  scheme = ssh;
 
 if (foreign_script)
   fprintf (foreign_script, \necho 'deb %s://%s%s %s main'  
/etc/apt/sources.list\n\n, scheme, mirror_host, mirror_path, suite_name);
-- 
1.5.5.1



signature.asc
Description: Digital signature http://en.wikipedia.org/wiki/OpenPGP


Bug#434875: cdebootstrap: Please consider adding support for ssh

2007-07-27 Thread Steffen Joeris
Package: cdebootstrap
Version: 0.4.3
Severity: wishlist

Hi mate

According to the manpage, cdebootstrap supports http,ftp and file. Apt
also has the option to use ssh (which I am forced to do). I would very
much appreciate to use cdebootstrap with it as well :)

Cheers
Steffen


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]