File: copy.sh

package info (click to toggle)
golang-github-containers-buildah 1.19.6%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 5,020 kB
  • sloc: sh: 1,957; makefile: 199; perl: 173; awk: 12; ansic: 1
file content (105 lines) | stat: -rwxr-xr-x 3,493 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#!/usr/bin/env bash
set -e
set -x
: " Build a temporary directory; make sure ocid is running."
export PATH=`pwd`:$PATH
d=`mktemp -d`
trap 'cd /;rm -fr "$d"' EXIT
cd "$d"
systemctl restart ocid
read
: " Check if we have some images to work with."
read
ocic image list
read
: " Create a working container, and capture its name "
read
echo '[container1=`buildah from ${1:-alpine}`]'
container1=`buildah from ${1:-alpine}`
read
: " Mount that working container, and capture the mountpoint "
read
echo '[mountpoint1=`buildah mount $container1`]'
mountpoint1=`buildah mount $container1`
read
: " List random files in the container "
read
echo '[find $mountpoint1 -name "random*"]'
find $mountpoint1 -name "random*"
read
: " Ensure the default destination for copying files is / "
read
echo '[buildah config $container1 --workingdir /]'
buildah config $container1 --workingdir /
read
: " Add a file to the container "
read
echo '[dd if=/dev/urandom of=random1 bs=512 count=1]'
echo '[buildah copy $container1 random1]'
dd if=/dev/urandom of=random1 bs=512 count=1
buildah copy $container1 random1
read
: " Change the default destination for copying files "
read
echo '[buildah config $container1 --workingdir /tmp]'
buildah config $container1 --workingdir /tmp
read
: " Add another new file to the container "
read
echo '[dd if=/dev/urandom of=random2 bs=512 count=1]'
echo '[buildah copy $container1 random2]'
dd if=/dev/urandom of=random2 bs=512 count=1
buildah copy $container1 random2
read
: " Copy a subdirectory with some files in it "
read
echo '[mkdir -p randomsubdir]'
echo '[dd if=/dev/urandom of=randomsubdir/random3 bs=512 count=1]'
echo '[dd if=/dev/urandom of=randomsubdir/random4 bs=512 count=1]'
echo '[buildah copy $container1 randomsubdir]'
mkdir -p randomsubdir
dd if=/dev/urandom of=randomsubdir/random3 bs=512 count=1
dd if=/dev/urandom of=randomsubdir/random4 bs=512 count=1
buildah copy $container1 randomsubdir
read
: " List some of the container's contents "
read
echo '[find $mountpoint1 -name "random*"]'
find $mountpoint1 -name "random*"
read
: " Download a tarball "
read
echo '[wget -c https://releases.pagure.org/tmpwatch/tmpwatch-2.9.17.tar.bz2]'
wget -c https://releases.pagure.org/tmpwatch/tmpwatch-2.9.17.tar.bz2
read
: " Copy that tarball to the container "
read
echo '[mkdir -p $mountpoint1/tmpwatch]'
echo '[buildah copy $container1 --dest /tmpwatch tmpwatch-2.9.17.tar.bz2]'
mkdir -p $mountpoint1/tmpwatch
buildah copy $container1 --dest /tmpwatch tmpwatch-2.9.17.tar.bz2
read
: " Download another tarball to the container "
read
echo '[buildah copy $container1 --dest /tmpwatch https://releases.pagure.org/newt/newt-0.52.19.tar.gz]'
buildah copy $container1 --dest /tmpwatch https://releases.pagure.org/newt/newt-0.52.19.tar.gz
read
: " List the contents of the target directory "
read
echo '[find $mountpoint1/tmpwatch]'
find $mountpoint1/tmpwatch
read
: " Now 'add' the downloaded tarball to the container "
read
echo '[buildah add $container1 --dest /tmpwatch tmpwatch-2.9.17.tar.bz2]'
buildah add $container1 --dest /tmpwatch tmpwatch-2.9.17.tar.bz2
read
: " List the contents of the target directory again "
read
echo '[find $mountpoint1/tmpwatch]'
find $mountpoint1/tmpwatch
read
: " Clean up, because I ran this like fifty times while testing "
read
echo '[buildah delete $container1]'
buildah rm $container1