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
f1ccde27
Commit
f1ccde27
authored
Aug 21, 2012
by
Serge Hallyn
Committed by
Stéphane Graber
Oct 25, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ubuntu and debian templates: Clean up cache if cache build is interrupted
Otherwise the next lxc-create may rsync a bad cache. Signed-off-by:
Serge Hallyn
<
serge.hallyn@ubuntu.com
>
parent
4a311c12
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
1 deletion
+36
-1
lxc-debian.in
templates/lxc-debian.in
+11
-0
lxc-ubuntu-cloud.in
templates/lxc-ubuntu-cloud.in
+14
-1
lxc-ubuntu.in
templates/lxc-ubuntu.in
+11
-0
No files found.
templates/lxc-debian.in
View file @
f1ccde27
...
@@ -95,6 +95,12 @@ EOF
...
@@ -95,6 +95,12 @@ EOF
return
0
return
0
}
}
cleanup
()
{
rm
-rf
$cache
/partial-
$SUITE
-
$arch
rm
-rf
$cache
/rootfs-
$SUITE
-
$arch
}
download_debian
()
download_debian
()
{
{
packages
=
\
packages
=
\
...
@@ -111,6 +117,7 @@ openssh-server
...
@@ -111,6 +117,7 @@ openssh-server
cache
=
$1
cache
=
$1
arch
=
$2
arch
=
$2
trap
cleanup EXIT SIGHUP SIGINT SIGTERM
# check the mini debian was not already downloaded
# check the mini debian was not already downloaded
mkdir
-p
"
$cache
/partial-
$SUITE
-
$arch
"
mkdir
-p
"
$cache
/partial-
$SUITE
-
$arch
"
if
[
$?
-ne
0
]
;
then
if
[
$?
-ne
0
]
;
then
...
@@ -130,6 +137,10 @@ openssh-server
...
@@ -130,6 +137,10 @@ openssh-server
mv
"
$1
/partial-
$SUITE
-
$arch
"
"
$1
/rootfs-
$SUITE
-
$arch
"
mv
"
$1
/partial-
$SUITE
-
$arch
"
"
$1
/rootfs-
$SUITE
-
$arch
"
echo
"Download complete."
echo
"Download complete."
trap
EXIT
trap
SIGINT
trap
SIGTERM
trap
SIGHUP
return
0
return
0
}
}
...
...
templates/lxc-ubuntu-cloud.in
View file @
f1ccde27
...
@@ -253,6 +253,11 @@ fi
...
@@ -253,6 +253,11 @@ fi
filename
=
`
basename
$url2
`
filename
=
`
basename
$url2
`
wgetcleanup
()
{
rm
-f
$filename
}
buildcleanup
()
buildcleanup
()
{
{
cd
$rootfs
cd
$rootfs
...
@@ -271,7 +276,7 @@ build_root_tgz()
...
@@ -271,7 +276,7 @@ build_root_tgz()
xdir
=
`
mktemp
-d
-p
.
`
xdir
=
`
mktemp
-d
-p
.
`
tarname
=
`
basename
$url
`
tarname
=
`
basename
$url
`
imgname
=
"
$release
-*-cloudimg-
$arch
.img"
imgname
=
"
$release
-*-cloudimg-
$arch
.img"
trap
buildcleanup EXIT
trap
buildcleanup EXIT
SIGHUP SIGINT SIGTERM
if
[
$flushcache
-eq
1
-o
!
-f
$cache
/
$tarname
]
;
then
if
[
$flushcache
-eq
1
-o
!
-f
$cache
/
$tarname
]
;
then
rm
-f
$tarname
rm
-f
$tarname
echo
"Downloading cloud image from
$url
"
echo
"Downloading cloud image from
$url
"
...
@@ -286,6 +291,9 @@ build_root_tgz()
...
@@ -286,6 +291,9 @@ build_root_tgz()
rmdir
$xdir
rmdir
$xdir
echo
"New cloud image cache created"
echo
"New cloud image cache created"
trap
EXIT
trap
EXIT
trap
SIGHUP
trap
SIGINT
trap
SIGTERM
}
}
mkdir
-p
/var/lock/subsys/
mkdir
-p
/var/lock/subsys/
...
@@ -298,9 +306,14 @@ mkdir -p /var/lock/subsys/
...
@@ -298,9 +306,14 @@ mkdir -p /var/lock/subsys/
rm
-f
$filename
rm
-f
$filename
fi
fi
trap
wgetcleanup EXIT SIGHUP SIGINT SIGTERM
if
[
!
-f
$filename
]
;
then
if
[
!
-f
$filename
]
;
then
wget
$url2
||
build_root_tgz
$url1
$filename
wget
$url2
||
build_root_tgz
$url1
$filename
fi
fi
trap
EXIT
trap
SIGHUP
trap
SIGINT
trap
SIGTERM
echo
"Extracting container rootfs"
echo
"Extracting container rootfs"
mkdir
-p
$rootfs
mkdir
-p
$rootfs
...
...
templates/lxc-ubuntu.in
View file @
f1ccde27
...
@@ -146,6 +146,12 @@ EOF
...
@@ -146,6 +146,12 @@ EOF
fi
fi
}
}
cleanup
()
{
rm
-rf
$cache
/partial-
$arch
rm
-rf
$cache
/rootfs-
$arch
}
download_ubuntu
()
download_ubuntu
()
{
{
cache
=
$1
cache
=
$1
...
@@ -155,6 +161,7 @@ download_ubuntu()
...
@@ -155,6 +161,7 @@ download_ubuntu()
packages
=
vim,ssh
packages
=
vim,ssh
echo
"installing packages:
$packages
"
echo
"installing packages:
$packages
"
trap
cleanup EXIT SIGHUP SIGINT SIGTERM
# check the mini ubuntu was not already downloaded
# check the mini ubuntu was not already downloaded
mkdir
-p
"
$cache
/partial-
$arch
"
mkdir
-p
"
$cache
/partial-
$arch
"
if
[
$?
-ne
0
]
;
then
if
[
$?
-ne
0
]
;
then
...
@@ -202,6 +209,10 @@ EOF
...
@@ -202,6 +209,10 @@ EOF
fi
fi
mv
"
$1
/partial-
$arch
"
"
$1
/rootfs-
$arch
"
mv
"
$1
/partial-
$arch
"
"
$1
/rootfs-
$arch
"
trap
EXIT
trap
SIGINT
trap
SIGTERM
trap
SIGHUP
echo
"Download complete"
echo
"Download complete"
return
0
return
0
}
}
...
...
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