-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #289 from NethServer/distfeed
Improve updates management
- Loading branch information
Showing
10 changed files
with
153 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/usr/sbin/distfeed-setup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/usr/sbin/distfeed-setup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/bash | ||
|
||
# | ||
# Copyright (C) 2024 Nethesis S.r.l. | ||
# SPDX-License-Identifier: GPL-2.0-only | ||
# | ||
|
||
# | ||
# Schedule automatic updates | ||
# | ||
|
||
action=${1:-"check"} | ||
timestamp=$2 | ||
cmd="sleep echo \$(( RANDOM % 18000 )); /bin/opkg list-upgradable | /usr/bin/cut -f 1 -d ' ' | /usr/bin/xargs -r opkg upgrade" | ||
|
||
if [ "$action" == "add" ]; then | ||
crontab -l | grep -q '$cmd' || echo "5 2 * * $cmd" >> /etc/crontabs/root | ||
elif [ "$action" == "remove" ]; then | ||
crontab -l | grep -v "$cmd" | sort | uniq | crontab - | ||
else | ||
crontab -l | grep -q "$cmd" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/bash | ||
|
||
# | ||
# Copyright (C) 2024 Nethesis S.r.l. | ||
# SPDX-License-Identifier: GPL-2.0-only | ||
# | ||
|
||
base_url=${BASE_URL:='https://updates.nethsecurity.nethserver.org'} | ||
channel=${CHANNEL:=''} | ||
owrt_version=${OWRT_VERSION:=''} | ||
|
||
source /etc/os-release | ||
if [ -z "$channel" ]; then | ||
channel="dev" | ||
if [ -n "$(uci -q get ns-plug.config.system_id)" ]; then | ||
channel="subscription" | ||
else | ||
# check if ns_version is stable or not | ||
ns_version=$(echo "$VERSION" | cut -d- -f3- | cut -d. -f2-) | ||
if [[ "$ns_version" =~ ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-((0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*)(\.(0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*))*))?(\+([0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*))?$ ]]; then | ||
pre_release="${BASH_REMATCH[5]:-""}" | ||
if [ -z "$pre_release" ]; then | ||
channel="stable" | ||
fi | ||
fi | ||
fi | ||
fi | ||
|
||
if [ -z "$owrt_version" ]; then | ||
owrt_version=$(echo "$VERSION" | cut -d- -f2) | ||
fi | ||
|
||
cat << EOF > /etc/opkg/distfeeds.conf | ||
src/gz nethsecurity_core $base_url/$channel/$owrt_version/targets/x86/64/packages | ||
src/gz nethsecurity_base $base_url/$channel/$owrt_version/packages/x86_64/base | ||
src/gz nethsecurity_luci $base_url/$channel/$owrt_version/packages/x86_64/luci | ||
src/gz nethsecurity_nethsecurity $base_url/$channel/$owrt_version/packages/x86_64/nethsecurity | ||
src/gz nethsecurity_packages $base_url/$channel/$owrt_version/packages/x86_64/packages | ||
src/gz nethsecurity_routing $base_url/$channel/$owrt_version/packages/x86_64/routing | ||
EOF |