2 # Copyright (C) 2018 - Jonathan Rajotte-Julien <jonathan.rajotte-julien@efficios.com>
4 # This program is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation, either version 3 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
24 from datetime
import datetime
27 def compress(filename
):
30 '-f', filename
+ ".tar.gz",
34 subprocess
.run(command
, check
=True)
35 shutil
.rmtree(filename
)
63 'libtap-harness-archive-perl',
89 parser
= argparse
.ArgumentParser(description
='Generate lava lttng rootfs')
90 parser
.add_argument("--arch", default
='amd64')
91 parser
.add_argument("--distribution", default
='jammy')
92 parser
.add_argument("--mirror", default
='http://archive.ubuntu.com/ubuntu')
94 "--component", default
='universe,multiverse,main,restricted')
95 args
= parser
.parse_args()
97 name
= "rootfs_{}_{}_{}".format(args
.arch
, args
.distribution
,
98 datetime
.now().strftime("%Y-%m-%d"))
100 hostname
= "linaro-server"
101 user
= "linaro/linaro"
102 root_password
= "root"
106 "--arch={}".format(args
.arch
),
107 "--components={}".format(args
.component
),
109 args
.distribution
, # SUITE
110 name
, # TARGET (directory is created)
111 args
.mirror
, # MIRROR
113 completed_command
= subprocess
.run(command
, check
=True)
118 'apt-get', 'install', '-y', ] + packages
119 completed_command
= subprocess
.run(command
, check
=True)
122 with
open(os
.path
.join(name
, 'etc', 'hostname'), 'w', encoding
='utf-8') as f
:
123 f
.write(hostname
+ "\n")
128 'adduser', '--gecos', '', '--disabled-password', 'linaro',
130 completed_process
= subprocess
.run(command
, check
=True)
133 'chroot', name
, 'chpasswd',
135 process
= subprocess
.Popen(command
, stdin
=subprocess
.PIPE
, text
=True)
136 process
.communicate(input='linaro:linaro')
139 process
= subprocess
.Popen(command
, stdin
=subprocess
.PIPE
, text
=True)
140 process
.communicate(input="root:root")
145 if __name__
== "__main__":
147 print("This script should be run as root: this is required by deboostrap", file=sys
.stderr
)
This page took 0.032673 seconds and 4 git commands to generate.