Skip to content

Commit 6f43863

Browse files
committed
Patch switchto* to support de822 files
1 parent edbb489 commit 6f43863

File tree

3 files changed

+88
-25
lines changed

3 files changed

+88
-25
lines changed

switchtoStable

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,38 @@
11
#!/usr/bin/env bash
22

3-
cat << EOF
3+
SOURCES_FILE=/etc/apt/sources.list.d/yunohost.sources
4+
LEVEL="stable"
5+
COMPONENTS="stable"
6+
7+
set_sources_components() {
8+
cat << EOF
9+
----
10+
Patching $SOURCES_FILE to use $LEVEL repository...
11+
----
12+
EOF
13+
sed -i 's|^\(Components: \).*$|\1'"$COMPONENTS" "$SOURCES_FILE"
14+
}
15+
16+
set_lists_components() {
17+
cat << EOF
418
----
519
Patching sources.list to disable testing repository...
620
----
721
EOF
822

9-
readarray -d '' apt_files < <(find /etc/apt/sources.list /etc/apt/sources.list.d -type f -print0)
10-
for FILE in "${apt_files[@]}"; do
11-
# Remove 'testing' and 'unstable' in lines using the yunohost repo
12-
sed -i 's|^\(deb.*yunohost.org.*\) testing\(.*\)$|\1\2|' "$FILE"
13-
sed -i 's|^\(deb.*yunohost.org.*\) unstable\(.*\)$|\1\2|' "$FILE"
14-
done
23+
readarray -d '' apt_files < <(find /etc/apt/sources.list /etc/apt/sources.list.d -type f -print0)
24+
for FILE in "${apt_files[@]}"; do
25+
# Remove 'testing' and 'unstable' in lines using the yunohost repo
26+
sed -i 's|^\(deb.*yunohost.org.*\) testing\(.*\)$|\1\2|' "$FILE"
27+
sed -i 's|^\(deb.*yunohost.org.*\) unstable\(.*\)$|\1\2|' "$FILE"
28+
done
29+
}
30+
31+
if [[ -f "$SOURCES_FILE" ]]; then
32+
set_sources_components
33+
else
34+
set_lists_components
35+
fi
1536

1637
cat << EOF
1738
----
@@ -22,7 +43,7 @@ apt-get update
2243

2344
cat << EOF
2445
----
25-
Running 'apt-get dist-upgrade'
46+
Running 'apt-get full-upgrade'
2647
----
2748
EOF
28-
apt-get dist-upgrade -y
49+
apt-get full-upgrade -y

switchtoTesting

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,37 @@
11
#!/usr/bin/env bash
22

3-
cat << EOF
3+
SOURCES_FILE=/etc/apt/sources.list.d/yunohost.sources
4+
LEVEL="testing"
5+
COMPONENTS="stable testing"
6+
7+
set_sources_components() {
8+
cat << EOF
9+
----
10+
Patching $SOURCES_FILE to use $LEVEL repository...
11+
----
12+
EOF
13+
sed -i 's|^\(Components: \).*$|\1'"$COMPONENTS" "$SOURCES_FILE"
14+
}
15+
16+
set_lists_components() {
17+
cat << EOF
418
----
519
Patching sources.list to enable testing repository...
620
----
721
EOF
822

9-
readarray -d '' apt_files < <(find /etc/apt/sources.list /etc/apt/sources.list.d -type f -print0)
10-
for FILE in "${apt_files[@]}"; do
11-
# (Append 'testing' at the end of lines starting with the yunohost repo..)
12-
sed -i 's@^deb.* http://forge.yunohost.org.*@& testing@' "$FILE"
13-
done
23+
readarray -d '' apt_files < <(find /etc/apt/sources.list /etc/apt/sources.list.d -type f -print0)
24+
for FILE in "${apt_files[@]}"; do
25+
# (Append 'testing' at the end of lines starting with the yunohost repo..)
26+
sed -i 's@^deb.* http://forge.yunohost.org.*@& testing@' "$FILE"
27+
done
28+
}
29+
30+
if [[ -f "$SOURCES_FILE" ]]; then
31+
set_sources_components
32+
else
33+
set_lists_components
34+
fi
1435

1536
cat << EOF
1637
----
@@ -21,7 +42,7 @@ apt-get update
2142

2243
cat << EOF
2344
----
24-
Running 'apt-get dist-upgrade'
45+
Running 'apt-get full-upgrade'
2546
----
2647
EOF
27-
apt-get dist-upgrade -y
48+
apt-get full-upgrade -y

switchtoUnstable

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,37 @@
11
#!/usr/bin/env bash
22

3-
cat << EOF
3+
SOURCES_FILE=/etc/apt/sources.list.d/yunohost.sources
4+
LEVEL="unstable"
5+
COMPONENTS="stable testing unstable"
6+
7+
set_sources_components() {
8+
cat << EOF
9+
----
10+
Patching $SOURCES_FILE to use $LEVEL repository...
11+
----
12+
EOF
13+
sed -i 's|^\(Components: \).*$|\1'"$COMPONENTS" "$SOURCES_FILE"
14+
}
15+
16+
set_lists_components() {
17+
cat << EOF
418
----
519
Patching sources.list to enable unstable repository...
620
----
721
EOF
822

9-
readarray -d '' apt_files < <(find /etc/apt/sources.list /etc/apt/sources.list.d -type f -print0)
10-
for FILE in "${apt_files[@]}"; do
11-
# (Append 'testing' at the end of lines starting with the yunohost repo..)
12-
sed -i 's@^deb http://forge.yunohost.org.*@& testing unstable@' "$FILE"
13-
done
23+
readarray -d '' apt_files < <(find /etc/apt/sources.list /etc/apt/sources.list.d -type f -print0)
24+
for FILE in "${apt_files[@]}"; do
25+
# (Append 'testing' at the end of lines starting with the yunohost repo..)
26+
sed -i 's@^deb http://forge.yunohost.org.*@& testing unstable@' "$FILE"
27+
done
28+
}
29+
30+
if [[ -f "$SOURCES_FILE" ]]; then
31+
set_sources_components
32+
else
33+
set_lists_components
34+
fi
1435

1536
cat << EOF
1637
----
@@ -21,7 +42,7 @@ apt-get update
2142

2243
cat << EOF
2344
----
24-
Running 'apt-get dist-upgrade'
45+
Running 'apt-get full-upgrade'
2546
----
2647
EOF
27-
apt-get dist-upgrade -y
48+
apt-get full-upgrade -y

0 commit comments

Comments
 (0)