Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lxc
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
lxc
Commits
c71f845c
Commit
c71f845c
authored
Jul 15, 2016
by
Andreas Freudenberg
Committed by
Stéphane Graber
Aug 11, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
templates: make shellcheck (Ubuntu: 0.3.7-5 amd64) most possible happy
Signed-off-by:
Andreas Freudenberg
<
andreas.freudenberg@licomonch.net
>
parent
d7538219
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
16 deletions
+17
-16
lxc-debian.in
templates/lxc-debian.in
+17
-16
No files found.
templates/lxc-debian.in
View file @
c71f845c
...
@@ -158,7 +158,7 @@ EOF
...
@@ -158,7 +158,7 @@ EOF
echo
"Timezone in container is not configured. Adjust it manually."
echo
"Timezone in container is not configured. Adjust it manually."
fi
fi
echo
"root:root"
|
chroot
$rootfs
chpasswd
echo
"root:root"
|
chroot
"
$rootfs
"
chpasswd
echo
"Root password is 'root', please change !"
echo
"Root password is 'root', please change !"
return
0
return
0
...
@@ -224,7 +224,8 @@ configure_debian_systemd()
...
@@ -224,7 +224,8 @@ configure_debian_systemd()
# Fix getty-static-service as debootstrap does not install dbus
# Fix getty-static-service as debootstrap does not install dbus
if
[
-e
"
$rootfs
//lib/systemd/system/getty-static.service"
]
;
then
if
[
-e
"
$rootfs
//lib/systemd/system/getty-static.service"
]
;
then
local
tty_services
=
$(for
i
in
$(
seq
2
"
$num_tty
"
)
;
do
echo
-n
"getty@tty
${
i
}
.service "
;
done
;
)
local
tty_services
tty_services
=
$(for
i
in
$(
seq
2
"
$num_tty
"
)
;
do
echo
-n
"getty@tty
${
i
}
.service "
;
done
;
)
sed
's/ getty@tty.*/'
"
$tty_services
"
'/g'
\
sed
's/ getty@tty.*/'
"
$tty_services
"
'/g'
\
"
$rootfs
/lib/systemd/system/getty-static.service"
|
\
"
$rootfs
/lib/systemd/system/getty-static.service"
|
\
sed
's/\(tty2-tty\)[5-9]/\1'
"
${
num_tty
}
"
'/g'
>
"
$rootfs
/etc/systemd/system/getty-static.service"
sed
's/\(tty2-tty\)[5-9]/\1'
"
${
num_tty
}
"
'/g'
>
"
$rootfs
/etc/systemd/system/getty-static.service"
...
@@ -253,8 +254,8 @@ configure_debian_systemd()
...
@@ -253,8 +254,8 @@ configure_debian_systemd()
cleanup
()
cleanup
()
{
{
rm
-rf
$cache
/partial-
$release
-
$arch
rm
-rf
"
$cache
/partial-
$release
-
$arch
"
rm
-rf
$cache
/rootfs-
$release
-
$arch
rm
-rf
"
$cache
/rootfs-
$release
-
$arch
"
}
}
download_debian
()
download_debian
()
...
@@ -315,9 +316,9 @@ openssh-server
...
@@ -315,9 +316,9 @@ openssh-server
# download a mini debian into a cache
# download a mini debian into a cache
echo
"Downloading debian minimal ..."
echo
"Downloading debian minimal ..."
debootstrap
--verbose
--variant
=
minbase
--arch
=
$arch
\
debootstrap
--verbose
--variant
=
minbase
--arch
=
"
$arch
"
\
--include
=
$packages
--keyring
=
${
releasekeyring
}
\
--include
=
"
$packages
"
--keyring
=
"
${
releasekeyring
}
"
\
"
$release
"
"
$cache
/partial-
$release
-
$arch
"
$MIRROR
"
$release
"
"
$cache
/partial-
$release
-
$arch
"
"
$MIRROR
"
if
[
$?
-ne
0
]
;
then
if
[
$?
-ne
0
]
;
then
echo
"Failed to download the rootfs, aborting."
echo
"Failed to download the rootfs, aborting."
return
1
return
1
...
@@ -342,8 +343,8 @@ copy_debian()
...
@@ -342,8 +343,8 @@ copy_debian()
# make a local copy of the minidebian
# make a local copy of the minidebian
echo
-n
"Copying rootfs to
$rootfs
..."
echo
-n
"Copying rootfs to
$rootfs
..."
mkdir
-p
$rootfs
mkdir
-p
"
$rootfs
"
rsync
-Ha
"
$cache
/rootfs-
$release
-
$arch
"
/
$rootfs
/
||
return
1
rsync
-Ha
"
$cache
/rootfs-
$release
-
$arch
"
/
"
$rootfs
"
/
||
return
1
return
0
return
0
}
}
...
@@ -363,7 +364,7 @@ install_debian()
...
@@ -363,7 +364,7 @@ install_debian()
echo
"Checking cache download in
$cache
/rootfs-
$release
-
$arch
... "
echo
"Checking cache download in
$cache
/rootfs-
$release
-
$arch
... "
if
[
!
-e
"
$cache
/rootfs-
$release
-
$arch
"
]
;
then
if
[
!
-e
"
$cache
/rootfs-
$release
-
$arch
"
]
;
then
download_debian
$cache
$arch
$release
download_debian
"
$cache
"
"
$arch
"
"
$release
"
if
[
$?
-ne
0
]
;
then
if
[
$?
-ne
0
]
;
then
echo
"Failed to download 'debian base'"
echo
"Failed to download 'debian base'"
return
1
return
1
...
@@ -394,7 +395,7 @@ copy_configuration()
...
@@ -394,7 +395,7 @@ copy_configuration()
# Generate the configuration file
# Generate the configuration file
# if there is exactly one veth network entry, make sure it has an
# if there is exactly one veth network entry, make sure it has an
# associated hwaddr.
# associated hwaddr.
nics
=
$(
grep
-
e
'^lxc\.network\.type[ \t]*=[ \t]*veth'
"
$path
/config"
|
wc
-l
)
nics
=
$(
grep
-
ce
'^lxc\.network\.type[ \t]*=[ \t]*veth'
"
$path
/config"
)
if
[
"
$nics
"
-eq
1
]
;
then
if
[
"
$nics
"
-eq
1
]
;
then
grep
-q
"^lxc.network.hwaddr"
"
$path
/config"
||
sed
-i
-e
"/^lxc
\.
network
\.
type[
\t
]*=[
\t
]*veth/a lxc.network.hwaddr = 00:16:3e:
$(
openssl rand
-hex
3|
sed
's/\(..\)/\1:/g; s/.$//'
)
"
"
$path
/config"
grep
-q
"^lxc.network.hwaddr"
"
$path
/config"
||
sed
-i
-e
"/^lxc
\.
network
\.
type[
\t
]*=[
\t
]*veth/a lxc.network.hwaddr = 00:16:3e:
$(
openssl rand
-hex
3|
sed
's/\(..\)/\1:/g; s/.$//'
)
"
"
$path
/config"
fi
fi
...
@@ -452,23 +453,23 @@ EOF
...
@@ -452,23 +453,23 @@ EOF
fi
fi
# Write a new sources.list containing both native and multiarch entries
# Write a new sources.list containing both native and multiarch entries
>
${
rootfs
}
/etc/apt/sources.list
>
"
${
rootfs
}
/etc/apt/sources.list"
if
[
"
${
arch
}
"
=
"
${
hostarch
}
"
]
;
then
if
[
"
${
arch
}
"
=
"
${
hostarch
}
"
]
;
then
write_sourceslist
${
rootfs
}
${
release
}
${
arch
}
write_sourceslist
"
${
rootfs
}
"
"
${
release
}
"
"
${
arch
}
"
else
else
write_sourceslist
"
${
rootfs
}
"
"
${
release
}
"
write_sourceslist
"
${
rootfs
}
"
"
${
release
}
"
fi
fi
# Install Packages in container
# Install Packages in container
if
[
-n
"
${
packages
}
"
]
;
then
if
[
-n
"
${
packages
}
"
]
;
then
local
pack_list
=
"
$(
echo
"
${
packages
}
"
|
sed
's/,/ /g'
)
"
local
pack_list
pack_list
=
"
${
packages
//,/
}
"
echo
"Installing packages:
${
pack_list
}
"
echo
"Installing packages:
${
pack_list
}
"
install_packages
"
${
rootfs
}
"
"
${
pack_list
}
"
install_packages
"
${
rootfs
}
"
"
${
pack_list
}
"
fi
fi
# Re-enable service startup
# Re-enable service startup
rm
"
${
rootfs
}
/usr/sbin/policy-rc.d"
rm
"
${
rootfs
}
/usr/sbin/policy-rc.d"
# end
# end
}
}
...
@@ -663,7 +664,7 @@ fi
...
@@ -663,7 +664,7 @@ fi
configure_debian_systemd
"
$path
"
"
$rootfs
"
"
$config
"
$num_tty
configure_debian_systemd
"
$path
"
"
$rootfs
"
"
$config
"
$num_tty
post_process
"
${
rootfs
}
"
"
${
release
}
"
${
arch
}
${
hostarch
}
${
packages
}
post_process
"
${
rootfs
}
"
"
${
release
}
"
"
${
arch
}
"
"
${
hostarch
}
"
"
${
packages
}
"
if
[
!
-z
"
$clean
"
]
;
then
if
[
!
-z
"
$clean
"
]
;
then
clean
||
exit
1
clean
||
exit
1
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment