Skip to content

Commit df11ebe

Browse files
committed
Add a --no-update flag to disable the "yum update" call
This is useful for: - avoiding network transfers when just a build is required (though this is only preliminary, and needs some support to use cached breqs) - people working through their phone connection and willing to spare some data transfer (and yes, cached breqs will be a boon there too) Signed-off-by: Yann Dirson <yann.dirson@vates.tech>
1 parent 1653a82 commit df11ebe

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/xcp_ng_dev/cli.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ def add_common_args(parser):
5656
parser.add_argument('--disablerepo',
5757
help='disable repositories. Same syntax as yum\'s --disablerepo parameter. '
5858
'If both --enablerepo and --disablerepo are set, --disablerepo will be applied first')
59+
parser.add_argument('--no-update', action='store_true',
60+
help='do not run "yum update" on container start, use it as it was at build time')
5961

6062
def add_container_args(parser):
6163
parser.add_argument('-v', '--volume', action='append',
@@ -204,6 +206,9 @@ def container(args):
204206
docker_args += ["-e", "ENABLEREPO=%s" % args.enablerepo]
205207
if args.disablerepo:
206208
docker_args += ["-e", "DISABLEREPO=%s" % args.disablerepo]
209+
if args.no_update:
210+
docker_args += ["-e", "NOUPDATE=1"]
211+
207212
ulimit_nofile = False
208213
if args.ulimit:
209214
for ulimit in args.ulimit:

src/xcp_ng_dev/files/init-container.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,10 @@ if [ -n "$ENABLEREPO" ]; then
5454
sudo $CFGMGR --enable "$ENABLEREPO"
5555
fi
5656

57-
# update to either install newer updates or to take packages from added repos into account
58-
sudo $DNF update -y --disablerepo=epel
57+
if [ -z "$NOUPDATE" ]; then
58+
# update to either install newer updates or to take packages from added repos into account
59+
sudo $DNF update -y --disablerepo=epel
60+
fi
5961

6062
cd "$HOME"
6163

0 commit comments

Comments
 (0)