Merge lp:~sveinse/project-rootstock/apt-source-fix into lp:project-rootstock

Proposed by Svein Seldal
Status: Needs review
Proposed branch: lp:~sveinse/project-rootstock/apt-source-fix
Merge into: lp:project-rootstock
Diff against target: 172 lines (+56/-16)
2 files modified
rootstock (+34/-15)
rootstock.1 (+22/-1)
To merge this branch: bzr merge lp:~sveinse/project-rootstock/apt-source-fix
Reviewer Review Type Date Requested Status
Developers of the Rootstock rootfs builder tool Pending
Review via email: mp+47387@code.launchpad.net

Description of the change

Added --sources and --apt-upgrade command line options.

--sources allows the user to provide a custom sources.list on the target system. If the user wants to install a apt sources file with more than two entries, the --sources option can be used. If user provides a --sources file, the source parameters (--mirror, --components, --dist) will only be used by debootstrap for initial bringup, and the --extra-mirror option will be ignored.

--apt-upgrade adds a step on the target where "apt-get update" is run after debootstrap has run, but prior to installing the seeds. This ensures an updated system.

To post a comment you must log in.

Unmerged revisions

127. By Svein Seldal

Added --sources and --apt-upgrade to handle custom apt sources files

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'rootstock'
2--- rootstock 2010-08-04 23:20:39 +0000
3+++ rootstock 2011-01-25 12:37:02 +0000
4@@ -4,6 +4,7 @@
5 #
6 # Author: Oliver Grawert <ogra@canonical.com>
7 # Ricardo Salveti <ricardo.salveti@canonical.com>
8+# Svein Seldal <sveinse@seldal.com>
9 #
10 # This program is free software; you can redistribute it and/or
11 # modify it under the terms of the GNU General Public License as
12@@ -204,7 +205,11 @@
13 additional mirror to use
14 --no-root
15 run rootstock without requiring root access (slower as uses a full vm)
16-
17+--sources <filename>
18+ Use <filename> as target apt sources.list file
19+--apt-upgrade
20+ run apt-upgrade after bootstrapping. Useful if multple apt sources are provided
21+ with --sources or --extra-mirror
22 Examples:
23
24 Xubuntu-Desktop (as root): rootstock -f host -l user -p temppwd -i 2G -s xubuntu-desktop
25@@ -639,11 +644,6 @@
26 APT_FORCE="--allow-unauthenticated"
27 }
28
29-add_extra_mirror()
30-{
31- EXRA_MIRROR_CMD="echo \"deb ${EXTRAMIRROR} ${DIST} ${COMPONENTS}\" >>/etc/apt/sources.list"
32-}
33-
34 roll_tarball()
35 {
36 # create a rootfs tgz
37@@ -705,6 +705,9 @@
38 MIRROR="http://ports.ubuntu.com/ubuntu-ports"
39 COMPONENTS="main universe"
40
41+# User-specified sources file
42+USER_SOURCES=""
43+
44 # user-specified script
45 USER_SCRIPT=""
46
47@@ -730,6 +733,7 @@
48
49 PACKAGE_CLEANUP="apt-get clean"
50 PACKAGE_CLEANUP_SUB="${PACKAGE_CLEANUP}"
51+APT_UPGRADE=""
52 APT_UPDATE="apt-get update"
53 APT_FORCE=""
54 EXRA_MIRROR_CMD=""
55@@ -738,8 +742,8 @@
56 GETOPT=`getopt -o hf:l:p:n:i:g:m:c:t:x:d:q --long help,fqdn:,login:,\
57 password:,fullname:,seed:,imagesize:,manifest:,mirror:,components:,timezone:,\
58 kblayout:,kbmodel:,kbvariant:,kboptions:,locale:,keepimage,notarball,script:,\
59-serial:,doswap,swapsize:,dist:,quiet,kernel-image:,copy-package-cache,\
60-restore-package-cache,clean-package-cache,extra-mirror:,no-root,version \
61+serial:,sources:,doswap,swapsize:,dist:,quiet,kernel-image:,copy-package-cache,\
62+restore-package-cache,clean-package-cache,extra-mirror:,no-root,version,apt-upgrade \
63 -n "$PROGRAM" -- "$@"`
64 if [ $? != 0 ]; then usage; exit 1; fi
65 eval set -- "$GETOPT"
66@@ -842,6 +846,14 @@
67 SERIAL=1
68 shift 2
69 ;;
70+ --sources)
71+ USER_SOURCES="$2"
72+ shift 2
73+ ;;
74+ --apt-upgrade)
75+ APT_UPGRADE="apt-get upgrade -y"
76+ shift
77+ ;;
78 --doswap)
79 NOSWAP=""
80 shift
81@@ -1007,10 +1019,6 @@
82 restore_package_cache
83 fi
84
85-if [ "$EXTRAMIRROR" ];then
86- add_extra_mirror
87-fi
88-
89 # basic fstab
90 echo "proc /proc proc defaults 0 0" >$ROOTFS/etc/fstab
91 if [ "$KEEPIMAGE" ];then
92@@ -1089,9 +1097,6 @@
93
94 ${SWAPCMD}
95
96-echo "deb ${MIRROR} ${DIST} ${COMPONENTS}" >/etc/apt/sources.list
97-${EXRA_MIRROR_CMD}
98-
99 if [ "$RUNVM" ];then
100 ifconfig lo up
101 ifconfig eth0 up
102@@ -1113,6 +1118,7 @@
103 groupadd fuse || true
104
105 ${APT_UPDATE}
106+${APT_UPGRADE}
107
108 ${PACKAGE_CLEANUP}
109
110@@ -1171,6 +1177,19 @@
111
112 EOF
113
114+if [ "$USER_SOURCES" ]; then
115+ # Copy user provided sources file
116+ cp "$USER_SOURCES" "$ROOTFS/etc/apt/sources.list"
117+else
118+ # Use system default deb source
119+ echo "deb ${MIRROR} ${DIST} ${COMPONENTS}" >$ROOTFS/etc/apt/sources.list
120+
121+ # Add extra debsource
122+ if [ "$EXTRAMIRROR" ];then
123+ echo "deb ${EXTRAMIRROR} ${DIST} ${COMPONENTS}" >>${ROOTFS}/etc/apt/sources.list
124+ fi
125+fi
126+
127 # copy over user script
128 if [ "$USER_SCRIPT" ]; then
129 cp "$USER_SCRIPT" "$ROOTFS/rootstock-user-script"
130
131=== modified file 'rootstock.1'
132--- rootstock.1 2010-08-02 13:56:53 +0000
133+++ rootstock.1 2011-01-25 12:37:02 +0000
134@@ -1,5 +1,5 @@
135 .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.38.2.
136-.TH ROOTSTOCK "1" "August 2010" "rootstock 0.1.99.4" "User Commands"
137+.TH ROOTSTOCK "1" "January 2011" "rootstock 0.1.99.4" "User Commands"
138 .SH NAME
139 rootstock \- manual page for rootstock 0.1.99.4
140 .SH SYNOPSIS
141@@ -167,6 +167,15 @@
142 \fB\-\-no\-root\fR
143 .IP
144 run rootstock without requiring root access (slower as uses a full vm)
145+.PP
146+\fB\-\-sources\fR <filename>
147+.IP
148+Use <filename> as target apt sources.list file
149+.PP
150+\fB\-\-apt\-upgrade\fR
151+.IP
152+run apt\-upgrade after bootstrapping. Useful if multple apt sources are provided
153+with \fB\-\-sources\fR or \fB\-\-extra\-mirror\fR
154 .SH EXAMPLES
155
156 Xubuntu\-Desktop (as root): rootstock \fB\-f\fR host \fB\-l\fR user \fB\-p\fR temppwd \fB\-i\fR 2G \fB\-s\fR xubuntu\-desktop
157@@ -186,3 +195,15 @@
158 .br
159 This is free software: you are free to change and redistribute it.
160 There is NO WARRANTY, to the extent permitted by law.
161+.SH "SEE ALSO"
162+The full documentation for
163+.B rootstock
164+is maintained as a Texinfo manual. If the
165+.B info
166+and
167+.B rootstock
168+programs are properly installed at your site, the command
169+.IP
170+.B info rootstock
171+.PP
172+should give you access to the complete manual.

Subscribers

People subscribed via source and target branches