Skip to content

Commit 6fa3d40

Browse files
committed
bin/ncp-dist-upgrade*: Move prompt to launch script (so it happens outside of tmux).
1 parent edbefe6 commit 6fa3d40

4 files changed

Lines changed: 23 additions & 66 deletions

File tree

bin/ncp-dist-upgrade

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,29 @@ set -e
99

1010
. /etc/os-release
1111

12+
new_cfg=/usr/local/etc/ncp-recommended.cfg
13+
[[ -f "${new_cfg}" ]] || { echo "Already on the latest recommended distribution. Abort." >&2; exit 1; }
14+
15+
echo "
16+
>>> ATTENTION <<<
17+
This is a dangerous process that is only guaranteed to work properly if you
18+
have not made manual changes in the system. Backup the SD card first and
19+
proceed at your own risk.
20+
21+
Note that this is not a requirement for NCP to continue working properly.
22+
The current distribution will keep receiving updates for some time.
23+
24+
Do you want to continue? [y/N]"
25+
26+
if [[ "${DEBIAN_FRONTEND:-}" == "noninteractive" ]] || ! [[ -t 0 ]]
27+
then
28+
echo "Noninteractive environment detected. Automatically proceeding in 30 seconds..."
29+
sleep 30
30+
else
31+
read -n1 -r key
32+
[[ "${key,,}" == y ]] || exit 0
33+
fi
34+
1235
if [[ "$VERSION_ID" -eq 10 ]]
1336
then
1437
UPGRADE_CMD=(bash /usr/local/bin/ncp-dist-upgrade.d/debian-10.sh)

bin/ncp-dist-upgrade.d/debian-10.sh

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,6 @@ set -eu -o pipefail
44

55
[[ -f /.dockerenv ]] && { echo "Not supported in Docker. Upgrade the container instead"; exit 0; }
66

7-
new_cfg=/usr/local/etc/ncp-recommended.cfg
8-
[[ -f "${new_cfg}" ]] || { echo "Already on the lastest recommended distribution. Abort." >&2; exit 1; }
9-
10-
APTINSTALL="apt-get install -y --no-install-recommends"
11-
export DEBIAN_FRONTEND=noninteractive
12-
13-
echo "
14-
>>> ATTENTION <<<
15-
This is a dangerous process that is only guaranteed to work properly if you
16-
have not made manual changes in the system. Backup the SD card first and
17-
proceed at your own risk.
18-
19-
Note that this is not a requirement for NCP to continue working properly.
20-
The current distribution will keep receiving updates for some time.
21-
22-
Do you want to continue? [y/N]"
23-
24-
read key
25-
[[ "$key" == y ]] || exit 0
26-
277
source /usr/local/etc/library.sh # sets NCPCFG RELEASE PHPVER
288
old_cfg="${NCPCFG}"
299

bin/ncp-dist-upgrade.d/debian-11.sh

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,6 @@
22

33
set -eu -o pipefail
44

5-
new_cfg=/usr/local/etc/ncp-recommended.cfg
6-
[[ -f "${new_cfg}" ]] || { echo "Already on the lastest recommended distribution. Abort." >&2; exit 1; }
7-
8-
echo "
9-
>>> ATTENTION <<<
10-
This is a dangerous process that is only guaranteed to work properly if you
11-
have not made manual changes in the system. Backup the SD card first and
12-
proceed at your own risk.
13-
14-
Note that this is not a requirement for NCP to continue working properly.
15-
The current distribution will keep receiving updates for some time.
16-
17-
Do you want to continue? [y/N]"
18-
19-
if [[ "${DEBIAN_FRONTEND:-}" == "noninteractive" ]] || ! [[ -t 0 ]]
20-
then
21-
echo "Noninteractive environment detected. Automatically proceeding in 30 seconds..."
22-
sleep 30
23-
else
24-
read -n1 -r key
25-
[[ "${key,,}" == y ]] || exit 0
26-
fi
27-
285
export DEBIAN_FRONTEND=noninteractive
296

307
source /usr/local/etc/library.sh

bin/ncp-dist-upgrade.d/debian-12.sh

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,6 @@
22

33
set -eu -o pipefail
44

5-
new_cfg=/usr/local/etc/ncp-recommended.cfg
6-
[[ -f "${new_cfg}" ]] || { echo "Already on the latest recommended distribution. Abort." >&2; exit 1; }
7-
8-
echo "
9-
>>> ATTENTION <<<
10-
This is a dangerous process that is only guaranteed to work properly if you
11-
have not made manual changes in the system. Backup the SD card first and
12-
proceed at your own risk.
13-
14-
Note that this is not a requirement for NCP to continue working properly.
15-
The current distribution will keep receiving updates for some time.
16-
17-
Do you want to continue? [y/N]"
18-
19-
if [[ "${DEBIAN_FRONTEND:-}" == "noninteractive" ]] || ! [[ -t 0 ]]
20-
then
21-
echo "Noninteractive environment detected. Automatically proceeding in 30 seconds..."
22-
sleep 30
23-
else
24-
read -n1 -r key
25-
[[ "${key,,}" == y ]] || exit 0
26-
fi
27-
285
export DEBIAN_FRONTEND=noninteractive
296

307
source /usr/local/etc/library.sh

0 commit comments

Comments
 (0)