~m-grant-prg/vm-container-utils/focal-trunk

« back to all changes in this revision

Viewing changes to src/prg/bash/lxcu/lxcu-create.sh.in

  • Committer: Mark Grant
  • Date: 2020-11-29 14:25:58 UTC
  • mfrom: (1.1.6)
  • Revision ID: m.grant.prg@gmail.com-20201129142558-c2jhqvixk9hnylhj
Merge new upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
62
62
# 23/09/2020    MG      1.0.1   Created.                                #
63
63
# 05/10/2020    MG      1.0.2   Replace sleeps with network wait in     #
64
64
#                               lxcu-start.sh                           #
 
65
# 18/11/2020    MG      1.0.3   Do initial install of apt https prior   #
 
66
#                               to adding repo for server-dependency to #
 
67
#                               avoid hang on https comms.              #
 
68
#                               Ensure apt update is run after changing #
 
69
#                               repos.                                  #
 
70
#                               Do apt-get update after apt-key update. #
65
71
#                                                                       #
66
72
#########################################################################
67
73
 
74
80
##################
75
81
readonly outputprefix="$(basename $0):"
76
82
 
77
 
readonly version=1.0.2                          # Script version
 
83
readonly version=1.0.3                          # Script version
78
84
readonly packageversion=@pkgversion@            # Package version
79
85
 
80
86
readonly etclocation=@sysconfdir@/lxcu          # Path to config directory
317
323
# No return value.
318
324
create_deb()
319
325
{
320
 
        # Set up the apt files.
 
326
        # Set up the initial apt files, (just sources.list).
 
327
        sudo cp -v $(find $etclocation/$dist/apt -maxdepth 1 -type f) \
 
328
                $contlocation/$name/rootfs/etc/apt
 
329
        std_cmd_err_handler $?
 
330
        sudo chown -v 100000:100000  $contlocation/$name/rootfs/etc/apt
 
331
        std_cmd_err_handler $?
 
332
        sudo sed -i -e "s|@rel@|$rel|g" \
 
333
                $(find $contlocation/$name/rootfs/etc/apt -maxdepth 1 -type f)
 
334
        std_cmd_err_handler $?
 
335
 
 
336
        # Initially install apt https and sudo.
 
337
        lxcu-start.sh -n $name
 
338
        std_cmd_err_handler $?
 
339
        lxc-attach -n $name apt-get update
 
340
        std_cmd_err_handler $?
 
341
        lxc-attach -n $name -vPATH=$PATH:/sbin:/usr/sbin \
 
342
                apt-get -- -y install apt-transport-https apt-utils \
 
343
                ca-certificates sudo
 
344
        std_cmd_err_handler $?
 
345
        lxc-stop -n $name
 
346
        std_cmd_err_handler $?
 
347
 
 
348
        # Set up the other initial apt files.
321
349
        sudo cp -rv $etclocation/$dist/apt/* $contlocation/$name/rootfs/etc/apt
322
350
        std_cmd_err_handler $?
323
351
        sudo chown -Rv 100000:100000  $contlocation/$name/rootfs/etc/apt
330
358
                        -maxdepth 1 -type f)
331
359
        std_cmd_err_handler $?
332
360
 
333
 
        lxcu-start.sh -n $name
334
 
        std_cmd_err_handler $?
335
 
 
336
 
        # Initially install sudo.
337
 
        lxc-attach -n $name apt-get update
338
 
        std_cmd_err_handler $?
339
 
        lxc-attach -n $name -vPATH=$PATH:/sbin:/usr/sbin \
340
 
                apt-get -- -y install sudo
341
 
        std_cmd_err_handler $?
342
 
 
343
361
        # Set up the dosab files.
 
362
        lxcu-start.sh -n $name
 
363
        std_cmd_err_handler $?
 
364
        lxc-attach -n $name sudo apt-get update
 
365
        std_cmd_err_handler $?
344
366
        lxc-attach -n $name sudo apt-get -- -y install server-dependency
345
367
        std_cmd_err_handler $?
346
368
        lxc-stop -n $name
361
383
        std_cmd_err_handler $?
362
384
        lxc-attach -n $name sudo apt-get -- -y install gnupg
363
385
        std_cmd_err_handler $?
364
 
        lxc-attach -n $name sudo apt-get -- -y install apt apt-utils agmaint
 
386
        lxc-attach -n $name sudo apt-get -- -y install apt agmaint
365
387
        std_cmd_err_handler $?
366
388
        lxc-attach -n $name sudo apt-key update
367
389
        std_cmd_err_handler $?
 
390
        lxc-attach -n $name sudo apt-get update
 
391
        std_cmd_err_handler $?
368
392
        lxc-attach -n $name sudo agmaint.sh -- -- -y
369
393
        std_cmd_err_handler $?
370
394
        lxc-stop -n $name
377
401
}
378
402
 
379
403
 
380
 
 
381
404
########
382
405
# Main #
383
406
########
405
428
        ;;
406
429
esac
407
430
 
408
 
 
409
431
# And exit.
410
432
script_exit 0
411
433