From 3eaa174b23da2d8c9cec9baef2f22e64b8379935 Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Sun, 16 Jan 2022 15:11:49 +0100 Subject: [PATCH 0001/1229] Initial commit --- LICENSE | 29 +++++++++++++++++++++++++++++ README.md | 2 ++ 2 files changed, 31 insertions(+) create mode 100644 LICENSE create mode 100644 README.md diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..0a7a3987 --- /dev/null +++ b/LICENSE @@ -0,0 +1,29 @@ +BSD 3-Clause License + +Copyright (c) 2022, TrueCharts +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/README.md b/README.md new file mode 100644 index 00000000..ea4dc675 --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# trueupdate +A TrueCharts automatic and bulk update utility From cd9aacfb180de3779f0d9d3daf2cb4f832a0d96c Mon Sep 17 00:00:00 2001 From: kjeld Schouten-Lebbing Date: Sun, 16 Jan 2022 15:14:15 +0100 Subject: [PATCH 0002/1229] add TrueUpdate tool --- src/trueupdate.py | 90 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 src/trueupdate.py diff --git a/src/trueupdate.py b/src/trueupdate.py new file mode 100644 index 00000000..ae4dfcd7 --- /dev/null +++ b/src/trueupdate.py @@ -0,0 +1,90 @@ +import subprocess +import sys + +class Chart(object): + def __setattr__(self, name, value): + if name == 'status': + value = value.casefold() + if 'update_available' in name: + value = True if value.casefold() == "true" else False + super(Chart, self).__setattr__(name, value) + + def new_attr(self, attr): + setattr(self, attr, attr) + +INSTALLED_CHARTS = [] +CATALOG = "ALL" +SEMVER = "minor" + +def parse_headers(charts: str): + for line in charts.split("\n"): + if line.startswith("+-"): + continue + if "name" in line.casefold(): + return [col.strip() for col in line.casefold().strip().split("|") if col and col != ""] + +def parse_charts(charts: str): + headers = parse_headers(charts) + table_data = charts.split("\n")[3:-2:] # Skip the header part of the table + for row in table_data: + row = [section.strip() for section in row.split("|") if section and section != ""] + chart = Chart() + for item in zip(headers, row): + setattr(chart, item[0], item[1]) + INSTALLED_CHARTS.append(chart) + +def check_semver(current: str, latest: str): + split_current_semver = current.split(".", 3) + split_latest_semver = latest.split(".", 3) + if split_current_semver[0] != split_latest_semver[0]: + type="major" + if SEMVER == "major": + return True + if split_current_semver[1] != split_latest_semver[1]: + type="minor" + if SEMVER != "patch": + return True + if split_current_semver[2] != split_latest_semver[2]: + type="patch" + return True + return False + + +def execute_upgrades(): + if CATALOG == "ALL": + filtered = filter(lambda a: a.update_available and a.status == "active", INSTALLED_CHARTS) + else: + filtered = filter(lambda a: a.update_available and a.status == "active" and a.catalog == CATALOG, INSTALLED_CHARTS) + for chart in filtered: + pre_update_ver = chart.human_version + post_update_ver = chart.human_latest_version + split_current_version = chart.human_version.split("_", 1) + current_version = split_current_version[1] + split_latest = chart.human_latest_version.split("_", 1) + latest_version = split_latest[1] + if check_semver(current_version, latest_version): + pre_update_ver = chart.human_version + result = subprocess.run(['cli', '-c', f'app chart_release upgrade release_name={chart.name}'], capture_output=True) + post_update_ver = chart.human_latest_version + if "Upgrade complete" not in result.stdout.decode('utf-8'): + print(f"{chart.name} failed to upgrade. \n{result.stdout.decode('utf-8')}") + else: + print(f"{chart.name} upgraded ({pre_update_ver} --> {post_update_ver})") + +def fetch_charts(): + rawcharts = subprocess.run(["cli", "-c", "app chart_release query"], stdout=subprocess.PIPE) + charts = rawcharts.stdout.decode('utf-8') + return(charts) + +def get_args(): + if len(sys.argv) == 3: + SEMVER = sys.argv[2] or "minor" + if len(sys.argv) == 2: + CATALOG = sys.argv[1] or "ALL" + +if __name__ == '__main__': + get_args() + charts = fetch_charts() + parse_charts(charts) + execute_upgrades() + exit(0) From dede37df91ba58e1875b0ab0d5e6ebaeef28fe47 Mon Sep 17 00:00:00 2001 From: kjeld Schouten-Lebbing Date: Sun, 16 Jan 2022 15:33:26 +0100 Subject: [PATCH 0003/1229] setup repo --- .../workflows/test-and-upload-to-testpypi.yml | 58 ++++++++++++++ .github/workflows/upload-to-pip.yml | 43 +++++++++++ .gitignore | 7 ++ pydash/__init__.py | 0 {src => pydash}/trueupdate.py | 0 setup.py | 77 +++++++++++++++++++ tests/__init__.py | 0 tests/test_string.py | 7 ++ 8 files changed, 192 insertions(+) create mode 100644 .github/workflows/test-and-upload-to-testpypi.yml create mode 100644 .github/workflows/upload-to-pip.yml create mode 100644 .gitignore create mode 100644 pydash/__init__.py rename {src => pydash}/trueupdate.py (100%) create mode 100644 setup.py create mode 100644 tests/__init__.py create mode 100644 tests/test_string.py diff --git a/.github/workflows/test-and-upload-to-testpypi.yml b/.github/workflows/test-and-upload-to-testpypi.yml new file mode 100644 index 00000000..e9312463 --- /dev/null +++ b/.github/workflows/test-and-upload-to-testpypi.yml @@ -0,0 +1,58 @@ +# This is a basic workflow to help you get started with Actions + +name: Test & Upload to TestPyPI + +# Controls when the action will run. +on: + # Triggers the workflow on push to the master branch + push: + branches: [ master ] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v2 + + # Sets up python3 + - uses: actions/setup-python@v2 + with: + python-version: 3.8 + + # Installs and upgrades pip, installs other dependencies and installs the package from setup.py + - name: "Installs and upgrades pip, installs other dependencies and installs the package from setup.py" + run: | + # Upgrade pip + python3 -m pip install --upgrade pip + # Install build deps + python3 -m pip install setuptools wheel twine + # If requirements.txt exists, install from it + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + # Install the package from setup.py + python3 setup.py install + + # Tests with unittest + - name: Test with unittest + run: | + cd tests + python3 -m unittest discover + cd .. + + # Upload to TestPyPI + - name: Build and Upload to TestPyPI + run: | + python3 setup.py sdist bdist_wheel + python3 -m twine upload dist/* + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.TWINE_TEST_TOKEN }} + TWINE_REPOSITORY: testpypi diff --git a/.github/workflows/upload-to-pip.yml b/.github/workflows/upload-to-pip.yml new file mode 100644 index 00000000..ddd77d85 --- /dev/null +++ b/.github/workflows/upload-to-pip.yml @@ -0,0 +1,43 @@ +# This is a basic workflow to help you get started with Actions + +name: Upload to PIP + +# Controls when the action will run. +on: + # Triggers the workflow when a release is created + release: + types: [created] + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "upload" + upload: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v2 + + # Sets up python + - uses: actions/setup-python@v2 + with: + python-version: 3.8 + + # Install dependencies + - name: "Installs dependencies" + run: | + python3 -m pip install --upgrade pip + python3 -m pip install setuptools wheel twine + + # Build and upload to PyPI + - name: "Builds and uploads to PyPI" + run: | + python3 setup.py sdist bdist_wheel + python3 -m twine upload dist/* + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.TWINE_TOKEN }} diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..f17f07b3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +__pycache__/ +build/ +dist/ +*.egg-info/ +*.egg +venv/ +.env diff --git a/pydash/__init__.py b/pydash/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/src/trueupdate.py b/pydash/trueupdate.py similarity index 100% rename from src/trueupdate.py rename to pydash/trueupdate.py diff --git a/setup.py b/setup.py new file mode 100644 index 00000000..125391f5 --- /dev/null +++ b/setup.py @@ -0,0 +1,77 @@ +from setuptools import setup, find_packages +from os.path import abspath, dirname, join + +# Fetches the content from README.md +# This will be used for the "long_description" field. +README_MD = open(join(dirname(abspath(__file__)), "README.md")).read() + +setup( + # The name of your project that we discussed earlier. + # This name will decide what users will type when they install your package. + # In my case it will be: + # pip install pydash-arnu515 + # This field is REQUIRED + name="pydash-arnu515", + + # The version of your project. + # Usually, it would be in the form of: + # major.minor.patch + # eg: 1.0.0, 1.0.1, 3.0.2, 5.0-beta, etc. + # You CANNOT upload two versions of your package with the same version number + # This field is REQUIRED + version="1.0.1", + + # The packages that constitute your project. + # For my project, I have only one - "pydash". + # Either you could write the name of the package, or + # alternatively use setuptools.findpackages() + # + # If you only have one file, instead of a package, + # you can instead use the py_modules field instead. + # EITHER py_modules OR packages should be present. + packages=find_packages(exclude="tests"), + + # The description that will be shown on PyPI. + # Keep it short and concise + # This field is OPTIONAL + description="A small clone of lodash", + + # The content that will be shown on your project page. + # In this case, we're displaying whatever is there in our README.md file + # This field is OPTIONAL + long_description=README_MD, + + # Now, we'll tell PyPI what language our README file is in. + # In my case it is in Markdown, so I'll write "text/markdown" + # Some people use reStructuredText instead, so you should write "text/x-rst" + # If your README is just a text file, you have to write "text/plain" + # This field is OPTIONAL + long_description_content_type="text/markdown", + + # The url field should contain a link to a git repository, the project's website + # or the project's documentation. I'll leave a link to this project's Github repository. + # This field is OPTIONAL + url="https://github.com/arnu515/pydash", + + # The author name and email fields are self explanatory. + # These fields are OPTIONAL + author_name="arnu515", + author_email="arnu5152@gmail.com", + + # Classifiers help categorize your project. + # For a complete list of classifiers, visit: + # https://pypi.org/classifiers + # This is OPTIONAL + classifiers=[ + "License :: OSI Approved :: MIT License", + "Intended Audience :: Developers", + "Programming Language :: Python :: 3 :: Only" + ], + + # Keywords are tags that identify your project and help searching for it + # This field is OPTIONAL + keywords="lodash, string, manipulation", + + # For additional fields, check: + # https://github.com/pypa/sampleproject/blob/master/setup.py +) diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/test_string.py b/tests/test_string.py new file mode 100644 index 00000000..66b5f4a9 --- /dev/null +++ b/tests/test_string.py @@ -0,0 +1,7 @@ +import unittest + +from pydash import PyDash + + +class Test(unittest.TestCase): + From 4659235436ed7cc5ebf04cd6d5d69becb482aeb4 Mon Sep 17 00:00:00 2001 From: kjeld Schouten-Lebbing Date: Sun, 16 Jan 2022 15:37:21 +0100 Subject: [PATCH 0004/1229] cleaunup --- tests/test_string.py | 7 ------- {pydash => trueupdate}/__init__.py | 0 {pydash => trueupdate}/trueupdate.py | 0 3 files changed, 7 deletions(-) delete mode 100644 tests/test_string.py rename {pydash => trueupdate}/__init__.py (100%) rename {pydash => trueupdate}/trueupdate.py (100%) diff --git a/tests/test_string.py b/tests/test_string.py deleted file mode 100644 index 66b5f4a9..00000000 --- a/tests/test_string.py +++ /dev/null @@ -1,7 +0,0 @@ -import unittest - -from pydash import PyDash - - -class Test(unittest.TestCase): - diff --git a/pydash/__init__.py b/trueupdate/__init__.py similarity index 100% rename from pydash/__init__.py rename to trueupdate/__init__.py diff --git a/pydash/trueupdate.py b/trueupdate/trueupdate.py similarity index 100% rename from pydash/trueupdate.py rename to trueupdate/trueupdate.py From 8964a9b34b97f5233fabdff96ab667640390f552 Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Sun, 16 Jan 2022 15:42:31 +0100 Subject: [PATCH 0005/1229] Update setup.py --- setup.py | 40 +++++++--------------------------------- 1 file changed, 7 insertions(+), 33 deletions(-) diff --git a/setup.py b/setup.py index 125391f5..f686ebf0 100644 --- a/setup.py +++ b/setup.py @@ -6,20 +6,8 @@ from os.path import abspath, dirname, join README_MD = open(join(dirname(abspath(__file__)), "README.md")).read() setup( - # The name of your project that we discussed earlier. - # This name will decide what users will type when they install your package. - # In my case it will be: - # pip install pydash-arnu515 - # This field is REQUIRED - name="pydash-arnu515", - - # The version of your project. - # Usually, it would be in the form of: - # major.minor.patch - # eg: 1.0.0, 1.0.1, 3.0.2, 5.0-beta, etc. - # You CANNOT upload two versions of your package with the same version number - # This field is REQUIRED - version="1.0.1", + name="trueupdate", + version="1.0.0", # The packages that constitute your project. # For my project, I have only one - "pydash". @@ -29,12 +17,12 @@ setup( # If you only have one file, instead of a package, # you can instead use the py_modules field instead. # EITHER py_modules OR packages should be present. - packages=find_packages(exclude="tests"), + packages=find_packages(), # The description that will be shown on PyPI. # Keep it short and concise # This field is OPTIONAL - description="A small clone of lodash", + description="An Automatic and Bulk update utility for TrueNAS SCALE Apps", # The content that will be shown on your project page. # In this case, we're displaying whatever is there in our README.md file @@ -51,26 +39,12 @@ setup( # The url field should contain a link to a git repository, the project's website # or the project's documentation. I'll leave a link to this project's Github repository. # This field is OPTIONAL - url="https://github.com/arnu515/pydash", + url="https://github.com/truecharts/trueupdate", # The author name and email fields are self explanatory. # These fields are OPTIONAL - author_name="arnu515", - author_email="arnu5152@gmail.com", - - # Classifiers help categorize your project. - # For a complete list of classifiers, visit: - # https://pypi.org/classifiers - # This is OPTIONAL - classifiers=[ - "License :: OSI Approved :: MIT License", - "Intended Audience :: Developers", - "Programming Language :: Python :: 3 :: Only" - ], - - # Keywords are tags that identify your project and help searching for it - # This field is OPTIONAL - keywords="lodash, string, manipulation", + author_name="truecharts", + author_email="into@truecharts.org", # For additional fields, check: # https://github.com/pypa/sampleproject/blob/master/setup.py From 2564e4256a5e65e04e4a71257fa6bc2579002622 Mon Sep 17 00:00:00 2001 From: kjeld Schouten-Lebbing Date: Sun, 16 Jan 2022 15:42:56 +0100 Subject: [PATCH 0006/1229] move code to init --- trueupdate/__init__.py | 90 ++++++++++++++++++++++++++++++++++++++++ trueupdate/trueupdate.py | 90 ---------------------------------------- 2 files changed, 90 insertions(+), 90 deletions(-) delete mode 100644 trueupdate/trueupdate.py diff --git a/trueupdate/__init__.py b/trueupdate/__init__.py index e69de29b..ae4dfcd7 100644 --- a/trueupdate/__init__.py +++ b/trueupdate/__init__.py @@ -0,0 +1,90 @@ +import subprocess +import sys + +class Chart(object): + def __setattr__(self, name, value): + if name == 'status': + value = value.casefold() + if 'update_available' in name: + value = True if value.casefold() == "true" else False + super(Chart, self).__setattr__(name, value) + + def new_attr(self, attr): + setattr(self, attr, attr) + +INSTALLED_CHARTS = [] +CATALOG = "ALL" +SEMVER = "minor" + +def parse_headers(charts: str): + for line in charts.split("\n"): + if line.startswith("+-"): + continue + if "name" in line.casefold(): + return [col.strip() for col in line.casefold().strip().split("|") if col and col != ""] + +def parse_charts(charts: str): + headers = parse_headers(charts) + table_data = charts.split("\n")[3:-2:] # Skip the header part of the table + for row in table_data: + row = [section.strip() for section in row.split("|") if section and section != ""] + chart = Chart() + for item in zip(headers, row): + setattr(chart, item[0], item[1]) + INSTALLED_CHARTS.append(chart) + +def check_semver(current: str, latest: str): + split_current_semver = current.split(".", 3) + split_latest_semver = latest.split(".", 3) + if split_current_semver[0] != split_latest_semver[0]: + type="major" + if SEMVER == "major": + return True + if split_current_semver[1] != split_latest_semver[1]: + type="minor" + if SEMVER != "patch": + return True + if split_current_semver[2] != split_latest_semver[2]: + type="patch" + return True + return False + + +def execute_upgrades(): + if CATALOG == "ALL": + filtered = filter(lambda a: a.update_available and a.status == "active", INSTALLED_CHARTS) + else: + filtered = filter(lambda a: a.update_available and a.status == "active" and a.catalog == CATALOG, INSTALLED_CHARTS) + for chart in filtered: + pre_update_ver = chart.human_version + post_update_ver = chart.human_latest_version + split_current_version = chart.human_version.split("_", 1) + current_version = split_current_version[1] + split_latest = chart.human_latest_version.split("_", 1) + latest_version = split_latest[1] + if check_semver(current_version, latest_version): + pre_update_ver = chart.human_version + result = subprocess.run(['cli', '-c', f'app chart_release upgrade release_name={chart.name}'], capture_output=True) + post_update_ver = chart.human_latest_version + if "Upgrade complete" not in result.stdout.decode('utf-8'): + print(f"{chart.name} failed to upgrade. \n{result.stdout.decode('utf-8')}") + else: + print(f"{chart.name} upgraded ({pre_update_ver} --> {post_update_ver})") + +def fetch_charts(): + rawcharts = subprocess.run(["cli", "-c", "app chart_release query"], stdout=subprocess.PIPE) + charts = rawcharts.stdout.decode('utf-8') + return(charts) + +def get_args(): + if len(sys.argv) == 3: + SEMVER = sys.argv[2] or "minor" + if len(sys.argv) == 2: + CATALOG = sys.argv[1] or "ALL" + +if __name__ == '__main__': + get_args() + charts = fetch_charts() + parse_charts(charts) + execute_upgrades() + exit(0) diff --git a/trueupdate/trueupdate.py b/trueupdate/trueupdate.py deleted file mode 100644 index ae4dfcd7..00000000 --- a/trueupdate/trueupdate.py +++ /dev/null @@ -1,90 +0,0 @@ -import subprocess -import sys - -class Chart(object): - def __setattr__(self, name, value): - if name == 'status': - value = value.casefold() - if 'update_available' in name: - value = True if value.casefold() == "true" else False - super(Chart, self).__setattr__(name, value) - - def new_attr(self, attr): - setattr(self, attr, attr) - -INSTALLED_CHARTS = [] -CATALOG = "ALL" -SEMVER = "minor" - -def parse_headers(charts: str): - for line in charts.split("\n"): - if line.startswith("+-"): - continue - if "name" in line.casefold(): - return [col.strip() for col in line.casefold().strip().split("|") if col and col != ""] - -def parse_charts(charts: str): - headers = parse_headers(charts) - table_data = charts.split("\n")[3:-2:] # Skip the header part of the table - for row in table_data: - row = [section.strip() for section in row.split("|") if section and section != ""] - chart = Chart() - for item in zip(headers, row): - setattr(chart, item[0], item[1]) - INSTALLED_CHARTS.append(chart) - -def check_semver(current: str, latest: str): - split_current_semver = current.split(".", 3) - split_latest_semver = latest.split(".", 3) - if split_current_semver[0] != split_latest_semver[0]: - type="major" - if SEMVER == "major": - return True - if split_current_semver[1] != split_latest_semver[1]: - type="minor" - if SEMVER != "patch": - return True - if split_current_semver[2] != split_latest_semver[2]: - type="patch" - return True - return False - - -def execute_upgrades(): - if CATALOG == "ALL": - filtered = filter(lambda a: a.update_available and a.status == "active", INSTALLED_CHARTS) - else: - filtered = filter(lambda a: a.update_available and a.status == "active" and a.catalog == CATALOG, INSTALLED_CHARTS) - for chart in filtered: - pre_update_ver = chart.human_version - post_update_ver = chart.human_latest_version - split_current_version = chart.human_version.split("_", 1) - current_version = split_current_version[1] - split_latest = chart.human_latest_version.split("_", 1) - latest_version = split_latest[1] - if check_semver(current_version, latest_version): - pre_update_ver = chart.human_version - result = subprocess.run(['cli', '-c', f'app chart_release upgrade release_name={chart.name}'], capture_output=True) - post_update_ver = chart.human_latest_version - if "Upgrade complete" not in result.stdout.decode('utf-8'): - print(f"{chart.name} failed to upgrade. \n{result.stdout.decode('utf-8')}") - else: - print(f"{chart.name} upgraded ({pre_update_ver} --> {post_update_ver})") - -def fetch_charts(): - rawcharts = subprocess.run(["cli", "-c", "app chart_release query"], stdout=subprocess.PIPE) - charts = rawcharts.stdout.decode('utf-8') - return(charts) - -def get_args(): - if len(sys.argv) == 3: - SEMVER = sys.argv[2] or "minor" - if len(sys.argv) == 2: - CATALOG = sys.argv[1] or "ALL" - -if __name__ == '__main__': - get_args() - charts = fetch_charts() - parse_charts(charts) - execute_upgrades() - exit(0) From 191adb9012c21ef0115428c93c03aeb4d4c187cd Mon Sep 17 00:00:00 2001 From: kjeld Schouten-Lebbing Date: Sun, 16 Jan 2022 15:59:43 +0100 Subject: [PATCH 0007/1229] tweak commandline access --- .github/workflows/test-and-upload-to-testpypi.yml | 2 +- setup.py | 6 +++++- trueupdate/__init__.py | 12 ++++++++---- trueupdate/command_line.py | 4 ++++ 4 files changed, 18 insertions(+), 6 deletions(-) create mode 100644 trueupdate/command_line.py diff --git a/.github/workflows/test-and-upload-to-testpypi.yml b/.github/workflows/test-and-upload-to-testpypi.yml index e9312463..d73bc96e 100644 --- a/.github/workflows/test-and-upload-to-testpypi.yml +++ b/.github/workflows/test-and-upload-to-testpypi.yml @@ -6,7 +6,7 @@ name: Test & Upload to TestPyPI on: # Triggers the workflow on push to the master branch push: - branches: [ master ] + branches: [ main ] # Allows you to run this workflow manually from the Actions tab workflow_dispatch: diff --git a/setup.py b/setup.py index f686ebf0..da423c5d 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ README_MD = open(join(dirname(abspath(__file__)), "README.md")).read() setup( name="trueupdate", - version="1.0.0", + version="1.0.1", # The packages that constitute your project. # For my project, I have only one - "pydash". @@ -18,6 +18,10 @@ setup( # you can instead use the py_modules field instead. # EITHER py_modules OR packages should be present. packages=find_packages(), + + entry_points = { + 'console_scripts': ['trueupdate=trueupdate.command_line:main'], + } # The description that will be shown on PyPI. # Keep it short and concise diff --git a/trueupdate/__init__.py b/trueupdate/__init__.py index ae4dfcd7..1a68eb9f 100644 --- a/trueupdate/__init__.py +++ b/trueupdate/__init__.py @@ -76,6 +76,12 @@ def fetch_charts(): charts = rawcharts.stdout.decode('utf-8') return(charts) +def run() + get_args() + charts = fetch_charts() + parse_charts(charts) + execute_upgrades() + def get_args(): if len(sys.argv) == 3: SEMVER = sys.argv[2] or "minor" @@ -83,8 +89,6 @@ def get_args(): CATALOG = sys.argv[1] or "ALL" if __name__ == '__main__': - get_args() - charts = fetch_charts() - parse_charts(charts) - execute_upgrades() + run() exit(0) + diff --git a/trueupdate/command_line.py b/trueupdate/command_line.py new file mode 100644 index 00000000..ff1879eb --- /dev/null +++ b/trueupdate/command_line.py @@ -0,0 +1,4 @@ +import trueupdate + +def main(): + print trueupdate.run() \ No newline at end of file From a989fa2d6e21e5af9bc5d029c288ab0daa3573e1 Mon Sep 17 00:00:00 2001 From: kjeld Schouten-Lebbing Date: Sun, 16 Jan 2022 16:01:37 +0100 Subject: [PATCH 0008/1229] fix small mistake --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index da423c5d..83ab053e 100644 --- a/setup.py +++ b/setup.py @@ -21,7 +21,7 @@ setup( entry_points = { 'console_scripts': ['trueupdate=trueupdate.command_line:main'], - } + }, # The description that will be shown on PyPI. # Keep it short and concise From 9f46c428d07bf7b4ba899f18e733d8a5dc17797c Mon Sep 17 00:00:00 2001 From: kjeld Schouten-Lebbing Date: Sun, 16 Jan 2022 16:07:36 +0100 Subject: [PATCH 0009/1229] fix mistake --- setup.py | 2 +- trueupdate/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 83ab053e..c8f8c966 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ README_MD = open(join(dirname(abspath(__file__)), "README.md")).read() setup( name="trueupdate", - version="1.0.1", + version="1.0.2", # The packages that constitute your project. # For my project, I have only one - "pydash". diff --git a/trueupdate/__init__.py b/trueupdate/__init__.py index 1a68eb9f..38d75f6d 100644 --- a/trueupdate/__init__.py +++ b/trueupdate/__init__.py @@ -76,7 +76,7 @@ def fetch_charts(): charts = rawcharts.stdout.decode('utf-8') return(charts) -def run() +def run(): get_args() charts = fetch_charts() parse_charts(charts) From 86f8f54c70a261dadcc55907aa7e292ebe01c055 Mon Sep 17 00:00:00 2001 From: kjeld Schouten-Lebbing Date: Sun, 16 Jan 2022 16:15:58 +0100 Subject: [PATCH 0010/1229] no message --- README.md | 19 +++++++++++++++++++ setup.py | 2 +- trueupdate/command_line.py | 2 +- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ea4dc675..5ede9cef 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,21 @@ # trueupdate A TrueCharts automatic and bulk update utility + +## How to install + +run `pip install trueupdate` + +Please be aware you will need to reinstall after every SCALE update + +## How to Update + +run `pip install --upgrade trueupdate` + +## How to use + +Just run `trueupdate` in the shell of your TrueNAS SCALE machine, to have it process Patch and Minor version updates for all Apps + +Additional options are available: + +- `trueupdate CATALOG` where CATALOG is the name of the catalog you want to process in caps +- `trueupdate Semver` where semver is the highest semver version you want to process. options: `patch`, `minor` and `major` \ No newline at end of file diff --git a/setup.py b/setup.py index c8f8c966..8bb847af 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ README_MD = open(join(dirname(abspath(__file__)), "README.md")).read() setup( name="trueupdate", - version="1.0.2", + version="1.0.3", # The packages that constitute your project. # For my project, I have only one - "pydash". diff --git a/trueupdate/command_line.py b/trueupdate/command_line.py index ff1879eb..61007677 100644 --- a/trueupdate/command_line.py +++ b/trueupdate/command_line.py @@ -1,4 +1,4 @@ import trueupdate def main(): - print trueupdate.run() \ No newline at end of file + trueupdate.run() \ No newline at end of file From 314fe942d130919db349a1e411d16a4881cea770 Mon Sep 17 00:00:00 2001 From: kjeld Schouten-Lebbing Date: Tue, 18 Jan 2022 23:18:39 +0100 Subject: [PATCH 0011/1229] expand commandline options and add sync option --- setup.py | 2 +- trueupdate/__init__.py | 61 +++++++++++++++++++++++++++++------------- 2 files changed, 43 insertions(+), 20 deletions(-) diff --git a/setup.py b/setup.py index 8bb847af..ff475a4f 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ README_MD = open(join(dirname(abspath(__file__)), "README.md")).read() setup( name="trueupdate", - version="1.0.3", + version="2.0.0", # The packages that constitute your project. # For my project, I have only one - "pydash". diff --git a/trueupdate/__init__.py b/trueupdate/__init__.py index 38d75f6d..6cbd6d56 100644 --- a/trueupdate/__init__.py +++ b/trueupdate/__init__.py @@ -1,5 +1,7 @@ import subprocess import sys +import argparse +import time class Chart(object): def __setattr__(self, name, value): @@ -13,8 +15,6 @@ class Chart(object): setattr(self, attr, attr) INSTALLED_CHARTS = [] -CATALOG = "ALL" -SEMVER = "minor" def parse_headers(charts: str): for line in charts.split("\n"): @@ -38,11 +38,11 @@ def check_semver(current: str, latest: str): split_latest_semver = latest.split(".", 3) if split_current_semver[0] != split_latest_semver[0]: type="major" - if SEMVER == "major": + if VERSIONING == "major": return True if split_current_semver[1] != split_latest_semver[1]: type="minor" - if SEMVER != "patch": + if VERSIONING != "patch": return True if split_current_semver[2] != split_latest_semver[2]: type="patch" @@ -63,32 +63,55 @@ def execute_upgrades(): split_latest = chart.human_latest_version.split("_", 1) latest_version = split_latest[1] if check_semver(current_version, latest_version): - pre_update_ver = chart.human_version - result = subprocess.run(['cli', '-c', f'app chart_release upgrade release_name={chart.name}'], capture_output=True) - post_update_ver = chart.human_latest_version - if "Upgrade complete" not in result.stdout.decode('utf-8'): - print(f"{chart.name} failed to upgrade. \n{result.stdout.decode('utf-8')}") - else: - print(f"{chart.name} upgraded ({pre_update_ver} --> {post_update_ver})") + print(f"Updating {chart.name}... \n") + #pre_update_ver = chart.human_version + #result = subprocess.run(['cli', '-c', f'app chart_release upgrade release_name={chart.name}'], capture_output=True) + #post_update_ver = chart.human_latest_version + #if "Upgrade complete" not in result.stdout.decode('utf-8'): + # print(f"{chart.name} failed to upgrade. \n{result.stdout.decode('utf-8')}") + #else: + # print(f"{chart.name} upgraded ({pre_update_ver} --> {post_update_ver})") def fetch_charts(): rawcharts = subprocess.run(["cli", "-c", "app chart_release query"], stdout=subprocess.PIPE) charts = rawcharts.stdout.decode('utf-8') return(charts) +def process_args(): + global CATALOG + global SEMVER + global SYNC + parser = argparse.ArgumentParser(description='Update TrueNAS SCALE Apps') + parser.add_argument('--catalog', nargs='?', default='ALL', help='name of the catalog you want to process in caps. Or "ALL" to render all catalogs.') + parser.add_argument('--versioning', nargs='?', default='minor', help='Name of the versioning scheme you want to update. Options: major, minor or patch. Defaults to minor') + parser.add_argument('-s', '--sync', action="store_true", help='sync catalogs before trying to update') + args = parser.parse_args() + CATALOG = args.catalog + VERSIONING = args.versioning + if args.sync: + SYNC = True + +def sync_catalog(): + if SYNC: + print("Syncing Catalogs...\n") + process = subprocess.Popen(["cli", "-c", "app catalog sync_all"], stdout=subprocess.PIPE) + while process.poll() is None: + lines = process.stdout.readline() + print (lines) + print (process.stdout.read()) + def run(): - get_args() + process_args() + print("Starting TrueCharts App updater...\n") + sync_catalog() charts = fetch_charts() parse_charts(charts) + print("Executing Updates...\n") execute_upgrades() - -def get_args(): - if len(sys.argv) == 3: - SEMVER = sys.argv[2] or "minor" - if len(sys.argv) == 2: - CATALOG = sys.argv[1] or "ALL" + print("Updating Finished\n") + exit(0) + if __name__ == '__main__': run() - exit(0) From 66b72a5b4b06ea880385390da80d262a10af3562 Mon Sep 17 00:00:00 2001 From: kjeld Schouten-Lebbing Date: Tue, 18 Jan 2022 23:34:22 +0100 Subject: [PATCH 0012/1229] update readme --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5ede9cef..6b002190 100644 --- a/README.md +++ b/README.md @@ -17,5 +17,6 @@ Just run `trueupdate` in the shell of your TrueNAS SCALE machine, to have it pro Additional options are available: -- `trueupdate CATALOG` where CATALOG is the name of the catalog you want to process in caps -- `trueupdate Semver` where semver is the highest semver version you want to process. options: `patch`, `minor` and `major` \ No newline at end of file +- `trueupdate -s` or ` trueupdate --sync` to sync the catalogs before running auto-update +- `trueupdate --catalog CATALOGNAME` where CATALOGNAME is the name of the catalog you want to process in caps +- `trueupdate --versioning SCHEME` where SCHEME is the highest semver version you want to process. options: `patch`, `minor` and `major` \ No newline at end of file From 8b641e0b5ce2decb0bd1a4a912292c1b4dd8bd85 Mon Sep 17 00:00:00 2001 From: kjeld Schouten-Lebbing Date: Tue, 18 Jan 2022 23:35:52 +0100 Subject: [PATCH 0013/1229] add help page to readme --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 6b002190..d6c3f1d8 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ Just run `trueupdate` in the shell of your TrueNAS SCALE machine, to have it pro Additional options are available: +- `trueupdate -h` for the CLI help page - `trueupdate -s` or ` trueupdate --sync` to sync the catalogs before running auto-update - `trueupdate --catalog CATALOGNAME` where CATALOGNAME is the name of the catalog you want to process in caps - `trueupdate --versioning SCHEME` where SCHEME is the highest semver version you want to process. options: `patch`, `minor` and `major` \ No newline at end of file From 3be0715b4348b39e0f3756a13aa1db479e4dba80 Mon Sep 17 00:00:00 2001 From: kjeld Schouten-Lebbing Date: Tue, 18 Jan 2022 23:57:15 +0100 Subject: [PATCH 0014/1229] hotfix --- setup.py | 2 +- trueupdate/__init__.py | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/setup.py b/setup.py index ff475a4f..75a764cd 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ README_MD = open(join(dirname(abspath(__file__)), "README.md")).read() setup( name="trueupdate", - version="2.0.0", + version="2.0.1", # The packages that constitute your project. # For my project, I have only one - "pydash". diff --git a/trueupdate/__init__.py b/trueupdate/__init__.py index 6cbd6d56..14ccce14 100644 --- a/trueupdate/__init__.py +++ b/trueupdate/__init__.py @@ -64,13 +64,13 @@ def execute_upgrades(): latest_version = split_latest[1] if check_semver(current_version, latest_version): print(f"Updating {chart.name}... \n") - #pre_update_ver = chart.human_version - #result = subprocess.run(['cli', '-c', f'app chart_release upgrade release_name={chart.name}'], capture_output=True) - #post_update_ver = chart.human_latest_version - #if "Upgrade complete" not in result.stdout.decode('utf-8'): - # print(f"{chart.name} failed to upgrade. \n{result.stdout.decode('utf-8')}") - #else: - # print(f"{chart.name} upgraded ({pre_update_ver} --> {post_update_ver})") + pre_update_ver = chart.human_version + result = subprocess.run(['cli', '-c', f'app chart_release upgrade release_name={chart.name}'], capture_output=True) + post_update_ver = chart.human_latest_version + if "Upgrade complete" not in result.stdout.decode('utf-8'): + print(f"{chart.name} failed to upgrade. \n{result.stdout.decode('utf-8')}") + else: + print(f"{chart.name} upgraded ({pre_update_ver} --> {post_update_ver})") def fetch_charts(): rawcharts = subprocess.run(["cli", "-c", "app chart_release query"], stdout=subprocess.PIPE) From 126125c377a62a05ac43bc508409a65bc2455e0b Mon Sep 17 00:00:00 2001 From: kjeld Schouten-Lebbing Date: Wed, 19 Jan 2022 00:03:23 +0100 Subject: [PATCH 0015/1229] hotfix 2 --- setup.py | 2 +- trueupdate/__init__.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 75a764cd..0a307d4e 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ README_MD = open(join(dirname(abspath(__file__)), "README.md")).read() setup( name="trueupdate", - version="2.0.1", + version="2.0.2", # The packages that constitute your project. # For my project, I have only one - "pydash". diff --git a/trueupdate/__init__.py b/trueupdate/__init__.py index 14ccce14..212235d8 100644 --- a/trueupdate/__init__.py +++ b/trueupdate/__init__.py @@ -90,6 +90,8 @@ def process_args(): VERSIONING = args.versioning if args.sync: SYNC = True + else: + SYNC = False def sync_catalog(): if SYNC: From 768854df4fe01021fe7009d58f5db8fd892b02e8 Mon Sep 17 00:00:00 2001 From: kjeld Schouten-Lebbing Date: Wed, 19 Jan 2022 17:37:14 +0100 Subject: [PATCH 0016/1229] Add (optional) automatic docker pruning after update --- README.md | 1 + setup.py | 2 +- trueupdate/__init__.py | 15 +++++++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d6c3f1d8..b4911b60 100644 --- a/README.md +++ b/README.md @@ -19,5 +19,6 @@ Additional options are available: - `trueupdate -h` for the CLI help page - `trueupdate -s` or ` trueupdate --sync` to sync the catalogs before running auto-update +- `trueupdate -p` or ` trueupdate --prune` to prune (remove) old docker images after running auto-update - `trueupdate --catalog CATALOGNAME` where CATALOGNAME is the name of the catalog you want to process in caps - `trueupdate --versioning SCHEME` where SCHEME is the highest semver version you want to process. options: `patch`, `minor` and `major` \ No newline at end of file diff --git a/setup.py b/setup.py index 0a307d4e..1230b6a7 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ README_MD = open(join(dirname(abspath(__file__)), "README.md")).read() setup( name="trueupdate", - version="2.0.2", + version="2.1.0", # The packages that constitute your project. # For my project, I have only one - "pydash". diff --git a/trueupdate/__init__.py b/trueupdate/__init__.py index 212235d8..b791a429 100644 --- a/trueupdate/__init__.py +++ b/trueupdate/__init__.py @@ -81,10 +81,12 @@ def process_args(): global CATALOG global SEMVER global SYNC + global PRUNE parser = argparse.ArgumentParser(description='Update TrueNAS SCALE Apps') parser.add_argument('--catalog', nargs='?', default='ALL', help='name of the catalog you want to process in caps. Or "ALL" to render all catalogs.') parser.add_argument('--versioning', nargs='?', default='minor', help='Name of the versioning scheme you want to update. Options: major, minor or patch. Defaults to minor') parser.add_argument('-s', '--sync', action="store_true", help='sync catalogs before trying to update') + parser.add_argument('-p', '--prune', action="store_true", help='prune old docker images after update') args = parser.parse_args() CATALOG = args.catalog VERSIONING = args.versioning @@ -92,6 +94,10 @@ def process_args(): SYNC = True else: SYNC = False + if args.prune: + PRUNE = True + else: + PRUNE = False def sync_catalog(): if SYNC: @@ -102,6 +108,15 @@ def sync_catalog(): print (lines) print (process.stdout.read()) +def docker_prune(): + if PRUNE: + print("Pruning old docker images...\n") + process = subprocess.Popen(["docker", "image ", "prune", "-a", "-f"], stdout=subprocess.PIPE) + while process.poll() is None: + lines = process.stdout.readline() + print (lines) + print (process.stdout.read()) + def run(): process_args() print("Starting TrueCharts App updater...\n") From e5be1df69dda0c7dbaa32c7cd45231c1e2f5d826 Mon Sep 17 00:00:00 2001 From: kjeld Schouten-Lebbing Date: Wed, 19 Jan 2022 17:59:00 +0100 Subject: [PATCH 0017/1229] fix bug concerning `-` in app names --- setup.py | 2 +- trueupdate/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 1230b6a7..850b580e 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ README_MD = open(join(dirname(abspath(__file__)), "README.md")).read() setup( name="trueupdate", - version="2.1.0", + version="2.1.1", # The packages that constitute your project. # For my project, I have only one - "pydash". diff --git a/trueupdate/__init__.py b/trueupdate/__init__.py index b791a429..442094b0 100644 --- a/trueupdate/__init__.py +++ b/trueupdate/__init__.py @@ -65,7 +65,7 @@ def execute_upgrades(): if check_semver(current_version, latest_version): print(f"Updating {chart.name}... \n") pre_update_ver = chart.human_version - result = subprocess.run(['cli', '-c', f'app chart_release upgrade release_name={chart.name}'], capture_output=True) + result = subprocess.run(['cli', '-c', f'app chart_release upgrade release_name="{chart.name}"'], capture_output=True) post_update_ver = chart.human_latest_version if "Upgrade complete" not in result.stdout.decode('utf-8'): print(f"{chart.name} failed to upgrade. \n{result.stdout.decode('utf-8')}") From 4bb2e55d92511d7fa13e49a84c88c8e3fa3d056f Mon Sep 17 00:00:00 2001 From: kjeld Schouten-Lebbing Date: Wed, 19 Jan 2022 18:32:38 +0100 Subject: [PATCH 0018/1229] fix missing function --- setup.py | 2 +- trueupdate/__init__.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 850b580e..4f649a31 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ README_MD = open(join(dirname(abspath(__file__)), "README.md")).read() setup( name="trueupdate", - version="2.1.1", + version="2.1.2", # The packages that constitute your project. # For my project, I have only one - "pydash". diff --git a/trueupdate/__init__.py b/trueupdate/__init__.py index 442094b0..a4f63896 100644 --- a/trueupdate/__init__.py +++ b/trueupdate/__init__.py @@ -126,6 +126,7 @@ def run(): print("Executing Updates...\n") execute_upgrades() print("Updating Finished\n") + docker_prune() exit(0) From f723dc71e31632687af316efad0d648984f6b409 Mon Sep 17 00:00:00 2001 From: kjeld Schouten-Lebbing Date: Wed, 19 Jan 2022 18:34:20 +0100 Subject: [PATCH 0019/1229] fix wrong variable name --- setup.py | 2 +- trueupdate/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 4f649a31..41977213 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ README_MD = open(join(dirname(abspath(__file__)), "README.md")).read() setup( name="trueupdate", - version="2.1.2", + version="2.1.3", # The packages that constitute your project. # For my project, I have only one - "pydash". diff --git a/trueupdate/__init__.py b/trueupdate/__init__.py index a4f63896..a402b9ff 100644 --- a/trueupdate/__init__.py +++ b/trueupdate/__init__.py @@ -79,7 +79,7 @@ def fetch_charts(): def process_args(): global CATALOG - global SEMVER + global VERSIONING global SYNC global PRUNE parser = argparse.ArgumentParser(description='Update TrueNAS SCALE Apps') From eabd80c443ce17c3471edb86425377ac46528662 Mon Sep 17 00:00:00 2001 From: kjeld Schouten-Lebbing Date: Wed, 19 Jan 2022 18:39:46 +0100 Subject: [PATCH 0020/1229] use different argument structure for docker prune --- setup.py | 2 +- trueupdate/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 41977213..6a151ee7 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ README_MD = open(join(dirname(abspath(__file__)), "README.md")).read() setup( name="trueupdate", - version="2.1.3", + version="2.1.4", # The packages that constitute your project. # For my project, I have only one - "pydash". diff --git a/trueupdate/__init__.py b/trueupdate/__init__.py index a402b9ff..3dd3d687 100644 --- a/trueupdate/__init__.py +++ b/trueupdate/__init__.py @@ -111,7 +111,7 @@ def sync_catalog(): def docker_prune(): if PRUNE: print("Pruning old docker images...\n") - process = subprocess.Popen(["docker", "image ", "prune", "-a", "-f"], stdout=subprocess.PIPE) + process = subprocess.Popen(["docker", "image ", "prune", "-af"], stdout=subprocess.PIPE) while process.poll() is None: lines = process.stdout.readline() print (lines) From 4da492181f3fea0a335a9e315006b361e66a9c05 Mon Sep 17 00:00:00 2001 From: kjeld Schouten-Lebbing Date: Wed, 19 Jan 2022 18:59:44 +0100 Subject: [PATCH 0021/1229] fix docker prune AGAIN --- setup.py | 2 +- trueupdate/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 6a151ee7..b5fadf4d 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ README_MD = open(join(dirname(abspath(__file__)), "README.md")).read() setup( name="trueupdate", - version="2.1.4", + version="2.1.5", # The packages that constitute your project. # For my project, I have only one - "pydash". diff --git a/trueupdate/__init__.py b/trueupdate/__init__.py index 3dd3d687..5dfe766c 100644 --- a/trueupdate/__init__.py +++ b/trueupdate/__init__.py @@ -111,7 +111,7 @@ def sync_catalog(): def docker_prune(): if PRUNE: print("Pruning old docker images...\n") - process = subprocess.Popen(["docker", "image ", "prune", "-af"], stdout=subprocess.PIPE) + process = subprocess.Popen(["docker", "image", "prune", "-af"], stdout=subprocess.PIPE) while process.poll() is None: lines = process.stdout.readline() print (lines) From 1064d1e13fdd295a275779845c5c035cab138b03 Mon Sep 17 00:00:00 2001 From: kjeld Schouten-Lebbing Date: Wed, 19 Jan 2022 19:12:29 +0100 Subject: [PATCH 0022/1229] silence stdout on prune --- setup.py | 2 +- trueupdate/__init__.py | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/setup.py b/setup.py index b5fadf4d..feb669f4 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ README_MD = open(join(dirname(abspath(__file__)), "README.md")).read() setup( name="trueupdate", - version="2.1.5", + version="2.1.6", # The packages that constitute your project. # For my project, I have only one - "pydash". diff --git a/trueupdate/__init__.py b/trueupdate/__init__.py index 5dfe766c..f277de79 100644 --- a/trueupdate/__init__.py +++ b/trueupdate/__init__.py @@ -112,10 +112,7 @@ def docker_prune(): if PRUNE: print("Pruning old docker images...\n") process = subprocess.Popen(["docker", "image", "prune", "-af"], stdout=subprocess.PIPE) - while process.poll() is None: - lines = process.stdout.readline() - print (lines) - print (process.stdout.read()) + print("Images pruned.\n") def run(): process_args() From 75c6fe019912791b649acc189fa673c37f8c091f Mon Sep 17 00:00:00 2001 From: kjeld Schouten-Lebbing Date: Wed, 19 Jan 2022 20:34:56 +0100 Subject: [PATCH 0023/1229] cleanup sync messages --- trueupdate/__init__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/trueupdate/__init__.py b/trueupdate/__init__.py index f277de79..1664fb92 100644 --- a/trueupdate/__init__.py +++ b/trueupdate/__init__.py @@ -105,8 +105,10 @@ def sync_catalog(): process = subprocess.Popen(["cli", "-c", "app catalog sync_all"], stdout=subprocess.PIPE) while process.poll() is None: lines = process.stdout.readline() - print (lines) - print (process.stdout.read()) + print (lines.decode('utf-8')) + temp = process.stdout.read() + if temp: + print (temp.decode('utf-8')) def docker_prune(): if PRUNE: From 6c07e754593ac8630dbbf2f36170e6d595e8eaae Mon Sep 17 00:00:00 2001 From: kjeld Schouten-Lebbing Date: Wed, 19 Jan 2022 20:41:43 +0100 Subject: [PATCH 0024/1229] deal with inactive apps as well --- trueupdate/__init__.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/trueupdate/__init__.py b/trueupdate/__init__.py index 1664fb92..014089a0 100644 --- a/trueupdate/__init__.py +++ b/trueupdate/__init__.py @@ -51,10 +51,16 @@ def check_semver(current: str, latest: str): def execute_upgrades(): - if CATALOG == "ALL": - filtered = filter(lambda a: a.update_available and a.status == "active", INSTALLED_CHARTS) + if ACTIVE: + if CATALOG == "ALL": + filtered = filter(lambda a: a.update_available and a.status == "active", INSTALLED_CHARTS) + else: + filtered = filter(lambda a: a.update_available and a.status == "active" and a.catalog == CATALOG, INSTALLED_CHARTS) else: - filtered = filter(lambda a: a.update_available and a.status == "active" and a.catalog == CATALOG, INSTALLED_CHARTS) + if CATALOG == "ALL": + filtered = filter(lambda a: a.update_available, INSTALLED_CHARTS) + else: + filtered = filter(lambda a: a.update_available and a.catalog == CATALOG, INSTALLED_CHARTS) for chart in filtered: pre_update_ver = chart.human_version post_update_ver = chart.human_latest_version @@ -82,11 +88,13 @@ def process_args(): global VERSIONING global SYNC global PRUNE + global ACTIVE parser = argparse.ArgumentParser(description='Update TrueNAS SCALE Apps') parser.add_argument('--catalog', nargs='?', default='ALL', help='name of the catalog you want to process in caps. Or "ALL" to render all catalogs.') parser.add_argument('--versioning', nargs='?', default='minor', help='Name of the versioning scheme you want to update. Options: major, minor or patch. Defaults to minor') parser.add_argument('-s', '--sync', action="store_true", help='sync catalogs before trying to update') parser.add_argument('-p', '--prune', action="store_true", help='prune old docker images after update') + parser.add_argument('-a', '--active', action="store_true", help='update "active" apps only and ignore "stopped" or "stuck" apps') args = parser.parse_args() CATALOG = args.catalog VERSIONING = args.versioning @@ -98,6 +106,10 @@ def process_args(): PRUNE = True else: PRUNE = False + if args.active: + ACTIVE = True + else: + ACTIVE = False def sync_catalog(): if SYNC: From 3ec93d5b69d69a39e00bdcb34c650be7e323b084 Mon Sep 17 00:00:00 2001 From: kjeld Schouten-Lebbing Date: Wed, 19 Jan 2022 20:42:43 +0100 Subject: [PATCH 0025/1229] bump version --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index feb669f4..c90a6bfd 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ README_MD = open(join(dirname(abspath(__file__)), "README.md")).read() setup( name="trueupdate", - version="2.1.6", + version="2.2.0", # The packages that constitute your project. # For my project, I have only one - "pydash". From 2c1c0a7a795f81794f5f6f20c2890799773c53c8 Mon Sep 17 00:00:00 2001 From: kjeld Schouten-Lebbing Date: Wed, 19 Jan 2022 20:46:10 +0100 Subject: [PATCH 0026/1229] move from active to all --- README.md | 1 + trueupdate/__init__.py | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index b4911b60..314a5f07 100644 --- a/README.md +++ b/README.md @@ -20,5 +20,6 @@ Additional options are available: - `trueupdate -h` for the CLI help page - `trueupdate -s` or ` trueupdate --sync` to sync the catalogs before running auto-update - `trueupdate -p` or ` trueupdate --prune` to prune (remove) old docker images after running auto-update +- `trueupdate -a` or ` trueupdate --all` updates both active (running) and non-active (stuck or stopped) Apps - `trueupdate --catalog CATALOGNAME` where CATALOGNAME is the name of the catalog you want to process in caps - `trueupdate --versioning SCHEME` where SCHEME is the highest semver version you want to process. options: `patch`, `minor` and `major` \ No newline at end of file diff --git a/trueupdate/__init__.py b/trueupdate/__init__.py index 014089a0..05cc4756 100644 --- a/trueupdate/__init__.py +++ b/trueupdate/__init__.py @@ -51,7 +51,7 @@ def check_semver(current: str, latest: str): def execute_upgrades(): - if ACTIVE: + if ALL: if CATALOG == "ALL": filtered = filter(lambda a: a.update_available and a.status == "active", INSTALLED_CHARTS) else: @@ -88,13 +88,13 @@ def process_args(): global VERSIONING global SYNC global PRUNE - global ACTIVE + global ALL parser = argparse.ArgumentParser(description='Update TrueNAS SCALE Apps') parser.add_argument('--catalog', nargs='?', default='ALL', help='name of the catalog you want to process in caps. Or "ALL" to render all catalogs.') parser.add_argument('--versioning', nargs='?', default='minor', help='Name of the versioning scheme you want to update. Options: major, minor or patch. Defaults to minor') parser.add_argument('-s', '--sync', action="store_true", help='sync catalogs before trying to update') parser.add_argument('-p', '--prune', action="store_true", help='prune old docker images after update') - parser.add_argument('-a', '--active', action="store_true", help='update "active" apps only and ignore "stopped" or "stuck" apps') + parser.add_argument('-a', '--all', action="store_true", help='update "active" apps only and ignore "stopped" or "stuck" apps') args = parser.parse_args() CATALOG = args.catalog VERSIONING = args.versioning @@ -106,10 +106,10 @@ def process_args(): PRUNE = True else: PRUNE = False - if args.active: - ACTIVE = True + if args.all: + ALL = True else: - ACTIVE = False + ALL = False def sync_catalog(): if SYNC: From 7f8f523fca99fb565a547fa4f48a301b6877ff85 Mon Sep 17 00:00:00 2001 From: kjeld Schouten-Lebbing Date: Wed, 19 Jan 2022 21:00:14 +0100 Subject: [PATCH 0027/1229] add automated Apps Backup option --- README.md | 7 +++++-- setup.py | 2 +- trueupdate/__init__.py | 18 ++++++++++++++++++ 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 314a5f07..103f946c 100644 --- a/README.md +++ b/README.md @@ -17,9 +17,12 @@ Just run `trueupdate` in the shell of your TrueNAS SCALE machine, to have it pro Additional options are available: +- `trueupdate --catalog CATALOGNAME` where CATALOGNAME is the name of the catalog you want to process in caps +- `trueupdate --versioning SCHEME` where SCHEME is the highest semver version you want to process. options: `patch`, `minor` and `major` + + - `trueupdate -h` for the CLI help page - `trueupdate -s` or ` trueupdate --sync` to sync the catalogs before running auto-update - `trueupdate -p` or ` trueupdate --prune` to prune (remove) old docker images after running auto-update - `trueupdate -a` or ` trueupdate --all` updates both active (running) and non-active (stuck or stopped) Apps -- `trueupdate --catalog CATALOGNAME` where CATALOGNAME is the name of the catalog you want to process in caps -- `trueupdate --versioning SCHEME` where SCHEME is the highest semver version you want to process. options: `patch`, `minor` and `major` \ No newline at end of file +- `trueupdate -b` or ` trueupdate --backup` backup the complete Apps system prior to updates \ No newline at end of file diff --git a/setup.py b/setup.py index c90a6bfd..3c64073a 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ README_MD = open(join(dirname(abspath(__file__)), "README.md")).read() setup( name="trueupdate", - version="2.2.0", + version="2.3.0", # The packages that constitute your project. # For my project, I have only one - "pydash". diff --git a/trueupdate/__init__.py b/trueupdate/__init__.py index 05cc4756..c75ccebf 100644 --- a/trueupdate/__init__.py +++ b/trueupdate/__init__.py @@ -89,12 +89,14 @@ def process_args(): global SYNC global PRUNE global ALL + global BACKUP parser = argparse.ArgumentParser(description='Update TrueNAS SCALE Apps') parser.add_argument('--catalog', nargs='?', default='ALL', help='name of the catalog you want to process in caps. Or "ALL" to render all catalogs.') parser.add_argument('--versioning', nargs='?', default='minor', help='Name of the versioning scheme you want to update. Options: major, minor or patch. Defaults to minor') parser.add_argument('-s', '--sync', action="store_true", help='sync catalogs before trying to update') parser.add_argument('-p', '--prune', action="store_true", help='prune old docker images after update') parser.add_argument('-a', '--all', action="store_true", help='update "active" apps only and ignore "stopped" or "stuck" apps') + parser.add_argument('-b', '--backup', action="store_true", help='backup the complete Apps system prior to updates') args = parser.parse_args() CATALOG = args.catalog VERSIONING = args.versioning @@ -110,6 +112,10 @@ def process_args(): ALL = True else: ALL = False + if args.backup: + BACKUP = True + else: + BACKUP = False def sync_catalog(): if SYNC: @@ -127,10 +133,22 @@ def docker_prune(): print("Pruning old docker images...\n") process = subprocess.Popen(["docker", "image", "prune", "-af"], stdout=subprocess.PIPE) print("Images pruned.\n") + +def chart_backup(): + if BACKUP: + print("Running App Backup...\n") + process = subprocess.Popen(["cli", "-c", "app kubernetes backup_chart_releases"], stdout=subprocess.PIPE) + while process.poll() is None: + lines = process.stdout.readline() + print (lines.decode('utf-8')) + temp = process.stdout.read() + if temp: + print (temp.decode('utf-8')) def run(): process_args() print("Starting TrueCharts App updater...\n") + chart_backup() sync_catalog() charts = fetch_charts() parse_charts(charts) From 779b632835d24d3a984047b0bb32a2a095136973 Mon Sep 17 00:00:00 2001 From: kjeld Schouten-Lebbing Date: Wed, 19 Jan 2022 21:14:09 +0100 Subject: [PATCH 0028/1229] trueupdate -> TrueTool --- README.md | 25 +++++++++++++------------ setup.py | 10 +++++----- {trueupdate => truetool}/__init__.py | 0 truetool/command_line.py | 4 ++++ trueupdate/command_line.py | 4 ---- 5 files changed, 22 insertions(+), 21 deletions(-) rename {trueupdate => truetool}/__init__.py (100%) create mode 100644 truetool/command_line.py delete mode 100644 trueupdate/command_line.py diff --git a/README.md b/README.md index 103f946c..281d5f99 100644 --- a/README.md +++ b/README.md @@ -1,28 +1,29 @@ -# trueupdate -A TrueCharts automatic and bulk update utility +# truetool +A easy tool for frequently used TrueNAS SCALE CLI utilities. +Previously known as "trueupdate" ## How to install -run `pip install trueupdate` +run `pip install truetool` Please be aware you will need to reinstall after every SCALE update ## How to Update -run `pip install --upgrade trueupdate` +run `pip install --upgrade truetool` ## How to use -Just run `trueupdate` in the shell of your TrueNAS SCALE machine, to have it process Patch and Minor version updates for all Apps +Just run `truetool` in the shell of your TrueNAS SCALE machine, to have it process Patch and Minor version updates for all Apps Additional options are available: -- `trueupdate --catalog CATALOGNAME` where CATALOGNAME is the name of the catalog you want to process in caps -- `trueupdate --versioning SCHEME` where SCHEME is the highest semver version you want to process. options: `patch`, `minor` and `major` +- `truetool --catalog CATALOGNAME` where CATALOGNAME is the name of the catalog you want to process in caps +- `truetool --versioning SCHEME` where SCHEME is the highest semver version you want to process. options: `patch`, `minor` and `major` -- `trueupdate -h` for the CLI help page -- `trueupdate -s` or ` trueupdate --sync` to sync the catalogs before running auto-update -- `trueupdate -p` or ` trueupdate --prune` to prune (remove) old docker images after running auto-update -- `trueupdate -a` or ` trueupdate --all` updates both active (running) and non-active (stuck or stopped) Apps -- `trueupdate -b` or ` trueupdate --backup` backup the complete Apps system prior to updates \ No newline at end of file +- `truetool -h` for the CLI help page +- `truetool -s` or ` truetool --sync` to sync the catalogs before running auto-update +- `truetool -p` or ` truetool --prune` to prune (remove) old docker images after running auto-update +- `truetool -a` or ` truetool --all` updates both active (running) and non-active (stuck or stopped) Apps +- `truetool -b` or ` truetool --backup` backup the complete Apps system prior to updates \ No newline at end of file diff --git a/setup.py b/setup.py index 3c64073a..8c8904e6 100644 --- a/setup.py +++ b/setup.py @@ -6,8 +6,8 @@ from os.path import abspath, dirname, join README_MD = open(join(dirname(abspath(__file__)), "README.md")).read() setup( - name="trueupdate", - version="2.3.0", + name="truetool", + version="1.0.0", # The packages that constitute your project. # For my project, I have only one - "pydash". @@ -20,13 +20,13 @@ setup( packages=find_packages(), entry_points = { - 'console_scripts': ['trueupdate=trueupdate.command_line:main'], + 'console_scripts': ['truetool=truetool.command_line:main'], }, # The description that will be shown on PyPI. # Keep it short and concise # This field is OPTIONAL - description="An Automatic and Bulk update utility for TrueNAS SCALE Apps", + description="An easy utility to managed frequently used TrueNAS SCALE CLI features", # The content that will be shown on your project page. # In this case, we're displaying whatever is there in our README.md file @@ -43,7 +43,7 @@ setup( # The url field should contain a link to a git repository, the project's website # or the project's documentation. I'll leave a link to this project's Github repository. # This field is OPTIONAL - url="https://github.com/truecharts/trueupdate", + url="https://github.com/truecharts/truetool", # The author name and email fields are self explanatory. # These fields are OPTIONAL diff --git a/trueupdate/__init__.py b/truetool/__init__.py similarity index 100% rename from trueupdate/__init__.py rename to truetool/__init__.py diff --git a/truetool/command_line.py b/truetool/command_line.py new file mode 100644 index 00000000..33e703bc --- /dev/null +++ b/truetool/command_line.py @@ -0,0 +1,4 @@ +import truetool + +def main(): + truetool.run() \ No newline at end of file diff --git a/trueupdate/command_line.py b/trueupdate/command_line.py deleted file mode 100644 index 61007677..00000000 --- a/trueupdate/command_line.py +++ /dev/null @@ -1,4 +0,0 @@ -import trueupdate - -def main(): - trueupdate.run() \ No newline at end of file From fdd76bbce595e7180785e3c069e1dca5630aa743 Mon Sep 17 00:00:00 2001 From: kjeld Schouten-Lebbing Date: Wed, 19 Jan 2022 22:15:29 +0100 Subject: [PATCH 0029/1229] add basic backup, backup-list and restore functionality --- README.md | 28 ++++++--- setup.py | 2 +- truetool/__init__.py | 135 ++++++++++++++++++++++++++++++------------- 3 files changed, 118 insertions(+), 47 deletions(-) diff --git a/README.md b/README.md index 281d5f99..8c4e5a9f 100644 --- a/README.md +++ b/README.md @@ -14,16 +14,30 @@ run `pip install --upgrade truetool` ## How to use -Just run `truetool` in the shell of your TrueNAS SCALE machine, to have it process Patch and Minor version updates for all Apps +running `truetool` should be a good start. Additional options are available: -- `truetool --catalog CATALOGNAME` where CATALOGNAME is the name of the catalog you want to process in caps -- `truetool --versioning SCHEME` where SCHEME is the highest semver version you want to process. options: `patch`, `minor` and `major` - +##### Help - `truetool -h` for the CLI help page -- `truetool -s` or ` truetool --sync` to sync the catalogs before running auto-update -- `truetool -p` or ` truetool --prune` to prune (remove) old docker images after running auto-update + + +##### Update + +- `truetool -u` or ` truetool --update` update TrueNAS SCALE Apps + + +- `truetool --catalog CATALOGNAME` where CATALOGNAME is the name of the catalog you want to process in caps +- `truetool --versioning SCHEME` where SCHEME is the highest semver version you want to process. options: `patch`, `minor` and `major` - `truetool -a` or ` truetool --all` updates both active (running) and non-active (stuck or stopped) Apps -- `truetool -b` or ` truetool --backup` backup the complete Apps system prior to updates \ No newline at end of file + + +#### Backup +- `truetool -b` or ` truetool --backup` backup the complete Apps system prior to updates +- `truetool -r` or ` truetool --restore` restores a specific backup by name + +#### Other + +- `truetool -s` or ` truetool --sync` to sync the catalogs before running updates +- `truetool -p` or ` truetool --prune` to prune (remove) old docker images after running auto-update \ No newline at end of file diff --git a/setup.py b/setup.py index 8c8904e6..1d6606e1 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ README_MD = open(join(dirname(abspath(__file__)), "README.md")).read() setup( name="truetool", - version="1.0.0", + version="2.0.0", # The packages that constitute your project. # For my project, I have only one - "pydash". diff --git a/truetool/__init__.py b/truetool/__init__.py index c75ccebf..2c2891fe 100644 --- a/truetool/__init__.py +++ b/truetool/__init__.py @@ -2,6 +2,7 @@ import subprocess import sys import argparse import time +from datetime import datetime class Chart(object): def __setattr__(self, name, value): @@ -51,32 +52,35 @@ def check_semver(current: str, latest: str): def execute_upgrades(): - if ALL: - if CATALOG == "ALL": - filtered = filter(lambda a: a.update_available and a.status == "active", INSTALLED_CHARTS) - else: - filtered = filter(lambda a: a.update_available and a.status == "active" and a.catalog == CATALOG, INSTALLED_CHARTS) - else: - if CATALOG == "ALL": - filtered = filter(lambda a: a.update_available, INSTALLED_CHARTS) - else: - filtered = filter(lambda a: a.update_available and a.catalog == CATALOG, INSTALLED_CHARTS) - for chart in filtered: - pre_update_ver = chart.human_version - post_update_ver = chart.human_latest_version - split_current_version = chart.human_version.split("_", 1) - current_version = split_current_version[1] - split_latest = chart.human_latest_version.split("_", 1) - latest_version = split_latest[1] - if check_semver(current_version, latest_version): - print(f"Updating {chart.name}... \n") - pre_update_ver = chart.human_version - result = subprocess.run(['cli', '-c', f'app chart_release upgrade release_name="{chart.name}"'], capture_output=True) - post_update_ver = chart.human_latest_version - if "Upgrade complete" not in result.stdout.decode('utf-8'): - print(f"{chart.name} failed to upgrade. \n{result.stdout.decode('utf-8')}") + if UPDATE: + if ALL: + if CATALOG == "ALL": + filtered = filter(lambda a: a.update_available and a.status == "active", INSTALLED_CHARTS) else: - print(f"{chart.name} upgraded ({pre_update_ver} --> {post_update_ver})") + filtered = filter(lambda a: a.update_available and a.status == "active" and a.catalog == CATALOG, INSTALLED_CHARTS) + else: + if CATALOG == "ALL": + filtered = filter(lambda a: a.update_available, INSTALLED_CHARTS) + else: + filtered = filter(lambda a: a.update_available and a.catalog == CATALOG, INSTALLED_CHARTS) + for chart in filtered: + pre_update_ver = chart.human_version + post_update_ver = chart.human_latest_version + split_current_version = chart.human_version.split("_", 1) + current_version = split_current_version[1] + split_latest = chart.human_latest_version.split("_", 1) + latest_version = split_latest[1] + if check_semver(current_version, latest_version): + print(f"Updating {chart.name}... \n") + pre_update_ver = chart.human_version + result = subprocess.run(['cli', '-c', f'app chart_release upgrade release_name="{chart.name}"'], capture_output=True) + post_update_ver = chart.human_latest_version + if "Upgrade complete" not in result.stdout.decode('utf-8'): + print(f"{chart.name} failed to upgrade. \n{result.stdout.decode('utf-8')}") + else: + print(f"{chart.name} upgraded ({pre_update_ver} --> {post_update_ver})") + else: + print("Update disabled, skipping...") def fetch_charts(): rawcharts = subprocess.run(["cli", "-c", "app chart_release query"], stdout=subprocess.PIPE) @@ -90,16 +94,27 @@ def process_args(): global PRUNE global ALL global BACKUP + global UPDATE + global RESTORE + global LIST parser = argparse.ArgumentParser(description='Update TrueNAS SCALE Apps') - parser.add_argument('--catalog', nargs='?', default='ALL', help='name of the catalog you want to process in caps. Or "ALL" to render all catalogs.') - parser.add_argument('--versioning', nargs='?', default='minor', help='Name of the versioning scheme you want to update. Options: major, minor or patch. Defaults to minor') + parser.add_argument('-c', '--catalog', nargs='?', default='ALL', help='name of the catalog you want to process in caps. Or "ALL" to render all catalogs.') + parser.add_argument('-v', '--versioning', nargs='?', default='minor', help='Name of the versioning scheme you want to update. Options: major, minor or patch. Defaults to minor') parser.add_argument('-s', '--sync', action="store_true", help='sync catalogs before trying to update') + parser.add_argument('-u', '--update', action="store_true", help='update the Apps in the selected catalog') parser.add_argument('-p', '--prune', action="store_true", help='prune old docker images after update') parser.add_argument('-a', '--all', action="store_true", help='update "active" apps only and ignore "stopped" or "stuck" apps') parser.add_argument('-b', '--backup', action="store_true", help='backup the complete Apps system prior to updates') + parser.add_argument('-r', '--restore', nargs='?', help='restore a previous backup, disables all other features') + parser.add_argument('-l', '--list', action="store_true", help='lists existing backups') args = parser.parse_args() CATALOG = args.catalog VERSIONING = args.versioning + RESTORE = args.restore + if args.update: + UPDATE = True + else: + UPDATE = False if args.sync: SYNC = True else: @@ -116,6 +131,11 @@ def process_args(): BACKUP = True else: BACKUP = False + if args.list: + LIST = True + else: + LIST = False + def sync_catalog(): if SYNC: @@ -127,36 +147,73 @@ def sync_catalog(): temp = process.stdout.read() if temp: print (temp.decode('utf-8')) + else: + print("Catalog Sync disabled, skipping...") def docker_prune(): if PRUNE: print("Pruning old docker images...\n") process = subprocess.Popen(["docker", "image", "prune", "-af"], stdout=subprocess.PIPE) print("Images pruned.\n") + else: + print("Container Image Pruning disabled, skipping...") -def chart_backup(): +def apps_backup(): if BACKUP: print("Running App Backup...\n") - process = subprocess.Popen(["cli", "-c", "app kubernetes backup_chart_releases"], stdout=subprocess.PIPE) + now = datetime.now() + command = "app kubernetes backup_chart_releases backup_name=TrueTool_"+now.strftime("%Y_%d_%m_%H_%M_%S") + process = subprocess.Popen(["cli", "-c", command], stdout=subprocess.PIPE) while process.poll() is None: lines = process.stdout.readline() print (lines.decode('utf-8')) temp = process.stdout.read() if temp: print (temp.decode('utf-8')) + else: + print("Backup disabled, skipping...") + +def backups_list(): + if LIST: + print("Running App Backup...\n") + process = subprocess.Popen(["cli", "-c", "app kubernetes list_backups"], stdout=subprocess.PIPE) + while process.poll() is None: + lines = process.stdout.readline() + print (lines.decode('utf-8')) + temp = process.stdout.read() + if temp: + print (temp.decode('utf-8')) + +def apps_restore(): + print("Running Backup Restore...\n") + command = "app kubernetes restore_backup backup_name="+RESTORE + print(f"{command}") + process = subprocess.Popen(["cli", "-c", command], stdout=subprocess.PIPE) + while process.poll() is None: + lines = process.stdout.readline() + print (lines.decode('utf-8')) + temp = process.stdout.read() + if temp: + print (temp.decode('utf-8')) + def run(): process_args() - print("Starting TrueCharts App updater...\n") - chart_backup() - sync_catalog() - charts = fetch_charts() - parse_charts(charts) - print("Executing Updates...\n") - execute_upgrades() - print("Updating Finished\n") - docker_prune() - exit(0) + print("Starting TrueCharts TrueTool...\n") + if RESTORE: + apps_restore() + elif LIST: + backups_list() + else: + apps_backup() + sync_catalog() + charts = fetch_charts() + parse_charts(charts) + print("Executing Updates...\n") + execute_upgrades() + docker_prune() + print("TrueTool Finished\n") + exit(0) if __name__ == '__main__': From ba1ccb7d18ebea1b4b6b7b56c48c7dbfbc46271a Mon Sep 17 00:00:00 2001 From: kjeld Schouten-Lebbing Date: Wed, 19 Jan 2022 22:16:04 +0100 Subject: [PATCH 0030/1229] readme --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 8c4e5a9f..bed2126d 100644 --- a/README.md +++ b/README.md @@ -18,12 +18,12 @@ running `truetool` should be a good start. Additional options are available: -##### Help +### Help - `truetool -h` for the CLI help page -##### Update +### Update - `truetool -u` or ` truetool --update` update TrueNAS SCALE Apps @@ -33,7 +33,7 @@ Additional options are available: - `truetool -a` or ` truetool --all` updates both active (running) and non-active (stuck or stopped) Apps -#### Backup +### Backup - `truetool -b` or ` truetool --backup` backup the complete Apps system prior to updates - `truetool -r` or ` truetool --restore` restores a specific backup by name From b540499b4daac3907ec5bc738ef345dc7ed696a3 Mon Sep 17 00:00:00 2001 From: kjeld Schouten-Lebbing Date: Wed, 19 Jan 2022 22:16:33 +0100 Subject: [PATCH 0031/1229] more readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bed2126d..ac77e415 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Additional options are available: ### Update -- `truetool -u` or ` truetool --update` update TrueNAS SCALE Apps +- `truetool -u` or ` truetool --update` updates TrueNAS SCALE Apps - `truetool --catalog CATALOGNAME` where CATALOGNAME is the name of the catalog you want to process in caps From 1c41a77e128d089039b082d8cc83706287b585ca Mon Sep 17 00:00:00 2001 From: kjeld Schouten-Lebbing Date: Thu, 20 Jan 2022 15:45:13 +0100 Subject: [PATCH 0032/1229] updates backup system, cleanup backup list and add backup deletion --- README.md | 5 +++-- setup.py | 2 +- truetool/__init__.py | 53 +++++++++++++++++++++++++++++++------------- 3 files changed, 42 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index ac77e415..d5e1c92b 100644 --- a/README.md +++ b/README.md @@ -34,8 +34,9 @@ Additional options are available: ### Backup -- `truetool -b` or ` truetool --backup` backup the complete Apps system prior to updates -- `truetool -r` or ` truetool --restore` restores a specific backup by name +- `truetool -b` or ` truetool --backup` backup the complete Apps system prior to updates. Deletes old backups prior, number of old backups can be set, 14 by default +- `truetool -r` or ` truetool --restore` **WIP** restores a specific backup by name +- `truetool -d` or ` truetool --delete` deletes a specific backup by name #### Other diff --git a/setup.py b/setup.py index 1d6606e1..1138d303 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ README_MD = open(join(dirname(abspath(__file__)), "README.md")).read() setup( name="truetool", - version="2.0.0", + version="2.1.0", # The packages that constitute your project. # For my project, I have only one - "pydash". diff --git a/truetool/__init__.py b/truetool/__init__.py index 2c2891fe..65b7b56e 100644 --- a/truetool/__init__.py +++ b/truetool/__init__.py @@ -97,20 +97,24 @@ def process_args(): global UPDATE global RESTORE global LIST + global DELETE parser = argparse.ArgumentParser(description='Update TrueNAS SCALE Apps') parser.add_argument('-c', '--catalog', nargs='?', default='ALL', help='name of the catalog you want to process in caps. Or "ALL" to render all catalogs.') parser.add_argument('-v', '--versioning', nargs='?', default='minor', help='Name of the versioning scheme you want to update. Options: major, minor or patch. Defaults to minor') + parser.add_argument('-b', '--backup', nargs='?', const='14', help='backup the complete Apps system prior to updates, add a number to specify the max old backups to keep') + parser.add_argument('-r', '--restore', nargs='?', help='restore a previous backup, disables all other features') + parser.add_argument('-d', '--delete', nargs='?', help='delete a specific backup') parser.add_argument('-s', '--sync', action="store_true", help='sync catalogs before trying to update') parser.add_argument('-u', '--update', action="store_true", help='update the Apps in the selected catalog') parser.add_argument('-p', '--prune', action="store_true", help='prune old docker images after update') parser.add_argument('-a', '--all', action="store_true", help='update "active" apps only and ignore "stopped" or "stuck" apps') - parser.add_argument('-b', '--backup', action="store_true", help='backup the complete Apps system prior to updates') - parser.add_argument('-r', '--restore', nargs='?', help='restore a previous backup, disables all other features') parser.add_argument('-l', '--list', action="store_true", help='lists existing backups') args = parser.parse_args() CATALOG = args.catalog VERSIONING = args.versioning RESTORE = args.restore + BACKUP = args.backup + DELETE = args.delete if args.update: UPDATE = True else: @@ -127,10 +131,6 @@ def process_args(): ALL = True else: ALL = False - if args.backup: - BACKUP = True - else: - BACKUP = False if args.list: LIST = True else: @@ -153,13 +153,20 @@ def sync_catalog(): def docker_prune(): if PRUNE: print("Pruning old docker images...\n") - process = subprocess.Popen(["docker", "image", "prune", "-af"], stdout=subprocess.PIPE) + process = subprocess.run(["docker", "image", "prune", "-af"], stdout=subprocess.PIPE) print("Images pruned.\n") else: print("Container Image Pruning disabled, skipping...") def apps_backup(): if BACKUP: + print(f"Cleaning old backups to a max. of {BACKUP}...\n") + backups_fetch = get_backups_names() + backups_cleaned = [k for k in backups_fetch if 'TrueTool' in k] + backups_remove = backups_cleaned[:len(backups_cleaned)-int(BACKUP)] + for backup in backups_remove: + backups_delete(backup) + print("Running App Backup...\n") now = datetime.now() command = "app kubernetes backup_chart_releases backup_name=TrueTool_"+now.strftime("%Y_%d_%m_%H_%M_%S") @@ -175,14 +182,28 @@ def apps_backup(): def backups_list(): if LIST: - print("Running App Backup...\n") - process = subprocess.Popen(["cli", "-c", "app kubernetes list_backups"], stdout=subprocess.PIPE) - while process.poll() is None: - lines = process.stdout.readline() - print (lines.decode('utf-8')) - temp = process.stdout.read() - if temp: - print (temp.decode('utf-8')) + print("Generating Backup list...\n") + backups = get_backups_names() + for backup in backups: + print(f"{backup}") + +def backups_delete(backup: str): + print(f"removing {backup}...") + process = subprocess.run(["midclt", "call", "kubernetes.delete_backup", backup], stdout=subprocess.PIPE) + +def get_backups_names(): + names = [] + process = subprocess.run(["cli", "-c", "app kubernetes list_backups"], stdout=subprocess.PIPE) + output = process.stdout.decode('utf-8') + for line in output.split("\n"): + if line.startswith("+-"): + continue + else: + rowlist = [col.strip() for col in line.strip().split("|") if col and col != ""] + if rowlist: + names.append(rowlist[0]) + names.sort() + return names def apps_restore(): print("Running Backup Restore...\n") @@ -204,6 +225,8 @@ def run(): apps_restore() elif LIST: backups_list() + elif DELETE: + backups_delete(DELETE) else: apps_backup() sync_catalog() From 22c3d3d05019a16448950da3ef2d113e42bf4ab3 Mon Sep 17 00:00:00 2001 From: kjeld Schouten-Lebbing Date: Thu, 20 Jan 2022 16:00:41 +0100 Subject: [PATCH 0033/1229] update readme --- README.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d5e1c92b..ecf8094b 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,13 @@ Additional options are available: - `truetool -r` or ` truetool --restore` **WIP** restores a specific backup by name - `truetool -d` or ` truetool --delete` deletes a specific backup by name -#### Other +### Other - `truetool -s` or ` truetool --sync` to sync the catalogs before running updates -- `truetool -p` or ` truetool --prune` to prune (remove) old docker images after running auto-update \ No newline at end of file +- `truetool -p` or ` truetool --prune` to prune (remove) old docker images after running auto-update + +### Important note + +Please use the above arguments seperatly, combining them might not work as you would expect. +So use: `truetool -u -b -p -s -a` +not: `truetool -ubpsa` \ No newline at end of file From 41c7c5782fd362dda0d9fc28f968543a1e9aff36 Mon Sep 17 00:00:00 2001 From: kjeld Schouten-Lebbing Date: Thu, 20 Jan 2022 16:26:24 +0100 Subject: [PATCH 0034/1229] add backup restore feature and bump to 3.0.0 to surpass TrueUpdate --- README.md | 2 +- setup.py | 2 +- truetool/__init__.py | 13 +++---------- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index ecf8094b..d90d398b 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ Additional options are available: ### Backup - `truetool -b` or ` truetool --backup` backup the complete Apps system prior to updates. Deletes old backups prior, number of old backups can be set, 14 by default -- `truetool -r` or ` truetool --restore` **WIP** restores a specific backup by name +- `truetool -r` or ` truetool --restore` restores a specific backup by name - `truetool -d` or ` truetool --delete` deletes a specific backup by name ### Other diff --git a/setup.py b/setup.py index 1138d303..eadd067a 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ README_MD = open(join(dirname(abspath(__file__)), "README.md")).read() setup( name="truetool", - version="2.1.0", + version="3.0.0", # The packages that constitute your project. # For my project, I have only one - "pydash". diff --git a/truetool/__init__.py b/truetool/__init__.py index 65b7b56e..cdfa0375 100644 --- a/truetool/__init__.py +++ b/truetool/__init__.py @@ -207,16 +207,9 @@ def get_backups_names(): def apps_restore(): print("Running Backup Restore...\n") - command = "app kubernetes restore_backup backup_name="+RESTORE - print(f"{command}") - process = subprocess.Popen(["cli", "-c", command], stdout=subprocess.PIPE) - while process.poll() is None: - lines = process.stdout.readline() - print (lines.decode('utf-8')) - temp = process.stdout.read() - if temp: - print (temp.decode('utf-8')) - + process = subprocess.run(["midclt", "call", "kubernetes.restore_backup", RESTORE], stdout=subprocess.PIPE) + time.sleep(5) + print("Restoration started, please check the restoration process in the TrueNAS SCALE Web GUI...\n") def run(): process_args() From 92dbb4000763ca8f70b89999bea6300ae2c67892 Mon Sep 17 00:00:00 2001 From: kjeld Schouten-Lebbing Date: Thu, 20 Jan 2022 16:30:04 +0100 Subject: [PATCH 0035/1229] add extra warning during restore regarding the time needed --- truetool/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/truetool/__init__.py b/truetool/__init__.py index cdfa0375..586e8c23 100644 --- a/truetool/__init__.py +++ b/truetool/__init__.py @@ -210,6 +210,7 @@ def apps_restore(): process = subprocess.run(["midclt", "call", "kubernetes.restore_backup", RESTORE], stdout=subprocess.PIPE) time.sleep(5) print("Restoration started, please check the restoration process in the TrueNAS SCALE Web GUI...\n") + print("Please remember: This can take a LONG time.\n") def run(): process_args() From c43251f390d4ff7c918c4722b807d02eaf157d22 Mon Sep 17 00:00:00 2001 From: kjeld Schouten-Lebbing Date: Thu, 20 Jan 2022 17:04:21 +0100 Subject: [PATCH 0036/1229] docs update with warning --- setup.py | 2 +- truetool/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index eadd067a..e8860ecb 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ README_MD = open(join(dirname(abspath(__file__)), "README.md")).read() setup( name="truetool", - version="3.0.0", + version="3.0.1", # The packages that constitute your project. # For my project, I have only one - "pydash". diff --git a/truetool/__init__.py b/truetool/__init__.py index 586e8c23..5249a847 100644 --- a/truetool/__init__.py +++ b/truetool/__init__.py @@ -98,7 +98,7 @@ def process_args(): global RESTORE global LIST global DELETE - parser = argparse.ArgumentParser(description='Update TrueNAS SCALE Apps') + parser = argparse.ArgumentParser(description='Update TrueNAS SCALE Apps \n please do NOT combine short arguments like -ubs always use -u -b -s etc.') parser.add_argument('-c', '--catalog', nargs='?', default='ALL', help='name of the catalog you want to process in caps. Or "ALL" to render all catalogs.') parser.add_argument('-v', '--versioning', nargs='?', default='minor', help='Name of the versioning scheme you want to update. Options: major, minor or patch. Defaults to minor') parser.add_argument('-b', '--backup', nargs='?', const='14', help='backup the complete Apps system prior to updates, add a number to specify the max old backups to keep') From 20f68e608b08b08f598806421510bcba1c5198e0 Mon Sep 17 00:00:00 2001 From: kjeld Schouten-Lebbing Date: Thu, 20 Jan 2022 17:05:46 +0100 Subject: [PATCH 0037/1229] update readme again --- truetool/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/truetool/__init__.py b/truetool/__init__.py index 5249a847..232a054f 100644 --- a/truetool/__init__.py +++ b/truetool/__init__.py @@ -98,7 +98,7 @@ def process_args(): global RESTORE global LIST global DELETE - parser = argparse.ArgumentParser(description='Update TrueNAS SCALE Apps \n please do NOT combine short arguments like -ubs always use -u -b -s etc.') + parser = argparse.ArgumentParser(description='TrueCharts CLI Tool. Warning: please do NOT combine short arguments like -ubs always use -u -b -s etc.') parser.add_argument('-c', '--catalog', nargs='?', default='ALL', help='name of the catalog you want to process in caps. Or "ALL" to render all catalogs.') parser.add_argument('-v', '--versioning', nargs='?', default='minor', help='Name of the versioning scheme you want to update. Options: major, minor or patch. Defaults to minor') parser.add_argument('-b', '--backup', nargs='?', const='14', help='backup the complete Apps system prior to updates, add a number to specify the max old backups to keep') From 020d45806d69f014500be23b29e1b4ec9b4c4a9a Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Sat, 22 Jan 2022 11:30:54 +0100 Subject: [PATCH 0038/1229] fix all --- truetool/__init__.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/truetool/__init__.py b/truetool/__init__.py index 232a054f..5b921f62 100644 --- a/truetool/__init__.py +++ b/truetool/__init__.py @@ -54,15 +54,15 @@ def check_semver(current: str, latest: str): def execute_upgrades(): if UPDATE: if ALL: - if CATALOG == "ALL": - filtered = filter(lambda a: a.update_available and a.status == "active", INSTALLED_CHARTS) - else: - filtered = filter(lambda a: a.update_available and a.status == "active" and a.catalog == CATALOG, INSTALLED_CHARTS) - else: if CATALOG == "ALL": filtered = filter(lambda a: a.update_available, INSTALLED_CHARTS) else: filtered = filter(lambda a: a.update_available and a.catalog == CATALOG, INSTALLED_CHARTS) + else: + if CATALOG == "ALL": + filtered = filter(lambda a: a.update_available and a.status == "active", INSTALLED_CHARTS) + else: + filtered = filter(lambda a: a.update_available and a.status == "active" and a.catalog == CATALOG, INSTALLED_CHARTS) for chart in filtered: pre_update_ver = chart.human_version post_update_ver = chart.human_latest_version @@ -107,7 +107,7 @@ def process_args(): parser.add_argument('-s', '--sync', action="store_true", help='sync catalogs before trying to update') parser.add_argument('-u', '--update', action="store_true", help='update the Apps in the selected catalog') parser.add_argument('-p', '--prune', action="store_true", help='prune old docker images after update') - parser.add_argument('-a', '--all', action="store_true", help='update "active" apps only and ignore "stopped" or "stuck" apps') + parser.add_argument('-a', '--all', action="store_true", help='update all apps for said catalog, including "stopped" or "stuck" apps') parser.add_argument('-l', '--list', action="store_true", help='lists existing backups') args = parser.parse_args() CATALOG = args.catalog From 982693639b0c2e9ccd119acde22519eca39d541a Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Sat, 22 Jan 2022 11:31:11 +0100 Subject: [PATCH 0039/1229] Update setup.py --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index e8860ecb..88dd0067 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ README_MD = open(join(dirname(abspath(__file__)), "README.md")).read() setup( name="truetool", - version="3.0.1", + version="3.0.2", # The packages that constitute your project. # For my project, I have only one - "pydash". From cb9e2ceb68c8528edbd1c253e56aa52f5c5e7e08 Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Thu, 3 Feb 2022 11:11:51 +0100 Subject: [PATCH 0040/1229] Fix backup date format --- truetool/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/truetool/__init__.py b/truetool/__init__.py index 5b921f62..cb06dc45 100644 --- a/truetool/__init__.py +++ b/truetool/__init__.py @@ -169,7 +169,7 @@ def apps_backup(): print("Running App Backup...\n") now = datetime.now() - command = "app kubernetes backup_chart_releases backup_name=TrueTool_"+now.strftime("%Y_%d_%m_%H_%M_%S") + command = "app kubernetes backup_chart_releases backup_name=TrueTool_"+now.strftime("%Y_%m_%d_%H_%M_%S") process = subprocess.Popen(["cli", "-c", command], stdout=subprocess.PIPE) while process.poll() is None: lines = process.stdout.readline() From e487c84139b70f868499892cdf308e31d48a8be9 Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Thu, 3 Feb 2022 11:12:03 +0100 Subject: [PATCH 0041/1229] Update setup.py --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 88dd0067..fee39cbb 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ README_MD = open(join(dirname(abspath(__file__)), "README.md")).read() setup( name="truetool", - version="3.0.2", + version="3.0.3", # The packages that constitute your project. # For my project, I have only one - "pydash". From 0582ee26d6251d17b175cb04bfdef297a27dbda3 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Mon, 7 Mar 2022 00:31:52 +0000 Subject: [PATCH 0042/1229] Add renovate.json --- renovate.json | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 renovate.json diff --git a/renovate.json b/renovate.json new file mode 100644 index 00000000..f45d8f11 --- /dev/null +++ b/renovate.json @@ -0,0 +1,5 @@ +{ + "extends": [ + "config:base" + ] +} From d3b583e812cf85ffad5a19cb924876fdb7ad0c6d Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 21 Apr 2022 21:18:27 +0000 Subject: [PATCH 0043/1229] Initial commit --- LICENSE | 674 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 2 + 2 files changed, 676 insertions(+) create mode 100644 LICENSE create mode 100644 README.md diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..f288702d --- /dev/null +++ b/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/README.md b/README.md new file mode 100644 index 00000000..88d070e1 --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# heavy_script +Script that can: Update Truenas SCALE applications, Mount and unmount PVC storage, Prune Docker images. From 29d59890f4601ca6a971eb70ee2ec9c3f4629e12 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 21 Apr 2022 21:19:53 +0000 Subject: [PATCH 0044/1229] initial --- heavy_script.sh | 161 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 161 insertions(+) create mode 100644 heavy_script.sh diff --git a/heavy_script.sh b/heavy_script.sh new file mode 100644 index 00000000..8746fa2f --- /dev/null +++ b/heavy_script.sh @@ -0,0 +1,161 @@ +#!/bin/bash + +#If no argument is passed, kill the script. +[[ -z "$@" ]] && echo "This script requires an arguent, use -h for help" && exit + +while getopts ":hsi:mt:uUp" opt +do + case $opt in + h) + echo "These arguments NEED to be ran in a specific order, you can go from TOP to BOTTOM, see example below" + echo "-m | Initiates mounting feature, choose between unmounting and mounting PVC data" + echo "-i | Add application to ignore list, one by one, see example below." + echo "-t | Default: 300 -- Set a custom timeout: This is the ammount of time the script will wait for an application to go from DEPLOYING to ACTIVE" + echo "-s | sync catalog" + echo "-U | Update all applications, ignores versions" + echo "-u | Update all applications, does not update Major releases" + echo "-p | Prune unused/old docker images" + echo "EX |./update.sh -I portainer -I arch -I sonarr -I radarr -t 600 -sUp" + exit;; + \?) + echo "Invalid Option -$OPTARG, type -h for help" + exit;; + m) + echo -e "1 Mount\n2 Unmount All" && read -p "Please type a number: " selection + + if [[ $selection == "1" ]]; then + list=$(k3s kubectl get pvc -A | sort -u | awk '{print NR-1, "\t" $1 "\t" $2 "\t" $4}' | column -t | sed "s/^0/ /") + echo "$list" && read -p "Please type a number : " selection + app=$(echo -e "$list" | grep ^$selection | awk '{print $2}' | cut -c 4-) + pvc=$(echo -e "$list" | grep ^$selection || echo -e "\nInvalid selection") + status=$(cli -m csv -c 'app chart_release query name,status' | grep $app | awk -F ',' '{print $2}'| tr -d " \t\n\r") && SECONDS=0 && timeout=200 + [[ "$status" != "STOPPED" ]] && echo -e "\nScaling down $app" && midclt call chart.release.scale $app '{"replica_count": 0}' &> /dev/null + while [[ "$SECONDS" -le "$timeout" && "$status" != "STOPPED" ]] + do + status=$(cli -m csv -c 'app chart_release query name,status' | grep $app | awk -F ',' '{print $2}'|tr -d " \t\n\r") + echo -e "Waiting $(($timeout-$SECONDS)) more seconds for $app to be STOPPED" && sleep 10 + done + data_name=$(echo $pvc | awk '{print $3}') + mount=$(echo $pvc | awk '{print $4}') + path=$(find /*/*/ix-applications/releases/$app/volumes/ -maxdepth 0 | cut -c 6-) + echo -e "\nMounting\n"$path""$mount"\nTo\n/mnt/temporary/$data_name" && zfs set mountpoint=/temporary/$data_name "$path""$mount" && echo -e "Mounted\n\nUnmount with the following command\nzfs set mountpoint=legacy "$path""$mount"\nOr use the Unmount All option" + break + elif [[ $selection == "2" ]]; then + unmount_array=($(basename -a /mnt/temporary/* | sed "s/*//")) + [[ -z $unmount_array ]] && echo "Theres nothing to unmount" && exit + for i in ${unmount_array[@]} + do + main=$(k3s kubectl get pvc -A | grep $i | awk '{print $1, $2, $4}') + app=$(echo $main | awk '{print $1}' | cut -c 4-) + pvc=$(echo $main | awk '{print $3}') + path=$(find /*/*/ix-applications/releases/$app/volumes/ -maxdepth 0 | cut -c 6-) + zfs set mountpoint=legacy "$path""$pvc" && echo "$i unmounted" && rmdir /mnt/temporary/$i || echo "failed to unmount $i" + done + else + echo "Invalid selection, type -h for help" + break + fi + exit;; + :) + echo "Option: -$OPTARG requires an argument" >&2 + exit;; + s) + echo -e "Syncing all catalogs, please wait.." && cli -c 'app catalog sync_all' &> /dev/null && echo -e "Catalog sync complete" + ;; + i) + ignore+="$OPTARG" + ;; + t) + timeout=$OPTARG + re='^[0-9]+$' + ! [[ $timeout =~ $re ]] && echo -e "Error: -t needs to be assigned an interger\n$timeout is not an interger" >&2 + ;; + U) + array=($(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep ,true,)) + [[ -z $array ]] && echo -e "\nThere are no updates available" && continue || echo -e "\n${#array[@]} update(s) available" + [[ -z $timeout ]] && echo -e "\nSetting Default Timeout to 300\nChange timeout with -t" && timeout=300 || echo -e "\nTimeout was set to $timeout" + for i in ${array[@]} + do + n=$(echo $i | awk -F ',' '{print $1}') #print out first catagory, name. + ov=$(echo $i | awk -F ',' '{print $4}') #Old version + nv=$(echo $i | awk -F ',' '{print $5}') #New Version + status=$(echo $i | awk -F ',' '{print $2}') #status of the app: STOPPED / DEPLOYING / ACTIVE + if [[ "${ignore[*]}" =~ "${n}" ]]; then + echo -e "\n$n\nIgnored, skipping" + continue + elif [[ "$status" == "STOPPED" ]]; then + echo -e "\n$n\nUpdating" && cli -c 'app chart_release upgrade release_name=''"'$n'"' &> /dev/null && echo -e "Updated\n$ov\n$nv\nWas Stopped, Beginning Stop Loop" && SECONDS=0 || { echo "FAILED"; continue; } + while [[ "$status" != "ACTIVE" ]] + do + status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep $n | awk -F ',' '{print $2}') + if [[ "$status" == "STOPPED" ]]; then + echo -e "Stopped" + break + elif [[ "$SECONDS" -ge "$timeout" && "$status" == "DEPLOYING" ]]; then + echo -e "Error: Run Time($SECONDS) has exceeded Timeout($timeout)\nIf this is a slow starting application, set a higher time with -t\nIf this applicaion is always DEPLOYING, you can disable all probes under the Healthcheck Probes Liveness section in the edit configuration\nNot shutting down application for safety reasons, continuing to next applicaion" + break + elif [[ "$status" == "DEPLOYING" ]]; then + echo -e "Waiting $(($timeout-$SECONDS)) more seconds for $n to be ACTIVE" && sleep 15 + continue + else + echo -e "Returing to STOPPED state.." && midclt call chart.release.scale $n '{"replica_count": 0}' &> /dev/null && echo -e "Stopped"|| echo "FAILED" + break + fi + done + else + echo -e "\n$n\nUpdating" && cli -c 'app chart_release upgrade release_name=''"'$n'"' &> /dev/null && echo -e "Updated\n$ov\n$nv" || echo -e "FAILED" + continue + fi + done + ;; + u) + array=($(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep ,true,)) + [[ -z $array ]] && echo -e "\nThere are no updates available" && continue || echo -e "\n${#array[@]} update(s) available" + [[ -z $timeout ]] && echo -e "\nSetting Default Timeout to 300\nChange timeout with -t" && timeout=300 || echo -e "\nTimeout was set to $timeout" + for i in ${array[@]} + do + n=$(echo $i | awk -F ',' '{print $1}') #print out first catagory, name. + ottv=$(echo $i | awk -F ',' '{print $4}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #previous Truecharts version + nttv=$(echo $i | awk -F ',' '{print $5}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #previous version) #New Truecharts Version + oav=$(echo $i | awk -F ',' '{print $4}' | awk -F '_' '{print $2}' | awk -F '.' '{print $1}') #previous version) #New App Version + nav=$(echo $i | awk -F ',' '{print $5}' | awk -F '_' '{print $2}' | awk -F '.' '{print $1}') #previous version) #New App Version + status=$(echo $i | awk -F ',' '{print $2}') #status of the app: STOPPED / DEPLOYING / ACTIVE + tt=$(diff <(echo "$ottv") <(echo "$nttv")) #caluclating difference in major Truecharts versions + av=$(diff <(echo "$oav") <(echo "$nav")) #caluclating difference in major app versions + ov=$(echo $i | awk -F ',' '{print $4}') #Upgraded From + nv=$(echo $i | awk -F ',' '{print $5}') #Upraded To + if [[ "${ignore[*]}" =~ "${n}" ]]; then + echo -e "\n$n\nIgnored, skipping" + continue + elif [[ "$tt" == "$av" && "$status" == "ACTIVE" || "$status" == "DEPLOYING" ]]; then + echo -e "\n$n\nUpdating" && cli -c 'app chart_release upgrade release_name=''"'$n'"' &> /dev/null && echo -e "Updated\n$ov\n$nv" || echo "FAILED" + continue + elif [[ "$tt" == "$av" && "$status" == "STOPPED" ]]; then + echo -e "\n$n\nUpdating" && cli -c 'app chart_release upgrade release_name=''"'$n'"' &> /dev/null && echo -e "Updated\n$ov\n$nv\nWas Stopped, Beginning Stop Loop" && SECONDS=0 || { echo "FAILED"; continue; } + while [[ "$status" != "ACTIVE" ]] + do + status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep $n | awk -F ',' '{print $2}') + if [[ "$status" == "STOPPED" ]]; then + echo -e "Stopped" + break + elif [[ "$SECONDS" -ge "$timeout" && "$status" == "DEPLOYING" ]]; then + echo -e "Error: Run Time($SECONDS) has exceeded Timeout($timeout)\nIf this is a slow starting application, set a higher time with -t\nIf this applicaion is always DEPLOYING, you can disable all probes under the Healthcheck Probes Liveness section in the edit configuration\nNot shutting down application for safety reasons, continuing to next applicaion" + break + elif [[ "$status" == "DEPLOYING" ]]; then + echo -e "Waiting $(($timeout-$SECONDS)) more seconds for $n to be ACTIVE" && sleep 15 + continue + else + echo "Returing to STOPPED state.." && midclt call chart.release.scale $n '{"replica_count": 0}' &> /dev/null && echo "Stopped"|| echo -e "FAILED" + break + fi + done + else + echo -e "\n$n\nMajor Release, update manually" + continue + fi + done + ;; + p) + echo -e "\nPruning Docker Images" && docker image prune -af | grep Total || echo "Failed to Prune Docker Images" + esac +done From 427076d8c4baa0506fb79db6da715a6eaac54291 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 21 Apr 2022 21:22:55 +0000 Subject: [PATCH 0045/1229] Update README.md --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index 88d070e1..07be40de 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,13 @@ # heavy_script Script that can: Update Truenas SCALE applications, Mount and unmount PVC storage, Prune Docker images. + + +These arguments NEED to be ran in a specific order, you can go from TOP to BOTTOM, see example below +| -m | Initiates mounting feature, choose between unmounting and mounting PVC data +| -i | Add application to ignore list, one by one, see example below. +| -t | Default: 300 -- Set a custom timeout: This is the ammount of time the script will wait for an application to go from DEPLOYING to ACTIVE +| -s |sync catalog +| -U | Update all applications, ignores versions +| -u | Update all applications, does not update Major releases +| -p | Prune unused/old docker images +| EX |./update.sh -i portainer -i arch -i sonarr -i radarr -t 600 -sUp From 8ba973521236835fb71a158270f883ef90089417 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 21 Apr 2022 21:25:52 +0000 Subject: [PATCH 0046/1229] Update README.md --- README.md | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/README.md b/README.md index 07be40de..88d070e1 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,2 @@ # heavy_script Script that can: Update Truenas SCALE applications, Mount and unmount PVC storage, Prune Docker images. - - -These arguments NEED to be ran in a specific order, you can go from TOP to BOTTOM, see example below -| -m | Initiates mounting feature, choose between unmounting and mounting PVC data -| -i | Add application to ignore list, one by one, see example below. -| -t | Default: 300 -- Set a custom timeout: This is the ammount of time the script will wait for an application to go from DEPLOYING to ACTIVE -| -s |sync catalog -| -U | Update all applications, ignores versions -| -u | Update all applications, does not update Major releases -| -p | Prune unused/old docker images -| EX |./update.sh -i portainer -i arch -i sonarr -i radarr -t 600 -sUp From bdf6641fac760250ce03b16c5bd219470b695109 Mon Sep 17 00:00:00 2001 From: kyler Date: Thu, 21 Apr 2022 21:46:50 -0600 Subject: [PATCH 0047/1229] fixing issue with multiple applications have similar name. --- heavy_script.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index 8746fa2f..d45b4a85 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -28,8 +28,8 @@ do echo "$list" && read -p "Please type a number : " selection app=$(echo -e "$list" | grep ^$selection | awk '{print $2}' | cut -c 4-) pvc=$(echo -e "$list" | grep ^$selection || echo -e "\nInvalid selection") - status=$(cli -m csv -c 'app chart_release query name,status' | grep $app | awk -F ',' '{print $2}'| tr -d " \t\n\r") && SECONDS=0 && timeout=200 - [[ "$status" != "STOPPED" ]] && echo -e "\nScaling down $app" && midclt call chart.release.scale $app '{"replica_count": 0}' &> /dev/null + status=$(cli -m csv -c 'app chart_release query name,status' | grep -w $app | awk -F ',' '{print $2}'| tr -d " \t\n\r") && SECONDS=0 && timeout=200 + [[ "$status" != "STOPPED" ]] && echo -e "\nScaling down -w $app" && midclt call chart.release.scale $app '{"replica_count": 0}' &> /dev/null while [[ "$SECONDS" -le "$timeout" && "$status" != "STOPPED" ]] do status=$(cli -m csv -c 'app chart_release query name,status' | grep $app | awk -F ',' '{print $2}'|tr -d " \t\n\r") From 3ea7d03bb7e7fd93dbca3fb680bc8bf6257974ad Mon Sep 17 00:00:00 2001 From: kyler Date: Fri, 22 Apr 2022 15:37:02 -0600 Subject: [PATCH 0048/1229] general syntax improvements + echo mistakes fixed --- heavy_script.sh | 88 ++++++++++++++++++++++++------------------------- 1 file changed, 44 insertions(+), 44 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index d45b4a85..6894bacb 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -1,7 +1,7 @@ #!/bin/bash #If no argument is passed, kill the script. -[[ -z "$@" ]] && echo "This script requires an arguent, use -h for help" && exit +[[ -z "$*" ]] && echo "This script requires an arguent, use -h for help" && exit while getopts ":hsi:mt:uUp" opt do @@ -26,30 +26,30 @@ do if [[ $selection == "1" ]]; then list=$(k3s kubectl get pvc -A | sort -u | awk '{print NR-1, "\t" $1 "\t" $2 "\t" $4}' | column -t | sed "s/^0/ /") echo "$list" && read -p "Please type a number : " selection - app=$(echo -e "$list" | grep ^$selection | awk '{print $2}' | cut -c 4-) - pvc=$(echo -e "$list" | grep ^$selection || echo -e "\nInvalid selection") - status=$(cli -m csv -c 'app chart_release query name,status' | grep -w $app | awk -F ',' '{print $2}'| tr -d " \t\n\r") && SECONDS=0 && timeout=200 - [[ "$status" != "STOPPED" ]] && echo -e "\nScaling down -w $app" && midclt call chart.release.scale $app '{"replica_count": 0}' &> /dev/null + app=$(echo -e "$list" | grep ^"$selection" | awk '{print $2}' | cut -c 4-) + pvc=$(echo -e "$list" | grep ^"$selection" || echo -e "\nInvalid selection") + status=$(cli -m csv -c 'app chart_release query name,status' | grep -E "(,|^)$app(,|$)" | awk -F ',' '{print $2}'| tr -d " \t\n\r") && SECONDS=0 && timeout=200 + [[ "$status" != "STOPPED" ]] && echo -e "\nScaling down $app" && midclt call chart.release.scale "$app" '{"replica_count": 0}' &> /dev/null while [[ "$SECONDS" -le "$timeout" && "$status" != "STOPPED" ]] do - status=$(cli -m csv -c 'app chart_release query name,status' | grep $app | awk -F ',' '{print $2}'|tr -d " \t\n\r") - echo -e "Waiting $(($timeout-$SECONDS)) more seconds for $app to be STOPPED" && sleep 10 + status=$(cli -m csv -c 'app chart_release query name,status' | grep -E "(,|^)$app(,|$)" | awk -F ',' '{print $2}'| tr -d " \t\n\r") + echo -e "Waiting $((timeout-SECONDS)) more seconds for $app to be STOPPED" && sleep 10 done - data_name=$(echo $pvc | awk '{print $3}') - mount=$(echo $pvc | awk '{print $4}') - path=$(find /*/*/ix-applications/releases/$app/volumes/ -maxdepth 0 | cut -c 6-) - echo -e "\nMounting\n"$path""$mount"\nTo\n/mnt/temporary/$data_name" && zfs set mountpoint=/temporary/$data_name "$path""$mount" && echo -e "Mounted\n\nUnmount with the following command\nzfs set mountpoint=legacy "$path""$mount"\nOr use the Unmount All option" + data_name=$(echo "$pvc" | awk '{print $3}') + mount=$(echo "$pvc" | awk '{print $4}') + path=$(find /*/*/ix-applications/releases/"$app"/volumes/ -maxdepth 0 | cut -c 6-) + echo -e "\nMounting\n""$path""""$mount""\nTo\n/mnt/temporary/$data_name" && zfs set mountpoint=/temporary/"$data_name" "$path""$mount" && echo -e "Mounted\n\nUnmount with the following command\nzfs set mountpoint=legacy ""$path"""$mount"\nOr use the Unmount All option" break elif [[ $selection == "2" ]]; then - unmount_array=($(basename -a /mnt/temporary/* | sed "s/*//")) + mapfile -t unmount_array < <(basename -a /mnt/temporary/* | sed "s/*//") [[ -z $unmount_array ]] && echo "Theres nothing to unmount" && exit - for i in ${unmount_array[@]} + for i in "${unmount_array[@]}" do - main=$(k3s kubectl get pvc -A | grep $i | awk '{print $1, $2, $4}') - app=$(echo $main | awk '{print $1}' | cut -c 4-) - pvc=$(echo $main | awk '{print $3}') - path=$(find /*/*/ix-applications/releases/$app/volumes/ -maxdepth 0 | cut -c 6-) - zfs set mountpoint=legacy "$path""$pvc" && echo "$i unmounted" && rmdir /mnt/temporary/$i || echo "failed to unmount $i" + main=$(k3s kubectl get pvc -A | grep "$i" | awk '{print $1, $2, $4}') + app=$(echo "$main" | awk '{print $1}' | cut -c 4-) + pvc=$(echo "$main" | awk '{print $3}') + path=$(find /*/*/ix-applications/releases/"$app"/volumes/ -maxdepth 0 | cut -c 6-) + zfs set mountpoint=legacy "$path""$pvc" && echo "$i unmounted" && rmdir /mnt/temporary/"$i" || echo "failed to unmount $i" done else echo "Invalid selection, type -h for help" @@ -71,20 +71,20 @@ do ! [[ $timeout =~ $re ]] && echo -e "Error: -t needs to be assigned an interger\n$timeout is not an interger" >&2 ;; U) - array=($(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep ,true,)) + mapfile -t array < <(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep ,true,) [[ -z $array ]] && echo -e "\nThere are no updates available" && continue || echo -e "\n${#array[@]} update(s) available" [[ -z $timeout ]] && echo -e "\nSetting Default Timeout to 300\nChange timeout with -t" && timeout=300 || echo -e "\nTimeout was set to $timeout" - for i in ${array[@]} + for i in "${array[@]}" do - n=$(echo $i | awk -F ',' '{print $1}') #print out first catagory, name. - ov=$(echo $i | awk -F ',' '{print $4}') #Old version - nv=$(echo $i | awk -F ',' '{print $5}') #New Version - status=$(echo $i | awk -F ',' '{print $2}') #status of the app: STOPPED / DEPLOYING / ACTIVE - if [[ "${ignore[*]}" =~ "${n}" ]]; then + n=$(echo "$i" | awk -F ',' '{print $1}') #print out first catagory, name. + ov=$(echo "$i" | awk -F ',' '{print $4}') #Old version + nv=$(echo "$i" | awk -F ',' '{print $5}') #New Version + status=$(echo "$i" | awk -F ',' '{print $2}') #status of the app: STOPPED / DEPLOYING / ACTIVE + if [[ "${ignore[*]}" == *"${n}"* ]]; then echo -e "\n$n\nIgnored, skipping" continue elif [[ "$status" == "STOPPED" ]]; then - echo -e "\n$n\nUpdating" && cli -c 'app chart_release upgrade release_name=''"'$n'"' &> /dev/null && echo -e "Updated\n$ov\n$nv\nWas Stopped, Beginning Stop Loop" && SECONDS=0 || { echo "FAILED"; continue; } + echo -e "\n$n\nUpdating" && cli -c 'app chart_release upgrade release_name=''"'"$n"'"' &> /dev/null && echo -e "Updated\n$ov\n$nv\nWas Stopped, Beginning Stop Loop" && SECONDS=0 || { echo "FAILED"; continue; } while [[ "$status" != "ACTIVE" ]] do status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep $n | awk -F ',' '{print $2}') @@ -95,46 +95,46 @@ do echo -e "Error: Run Time($SECONDS) has exceeded Timeout($timeout)\nIf this is a slow starting application, set a higher time with -t\nIf this applicaion is always DEPLOYING, you can disable all probes under the Healthcheck Probes Liveness section in the edit configuration\nNot shutting down application for safety reasons, continuing to next applicaion" break elif [[ "$status" == "DEPLOYING" ]]; then - echo -e "Waiting $(($timeout-$SECONDS)) more seconds for $n to be ACTIVE" && sleep 15 + echo -e "Waiting $((timeout-SECONDS)) more seconds for $n to be ACTIVE" && sleep 15 continue else - echo -e "Returing to STOPPED state.." && midclt call chart.release.scale $n '{"replica_count": 0}' &> /dev/null && echo -e "Stopped"|| echo "FAILED" + echo -e "Returing to STOPPED state.." && midclt call chart.release.scale "$n" '{"replica_count": 0}' &> /dev/null && echo -e "Stopped"|| echo "FAILED" break fi done else - echo -e "\n$n\nUpdating" && cli -c 'app chart_release upgrade release_name=''"'$n'"' &> /dev/null && echo -e "Updated\n$ov\n$nv" || echo -e "FAILED" + echo -e "\n$n\nUpdating" && cli -c 'app chart_release upgrade release_name=''"'"$n"'"' &> /dev/null && echo -e "Updated\n$ov\n$nv" || echo -e "FAILED" continue fi done ;; u) - array=($(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep ,true,)) + mapfile -t array < <(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep ,true,) [[ -z $array ]] && echo -e "\nThere are no updates available" && continue || echo -e "\n${#array[@]} update(s) available" [[ -z $timeout ]] && echo -e "\nSetting Default Timeout to 300\nChange timeout with -t" && timeout=300 || echo -e "\nTimeout was set to $timeout" - for i in ${array[@]} + for i in "${array[@]}" do - n=$(echo $i | awk -F ',' '{print $1}') #print out first catagory, name. - ottv=$(echo $i | awk -F ',' '{print $4}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #previous Truecharts version - nttv=$(echo $i | awk -F ',' '{print $5}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #previous version) #New Truecharts Version - oav=$(echo $i | awk -F ',' '{print $4}' | awk -F '_' '{print $2}' | awk -F '.' '{print $1}') #previous version) #New App Version - nav=$(echo $i | awk -F ',' '{print $5}' | awk -F '_' '{print $2}' | awk -F '.' '{print $1}') #previous version) #New App Version - status=$(echo $i | awk -F ',' '{print $2}') #status of the app: STOPPED / DEPLOYING / ACTIVE + n=$(echo "$i" | awk -F ',' '{print $1}') #print out first catagory, name. + ottv=$(echo "$i" | awk -F ',' '{print $4}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #previous Truecharts version + nttv=$(echo "$i" | awk -F ',' '{print $5}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #previous version) #New Truecharts Version + oav=$(echo "$i" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}' | awk -F '.' '{print $1}') #previous version) #New App Version + nav=$(echo "$i" | awk -F ',' '{print $5}' | awk -F '_' '{print $2}' | awk -F '.' '{print $1}') #previous version) #New App Version + status=$(echo "$i" | awk -F ',' '{print $2}') #status of the app: STOPPED / DEPLOYING / ACTIVE tt=$(diff <(echo "$ottv") <(echo "$nttv")) #caluclating difference in major Truecharts versions av=$(diff <(echo "$oav") <(echo "$nav")) #caluclating difference in major app versions - ov=$(echo $i | awk -F ',' '{print $4}') #Upgraded From - nv=$(echo $i | awk -F ',' '{print $5}') #Upraded To - if [[ "${ignore[*]}" =~ "${n}" ]]; then + ov=$(echo "$i" | awk -F ',' '{print $4}') #Upgraded From + nv=$(echo "$i" | awk -F ',' '{print $5}') #Upraded To + if [[ "${ignore[*]}" == *"${n}"* ]]; then echo -e "\n$n\nIgnored, skipping" continue elif [[ "$tt" == "$av" && "$status" == "ACTIVE" || "$status" == "DEPLOYING" ]]; then - echo -e "\n$n\nUpdating" && cli -c 'app chart_release upgrade release_name=''"'$n'"' &> /dev/null && echo -e "Updated\n$ov\n$nv" || echo "FAILED" + echo -e "\n$n\nUpdating" && cli -c 'app chart_release upgrade release_name=''"'"$n"'"' &> /dev/null && echo -e "Updated\n$ov\n$nv" || echo "FAILED" continue elif [[ "$tt" == "$av" && "$status" == "STOPPED" ]]; then echo -e "\n$n\nUpdating" && cli -c 'app chart_release upgrade release_name=''"'$n'"' &> /dev/null && echo -e "Updated\n$ov\n$nv\nWas Stopped, Beginning Stop Loop" && SECONDS=0 || { echo "FAILED"; continue; } while [[ "$status" != "ACTIVE" ]] do - status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep $n | awk -F ',' '{print $2}') + status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep "$n" | awk -F ',' '{print $2}') if [[ "$status" == "STOPPED" ]]; then echo -e "Stopped" break @@ -142,10 +142,10 @@ do echo -e "Error: Run Time($SECONDS) has exceeded Timeout($timeout)\nIf this is a slow starting application, set a higher time with -t\nIf this applicaion is always DEPLOYING, you can disable all probes under the Healthcheck Probes Liveness section in the edit configuration\nNot shutting down application for safety reasons, continuing to next applicaion" break elif [[ "$status" == "DEPLOYING" ]]; then - echo -e "Waiting $(($timeout-$SECONDS)) more seconds for $n to be ACTIVE" && sleep 15 + echo -e "Waiting $((timeout-SECONDS)) more seconds for $n to be ACTIVE" && sleep 15 continue else - echo "Returing to STOPPED state.." && midclt call chart.release.scale $n '{"replica_count": 0}' &> /dev/null && echo "Stopped"|| echo -e "FAILED" + echo "Returing to STOPPED state.." && midclt call chart.release.scale "$n" '{"replica_count": 0}' &> /dev/null && echo "Stopped"|| echo -e "FAILED" break fi done From 3fafbfeb64ae5cc5275b7bf8bf4a40725151b1dd Mon Sep 17 00:00:00 2001 From: kyler Date: Fri, 22 Apr 2022 16:00:48 -0600 Subject: [PATCH 0049/1229] give mounting feature ability to use timeout --- heavy_script.sh | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index 6894bacb..1a26642d 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -20,6 +20,17 @@ do \?) echo "Invalid Option -$OPTARG, type -h for help" exit;; + :) + echo "Option: -$OPTARG requires an argument" >&2 + exit;; + i) + ignore+="$OPTARG" + ;; + t) + timeout=$OPTARG + re='^[0-9]+$' + ! [[ $timeout =~ $re ]] && echo -e "Error: -t needs to be assigned an interger\n$timeout is not an interger" >&2 + ;; m) echo -e "1 Mount\n2 Unmount All" && read -p "Please type a number: " selection @@ -28,8 +39,8 @@ do echo "$list" && read -p "Please type a number : " selection app=$(echo -e "$list" | grep ^"$selection" | awk '{print $2}' | cut -c 4-) pvc=$(echo -e "$list" | grep ^"$selection" || echo -e "\nInvalid selection") - status=$(cli -m csv -c 'app chart_release query name,status' | grep -E "(,|^)$app(,|$)" | awk -F ',' '{print $2}'| tr -d " \t\n\r") && SECONDS=0 && timeout=200 - [[ "$status" != "STOPPED" ]] && echo -e "\nScaling down $app" && midclt call chart.release.scale "$app" '{"replica_count": 0}' &> /dev/null + status=$(cli -m csv -c 'app chart_release query name,status' | grep -E "(,|^)$app(,|$)" | awk -F ',' '{print $2}'| tr -d " \t\n\r") && SECONDS=0 + [[ "$status" != "STOPPED" ]] && echo -e "\nScaling down $app" && midclt call chart.release.scale "$app" '{"replica_count": 0}' &> /dev/null && [[ -z $timeout ]] && echo -e "\nSetting Default Timeout to 300\nChange timeout with -t" && timeout=300 || echo -e "\nTimeout was set to $timeout" while [[ "$SECONDS" -le "$timeout" && "$status" != "STOPPED" ]] do status=$(cli -m csv -c 'app chart_release query name,status' | grep -E "(,|^)$app(,|$)" | awk -F ',' '{print $2}'| tr -d " \t\n\r") @@ -56,20 +67,9 @@ do break fi exit;; - :) - echo "Option: -$OPTARG requires an argument" >&2 - exit;; s) echo -e "Syncing all catalogs, please wait.." && cli -c 'app catalog sync_all' &> /dev/null && echo -e "Catalog sync complete" ;; - i) - ignore+="$OPTARG" - ;; - t) - timeout=$OPTARG - re='^[0-9]+$' - ! [[ $timeout =~ $re ]] && echo -e "Error: -t needs to be assigned an interger\n$timeout is not an interger" >&2 - ;; U) mapfile -t array < <(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep ,true,) [[ -z $array ]] && echo -e "\nThere are no updates available" && continue || echo -e "\n${#array[@]} update(s) available" From c97fabd643f450a9ed95796446cde68f9e02950a Mon Sep 17 00:00:00 2001 From: kyler Date: Sat, 23 Apr 2022 13:50:58 -0600 Subject: [PATCH 0050/1229] Help argument update --- heavy_script.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index 1a26642d..4c9dfb2c 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -10,12 +10,14 @@ do echo "These arguments NEED to be ran in a specific order, you can go from TOP to BOTTOM, see example below" echo "-m | Initiates mounting feature, choose between unmounting and mounting PVC data" echo "-i | Add application to ignore list, one by one, see example below." - echo "-t | Default: 300 -- Set a custom timeout: This is the ammount of time the script will wait for an application to go from DEPLOYING to ACTIVE" + echo "-t | Set a custom timeout in seconds for -u or -U: This is the ammount of time the script will wait for an application to go from DEPLOYING to ACTIVE" + echo "-t | Set a custom timeout in seconds for -m: Amount of time script will wait for applications to stop, before timing out" echo "-s | sync catalog" echo "-U | Update all applications, ignores versions" echo "-u | Update all applications, does not update Major releases" echo "-p | Prune unused/old docker images" - echo "EX |./update.sh -I portainer -I arch -I sonarr -I radarr -t 600 -sUp" + echo "EX |./heavy_script.sh -i portainer -i arch -i sonarr -i radarr -t 600 -sUp" + echo "EX | bash /mnt/tank/scripts/heavy_script.sh -t 8812 -m" exit;; \?) echo "Invalid Option -$OPTARG, type -h for help" From 16e922e59ea046ce16ccccd2272b9e7d1d9f8efa Mon Sep 17 00:00:00 2001 From: kyler Date: Sat, 23 Apr 2022 15:13:57 -0600 Subject: [PATCH 0051/1229] video push --- heavy_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index 4c9dfb2c..81bd964c 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -16,7 +16,7 @@ do echo "-U | Update all applications, ignores versions" echo "-u | Update all applications, does not update Major releases" echo "-p | Prune unused/old docker images" - echo "EX |./heavy_script.sh -i portainer -i arch -i sonarr -i radarr -t 600 -sUp" + echo "EX | bash heavy_script.sh -i portainer -i arch -i sonarr -i radarr -t 600 -sUp" echo "EX | bash /mnt/tank/scripts/heavy_script.sh -t 8812 -m" exit;; \?) From e15cefa952c67ca6f6219d3aeb199df886e35674 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 25 Apr 2022 08:04:01 -0600 Subject: [PATCH 0052/1229] -u/-U can now update container images (custom-app) --- heavy_script.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index 81bd964c..940b9b53 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -73,7 +73,7 @@ do echo -e "Syncing all catalogs, please wait.." && cli -c 'app catalog sync_all' &> /dev/null && echo -e "Catalog sync complete" ;; U) - mapfile -t array < <(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep ,true,) + mapfile -t array < <(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,container_images_update_available,status' | grep ",true") [[ -z $array ]] && echo -e "\nThere are no updates available" && continue || echo -e "\n${#array[@]} update(s) available" [[ -z $timeout ]] && echo -e "\nSetting Default Timeout to 300\nChange timeout with -t" && timeout=300 || echo -e "\nTimeout was set to $timeout" for i in "${array[@]}" @@ -111,7 +111,7 @@ do done ;; u) - mapfile -t array < <(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep ,true,) + mapfile -t array < <(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,container_images_update_available,status' | grep -E ",true") [[ -z $array ]] && echo -e "\nThere are no updates available" && continue || echo -e "\n${#array[@]} update(s) available" [[ -z $timeout ]] && echo -e "\nSetting Default Timeout to 300\nChange timeout with -t" && timeout=300 || echo -e "\nTimeout was set to $timeout" for i in "${array[@]}" From 25c59c008caef7efc4f3d639f407594185f39544 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 28 Apr 2022 00:37:36 +0000 Subject: [PATCH 0053/1229] Add Backup and Restore functions Adds the ability to backup, and restore the ix-applications dataset. Tested to be working. --- heavy_script.sh | 40 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index 940b9b53..52656900 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -3,12 +3,14 @@ #If no argument is passed, kill the script. [[ -z "$*" ]] && echo "This script requires an arguent, use -h for help" && exit -while getopts ":hsi:mt:uUp" opt +while getopts ":hsi:mrb:t:uUp" opt do case $opt in h) echo "These arguments NEED to be ran in a specific order, you can go from TOP to BOTTOM, see example below" echo "-m | Initiates mounting feature, choose between unmounting and mounting PVC data" + echo "-r | Opens a menu to restore a HeavyScript backup that was taken on you ix-applications pool" + echo "-b | Back-up your ix-applications dataset, specify a number after -b" echo "-i | Add application to ignore list, one by one, see example below." echo "-t | Set a custom timeout in seconds for -u or -U: This is the ammount of time the script will wait for an application to go from DEPLOYING to ACTIVE" echo "-t | Set a custom timeout in seconds for -m: Amount of time script will wait for applications to stop, before timing out" @@ -16,7 +18,7 @@ do echo "-U | Update all applications, ignores versions" echo "-u | Update all applications, does not update Major releases" echo "-p | Prune unused/old docker images" - echo "EX | bash heavy_script.sh -i portainer -i arch -i sonarr -i radarr -t 600 -sUp" + echo "EX | bash heavy_script.sh -b 14 -i portainer -i arch -i sonarr -i radarr -t 600 -sUp" echo "EX | bash /mnt/tank/scripts/heavy_script.sh -t 8812 -m" exit;; \?) @@ -25,6 +27,36 @@ do :) echo "Option: -$OPTARG requires an argument" >&2 exit;; + b) + number_of_backups=$OPTARG + echo "Number of backups was set to $number_of_backups" + re='^[0-9]+$' + ! [[ $number_of_backups =~ $re ]] && echo -e "Error: -b needs to be assigned an interger\n$number_of_backups is not an interger" >&2 && exit + + date=$(date '+%Y_%m_%d_%H_%M_%S') + cli -c 'app kubernetes backup_chart_releases backup_name=''"'HeavyScript_"$date"'"' + + mapfile -t list_backups < <(cli -c 'app kubernetes list_backups' | grep "HeavyScript_" | sort -nr | awk -F '|' '{print $2}'| tr -d " \t\r") + overflow=$(expr ${#list_backups[@]} - $number_of_backups) + + if [[ ${#list_backups[@]} -gt "number_of_backups" ]]; then + echo && mapfile -t list_overflow < <(cli -c 'app kubernetes list_backups' | grep "HeavyScript_" | sort -nr | awk -F '|' '{print $2}'| tr -d " \t\r" | tail -n "$overflow") + for i in "${list_overflow[@]}" + do + cli -c 'app kubernetes delete_backup backup_name=''"'"$i"'"' &> /dev/null && echo -e "Deleting your oldest backup $i\nThis is to remain in the $number_of_backups backups range you set. " || echo "Failed to delete $i" + done + fi + ;; + r) + list_backups=$(cli -c 'app kubernetes list_backups' | sort -nr | tr -d " \t\r" | awk -F '|' '/HeavyScript_/{print NR-1, $2}') && echo "$list_backups" && read -p "Please type a number: " selection && restore_point=$(echo "$list_backups" | grep ^"$selection" | awk '{print $2}') && echo -e "\nThis is NOT guranteed to work\nThis is ONLY supposed to be used as a LAST RESORT\nConsider rolling back your applications instead if possible.\n\nYou have chosen to restore $restore_point\nWould you like to continue?" && echo -e "1 Yes\n2 No" && read -p "Please type a number: " yesno || { echo "FAILED"; exit; } + if [[ $yesno == "1" ]]; then + echo -e "\nStarting Backup, this will take a LONG time." && cli -c 'app kubernetes restore_backup backup_name=''"'"$restore_point"'"' || echo "Restore FAILED" + elif [[ $yesno == "2" ]]; then + echo "You've chosen NO, killing script. Good luck." + else + echo "Invalid Selection" + fi + ;; i) ignore+="$OPTARG" ;; @@ -89,7 +121,7 @@ do echo -e "\n$n\nUpdating" && cli -c 'app chart_release upgrade release_name=''"'"$n"'"' &> /dev/null && echo -e "Updated\n$ov\n$nv\nWas Stopped, Beginning Stop Loop" && SECONDS=0 || { echo "FAILED"; continue; } while [[ "$status" != "ACTIVE" ]] do - status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep $n | awk -F ',' '{print $2}') + status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep "$n" | awk -F ',' '{print $2}') if [[ "$status" == "STOPPED" ]]; then echo -e "Stopped" break @@ -133,7 +165,7 @@ do echo -e "\n$n\nUpdating" && cli -c 'app chart_release upgrade release_name=''"'"$n"'"' &> /dev/null && echo -e "Updated\n$ov\n$nv" || echo "FAILED" continue elif [[ "$tt" == "$av" && "$status" == "STOPPED" ]]; then - echo -e "\n$n\nUpdating" && cli -c 'app chart_release upgrade release_name=''"'$n'"' &> /dev/null && echo -e "Updated\n$ov\n$nv\nWas Stopped, Beginning Stop Loop" && SECONDS=0 || { echo "FAILED"; continue; } + echo -e "\n$n\nUpdating" && cli -c 'app chart_release upgrade release_name=''"'"$n"'"' &> /dev/null && echo -e "Updated\n$ov\n$nv\nWas Stopped, Beginning Stop Loop" && SECONDS=0 || { echo "FAILED"; continue; } while [[ "$status" != "ACTIVE" ]] do status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep "$n" | awk -F ',' '{print $2}') From f171428f647ceac16e6117502da5799218f3ab71 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 28 Apr 2022 01:02:11 +0000 Subject: [PATCH 0054/1229] Fix restore numbering Tried just using awk, rather than grepping into awk, but it didnt work out --- heavy_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index 52656900..891897a3 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -48,7 +48,7 @@ do fi ;; r) - list_backups=$(cli -c 'app kubernetes list_backups' | sort -nr | tr -d " \t\r" | awk -F '|' '/HeavyScript_/{print NR-1, $2}') && echo "$list_backups" && read -p "Please type a number: " selection && restore_point=$(echo "$list_backups" | grep ^"$selection" | awk '{print $2}') && echo -e "\nThis is NOT guranteed to work\nThis is ONLY supposed to be used as a LAST RESORT\nConsider rolling back your applications instead if possible.\n\nYou have chosen to restore $restore_point\nWould you like to continue?" && echo -e "1 Yes\n2 No" && read -p "Please type a number: " yesno || { echo "FAILED"; exit; } + list_backups=$(cli -c 'app kubernetes list_backups' | grep "HeavyScript_" | tr -d " \t\r" | awk -F '|' '{print NR-1, $2}' | column -t) && echo "$list_backups" && read -p "Please type a number: " selection && restore_point=$(echo "$list_backups" | grep ^"$selection" | awk '{print $2}') && echo -e "\nThis is NOT guranteed to work\nThis is ONLY supposed to be used as a LAST RESORT\nConsider rolling back your applications instead if possible.\n\nYou have chosen to restore $restore_point\nWould you like to continue?" && echo -e "1 Yes\n2 No" && read -p "Please type a number: " yesno || { echo "FAILED"; exit; } if [[ $yesno == "1" ]]; then echo -e "\nStarting Backup, this will take a LONG time." && cli -c 'app kubernetes restore_backup backup_name=''"'"$restore_point"'"' || echo "Restore FAILED" elif [[ $yesno == "2" ]]; then From d76c5f927a1c5c038f86ee1e2e1eb5d26d3f7550 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 28 Apr 2022 01:09:42 +0000 Subject: [PATCH 0055/1229] re-added sort --- heavy_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index 891897a3..313f6b2d 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -48,7 +48,7 @@ do fi ;; r) - list_backups=$(cli -c 'app kubernetes list_backups' | grep "HeavyScript_" | tr -d " \t\r" | awk -F '|' '{print NR-1, $2}' | column -t) && echo "$list_backups" && read -p "Please type a number: " selection && restore_point=$(echo "$list_backups" | grep ^"$selection" | awk '{print $2}') && echo -e "\nThis is NOT guranteed to work\nThis is ONLY supposed to be used as a LAST RESORT\nConsider rolling back your applications instead if possible.\n\nYou have chosen to restore $restore_point\nWould you like to continue?" && echo -e "1 Yes\n2 No" && read -p "Please type a number: " yesno || { echo "FAILED"; exit; } + list_backups=$(cli -c 'app kubernetes list_backups' | grep "HeavyScript_" | sort -rn | tr -d " \t\r" | awk -F '|' '{print NR-1, $2}' | column -t) && echo "$list_backups" && read -p "Please type a number: " selection && restore_point=$(echo "$list_backups" | grep ^"$selection" | awk '{print $2}') && echo -e "\nThis is NOT guranteed to work\nThis is ONLY supposed to be used as a LAST RESORT\nConsider rolling back your applications instead if possible.\n\nYou have chosen to restore $restore_point\nWould you like to continue?" && echo -e "1 Yes\n2 No" && read -p "Please type a number: " yesno || { echo "FAILED"; exit; } if [[ $yesno == "1" ]]; then echo -e "\nStarting Backup, this will take a LONG time." && cli -c 'app kubernetes restore_backup backup_name=''"'"$restore_point"'"' || echo "Restore FAILED" elif [[ $yesno == "2" ]]; then From 8c066d9a29b59ea4803580710fcc9b3072576560 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 28 Apr 2022 01:19:13 +0000 Subject: [PATCH 0056/1229] actually place information in the readme --- README.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/README.md b/README.md index 88d070e1..452a4cc2 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,21 @@ # heavy_script Script that can: Update Truenas SCALE applications, Mount and unmount PVC storage, Prune Docker images. + + +## These arguments NEED to be ran in a specific order, you can go from TOP to BOTTOM, see example below +- -m | Initiates mounting feature, choose between unmounting and mounting PVC data" +- -r | Opens a menu to restore a HeavyScript backup that was taken on you ix-applications pool" +- -b | Back-up your ix-applications dataset, specify a number after -b" +- -i | Add application to ignore list, one by one, see example below." +- -t | Set a custom timeout in seconds for -u or -U: This is the ammount of time the script will wait for an application to go from DEPLOYING to ACTIVE" +- -t | Set a custom timeout in seconds for -m: Amount of time script will wait for applications to stop, before timing out" +- -s | sync catalog" +- -U | Update all applications, ignores versions" +- -u | Update all applications, does not update Major releases" +- -p | Prune unused/old docker images" + + + +### Examples +- bash heavy_script.sh -b 14 -i portainer -i arch -i sonarr -i radarr -t 600 -sUp" +- bash /mnt/tank/scripts/heavy_script.sh -t 8812 -m" From cd212882dc38b61cccaa13db57bc521d4062f392 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 28 Apr 2022 01:30:18 +0000 Subject: [PATCH 0057/1229] rough update for readme --- README.md | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 452a4cc2..717cdda1 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,15 @@ Script that can: Update Truenas SCALE applications, Mount and unmount PVC storag - -p | Prune unused/old docker images" - ### Examples -- bash heavy_script.sh -b 14 -i portainer -i arch -i sonarr -i radarr -t 600 -sUp" -- bash /mnt/tank/scripts/heavy_script.sh -t 8812 -m" +#### bash heavy_script.sh -b 14 -i portainer -i arch -i sonarr -i radarr -t 600 -sup +- This is your typical cron job implementation. +- -b is set to 14. Up to 14 snapshots of your ix-applications dataset will be saved +- -i is set to ignore portainer, arch, sonarr, and radarr. These applications will be ignored when it comes to updates. +- -t I set it to 600 seconds, this means the script will wait 600 seconds for the application to become ACTIVE before timing out and continuing to a different application. +- -s will just sync the repositories, ensuring you are downloading the latest updates +- -u update applications as long as the major version has absolutely no change, if it does have a change it will ask the user to update manually. +- -p Prune docker images. + +- bash /mnt/tank/scripts/heavy_script.sh -t 8812 -m +- bash /mnt/tank/scripts/heavy_script/heavy_script.sh -r From cdd3fb8c6a9084226e85ebfb9ee1d9dbc580a087 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 28 Apr 2022 01:39:44 +0000 Subject: [PATCH 0058/1229] Add personal Cron Job --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 717cdda1..af57c590 100644 --- a/README.md +++ b/README.md @@ -27,3 +27,7 @@ Script that can: Update Truenas SCALE applications, Mount and unmount PVC storag - bash /mnt/tank/scripts/heavy_script.sh -t 8812 -m - bash /mnt/tank/scripts/heavy_script/heavy_script.sh -r + + +### My personal Cron Job +- ```git -C /mnt/speed/scripts/heavy_script pull && bash /mnt/speed/scripts/heavy_script/heavy_script.sh -b 14 -sup``` From ea90a42c744d16600a036cf5be637f38d2071d30 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 28 Apr 2022 01:40:54 +0000 Subject: [PATCH 0059/1229] formatting --- heavy_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index 313f6b2d..01aaef1e 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -102,7 +102,7 @@ do fi exit;; s) - echo -e "Syncing all catalogs, please wait.." && cli -c 'app catalog sync_all' &> /dev/null && echo -e "Catalog sync complete" + echo -e "\nSyncing all catalogs, please wait.." && cli -c 'app catalog sync_all' &> /dev/null && echo -e "Catalog sync complete" ;; U) mapfile -t array < <(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,container_images_update_available,status' | grep ",true") From e280bad4d2e5e34ed7fec6068a6899fec5c31f9c Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 28 Apr 2022 01:43:20 +0000 Subject: [PATCH 0060/1229] formatting last change i swear. Ive just been trying to get things nicely formatted and working. --- heavy_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index 01aaef1e..7988b08e 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -29,7 +29,7 @@ do exit;; b) number_of_backups=$OPTARG - echo "Number of backups was set to $number_of_backups" + echo -e "\nNumber of backups was set to $number_of_backups" re='^[0-9]+$' ! [[ $number_of_backups =~ $re ]] && echo -e "Error: -b needs to be assigned an interger\n$number_of_backups is not an interger" >&2 && exit From 9e066803636a385681be6998ba1e10c7acb863f8 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 28 Apr 2022 02:10:33 +0000 Subject: [PATCH 0061/1229] Place overflow within if statement doing unnecessary math when it might not be required. This will probably save 12 nanoseconds. --- heavy_script.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index 7988b08e..18d5eb2f 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -35,11 +35,9 @@ do date=$(date '+%Y_%m_%d_%H_%M_%S') cli -c 'app kubernetes backup_chart_releases backup_name=''"'HeavyScript_"$date"'"' - mapfile -t list_backups < <(cli -c 'app kubernetes list_backups' | grep "HeavyScript_" | sort -nr | awk -F '|' '{print $2}'| tr -d " \t\r") - overflow=$(expr ${#list_backups[@]} - $number_of_backups) - if [[ ${#list_backups[@]} -gt "number_of_backups" ]]; then + overflow=$(expr ${#list_backups[@]} - $number_of_backups) echo && mapfile -t list_overflow < <(cli -c 'app kubernetes list_backups' | grep "HeavyScript_" | sort -nr | awk -F '|' '{print $2}'| tr -d " \t\r" | tail -n "$overflow") for i in "${list_overflow[@]}" do From fdf19626fac5beb7125fd6e50b23fab3758e4e5e Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 3 May 2022 21:38:10 -0600 Subject: [PATCH 0062/1229] better method of finding PVC_path --- heavy_script.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index 18d5eb2f..74ea770a 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -80,8 +80,9 @@ do done data_name=$(echo "$pvc" | awk '{print $3}') mount=$(echo "$pvc" | awk '{print $4}') - path=$(find /*/*/ix-applications/releases/"$app"/volumes/ -maxdepth 0 | cut -c 6-) - echo -e "\nMounting\n""$path""""$mount""\nTo\n/mnt/temporary/$data_name" && zfs set mountpoint=/temporary/"$data_name" "$path""$mount" && echo -e "Mounted\n\nUnmount with the following command\nzfs set mountpoint=legacy ""$path"""$mount"\nOr use the Unmount All option" + volume_name=$(echo "$pvc" | awk '{print $4}') + full_path=$(zfs list | grep $volume_name | awk '{print $1}') + echo -e "\nMounting\n"$full_path"\nTo\n/mnt/temporary/$data_name" && zfs set mountpoint=/temporary/"$data_name" "$full_path" && echo -e "Mounted\n\nUnmount with the following command\nzfs set mountpoint=legacy "$full_path" && rmdir /mnt/temporary/"$data_name"\nOr use the Unmount All option" break elif [[ $selection == "2" ]]; then mapfile -t unmount_array < <(basename -a /mnt/temporary/* | sed "s/*//") From 07ca4b940115696721e9d530f2c0f44a9589feb3 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 4 May 2022 23:38:58 +0000 Subject: [PATCH 0063/1229] Sort Update output alphabetically --- heavy_script.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index 74ea770a..1b7ef5c8 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -104,7 +104,7 @@ do echo -e "\nSyncing all catalogs, please wait.." && cli -c 'app catalog sync_all' &> /dev/null && echo -e "Catalog sync complete" ;; U) - mapfile -t array < <(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,container_images_update_available,status' | grep ",true") + mapfile -t array < <(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,container_images_update_available,status' | grep ",true" | sort) [[ -z $array ]] && echo -e "\nThere are no updates available" && continue || echo -e "\n${#array[@]} update(s) available" [[ -z $timeout ]] && echo -e "\nSetting Default Timeout to 300\nChange timeout with -t" && timeout=300 || echo -e "\nTimeout was set to $timeout" for i in "${array[@]}" @@ -142,7 +142,7 @@ do done ;; u) - mapfile -t array < <(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,container_images_update_available,status' | grep -E ",true") + mapfile -t array < <(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,container_images_update_available,status' | grep ",true" | sort) [[ -z $array ]] && echo -e "\nThere are no updates available" && continue || echo -e "\n${#array[@]} update(s) available" [[ -z $timeout ]] && echo -e "\nSetting Default Timeout to 300\nChange timeout with -t" && timeout=300 || echo -e "\nTimeout was set to $timeout" for i in "${array[@]}" From b8765964d223bc5991cfe5c22ce1619c11d79be0 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 4 May 2022 22:07:55 -0600 Subject: [PATCH 0064/1229] Mounting feature improvement --- heavy_script.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index 74ea770a..a670ad8b 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -71,8 +71,13 @@ do echo "$list" && read -p "Please type a number : " selection app=$(echo -e "$list" | grep ^"$selection" | awk '{print $2}' | cut -c 4-) pvc=$(echo -e "$list" | grep ^"$selection" || echo -e "\nInvalid selection") - status=$(cli -m csv -c 'app chart_release query name,status' | grep -E "(,|^)$app(,|$)" | awk -F ',' '{print $2}'| tr -d " \t\n\r") && SECONDS=0 - [[ "$status" != "STOPPED" ]] && echo -e "\nScaling down $app" && midclt call chart.release.scale "$app" '{"replica_count": 0}' &> /dev/null && [[ -z $timeout ]] && echo -e "\nSetting Default Timeout to 300\nChange timeout with -t" && timeout=300 || echo -e "\nTimeout was set to $timeout" + status=$(cli -m csv -c 'app chart_release query name,status' | grep -E "(,|^)$app(,|$)" | awk -F ',' '{print $2}'| tr -d " \t\n\r") + if [[ "$status" != "STOPPED" ]]; then + [[ -z $timeout ]] && echo -e "\nSetting Default Timeout to 300\nChange timeout with -t" && timeout=300 || echo -e "\nTimeout was set to $timeout" + SECONDS=0 && echo -e "\nScaling down $app" && midclt call chart.release.scale "$app" '{"replica_count": 0}' &> /dev/null + else + echo -e "\n$app is already stopped" + fi while [[ "$SECONDS" -le "$timeout" && "$status" != "STOPPED" ]] do status=$(cli -m csv -c 'app chart_release query name,status' | grep -E "(,|^)$app(,|$)" | awk -F ',' '{print $2}'| tr -d " \t\n\r") @@ -82,7 +87,7 @@ do mount=$(echo "$pvc" | awk '{print $4}') volume_name=$(echo "$pvc" | awk '{print $4}') full_path=$(zfs list | grep $volume_name | awk '{print $1}') - echo -e "\nMounting\n"$full_path"\nTo\n/mnt/temporary/$data_name" && zfs set mountpoint=/temporary/"$data_name" "$full_path" && echo -e "Mounted\n\nUnmount with the following command\nzfs set mountpoint=legacy "$full_path" && rmdir /mnt/temporary/"$data_name"\nOr use the Unmount All option" + echo -e "\nMounting\n"$full_path"\nTo\n/mnt/temporary/$data_name" && zfs set mountpoint=/temporary/"$data_name" "$full_path" && echo -e "Mounted\n\nUnmount with the following command\nzfs set mountpoint=legacy "$full_path" && rmdir /mnt/temporary/"$data_name"\nOr use the Unmount All option\n" break elif [[ $selection == "2" ]]; then mapfile -t unmount_array < <(basename -a /mnt/temporary/* | sed "s/*//") From 48023d7f8196cb552733ca3ead34cec647dbcdcf Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 5 May 2022 12:29:01 +0000 Subject: [PATCH 0065/1229] proper Restore indentation --- heavy_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index 70e9daa9..7070e6f7 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -48,7 +48,7 @@ do r) list_backups=$(cli -c 'app kubernetes list_backups' | grep "HeavyScript_" | sort -rn | tr -d " \t\r" | awk -F '|' '{print NR-1, $2}' | column -t) && echo "$list_backups" && read -p "Please type a number: " selection && restore_point=$(echo "$list_backups" | grep ^"$selection" | awk '{print $2}') && echo -e "\nThis is NOT guranteed to work\nThis is ONLY supposed to be used as a LAST RESORT\nConsider rolling back your applications instead if possible.\n\nYou have chosen to restore $restore_point\nWould you like to continue?" && echo -e "1 Yes\n2 No" && read -p "Please type a number: " yesno || { echo "FAILED"; exit; } if [[ $yesno == "1" ]]; then - echo -e "\nStarting Backup, this will take a LONG time." && cli -c 'app kubernetes restore_backup backup_name=''"'"$restore_point"'"' || echo "Restore FAILED" + echo -e "\nStarting Backup, this will take a LONG time." && cli -c 'app kubernetes restore_backup backup_name=''"'"$restore_point"'"' || echo "Restore FAILED" elif [[ $yesno == "2" ]]; then echo "You've chosen NO, killing script. Good luck." else From b4e5b45045dd03bc99ab585a2ccd5dbef08d7655 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 10 May 2022 03:54:31 +0000 Subject: [PATCH 0066/1229] Backport Truescript Changes 1. Arguments can be used in any order now (Thanks Ornias) 2. Rollback applications feature (Ornias' Idea, again thank you) - When using -R The script will monitor the status of the application after updating it, make sure it deploys, if the app does not deploy within the timeout, roll the application back 3. Ability to stop applications prior to updating with -S (another idea by ornias) 4. Option for verbose output with -v I made this change after adding the new features, it makes the output ugly, but figured id give the users the choice to see more information. 5. Better variable names 6. A ton of other various little fixes and testing You can view the current work, and who exactly did what, and when with this link: https://github.com/truecharts/truescript/commits/optimise My current un-pulled Pull Request: https://github.com/truecharts/truescript/pull/5 --- heavy_script.sh | 476 ++++++++++++++++++++++++++++-------------------- 1 file changed, 283 insertions(+), 193 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index 7070e6f7..1d5bd7ba 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -1,199 +1,289 @@ #!/bin/bash - #If no argument is passed, kill the script. [[ -z "$*" ]] && echo "This script requires an arguent, use -h for help" && exit -while getopts ":hsi:mrb:t:uUp" opt +while getopts ":hsi:mrb:t:uUpSRv" opt do - case $opt in - h) - echo "These arguments NEED to be ran in a specific order, you can go from TOP to BOTTOM, see example below" - echo "-m | Initiates mounting feature, choose between unmounting and mounting PVC data" - echo "-r | Opens a menu to restore a HeavyScript backup that was taken on you ix-applications pool" - echo "-b | Back-up your ix-applications dataset, specify a number after -b" - echo "-i | Add application to ignore list, one by one, see example below." - echo "-t | Set a custom timeout in seconds for -u or -U: This is the ammount of time the script will wait for an application to go from DEPLOYING to ACTIVE" - echo "-t | Set a custom timeout in seconds for -m: Amount of time script will wait for applications to stop, before timing out" - echo "-s | sync catalog" - echo "-U | Update all applications, ignores versions" - echo "-u | Update all applications, does not update Major releases" - echo "-p | Prune unused/old docker images" - echo "EX | bash heavy_script.sh -b 14 -i portainer -i arch -i sonarr -i radarr -t 600 -sUp" - echo "EX | bash /mnt/tank/scripts/heavy_script.sh -t 8812 -m" - exit;; - \?) - echo "Invalid Option -$OPTARG, type -h for help" - exit;; - :) - echo "Option: -$OPTARG requires an argument" >&2 - exit;; - b) - number_of_backups=$OPTARG - echo -e "\nNumber of backups was set to $number_of_backups" - re='^[0-9]+$' - ! [[ $number_of_backups =~ $re ]] && echo -e "Error: -b needs to be assigned an interger\n$number_of_backups is not an interger" >&2 && exit - - date=$(date '+%Y_%m_%d_%H_%M_%S') - cli -c 'app kubernetes backup_chart_releases backup_name=''"'HeavyScript_"$date"'"' - mapfile -t list_backups < <(cli -c 'app kubernetes list_backups' | grep "HeavyScript_" | sort -nr | awk -F '|' '{print $2}'| tr -d " \t\r") - if [[ ${#list_backups[@]} -gt "number_of_backups" ]]; then - overflow=$(expr ${#list_backups[@]} - $number_of_backups) - echo && mapfile -t list_overflow < <(cli -c 'app kubernetes list_backups' | grep "HeavyScript_" | sort -nr | awk -F '|' '{print $2}'| tr -d " \t\r" | tail -n "$overflow") - for i in "${list_overflow[@]}" - do - cli -c 'app kubernetes delete_backup backup_name=''"'"$i"'"' &> /dev/null && echo -e "Deleting your oldest backup $i\nThis is to remain in the $number_of_backups backups range you set. " || echo "Failed to delete $i" - done - fi - ;; - r) - list_backups=$(cli -c 'app kubernetes list_backups' | grep "HeavyScript_" | sort -rn | tr -d " \t\r" | awk -F '|' '{print NR-1, $2}' | column -t) && echo "$list_backups" && read -p "Please type a number: " selection && restore_point=$(echo "$list_backups" | grep ^"$selection" | awk '{print $2}') && echo -e "\nThis is NOT guranteed to work\nThis is ONLY supposed to be used as a LAST RESORT\nConsider rolling back your applications instead if possible.\n\nYou have chosen to restore $restore_point\nWould you like to continue?" && echo -e "1 Yes\n2 No" && read -p "Please type a number: " yesno || { echo "FAILED"; exit; } - if [[ $yesno == "1" ]]; then - echo -e "\nStarting Backup, this will take a LONG time." && cli -c 'app kubernetes restore_backup backup_name=''"'"$restore_point"'"' || echo "Restore FAILED" - elif [[ $yesno == "2" ]]; then - echo "You've chosen NO, killing script. Good luck." - else - echo "Invalid Selection" - fi - ;; - i) - ignore+="$OPTARG" - ;; - t) - timeout=$OPTARG - re='^[0-9]+$' - ! [[ $timeout =~ $re ]] && echo -e "Error: -t needs to be assigned an interger\n$timeout is not an interger" >&2 - ;; - m) - echo -e "1 Mount\n2 Unmount All" && read -p "Please type a number: " selection - - if [[ $selection == "1" ]]; then - list=$(k3s kubectl get pvc -A | sort -u | awk '{print NR-1, "\t" $1 "\t" $2 "\t" $4}' | column -t | sed "s/^0/ /") - echo "$list" && read -p "Please type a number : " selection - app=$(echo -e "$list" | grep ^"$selection" | awk '{print $2}' | cut -c 4-) - pvc=$(echo -e "$list" | grep ^"$selection" || echo -e "\nInvalid selection") - status=$(cli -m csv -c 'app chart_release query name,status' | grep -E "(,|^)$app(,|$)" | awk -F ',' '{print $2}'| tr -d " \t\n\r") - if [[ "$status" != "STOPPED" ]]; then - [[ -z $timeout ]] && echo -e "\nSetting Default Timeout to 300\nChange timeout with -t" && timeout=300 || echo -e "\nTimeout was set to $timeout" - SECONDS=0 && echo -e "\nScaling down $app" && midclt call chart.release.scale "$app" '{"replica_count": 0}' &> /dev/null - else - echo -e "\n$app is already stopped" - fi - while [[ "$SECONDS" -le "$timeout" && "$status" != "STOPPED" ]] - do - status=$(cli -m csv -c 'app chart_release query name,status' | grep -E "(,|^)$app(,|$)" | awk -F ',' '{print $2}'| tr -d " \t\n\r") - echo -e "Waiting $((timeout-SECONDS)) more seconds for $app to be STOPPED" && sleep 10 - done - data_name=$(echo "$pvc" | awk '{print $3}') - mount=$(echo "$pvc" | awk '{print $4}') - volume_name=$(echo "$pvc" | awk '{print $4}') - full_path=$(zfs list | grep $volume_name | awk '{print $1}') - echo -e "\nMounting\n"$full_path"\nTo\n/mnt/temporary/$data_name" && zfs set mountpoint=/temporary/"$data_name" "$full_path" && echo -e "Mounted\n\nUnmount with the following command\nzfs set mountpoint=legacy "$full_path" && rmdir /mnt/temporary/"$data_name"\nOr use the Unmount All option\n" - break - elif [[ $selection == "2" ]]; then - mapfile -t unmount_array < <(basename -a /mnt/temporary/* | sed "s/*//") - [[ -z $unmount_array ]] && echo "Theres nothing to unmount" && exit - for i in "${unmount_array[@]}" - do - main=$(k3s kubectl get pvc -A | grep "$i" | awk '{print $1, $2, $4}') - app=$(echo "$main" | awk '{print $1}' | cut -c 4-) - pvc=$(echo "$main" | awk '{print $3}') - path=$(find /*/*/ix-applications/releases/"$app"/volumes/ -maxdepth 0 | cut -c 6-) - zfs set mountpoint=legacy "$path""$pvc" && echo "$i unmounted" && rmdir /mnt/temporary/"$i" || echo "failed to unmount $i" - done - else - echo "Invalid selection, type -h for help" - break - fi - exit;; - s) - echo -e "\nSyncing all catalogs, please wait.." && cli -c 'app catalog sync_all' &> /dev/null && echo -e "Catalog sync complete" - ;; - U) - mapfile -t array < <(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,container_images_update_available,status' | grep ",true" | sort) - [[ -z $array ]] && echo -e "\nThere are no updates available" && continue || echo -e "\n${#array[@]} update(s) available" - [[ -z $timeout ]] && echo -e "\nSetting Default Timeout to 300\nChange timeout with -t" && timeout=300 || echo -e "\nTimeout was set to $timeout" - for i in "${array[@]}" - do - n=$(echo "$i" | awk -F ',' '{print $1}') #print out first catagory, name. - ov=$(echo "$i" | awk -F ',' '{print $4}') #Old version - nv=$(echo "$i" | awk -F ',' '{print $5}') #New Version - status=$(echo "$i" | awk -F ',' '{print $2}') #status of the app: STOPPED / DEPLOYING / ACTIVE - if [[ "${ignore[*]}" == *"${n}"* ]]; then - echo -e "\n$n\nIgnored, skipping" - continue - elif [[ "$status" == "STOPPED" ]]; then - echo -e "\n$n\nUpdating" && cli -c 'app chart_release upgrade release_name=''"'"$n"'"' &> /dev/null && echo -e "Updated\n$ov\n$nv\nWas Stopped, Beginning Stop Loop" && SECONDS=0 || { echo "FAILED"; continue; } - while [[ "$status" != "ACTIVE" ]] - do - status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep "$n" | awk -F ',' '{print $2}') - if [[ "$status" == "STOPPED" ]]; then - echo -e "Stopped" - break - elif [[ "$SECONDS" -ge "$timeout" && "$status" == "DEPLOYING" ]]; then - echo -e "Error: Run Time($SECONDS) has exceeded Timeout($timeout)\nIf this is a slow starting application, set a higher time with -t\nIf this applicaion is always DEPLOYING, you can disable all probes under the Healthcheck Probes Liveness section in the edit configuration\nNot shutting down application for safety reasons, continuing to next applicaion" - break - elif [[ "$status" == "DEPLOYING" ]]; then - echo -e "Waiting $((timeout-SECONDS)) more seconds for $n to be ACTIVE" && sleep 15 - continue - else - echo -e "Returing to STOPPED state.." && midclt call chart.release.scale "$n" '{"replica_count": 0}' &> /dev/null && echo -e "Stopped"|| echo "FAILED" - break - fi - done - else - echo -e "\n$n\nUpdating" && cli -c 'app chart_release upgrade release_name=''"'"$n"'"' &> /dev/null && echo -e "Updated\n$ov\n$nv" || echo -e "FAILED" - continue - fi - done - ;; - u) - mapfile -t array < <(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,container_images_update_available,status' | grep ",true" | sort) - [[ -z $array ]] && echo -e "\nThere are no updates available" && continue || echo -e "\n${#array[@]} update(s) available" - [[ -z $timeout ]] && echo -e "\nSetting Default Timeout to 300\nChange timeout with -t" && timeout=300 || echo -e "\nTimeout was set to $timeout" - for i in "${array[@]}" - do - n=$(echo "$i" | awk -F ',' '{print $1}') #print out first catagory, name. - ottv=$(echo "$i" | awk -F ',' '{print $4}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #previous Truecharts version - nttv=$(echo "$i" | awk -F ',' '{print $5}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #previous version) #New Truecharts Version - oav=$(echo "$i" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}' | awk -F '.' '{print $1}') #previous version) #New App Version - nav=$(echo "$i" | awk -F ',' '{print $5}' | awk -F '_' '{print $2}' | awk -F '.' '{print $1}') #previous version) #New App Version - status=$(echo "$i" | awk -F ',' '{print $2}') #status of the app: STOPPED / DEPLOYING / ACTIVE - tt=$(diff <(echo "$ottv") <(echo "$nttv")) #caluclating difference in major Truecharts versions - av=$(diff <(echo "$oav") <(echo "$nav")) #caluclating difference in major app versions - ov=$(echo "$i" | awk -F ',' '{print $4}') #Upgraded From - nv=$(echo "$i" | awk -F ',' '{print $5}') #Upraded To - if [[ "${ignore[*]}" == *"${n}"* ]]; then - echo -e "\n$n\nIgnored, skipping" - continue - elif [[ "$tt" == "$av" && "$status" == "ACTIVE" || "$status" == "DEPLOYING" ]]; then - echo -e "\n$n\nUpdating" && cli -c 'app chart_release upgrade release_name=''"'"$n"'"' &> /dev/null && echo -e "Updated\n$ov\n$nv" || echo "FAILED" - continue - elif [[ "$tt" == "$av" && "$status" == "STOPPED" ]]; then - echo -e "\n$n\nUpdating" && cli -c 'app chart_release upgrade release_name=''"'"$n"'"' &> /dev/null && echo -e "Updated\n$ov\n$nv\nWas Stopped, Beginning Stop Loop" && SECONDS=0 || { echo "FAILED"; continue; } - while [[ "$status" != "ACTIVE" ]] - do - status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep "$n" | awk -F ',' '{print $2}') - if [[ "$status" == "STOPPED" ]]; then - echo -e "Stopped" - break - elif [[ "$SECONDS" -ge "$timeout" && "$status" == "DEPLOYING" ]]; then - echo -e "Error: Run Time($SECONDS) has exceeded Timeout($timeout)\nIf this is a slow starting application, set a higher time with -t\nIf this applicaion is always DEPLOYING, you can disable all probes under the Healthcheck Probes Liveness section in the edit configuration\nNot shutting down application for safety reasons, continuing to next applicaion" - break - elif [[ "$status" == "DEPLOYING" ]]; then - echo -e "Waiting $((timeout-SECONDS)) more seconds for $n to be ACTIVE" && sleep 15 - continue - else - echo "Returing to STOPPED state.." && midclt call chart.release.scale "$n" '{"replica_count": 0}' &> /dev/null && echo "Stopped"|| echo -e "FAILED" - break - fi - done - else - echo -e "\n$n\nMajor Release, update manually" - continue - fi - done - ;; - p) - echo -e "\nPruning Docker Images" && docker image prune -af | grep Total || echo "Failed to Prune Docker Images" - esac + case $opt in + h) + echo "-m | Initiates mounting feature, choose between unmounting and mounting PVC data" + echo "-r | Opens a menu to restore a heavy_script backup that was taken on you ix-applications pool" + echo "-b | Back-up your ix-applications dataset, specify a number after -b" + echo "-i | Add application to ignore list, one by one, see example below." + echo "-R | Roll-back applications if they fail to update" + echo "-S | Shutdown applications prior to updating" + echo "-v | verbose output" + echo "-t | Set a custom timeout in seconds when checking if either an App or Mountpoint correctly Started, Stopped or (un)Mounted. Defaults to 500 seconds" + echo "-s | sync catalog" + echo "-S | Stops App before update with -u or -U and restarts afterwards" + echo "-U | Update all applications, ignores versions" + echo "-u | Update all applications, does not update Major releases" + echo "-p | Prune unused/old docker images" + echo "-s | Stop App before attempting update" + echo "EX | bash heavy_script.sh -b 14 -i portainer -i arch -i sonarr -i radarr -t 600 -vRsUp" + echo "EX | bash /mnt/tank/scripts/heavy_script.sh -t 8812 -m" + exit + ;; + \?) + echo "Invalid Option -$OPTARG, type -h for help" + exit + ;; + :) + echo "Option: -$OPTARG requires an argument" >&2 + exit + ;; + b) + re='^[0-9]+$' + ! [[ $OPTARG =~ $re ]] && echo -e "Error: -b needs to be assigned an interger\n$number_of_backups is not an interger" >&2 && exit + number_of_backups=$OPTARG + echo -e "\nNumber of backups was set to $number_of_backups" + ;; + r) + restore="true" + ;; + i) + ignore+=("$OPTARG") + ;; + t) + re='^[0-9]+$' + timeout=$OPTARG + ! [[ $timeout =~ $re ]] && echo -e "Error: -t needs to be assigned an interger\n$timeout is not an interger" >&2 && exit + ;; + m) + mount="true" + ;; + s) + sync="true" + ;; + U) + update_all_apps="true" + ;; + u) + update_apps="true" + ;; + S) + stop_before_update="true" + ;; + p) + prune="true" + ;; + R) + rollback="true" + ;; + v) + verbose="true" + ;; + esac done + +backup(){ +date=$(date '+%Y_%m_%d_%H_%M_%S') +[[ "$verbose" == "true" ]] && cli -c 'app kubernetes backup_chart_releases backup_name=''"'HeavyScript_"$date"'"' +[[ -z "$verbose" ]] && echo -e "\nNew Backup Name:" && cli -c 'app kubernetes backup_chart_releases backup_name=''"'HeavyScript_"$date"'"' | tail -n 1 +mapfile -t list_backups < <(cli -c 'app kubernetes list_backups' | grep "HeavyScript_" | sort -t '_' -Vr -k2,7 | awk -F '|' '{print $2}'| tr -d " \t\r") +if [[ ${#list_backups[@]} -gt "number_of_backups" ]]; then + echo -e "\nDeleting the oldest backup(s) for exceeding limit:" + overflow=$(expr ${#list_backups[@]} - $number_of_backups) + mapfile -t list_overflow < <(cli -c 'app kubernetes list_backups' | grep "HeavyScript_" | sort -t '_' -Vr -k2,7 | awk -F '|' '{print $2}'| tr -d " \t\r" | tail -n "$overflow") + for i in "${list_overflow[@]}" + do + cli -c 'app kubernetes delete_backup backup_name=''"'"$i"'"' &> /dev/null || echo "Failed to delete $i" + echo "$i" + done +fi +} +export -f backup + +restore(){ +list_backups=$(cli -c 'app kubernetes list_backups' | grep "HeavyScript_" | sort -rV | tr -d " \t\r" | awk -F '|' '{print NR-1, $2}' | column -t) && echo "$list_backups" && read -p "Please type a number: " selection && restore_point=$(echo "$list_backups" | grep ^"$selection" | awk '{print $2}') && echo -e "\nThis is NOT guranteed to work\nThis is ONLY supposed to be used as a LAST RESORT\nConsider rolling back your applications instead if possible.\n\nYou have chosen to restore $restore_point\nWould you like to continue?" && echo -e "1 Yes\n2 No" && read -p "Please type a number: " yesno || { echo "FAILED"; exit; } +if [[ $yesno == "1" ]]; then + echo -e "\nStarting Backup, this will take a LONG time." && cli -c 'app kubernetes restore_backup backup_name=''"'"$restore_point"'"' || echo "Restore FAILED" +elif [[ $yesno == "2" ]]; then + echo "You've chosen NO, killing script. Good luck." +else + echo "Invalid Selection" +fi +} +export -f restore + +mount(){ +echo -e "1 Mount\n2 Unmount All" && read -p "Please type a number: " selection + +if [[ $selection == "1" ]]; then + list=$(k3s kubectl get pvc -A | sort -u | awk '{print NR-1, "\t" $1 "\t" $2 "\t" $4}' | column -t | sed "s/^0/ /") + echo "$list" && read -p "Please type a number : " selection + app=$(echo -e "$list" | grep ^"$selection" | awk '{print $2}' | cut -c 4-) + pvc=$(echo -e "$list" | grep ^"$selection" || echo -e "\nInvalid selection") + status=$(cli -m csv -c 'app chart_release query name,status' | grep -E "(,|^)$app(,|$)" | awk -F ',' '{print $2}'| tr -d " \t\n\r") + if [[ "$status" != "STOPPED" ]]; then + [[ -z $timeout ]] && echo -e "\nDefault Timeout: 500" && timeout=500 || echo -e "\nTimeout was set to $timeout" + SECONDS=0 && echo -e "\nScaling down $app" && midclt call chart.release.scale "$app" '{"replica_count": 0}' &> /dev/null + else + echo -e "\n$app is already stopped" + fi + while [[ "$SECONDS" -le "$timeout" && "$status" != "STOPPED" ]] + do + status=$(cli -m csv -c 'app chart_release query name,status' | grep -E "(,|^)$app(,|$)" | awk -F ',' '{print $2}'| tr -d " \t\n\r") + echo -e "Waiting $((timeout-SECONDS)) more seconds for $app to be STOPPED" && sleep 10 + done + data_name=$(echo "$pvc" | awk '{print $3}') + mount=$(echo "$pvc" | awk '{print $4}') + volume_name=$(echo "$pvc" | awk '{print $4}') + full_path=$(zfs list | grep $volume_name | awk '{print $1}') + echo -e "\nMounting\n"$full_path"\nTo\n/mnt/temporary/$data_name" && zfs set mountpoint=/temporary/"$data_name" "$full_path" && echo -e "Mounted\n\nUnmount with the following command\nzfs set mountpoint=legacy "$full_path" && rmdir /mnt/temporary/"$data_name"\nOr use the Unmount All option\n" + exit +elif [[ $selection == "2" ]]; then + mapfile -t unmount_array < <(basename -a /mnt/temporary/* | sed "s/*//") + [[ -z $unmount_array ]] && echo "Theres nothing to unmount" && exit + for i in "${unmount_array[@]}" + do + main=$(k3s kubectl get pvc -A | grep "$i" | awk '{print $1, $2, $4}') + app=$(echo "$main" | awk '{print $1}' | cut -c 4-) + pvc=$(echo "$main" | awk '{print $3}') + path=$(find /*/*/ix-applications/releases/"$app"/volumes/ -maxdepth 0 | cut -c 6-) + zfs set mountpoint=legacy "$path""$pvc" && echo "$i unmounted" && rmdir /mnt/temporary/"$i" || echo "failed to unmount $i" + done +else + echo "Invalid selection, type -h for help" + break +fi +} +export -f mount + +sync(){ +echo -e "\nSyncing all catalogs, please wait.." && cli -c 'app catalog sync_all' &> /dev/null && echo -e "Catalog sync complete" +} +export -f sync + +prune(){ +echo -e "\nPruning Docker Images" && docker image prune -af | grep Total || echo "Failed to Prune Docker Images" +} +export -f prune + +update_apps(){ + mapfile -t array < <(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,container_images_update_available,status' | grep ",true" | sort) + [[ -z $array ]] && echo -e "\nThere are no updates available" || echo -e "\n${#array[@]} update(s) available" + [[ -z $timeout ]] && echo -e "\nSetting Default Timeout to 500\nChange timeout with -t" && timeout=500 || echo -e "\nTimeout was set to $timeout" + for i in "${array[@]}" + do + app_name=$(echo "$i" | awk -F ',' '{print $1}') #print out first catagory, name. + old_app_ver=$(echo "$i" | awk -F ',' '{print $4}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #previous/current Application MAJOR Version + new_app_ver=$(echo "$i" | awk -F ',' '{print $5}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #new Application MAJOR Version + old_chart_ver=$(echo "$i" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}' | awk -F '.' '{print $1}') # Old Chart MAJOR version + new_chart_ver=$(echo "$i" | awk -F ',' '{print $5}' | awk -F '_' '{print $2}' | awk -F '.' '{print $1}') # New Chart MAJOR version + status=$(echo "$i" | awk -F ',' '{print $2}') #status of the app: STOPPED / DEPLOYING / ACTIVE + diff_app=$(diff <(echo "$old_app_ver") <(echo "$new_app_ver")) #caluclating difference in major app versions + diff_chart=$(diff <(echo "$old_chart_ver") <(echo "$new_chart_ver")) #caluclating difference in Chart versions + old_full_ver=$(echo "$i" | awk -F ',' '{print $4}') #Upgraded From + new_full_ver=$(echo "$i" | awk -F ',' '{print $5}') #Upraded To + rollback_version=$(echo "$i" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}') + [[ "${ignore[*]}" == *"${app_name}"* ]] && echo -e "\n$app_name\nIgnored, skipping" && continue + if [[ "$diff_app" == "$diff_chart" || "$update_all_apps" == "true" ]]; then #continue to update + startstatus=$status + if [[ $stop_before_update == "true" ]]; then # Check to see if user is using -S or not + if [[ "$status" == "STOPPED" ]]; then # if status is already stopped, skip while loop + echo -e "\n$app_name" + [[ "$verbose" == "true" ]] && echo "Updating..." + cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo -e "Updated\n$old_full_ver\n$new_full_ver" && after_update_actions || echo "FAILED" + continue + else # if status was not STOPPED, stop the app prior to updating + echo -e "\n"$app_name"" + [[ "$verbose" == "true" ]] && echo "Stopping prior to update..." + midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null && SECONDS=0 || echo -e "FAILED" + while [[ "$status" != "STOPPED" ]] + do + status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep ""$app_name"," | awk -F ',' '{print $2}') + if [[ "$status" == "STOPPED" ]]; then + echo "Stopped" + [[ "$verbose" == "true" ]] && echo "Updating..." + cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo -e "Updated\n$old_full_ver\n$new_full_ver" && after_update_actions || echo "Failed to update" + break + elif [[ "$SECONDS" -ge "$timeout" ]]; then + echo "Error: Run Time($SECONDS) has exceeded Timeout($timeout)" + break + elif [[ "$status" != "STOPPED" ]]; then + [[ "$verbose" == "true" ]] && echo "Waiting $((timeout-SECONDS)) more seconds for $app_name to be STOPPED" + sleep 10 + continue + fi + done + fi + else #user must not be using -S, just update + echo -e "\n$app_name" + [[ "$verbose" == "true" ]] && echo "Updating..." + cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo -e "Updated\n$old_full_ver\n$new_full_ver" && after_update_actions || { echo "FAILED"; continue; } + fi + else + echo -e "\n$app_name\nMajor Release, update manually" + continue + fi + done +} +export -f update_apps + +after_update_actions(){ +SECONDS=0 +count=0 +if [[ $rollback == "true" ]]; then + while [[ "0" != "1" ]] + do + (( count++ )) + status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep ""$app_name"," | awk -F ',' '{print $2}') + if [[ "$status" == "ACTIVE" && "$startstatus" == "STOPPED" ]]; then + [[ "$verbose" == "true" ]] && echo "Returing to STOPPED state.." + midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null && echo "Stopped"|| echo "FAILED" + break + elif [[ "$SECONDS" -ge "$timeout" && "$status" == "DEPLOYING" && "$failed" != "true" ]]; then + echo -e "Error: Run Time($SECONDS) for $app_name has exceeded Timeout($timeout)\nIf this is a slow starting application, set a higher timeout with -t\nIf this applicaion is always DEPLOYING, you can disable all probes under the Healthcheck Probes Liveness section in the edit configuration\nReverting update..." + midclt call chart.release.rollback "$app_name" "{\"item_version\": \"$rollback_version\"}" &> /dev/null + [[ "$startstatus" == "STOPPED" ]] && failed="true" && after_update_actions && unset failed #run back after_update_actions function if the app was stopped prior to update + break + elif [[ "$SECONDS" -ge "$timeout" && "$status" == "DEPLOYING" && "$failed" == "true" ]]; then + echo -e "Error: Run Time($SECONDS) for $app_name has exceeded Timeout($timeout)\nThe application failed to be ACTIVE even after a rollback,\nManual intervention is required\nAbandoning" + break + elif [[ "$status" == "STOPPED" ]]; then + [[ "$count" -le 1 ]] && echo "Verifying Stopped.." && sleep 15 && continue #if reports stopped on FIRST time through loop, double check + [[ "$count" -ge 2 ]] && echo "Error: Application appears to be stuck in stopped state" && break #if reports stopped any time after the first loop, assume its broken. + elif [[ "$status" == "ACTIVE" ]]; then + [[ "$count" -le 1 ]] && echo "Verifying Active.." && sleep 15 && continue #if reports active on FIRST time through loop, double check + [[ "$count" -ge 2 ]] && echo "Active" && break #if reports active any time after the first loop, assume actually active. + else + [[ "$verbose" == "true" ]] && echo "Waiting $((timeout-SECONDS)) more seconds for $app_name to be ACTIVE" + sleep 15 + continue + fi + done +else + if [[ "$startstatus" == "STOPPED" ]]; then + status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep ""$app_name"," | awk -F ',' '{print $2}') + while [[ "$status" != "STOPPED" ]] + do + (( count++ )) + [[ "$count" -ge 2 ]] && status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep ""$app_name"," | awk -F ',' '{print $2}') #Skip first status check, due to the one directly above it. + if [[ "$status" == "STOPPED" ]]; then + echo "Stopped" + break + elif [[ "$status" == "ACTIVE" ]]; then + [[ "$verbose" == "true" ]] && echo "Returing to STOPPED state.." + midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null && echo "Stopped"|| echo "FAILED" + break + elif [[ "$SECONDS" -ge "$timeout" ]]; then + echo "Error: Run Time($SECONDS) has exceeded Timeout($timeout)" + break + elif [[ "$status" != "STOPPED" ]]; then + [[ "$verbose" == "true" ]] && echo "Waiting $((timeout-SECONDS)) more seconds for $app_name to be ACTIVE" + sleep 10 + continue + fi + done + fi +fi +} +export -f prune + +[[ $restore == "true" ]] && restore && exit +[[ $number_of_backups -gt 0 ]] && backup +[[ $mount == "true" ]] && mount && exit +[[ $sync == "true" ]] && sync +[[ $update_all_apps == "true" || $update_apps == "true" ]] && update_apps +[[ $prune == "true" ]] && prune From 9d2f21d31f8ba1be80dd32029a47ffecc1d8c57a Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 10 May 2022 04:53:19 +0000 Subject: [PATCH 0067/1229] update readme will update with a longer, proper readme later. --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index af57c590..21bb9ed0 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,13 @@ Script that can: Update Truenas SCALE applications, Mount and unmount PVC storage, Prune Docker images. -## These arguments NEED to be ran in a specific order, you can go from TOP to BOTTOM, see example below - -m | Initiates mounting feature, choose between unmounting and mounting PVC data" - -r | Opens a menu to restore a HeavyScript backup that was taken on you ix-applications pool" - -b | Back-up your ix-applications dataset, specify a number after -b" - -i | Add application to ignore list, one by one, see example below." +- -R | Roll-back applications if they fail to update +- -S | Shutdown applications prior to updating +- -v | verbose output - -t | Set a custom timeout in seconds for -u or -U: This is the ammount of time the script will wait for an application to go from DEPLOYING to ACTIVE" - -t | Set a custom timeout in seconds for -m: Amount of time script will wait for applications to stop, before timing out" - -s | sync catalog" From b4272324b26a9483602a8984632a4cffdd8d93af Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 9 May 2022 22:55:26 -0600 Subject: [PATCH 0068/1229] Personal Cron job --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 21bb9ed0..4f3fa0b4 100644 --- a/README.md +++ b/README.md @@ -32,4 +32,4 @@ Script that can: Update Truenas SCALE applications, Mount and unmount PVC storag ### My personal Cron Job -- ```git -C /mnt/speed/scripts/heavy_script pull && bash /mnt/speed/scripts/heavy_script/heavy_script.sh -b 14 -sup``` +- ```git -C /mnt/speed/scripts/heavy_script pull && bash /mnt/speed/scripts/heavy_script/heavy_script.sh -b 14 -Rsup``` From a8b9deac6a2c725f9c24293b1f579a3a984ddc39 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 10 May 2022 12:48:35 -0600 Subject: [PATCH 0069/1229] cleaner timemout message --- heavy_script.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index 1d5bd7ba..b80ca5b8 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -116,7 +116,7 @@ if [[ $selection == "1" ]]; then pvc=$(echo -e "$list" | grep ^"$selection" || echo -e "\nInvalid selection") status=$(cli -m csv -c 'app chart_release query name,status' | grep -E "(,|^)$app(,|$)" | awk -F ',' '{print $2}'| tr -d " \t\n\r") if [[ "$status" != "STOPPED" ]]; then - [[ -z $timeout ]] && echo -e "\nDefault Timeout: 500" && timeout=500 || echo -e "\nTimeout was set to $timeout" + [[ -z $timeout ]] && echo -e "\nDefault Timeout: 500" && timeout=500 || echo -e "\nCustom Timeout: $timeout" SECONDS=0 && echo -e "\nScaling down $app" && midclt call chart.release.scale "$app" '{"replica_count": 0}' &> /dev/null else echo -e "\n$app is already stopped" @@ -163,7 +163,7 @@ export -f prune update_apps(){ mapfile -t array < <(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,container_images_update_available,status' | grep ",true" | sort) [[ -z $array ]] && echo -e "\nThere are no updates available" || echo -e "\n${#array[@]} update(s) available" - [[ -z $timeout ]] && echo -e "\nSetting Default Timeout to 500\nChange timeout with -t" && timeout=500 || echo -e "\nTimeout was set to $timeout" + [[ -z $timeout ]] && echo -e "\nDefault Timeout: 500" && timeout=500 || echo -e "\nCustom Timeout: $timeout" for i in "${array[@]}" do app_name=$(echo "$i" | awk -F ',' '{print $1}') #print out first catagory, name. From 174450ec3d342f9f6d9f3a5907dc169a302db487 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 10 May 2022 19:20:01 +0000 Subject: [PATCH 0070/1229] Update Readme --- README.md | 60 +++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 38 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 4f3fa0b4..aac04cd5 100644 --- a/README.md +++ b/README.md @@ -1,35 +1,51 @@ # heavy_script -Script that can: Update Truenas SCALE applications, Mount and unmount PVC storage, Prune Docker images. +Update | Backup | Restore | Mount PVC | Rollback Applications | Sync Catalog | Prune Docker Images -- -m | Initiates mounting feature, choose between unmounting and mounting PVC data" -- -r | Opens a menu to restore a HeavyScript backup that was taken on you ix-applications pool" -- -b | Back-up your ix-applications dataset, specify a number after -b" -- -i | Add application to ignore list, one by one, see example below." -- -R | Roll-back applications if they fail to update -- -S | Shutdown applications prior to updating -- -v | verbose output -- -t | Set a custom timeout in seconds for -u or -U: This is the ammount of time the script will wait for an application to go from DEPLOYING to ACTIVE" -- -t | Set a custom timeout in seconds for -m: Amount of time script will wait for applications to stop, before timing out" -- -s | sync catalog" -- -U | Update all applications, ignores versions" -- -u | Update all applications, does not update Major releases" -- -p | Prune unused/old docker images" - +| Flag | Example | Parameter | Description | +|------ |------------------------ |----------- |--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| -r | -r | None | Restore HeavyScript specific 'ix-applications dataset' snapshot | +| -m | -m | None | Initiates mounting feature
Choose between unmounting and mounting PVC data | +| -b | -b 14 | int | Backup 'ix-appliactions' dataset
Creates backups up to the number you've chosen | +| -i | -i nextcloud -i sonarr | String | Applications listed will be ignored during updating | +| -R | -R | None | Monitors applications after they update
If the app does not become "ACTIVE" after either:
The custom Timeout, or Default Timeout,
rollback the application. | +| -v | -v | None | Verbose output | +| -S | -S | None | Shutdown applications prior to updating | +| -t | -t 150 | int | Set a custom timeout to be used with either:
-m
- Time the script will wait for application to be "STOPPED"
or
-u/U
- Time the script will wait for application to be either "STOPPED" or "ACTIVE" | +| -s | -s | None | Sync Catalog before updating | +| -U | -U | None | Update applications, ignoring major version changes | +| -u | -u | None | Update applications, do NOT update if there was a major version change | +| -p | -p | None | Prune old/unused docker images | +
+
### Examples -#### bash heavy_script.sh -b 14 -i portainer -i arch -i sonarr -i radarr -t 600 -sup -- This is your typical cron job implementation. +#### Typical Cron Job +``` +bash heavy_script.sh -b 14 -i portainer -i arch -i sonarr -i radarr -t 600 -Rsup +``` + - -b is set to 14. Up to 14 snapshots of your ix-applications dataset will be saved - -i is set to ignore portainer, arch, sonarr, and radarr. These applications will be ignored when it comes to updates. - -t I set it to 600 seconds, this means the script will wait 600 seconds for the application to become ACTIVE before timing out and continuing to a different application. -- -s will just sync the repositories, ensuring you are downloading the latest updates +- -R Will rollback applications if they fail to deploy after updating. +- -s will just sync the repositories, ensuring you are downloading the latest updates. - -u update applications as long as the major version has absolutely no change, if it does have a change it will ask the user to update manually. - -p Prune docker images. -- bash /mnt/tank/scripts/heavy_script.sh -t 8812 -m -- bash /mnt/tank/scripts/heavy_script/heavy_script.sh -r +#### Mounting PVC Data +``` +bash /mnt/tank/scripts/heavy_script.sh -t 300 -m +``` -### My personal Cron Job -- ```git -C /mnt/speed/scripts/heavy_script pull && bash /mnt/speed/scripts/heavy_script/heavy_script.sh -b 14 -Rsup``` +#### Restoring ix-applications dataset + +``` +bash /mnt/tank/scripts/heavy_script/heavy_script.sh -r +``` + +#### My personal Cron Job +``` +git -C /mnt/speed/scripts/heavy_script pull && bash /mnt/speed/scripts/heavy_script/heavy_script.sh -b 14 -Rsup +``` From 1bb08e7d860d8561b3df2bd75c9410f822ce1075 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 10 May 2022 14:46:47 -0600 Subject: [PATCH 0071/1229] better ignore list search --- heavy_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index b80ca5b8..9f3d36ee 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -177,7 +177,7 @@ update_apps(){ old_full_ver=$(echo "$i" | awk -F ',' '{print $4}') #Upgraded From new_full_ver=$(echo "$i" | awk -F ',' '{print $5}') #Upraded To rollback_version=$(echo "$i" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}') - [[ "${ignore[*]}" == *"${app_name}"* ]] && echo -e "\n$app_name\nIgnored, skipping" && continue + printf '%s\0' "${ignore[@]}" | grep -iFxqz "${app_name}" && echo -e "\n$app_name\nIgnored, skipping" && continue #If application is on ignore list, skip if [[ "$diff_app" == "$diff_chart" || "$update_all_apps" == "true" ]]; then #continue to update startstatus=$status if [[ $stop_before_update == "true" ]]; then # Check to see if user is using -S or not From e91fd6d2d20031df2e1ea6f9d41179cc3f837dbc Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 10 May 2022 16:42:05 -0600 Subject: [PATCH 0072/1229] thwart wrong reporting --- heavy_script.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index 9f3d36ee..b339bef2 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -256,21 +256,23 @@ if [[ $rollback == "true" ]]; then else if [[ "$startstatus" == "STOPPED" ]]; then status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep ""$app_name"," | awk -F ',' '{print $2}') - while [[ "$status" != "STOPPED" ]] + while [[ "0" != "1" ]] do (( count++ )) [[ "$count" -ge 2 ]] && status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep ""$app_name"," | awk -F ',' '{print $2}') #Skip first status check, due to the one directly above it. if [[ "$status" == "STOPPED" ]]; then - echo "Stopped" + [[ "$count" -le 1 ]] && echo "Verifying Stopped.." && sleep 15 && continue #if reports stopped on FIRST time through loop, double check + [[ "$count" -ge 2 ]] && echo "Stopped" && break #assume actually stopped anytime AFTER the first loop break elif [[ "$status" == "ACTIVE" ]]; then + [[ "$count" -le 1 ]] && echo "Verifying Active.." && sleep 15 && continue #if reports active on FIRST time through loop, double check [[ "$verbose" == "true" ]] && echo "Returing to STOPPED state.." midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null && echo "Stopped"|| echo "FAILED" break elif [[ "$SECONDS" -ge "$timeout" ]]; then echo "Error: Run Time($SECONDS) has exceeded Timeout($timeout)" break - elif [[ "$status" != "STOPPED" ]]; then + else [[ "$verbose" == "true" ]] && echo "Waiting $((timeout-SECONDS)) more seconds for $app_name to be ACTIVE" sleep 10 continue From 39e66836a2e3817ec02a36607f402d0bb2bb647e Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 10 May 2022 17:37:20 -0600 Subject: [PATCH 0073/1229] after_update_actions optimizations --- heavy_script.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index b339bef2..64a5ad0a 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -243,10 +243,10 @@ if [[ $rollback == "true" ]]; then break elif [[ "$status" == "STOPPED" ]]; then [[ "$count" -le 1 ]] && echo "Verifying Stopped.." && sleep 15 && continue #if reports stopped on FIRST time through loop, double check - [[ "$count" -ge 2 ]] && echo "Error: Application appears to be stuck in stopped state" && break #if reports stopped any time after the first loop, assume its broken. + echo "Error: Application appears to be stuck in stopped state" && break #if reports stopped any time after the first loop, assume its broken. elif [[ "$status" == "ACTIVE" ]]; then [[ "$count" -le 1 ]] && echo "Verifying Active.." && sleep 15 && continue #if reports active on FIRST time through loop, double check - [[ "$count" -ge 2 ]] && echo "Active" && break #if reports active any time after the first loop, assume actually active. + echo "Active" && break #if reports active any time after the first loop, assume actually active. else [[ "$verbose" == "true" ]] && echo "Waiting $((timeout-SECONDS)) more seconds for $app_name to be ACTIVE" sleep 15 @@ -255,14 +255,13 @@ if [[ $rollback == "true" ]]; then done else if [[ "$startstatus" == "STOPPED" ]]; then - status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep ""$app_name"," | awk -F ',' '{print $2}') while [[ "0" != "1" ]] do (( count++ )) - [[ "$count" -ge 2 ]] && status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep ""$app_name"," | awk -F ',' '{print $2}') #Skip first status check, due to the one directly above it. + status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep ""$app_name"," | awk -F ',' '{print $2}') #Skip first status check, due to the one directly above it. if [[ "$status" == "STOPPED" ]]; then [[ "$count" -le 1 ]] && echo "Verifying Stopped.." && sleep 15 && continue #if reports stopped on FIRST time through loop, double check - [[ "$count" -ge 2 ]] && echo "Stopped" && break #assume actually stopped anytime AFTER the first loop + echo "Stopped" && break #assume actually stopped anytime AFTER the first loop break elif [[ "$status" == "ACTIVE" ]]; then [[ "$count" -le 1 ]] && echo "Verifying Active.." && sleep 15 && continue #if reports active on FIRST time through loop, double check From aca0c15ecd56ace98650abeb8ff5a1f4da720de5 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 10 May 2022 17:56:23 -0600 Subject: [PATCH 0074/1229] Kill script if invalid selection --- heavy_script.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index 64a5ad0a..990a6c20 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -95,7 +95,10 @@ fi export -f backup restore(){ -list_backups=$(cli -c 'app kubernetes list_backups' | grep "HeavyScript_" | sort -rV | tr -d " \t\r" | awk -F '|' '{print NR-1, $2}' | column -t) && echo "$list_backups" && read -p "Please type a number: " selection && restore_point=$(echo "$list_backups" | grep ^"$selection" | awk '{print $2}') && echo -e "\nThis is NOT guranteed to work\nThis is ONLY supposed to be used as a LAST RESORT\nConsider rolling back your applications instead if possible.\n\nYou have chosen to restore $restore_point\nWould you like to continue?" && echo -e "1 Yes\n2 No" && read -p "Please type a number: " yesno || { echo "FAILED"; exit; } +list_backups=$(cli -c 'app kubernetes list_backups' | grep "HeavyScript_" | sort -rV | tr -d " \t\r" | awk -F '|' '{print NR-1, $2}' | column -t) +echo "$list_backups" && read -p "Please type a number: " selection && restore_point=$(echo "$list_backups" | grep ^"$selection" | awk '{print $2}') +[[ -z "$restore_point" ]] && echo "Invalid Selection: $selection, was not an option" && exit #Check for valid selection. If none, kill script +echo -e "\nThis is NOT guranteed to work\nThis is ONLY supposed to be used as a LAST RESORT\nConsider rolling back your applications instead if possible.\n\nYou have chosen to restore $restore_point\nWould you like to continue?" && echo -e "1 Yes\n2 No" && read -p "Please type a number: " yesno || { echo "FAILED"; exit; } if [[ $yesno == "1" ]]; then echo -e "\nStarting Backup, this will take a LONG time." && cli -c 'app kubernetes restore_backup backup_name=''"'"$restore_point"'"' || echo "Restore FAILED" elif [[ $yesno == "2" ]]; then @@ -112,8 +115,9 @@ echo -e "1 Mount\n2 Unmount All" && read -p "Please type a number: " selection if [[ $selection == "1" ]]; then list=$(k3s kubectl get pvc -A | sort -u | awk '{print NR-1, "\t" $1 "\t" $2 "\t" $4}' | column -t | sed "s/^0/ /") echo "$list" && read -p "Please type a number : " selection - app=$(echo -e "$list" | grep ^"$selection" | awk '{print $2}' | cut -c 4-) - pvc=$(echo -e "$list" | grep ^"$selection" || echo -e "\nInvalid selection") + app=$(echo -e "$list" | grep ^"$selection" | awk '{print $2}' | cut -c 4- ) + [[ -z "$app" ]] && echo "Invalid Selection: $selection, was not an option" && exit #Check for valid selection. If none, kill script + pvc=$(echo -e "$list" | grep ^"$selection") status=$(cli -m csv -c 'app chart_release query name,status' | grep -E "(,|^)$app(,|$)" | awk -F ',' '{print $2}'| tr -d " \t\n\r") if [[ "$status" != "STOPPED" ]]; then [[ -z $timeout ]] && echo -e "\nDefault Timeout: 500" && timeout=500 || echo -e "\nCustom Timeout: $timeout" @@ -145,7 +149,6 @@ elif [[ $selection == "2" ]]; then done else echo "Invalid selection, type -h for help" - break fi } export -f mount From 9111b7b490240d645f29aa337d7dbbd9d0f84db4 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 10 May 2022 19:35:46 -0600 Subject: [PATCH 0075/1229] remove warning for ext services chart --- heavy_script.sh | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index 990a6c20..9513cb24 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -186,19 +186,19 @@ update_apps(){ if [[ $stop_before_update == "true" ]]; then # Check to see if user is using -S or not if [[ "$status" == "STOPPED" ]]; then # if status is already stopped, skip while loop echo -e "\n$app_name" - [[ "$verbose" == "true" ]] && echo "Updating..." + [[ "$verbose" == "true" ]] && echo "Updating.." cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo -e "Updated\n$old_full_ver\n$new_full_ver" && after_update_actions || echo "FAILED" continue else # if status was not STOPPED, stop the app prior to updating echo -e "\n"$app_name"" - [[ "$verbose" == "true" ]] && echo "Stopping prior to update..." + [[ "$verbose" == "true" ]] && echo "Stopping prior to update.." midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null && SECONDS=0 || echo -e "FAILED" while [[ "$status" != "STOPPED" ]] do status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep ""$app_name"," | awk -F ',' '{print $2}') if [[ "$status" == "STOPPED" ]]; then echo "Stopped" - [[ "$verbose" == "true" ]] && echo "Updating..." + [[ "$verbose" == "true" ]] && echo "Updating.." cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo -e "Updated\n$old_full_ver\n$new_full_ver" && after_update_actions || echo "Failed to update" break elif [[ "$SECONDS" -ge "$timeout" ]]; then @@ -213,7 +213,7 @@ update_apps(){ fi else #user must not be using -S, just update echo -e "\n$app_name" - [[ "$verbose" == "true" ]] && echo "Updating..." + [[ "$verbose" == "true" ]] && echo "Updating.." cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo -e "Updated\n$old_full_ver\n$new_full_ver" && after_update_actions || { echo "FAILED"; continue; } fi else @@ -237,7 +237,7 @@ if [[ $rollback == "true" ]]; then midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null && echo "Stopped"|| echo "FAILED" break elif [[ "$SECONDS" -ge "$timeout" && "$status" == "DEPLOYING" && "$failed" != "true" ]]; then - echo -e "Error: Run Time($SECONDS) for $app_name has exceeded Timeout($timeout)\nIf this is a slow starting application, set a higher timeout with -t\nIf this applicaion is always DEPLOYING, you can disable all probes under the Healthcheck Probes Liveness section in the edit configuration\nReverting update..." + echo -e "Error: Run Time($SECONDS) for $app_name has exceeded Timeout($timeout)\nIf this is a slow starting application, set a higher timeout with -t\nIf this applicaion is always DEPLOYING, you can disable all probes under the Healthcheck Probes Liveness section in the edit configuration\nReverting update.." midclt call chart.release.rollback "$app_name" "{\"item_version\": \"$rollback_version\"}" &> /dev/null [[ "$startstatus" == "STOPPED" ]] && failed="true" && after_update_actions && unset failed #run back after_update_actions function if the app was stopped prior to update break @@ -245,10 +245,12 @@ if [[ $rollback == "true" ]]; then echo -e "Error: Run Time($SECONDS) for $app_name has exceeded Timeout($timeout)\nThe application failed to be ACTIVE even after a rollback,\nManual intervention is required\nAbandoning" break elif [[ "$status" == "STOPPED" ]]; then - [[ "$count" -le 1 ]] && echo "Verifying Stopped.." && sleep 15 && continue #if reports stopped on FIRST time through loop, double check - echo "Error: Application appears to be stuck in stopped state" && break #if reports stopped any time after the first loop, assume its broken. + [[ "$count" -le 1 && "$verbose" == "true" ]] && echo "Verifying Stopped.." && sleep 15 && continue #if reports stopped on FIRST time through loop, double check + [[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports stopped on FIRST time through loop, double check + echo "Stopped" && break #if reports stopped any time after the first loop, assume its extermal services. elif [[ "$status" == "ACTIVE" ]]; then - [[ "$count" -le 1 ]] && echo "Verifying Active.." && sleep 15 && continue #if reports active on FIRST time through loop, double check + [[ "$count" -le 1 && "$verbose" == "true" ]] && echo "Verifying Active.." && sleep 15 && continue #if reports active on FIRST time through loop, double check + [[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports active on FIRST time through loop, double check echo "Active" && break #if reports active any time after the first loop, assume actually active. else [[ "$verbose" == "true" ]] && echo "Waiting $((timeout-SECONDS)) more seconds for $app_name to be ACTIVE" @@ -263,11 +265,13 @@ else (( count++ )) status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep ""$app_name"," | awk -F ',' '{print $2}') #Skip first status check, due to the one directly above it. if [[ "$status" == "STOPPED" ]]; then - [[ "$count" -le 1 ]] && echo "Verifying Stopped.." && sleep 15 && continue #if reports stopped on FIRST time through loop, double check + [[ "$count" -le 1 && "$verbose" == "true" ]] && echo "Verifying Stopped.." && sleep 15 && continue #if reports stopped on FIRST time through loop, double check + [[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports stopped on FIRST time through loop, double check echo "Stopped" && break #assume actually stopped anytime AFTER the first loop break elif [[ "$status" == "ACTIVE" ]]; then - [[ "$count" -le 1 ]] && echo "Verifying Active.." && sleep 15 && continue #if reports active on FIRST time through loop, double check + [[ "$count" -le 1 && "$verbose" == "true" ]] && echo "Verifying Active.." && sleep 15 && continue #if reports active on FIRST time through loop, double check + [[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports active on FIRST time through loop, double check [[ "$verbose" == "true" ]] && echo "Returing to STOPPED state.." midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null && echo "Stopped"|| echo "FAILED" break From e6250239c405e805d4ff481f076459d1dc245218 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 10 May 2022 20:10:26 -0600 Subject: [PATCH 0076/1229] start # line from 1 in Restore Function --- heavy_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index 9513cb24..45cacf27 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -95,7 +95,7 @@ fi export -f backup restore(){ -list_backups=$(cli -c 'app kubernetes list_backups' | grep "HeavyScript_" | sort -rV | tr -d " \t\r" | awk -F '|' '{print NR-1, $2}' | column -t) +list_backups=$(cli -c 'app kubernetes list_backups' | grep "HeavyScript_" | sort -rV | tr -d " \t\r" | awk -F '|' '{print $2}' | nl | column -t) echo "$list_backups" && read -p "Please type a number: " selection && restore_point=$(echo "$list_backups" | grep ^"$selection" | awk '{print $2}') [[ -z "$restore_point" ]] && echo "Invalid Selection: $selection, was not an option" && exit #Check for valid selection. If none, kill script echo -e "\nThis is NOT guranteed to work\nThis is ONLY supposed to be used as a LAST RESORT\nConsider rolling back your applications instead if possible.\n\nYou have chosen to restore $restore_point\nWould you like to continue?" && echo -e "1 Yes\n2 No" && read -p "Please type a number: " yesno || { echo "FAILED"; exit; } From 9c6312c3e92544ee00a9463adfe2dd627fdb4727 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 10 May 2022 20:53:01 -0600 Subject: [PATCH 0077/1229] restore + mount cleanup --- heavy_script.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index 45cacf27..6fc316f3 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -95,10 +95,13 @@ fi export -f backup restore(){ +clear -x list_backups=$(cli -c 'app kubernetes list_backups' | grep "HeavyScript_" | sort -rV | tr -d " \t\r" | awk -F '|' '{print $2}' | nl | column -t) echo "$list_backups" && read -p "Please type a number: " selection && restore_point=$(echo "$list_backups" | grep ^"$selection" | awk '{print $2}') +[[ -z "$selection" ]] && echo "Your selection cannot be empty" && exit #Check for valid selection. If none, kill script [[ -z "$restore_point" ]] && echo "Invalid Selection: $selection, was not an option" && exit #Check for valid selection. If none, kill script -echo -e "\nThis is NOT guranteed to work\nThis is ONLY supposed to be used as a LAST RESORT\nConsider rolling back your applications instead if possible.\n\nYou have chosen to restore $restore_point\nWould you like to continue?" && echo -e "1 Yes\n2 No" && read -p "Please type a number: " yesno || { echo "FAILED"; exit; } +echo -e "\nWARNING:\nThis is NOT guranteed to work\nThis is ONLY supposed to be used as a LAST RESORT\nConsider rolling back your applications instead if possible" || { echo "FAILED"; exit; } +echo -e "\n\nYou have chosen:\n$restore_point\n\nWould you like to continue?" && echo -e "1 Yes\n2 No" && read -p "Please type a number: " yesno || { echo "FAILED"; exit; } if [[ $yesno == "1" ]]; then echo -e "\nStarting Backup, this will take a LONG time." && cli -c 'app kubernetes restore_backup backup_name=''"'"$restore_point"'"' || echo "Restore FAILED" elif [[ $yesno == "2" ]]; then @@ -110,11 +113,13 @@ fi export -f restore mount(){ +clear -x echo -e "1 Mount\n2 Unmount All" && read -p "Please type a number: " selection - +[[ -z "$selection" ]] && echo "Your selection cannot be empty" && exit #Check for valid selection. If none, kill script if [[ $selection == "1" ]]; then list=$(k3s kubectl get pvc -A | sort -u | awk '{print NR-1, "\t" $1 "\t" $2 "\t" $4}' | column -t | sed "s/^0/ /") echo "$list" && read -p "Please type a number : " selection + [[ -z "$selection" ]] && echo "Your selection cannot be empty" && exit #Check for valid selection. If none, kill script app=$(echo -e "$list" | grep ^"$selection" | awk '{print $2}' | cut -c 4- ) [[ -z "$app" ]] && echo "Invalid Selection: $selection, was not an option" && exit #Check for valid selection. If none, kill script pvc=$(echo -e "$list" | grep ^"$selection") @@ -144,7 +149,7 @@ elif [[ $selection == "2" ]]; then main=$(k3s kubectl get pvc -A | grep "$i" | awk '{print $1, $2, $4}') app=$(echo "$main" | awk '{print $1}' | cut -c 4-) pvc=$(echo "$main" | awk '{print $3}') - path=$(find /*/*/ix-applications/releases/"$app"/volumes/ -maxdepth 0 | cut -c 6-) + path=$(find /mnt/*/ix-applications/releases/"$app"/volumes/ -maxdepth 0 | cut -c 6-) zfs set mountpoint=legacy "$path""$pvc" && echo "$i unmounted" && rmdir /mnt/temporary/"$i" || echo "failed to unmount $i" done else From 93e155c0f0ea4d5993bc5a70170cf3ba24dfd555 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 12 May 2022 01:15:28 +0000 Subject: [PATCH 0078/1229] Verbose information README --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.md b/README.md index aac04cd5..1866db89 100644 --- a/README.md +++ b/README.md @@ -49,3 +49,19 @@ bash /mnt/tank/scripts/heavy_script/heavy_script.sh -r ``` git -C /mnt/speed/scripts/heavy_script pull && bash /mnt/speed/scripts/heavy_script/heavy_script.sh -b 14 -Rsup ``` + +
+
+ +### Additional Informaton + +#### Verbose vs Non-Verbose +- Verbose used `bash heavy_test.sh -b 5 -SRupv` +- Non-Verbose used `bash heavy_test.sh -b 5 -SRup` + +| Verbose | Non-Verbose | +|--------- |------------- | +| ![image](https://user-images.githubusercontent.com/20793231/167971188-07f71d02-8da3-4e0c-b9a0-cd26e7f63613.png) | ![image](https://user-images.githubusercontent.com/20793231/167972033-dc8d4ab4-4fb2-4c8a-b7dc-b9311ae55cf8.png) | + + + From 1edff4f384c496f19ec3ba53c0b92355a374732c Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 12 May 2022 01:28:36 +0000 Subject: [PATCH 0079/1229] Re-arrange function calls --- heavy_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index 6fc316f3..d828eb59 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -295,8 +295,8 @@ fi export -f prune [[ $restore == "true" ]] && restore && exit -[[ $number_of_backups -gt 0 ]] && backup [[ $mount == "true" ]] && mount && exit +[[ $number_of_backups -gt 0 ]] && backup [[ $sync == "true" ]] && sync [[ $update_all_apps == "true" || $update_apps == "true" ]] && update_apps [[ $prune == "true" ]] && prune From 683e8b4d622c6a396a86a54d4d09289ac7cfd67e Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 12 May 2022 04:28:27 +0000 Subject: [PATCH 0080/1229] Safety Checks 1. Ensure number of backups is AT LEAST 1. Im assuming a value of 0 would be user error.. so we want to ensure we have at least one backup 2. Make restore function use the same sorting method. Which ignores all words, only uses the values. 3. Changed mountpoint from `/temporary` to `/heavyscript` Hopefully to avoid any issues of users using /temporary for ANY other reason.. 4. Add a safety check within the unmount feature.. Before, there was a possibility users could have two applications, on separate pools, the script would try to mount to both of them. Obviously this is an issue. So we added a newline count, if the find command finds more than one entry for an application, use the slower, but more reliable method of checking the users current application pool, attempt to mount the application instance that exists on that pool. 5. If user tries using '-r' and '-m' at the same time, report an error and exit. Those two functions cannot be used at the same time.. --- heavy_script.sh | 39 +++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index d828eb59..827a2f50 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -34,9 +34,9 @@ do ;; b) re='^[0-9]+$' - ! [[ $OPTARG =~ $re ]] && echo -e "Error: -b needs to be assigned an interger\n$number_of_backups is not an interger" >&2 && exit number_of_backups=$OPTARG - echo -e "\nNumber of backups was set to $number_of_backups" + ! [[ $OPTARG =~ $re ]] && echo -e "Error: -b needs to be assigned an interger\n"$number_of_backups" is not an interger" >&2 && exit + [[ "$number_of_backups" -le 0 ]] && echo "Error: Number of backups is required to be at least 1" && exit ;; r) restore="true" @@ -47,7 +47,8 @@ do t) re='^[0-9]+$' timeout=$OPTARG - ! [[ $timeout =~ $re ]] && echo -e "Error: -t needs to be assigned an interger\n$timeout is not an interger" >&2 && exit + ! [[ $timeout =~ $re ]] && echo -e "Error: -t needs to be assigned an interger\n"$timeout" is not an interger" >&2 && exit + [[ "$timeout" -le 50 ]] && echo "Warning: Your timeout is set very low and may lead to premature rollbacks or skips" ;; m) mount="true" @@ -77,6 +78,7 @@ do done backup(){ +echo -e "\nNumber of backups was set to $number_of_backups" date=$(date '+%Y_%m_%d_%H_%M_%S') [[ "$verbose" == "true" ]] && cli -c 'app kubernetes backup_chart_releases backup_name=''"'HeavyScript_"$date"'"' [[ -z "$verbose" ]] && echo -e "\nNew Backup Name:" && cli -c 'app kubernetes backup_chart_releases backup_name=''"'HeavyScript_"$date"'"' | tail -n 1 @@ -96,7 +98,7 @@ export -f backup restore(){ clear -x -list_backups=$(cli -c 'app kubernetes list_backups' | grep "HeavyScript_" | sort -rV | tr -d " \t\r" | awk -F '|' '{print $2}' | nl | column -t) +list_backups=$(cli -c 'app kubernetes list_backups' | grep "HeavyScript_" | sort -t '_' -Vr -k2,7 | tr -d " \t\r" | awk -F '|' '{print $2}' | nl | column -t) echo "$list_backups" && read -p "Please type a number: " selection && restore_point=$(echo "$list_backups" | grep ^"$selection" | awk '{print $2}') [[ -z "$selection" ]] && echo "Your selection cannot be empty" && exit #Check for valid selection. If none, kill script [[ -z "$restore_point" ]] && echo "Invalid Selection: $selection, was not an option" && exit #Check for valid selection. If none, kill script @@ -139,10 +141,10 @@ if [[ $selection == "1" ]]; then mount=$(echo "$pvc" | awk '{print $4}') volume_name=$(echo "$pvc" | awk '{print $4}') full_path=$(zfs list | grep $volume_name | awk '{print $1}') - echo -e "\nMounting\n"$full_path"\nTo\n/mnt/temporary/$data_name" && zfs set mountpoint=/temporary/"$data_name" "$full_path" && echo -e "Mounted\n\nUnmount with the following command\nzfs set mountpoint=legacy "$full_path" && rmdir /mnt/temporary/"$data_name"\nOr use the Unmount All option\n" + echo -e "\nMounting\n"$full_path"\nTo\n/mnt/heavyscript/$data_name" && zfs set mountpoint=/heavyscript/"$data_name" "$full_path" && echo -e "Mounted\n\nUnmount with the following command\nzfs set mountpoint=legacy "$full_path" && rmdir /mnt/heavyscript/"$data_name"\nOr use the Unmount All option\n" exit elif [[ $selection == "2" ]]; then - mapfile -t unmount_array < <(basename -a /mnt/temporary/* | sed "s/*//") + mapfile -t unmount_array < <(basename -a /mnt/heavyscript/* | sed "s/*//") [[ -z $unmount_array ]] && echo "Theres nothing to unmount" && exit for i in "${unmount_array[@]}" do @@ -150,8 +152,16 @@ elif [[ $selection == "2" ]]; then app=$(echo "$main" | awk '{print $1}' | cut -c 4-) pvc=$(echo "$main" | awk '{print $3}') path=$(find /mnt/*/ix-applications/releases/"$app"/volumes/ -maxdepth 0 | cut -c 6-) - zfs set mountpoint=legacy "$path""$pvc" && echo "$i unmounted" && rmdir /mnt/temporary/"$i" || echo "failed to unmount $i" + safety_check=$(find /mnt/*/ix-applications/releases/"$app"/volumes/ -maxdepth 0 | cut -c 6- | wc -l) #if theres more than one new lines, that means theres more than one application with the same name on another pool. + if [[ "$safety_check" -gt 1 ]]; then #if there is another app with the same name on another pool, use the current pools application, since the other instance is probably old, or unused. + echo "$i is a name used on more than one pool.. attempting to use your current kubernetes apps pool" + pool=$(cli -c 'app kubernetes config' | grep dataset | awk -F '|' '{print $3}' | awk -F '/' '{print $1}' | tr -d " \t\n\r") + full_path=$(find /mnt/"$pool"/ix-applications/releases/"$app"/volumes/ -maxdepth 0 | cut -c 6-) + zfs set mountpoint=legacy "$full_path""$pvc" && echo "$i unmounted" && rmdir /mnt/heavyscript/"$i" && continue || echo "failed to unmount $i" + fi + zfs set mountpoint=legacy "$path""$pvc" && echo "$i unmounted" && rmdir /mnt/heavyscript/"$i" || echo "failed to unmount $i" done + rmdir /mnt/heavyscript else echo "Invalid selection, type -h for help" fi @@ -268,7 +278,7 @@ else while [[ "0" != "1" ]] do (( count++ )) - status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep ""$app_name"," | awk -F ',' '{print $2}') #Skip first status check, due to the one directly above it. + status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep ""$app_name"," | awk -F ',' '{print $2}') if [[ "$status" == "STOPPED" ]]; then [[ "$count" -le 1 && "$verbose" == "true" ]] && echo "Verifying Stopped.." && sleep 15 && continue #if reports stopped on FIRST time through loop, double check [[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports stopped on FIRST time through loop, double check @@ -294,9 +304,10 @@ fi } export -f prune -[[ $restore == "true" ]] && restore && exit -[[ $mount == "true" ]] && mount && exit -[[ $number_of_backups -gt 0 ]] && backup -[[ $sync == "true" ]] && sync -[[ $update_all_apps == "true" || $update_apps == "true" ]] && update_apps -[[ $prune == "true" ]] && prune +[[ "$restore" == "true" && "$mount" == "true" ]] && echo -e "The Restore Function(-r)\nand\nMount Function(-m)\nCannot both be called at the same time." && exit +[[ "$restore" == "true" ]] && restore && exit +[[ "$mount" == "true" ]] && mount && exit +[[ "$number_of_backups" -ge 1 ]] && backup +[[ "$sync" == "true" ]] && sync +[[ "$update_all_apps" == "true" || $update_apps == "true" ]] && update_apps +[[ "$prune" == "true" ]] && prune From 62f1e0a9c279d1df3ffc9426b5751b36a5b81724 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 12 May 2022 08:41:18 -0600 Subject: [PATCH 0081/1229] fix out of order deletion --- heavy_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index 827a2f50..082f5a44 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -86,7 +86,7 @@ mapfile -t list_backups < <(cli -c 'app kubernetes list_backups' | grep "HeavySc if [[ ${#list_backups[@]} -gt "number_of_backups" ]]; then echo -e "\nDeleting the oldest backup(s) for exceeding limit:" overflow=$(expr ${#list_backups[@]} - $number_of_backups) - mapfile -t list_overflow < <(cli -c 'app kubernetes list_backups' | grep "HeavyScript_" | sort -t '_' -Vr -k2,7 | awk -F '|' '{print $2}'| tr -d " \t\r" | tail -n "$overflow") + mapfile -t list_overflow < <(cli -c 'app kubernetes list_backups' | grep "HeavyScript_" | sort -t '_' -Vr -k2,7 | awk -F '|' '{print $2}'| tr -d " \t\r" | tail -n "$overflow" | sort -t '_' -V -k2,7) for i in "${list_overflow[@]}" do cli -c 'app kubernetes delete_backup backup_name=''"'"$i"'"' &> /dev/null || echo "Failed to delete $i" From fb7b63169315bc1ff1c742dbdcb94a6a44cfb13c Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 12 May 2022 08:54:48 -0600 Subject: [PATCH 0082/1229] remove need to rev sort --- heavy_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index 082f5a44..e312afff 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -86,7 +86,7 @@ mapfile -t list_backups < <(cli -c 'app kubernetes list_backups' | grep "HeavySc if [[ ${#list_backups[@]} -gt "number_of_backups" ]]; then echo -e "\nDeleting the oldest backup(s) for exceeding limit:" overflow=$(expr ${#list_backups[@]} - $number_of_backups) - mapfile -t list_overflow < <(cli -c 'app kubernetes list_backups' | grep "HeavyScript_" | sort -t '_' -Vr -k2,7 | awk -F '|' '{print $2}'| tr -d " \t\r" | tail -n "$overflow" | sort -t '_' -V -k2,7) + mapfile -t list_overflow < <(cli -c 'app kubernetes list_backups' | grep "HeavyScript_" | sort -t '_' -V -k2,7 | awk -F '|' '{print $2}'| tr -d " \t\r" | head -n "$overflow") for i in "${list_overflow[@]}" do cli -c 'app kubernetes delete_backup backup_name=''"'"$i"'"' &> /dev/null || echo "Failed to delete $i" From 22c454c326885f80936821f4601e465cf46ad84e Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 13 May 2022 16:46:15 +0000 Subject: [PATCH 0083/1229] close update functino if no updates --- heavy_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index e312afff..94e2de5b 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -180,7 +180,7 @@ export -f prune update_apps(){ mapfile -t array < <(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,container_images_update_available,status' | grep ",true" | sort) - [[ -z $array ]] && echo -e "\nThere are no updates available" || echo -e "\n${#array[@]} update(s) available" + [[ -z $array ]] && echo -e "\nThere are no updates available" && return 0 || echo -e "\n${#array[@]} update(s) available" [[ -z $timeout ]] && echo -e "\nDefault Timeout: 500" && timeout=500 || echo -e "\nCustom Timeout: $timeout" for i in "${array[@]}" do From 0176e2c319c1fcd6fd28c020d6b5e6f84965405c Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 13 May 2022 17:40:15 -0600 Subject: [PATCH 0084/1229] fix various issues --- heavy_script.sh | 42 ++++++++++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index 94e2de5b..b2f30c0a 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -1,5 +1,6 @@ #!/bin/bash #If no argument is passed, kill the script. + [[ -z "$*" ]] && echo "This script requires an arguent, use -h for help" && exit while getopts ":hsi:mrb:t:uUpSRv" opt @@ -35,7 +36,7 @@ do b) re='^[0-9]+$' number_of_backups=$OPTARG - ! [[ $OPTARG =~ $re ]] && echo -e "Error: -b needs to be assigned an interger\n"$number_of_backups" is not an interger" >&2 && exit + ! [[ $OPTARG =~ $re ]] && echo -e "Error: -b needs to be assigned an interger\n\"""$number_of_backups""\" is not an interger" >&2 && exit [[ "$number_of_backups" -le 0 ]] && echo "Error: Number of backups is required to be at least 1" && exit ;; r) @@ -47,8 +48,7 @@ do t) re='^[0-9]+$' timeout=$OPTARG - ! [[ $timeout =~ $re ]] && echo -e "Error: -t needs to be assigned an interger\n"$timeout" is not an interger" >&2 && exit - [[ "$timeout" -le 50 ]] && echo "Warning: Your timeout is set very low and may lead to premature rollbacks or skips" + ! [[ $timeout =~ $re ]] && echo -e "Error: -t needs to be assigned an interger\n\"""$timeout""\" is not an interger" >&2 && exit ;; m) mount="true" @@ -85,7 +85,7 @@ date=$(date '+%Y_%m_%d_%H_%M_%S') mapfile -t list_backups < <(cli -c 'app kubernetes list_backups' | grep "HeavyScript_" | sort -t '_' -Vr -k2,7 | awk -F '|' '{print $2}'| tr -d " \t\r") if [[ ${#list_backups[@]} -gt "number_of_backups" ]]; then echo -e "\nDeleting the oldest backup(s) for exceeding limit:" - overflow=$(expr ${#list_backups[@]} - $number_of_backups) + overflow=$(( ${#list_backups[@]} - "$number_of_backups" )) mapfile -t list_overflow < <(cli -c 'app kubernetes list_backups' | grep "HeavyScript_" | sort -t '_' -V -k2,7 | awk -F '|' '{print $2}'| tr -d " \t\r" | head -n "$overflow") for i in "${list_overflow[@]}" do @@ -97,9 +97,11 @@ fi export -f backup restore(){ -clear -x +clear -x && echo "pulling restore points.." list_backups=$(cli -c 'app kubernetes list_backups' | grep "HeavyScript_" | sort -t '_' -Vr -k2,7 | tr -d " \t\r" | awk -F '|' '{print $2}' | nl | column -t) -echo "$list_backups" && read -p "Please type a number: " selection && restore_point=$(echo "$list_backups" | grep ^"$selection" | awk '{print $2}') +clear -x +[[ -z "$list_backups" ]] && echo "No HeavyScript restore points available" && exit || { title; echo "Choose a restore point" ; } +echo "$list_backups" && read -p "Please type a number: " selection && restore_point=$(echo "$list_backups" | grep ^""$selection" " | awk '{print $2}') [[ -z "$selection" ]] && echo "Your selection cannot be empty" && exit #Check for valid selection. If none, kill script [[ -z "$restore_point" ]] && echo "Invalid Selection: $selection, was not an option" && exit #Check for valid selection. If none, kill script echo -e "\nWARNING:\nThis is NOT guranteed to work\nThis is ONLY supposed to be used as a LAST RESORT\nConsider rolling back your applications instead if possible" || { echo "FAILED"; exit; } @@ -116,6 +118,7 @@ export -f restore mount(){ clear -x +title echo -e "1 Mount\n2 Unmount All" && read -p "Please type a number: " selection [[ -z "$selection" ]] && echo "Your selection cannot be empty" && exit #Check for valid selection. If none, kill script if [[ $selection == "1" ]]; then @@ -140,8 +143,8 @@ if [[ $selection == "1" ]]; then data_name=$(echo "$pvc" | awk '{print $3}') mount=$(echo "$pvc" | awk '{print $4}') volume_name=$(echo "$pvc" | awk '{print $4}') - full_path=$(zfs list | grep $volume_name | awk '{print $1}') - echo -e "\nMounting\n"$full_path"\nTo\n/mnt/heavyscript/$data_name" && zfs set mountpoint=/heavyscript/"$data_name" "$full_path" && echo -e "Mounted\n\nUnmount with the following command\nzfs set mountpoint=legacy "$full_path" && rmdir /mnt/heavyscript/"$data_name"\nOr use the Unmount All option\n" + full_path=$(zfs list | grep "$volume_name" | awk '{print $1}') + echo -e "\nMounting\n$full_path\nTo\n/mnt/heavyscript/$data_name" && zfs set mountpoint=/heavyscript/"$data_name" "$full_path" && echo -e "Mounted\n\nUnmount with the following command\nzfs set mountpoint=legacy "$full_path" && rmdir /mnt/heavyscript/"$data_name"\nOr use the Unmount All option\n" exit elif [[ $selection == "2" ]]; then mapfile -t unmount_array < <(basename -a /mnt/heavyscript/* | sed "s/*//") @@ -182,6 +185,7 @@ update_apps(){ mapfile -t array < <(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,container_images_update_available,status' | grep ",true" | sort) [[ -z $array ]] && echo -e "\nThere are no updates available" && return 0 || echo -e "\n${#array[@]} update(s) available" [[ -z $timeout ]] && echo -e "\nDefault Timeout: 500" && timeout=500 || echo -e "\nCustom Timeout: $timeout" + [[ "$timeout" -le 120 ]] && echo "Warning: Your timeout is set low and may lead to premature rollbacks or skips" for i in "${array[@]}" do app_name=$(echo "$i" | awk -F ',' '{print $1}') #print out first catagory, name. @@ -205,7 +209,7 @@ update_apps(){ cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo -e "Updated\n$old_full_ver\n$new_full_ver" && after_update_actions || echo "FAILED" continue else # if status was not STOPPED, stop the app prior to updating - echo -e "\n"$app_name"" + echo -e "\n$app_name" [[ "$verbose" == "true" ]] && echo "Stopping prior to update.." midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null && SECONDS=0 || echo -e "FAILED" while [[ "$status" != "STOPPED" ]] @@ -246,7 +250,7 @@ if [[ $rollback == "true" ]]; then while [[ "0" != "1" ]] do (( count++ )) - status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep ""$app_name"," | awk -F ',' '{print $2}') + status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep """$app_name""," | awk -F ',' '{print $2}') if [[ "$status" == "ACTIVE" && "$startstatus" == "STOPPED" ]]; then [[ "$verbose" == "true" ]] && echo "Returing to STOPPED state.." midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null && echo "Stopped"|| echo "FAILED" @@ -278,7 +282,7 @@ else while [[ "0" != "1" ]] do (( count++ )) - status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep ""$app_name"," | awk -F ',' '{print $2}') + status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep """$app_name""," | awk -F ',' '{print $2}') if [[ "$status" == "STOPPED" ]]; then [[ "$count" -le 1 && "$verbose" == "true" ]] && echo "Verifying Stopped.." && sleep 15 && continue #if reports stopped on FIRST time through loop, double check [[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports stopped on FIRST time through loop, double check @@ -304,10 +308,24 @@ fi } export -f prune +title(){ +echo ' _ _ _____ _ _ ' +echo '| | | | / ___| (_) | | ' +echo '| |_| | ___ __ ___ ___ _\ `--. ___ _ __ _ _ __ | |_' +echo "| _ |/ _ \/ _\` \ \ / / | | |\`--. \/ __| '__| | '_ \| __|" +echo '| | | | __/ (_| |\ V /| |_| /\__/ / (__| | | | |_) | |_ ' +echo '\_| |_/\___|\__,_| \_/ \__, \____/ \___|_| |_| .__/ \__|' +echo ' __/ | | | ' +echo ' |___/ |_| ' +echo +} +export -f title + [[ "$restore" == "true" && "$mount" == "true" ]] && echo -e "The Restore Function(-r)\nand\nMount Function(-m)\nCannot both be called at the same time." && exit [[ "$restore" == "true" ]] && restore && exit [[ "$mount" == "true" ]] && mount && exit +[[ "$number_of_backups" -ge 1 && "$sync" == "true" ]] && [[ "$update_all_apps" == "true" || "$update_apps" == "true" ]] && title [[ "$number_of_backups" -ge 1 ]] && backup [[ "$sync" == "true" ]] && sync -[[ "$update_all_apps" == "true" || $update_apps == "true" ]] && update_apps +[[ "$update_all_apps" == "true" || "$update_apps" == "true" ]] && update_apps [[ "$prune" == "true" ]] && prune From 71a2a49cc03c1a9911d171efbc2094e43b7f266b Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sat, 14 May 2022 00:09:35 +0000 Subject: [PATCH 0085/1229] remove ascii from updates. Looked awful in email :( --- heavy_script.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index b2f30c0a..36c63bc5 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -324,7 +324,6 @@ export -f title [[ "$restore" == "true" && "$mount" == "true" ]] && echo -e "The Restore Function(-r)\nand\nMount Function(-m)\nCannot both be called at the same time." && exit [[ "$restore" == "true" ]] && restore && exit [[ "$mount" == "true" ]] && mount && exit -[[ "$number_of_backups" -ge 1 && "$sync" == "true" ]] && [[ "$update_all_apps" == "true" || "$update_apps" == "true" ]] && title [[ "$number_of_backups" -ge 1 ]] && backup [[ "$sync" == "true" ]] && sync [[ "$update_all_apps" == "true" || "$update_apps" == "true" ]] && update_apps From dc10af179884dbdb605cc8f7ebd12dd4d82abafa Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sat, 14 May 2022 12:25:00 -0600 Subject: [PATCH 0086/1229] minor bugfixes --- heavy_script.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index b2f30c0a..cd472230 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -20,7 +20,7 @@ do echo "-U | Update all applications, ignores versions" echo "-u | Update all applications, does not update Major releases" echo "-p | Prune unused/old docker images" - echo "-s | Stop App before attempting update" + echo "-S | Stop App before attempting update" echo "EX | bash heavy_script.sh -b 14 -i portainer -i arch -i sonarr -i radarr -t 600 -vRsUp" echo "EX | bash /mnt/tank/scripts/heavy_script.sh -t 8812 -m" exit @@ -320,8 +320,10 @@ echo ' |___/ |_| ' echo } export -f title - +#exit if incompatable functions are called [[ "$restore" == "true" && "$mount" == "true" ]] && echo -e "The Restore Function(-r)\nand\nMount Function(-m)\nCannot both be called at the same time." && exit +[[ "$update_all_apps" == "true" && "$update_apps" == "true" ]] && echo -e "-U and -u cannot BOTH be called" && exit +#Continue to call functions in specific order [[ "$restore" == "true" ]] && restore && exit [[ "$mount" == "true" ]] && mount && exit [[ "$number_of_backups" -ge 1 && "$sync" == "true" ]] && [[ "$update_all_apps" == "true" || "$update_apps" == "true" ]] && title From b4a53bcddba81523dcf650612ca3814f65aaca99 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 16 May 2022 17:49:48 -0600 Subject: [PATCH 0087/1229] misc changes --- heavy_script.sh | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index cd472230..973ca5ee 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -1,7 +1,7 @@ #!/bin/bash -#If no argument is passed, kill the script. -[[ -z "$*" ]] && echo "This script requires an arguent, use -h for help" && exit +#If no argument is passed, kill the script. +[[ -z "$*" ]] && echo "This script requires an argument, use -h for help" && exit while getopts ":hsi:mrb:t:uUpSRv" opt do @@ -12,7 +12,7 @@ do echo "-b | Back-up your ix-applications dataset, specify a number after -b" echo "-i | Add application to ignore list, one by one, see example below." echo "-R | Roll-back applications if they fail to update" - echo "-S | Shutdown applications prior to updating" + echo "-S | Shutdown application prior to updating" echo "-v | verbose output" echo "-t | Set a custom timeout in seconds when checking if either an App or Mountpoint correctly Started, Stopped or (un)Mounted. Defaults to 500 seconds" echo "-s | sync catalog" @@ -20,7 +20,6 @@ do echo "-U | Update all applications, ignores versions" echo "-u | Update all applications, does not update Major releases" echo "-p | Prune unused/old docker images" - echo "-S | Stop App before attempting update" echo "EX | bash heavy_script.sh -b 14 -i portainer -i arch -i sonarr -i radarr -t 600 -vRsUp" echo "EX | bash /mnt/tank/scripts/heavy_script.sh -t 8812 -m" exit @@ -101,7 +100,7 @@ clear -x && echo "pulling restore points.." list_backups=$(cli -c 'app kubernetes list_backups' | grep "HeavyScript_" | sort -t '_' -Vr -k2,7 | tr -d " \t\r" | awk -F '|' '{print $2}' | nl | column -t) clear -x [[ -z "$list_backups" ]] && echo "No HeavyScript restore points available" && exit || { title; echo "Choose a restore point" ; } -echo "$list_backups" && read -p "Please type a number: " selection && restore_point=$(echo "$list_backups" | grep ^""$selection" " | awk '{print $2}') +echo "$list_backups" && read -p "Please type a number: " selection && restore_point=$(echo "$list_backups" | grep ^"$selection " | awk '{print $2}') [[ -z "$selection" ]] && echo "Your selection cannot be empty" && exit #Check for valid selection. If none, kill script [[ -z "$restore_point" ]] && echo "Invalid Selection: $selection, was not an option" && exit #Check for valid selection. If none, kill script echo -e "\nWARNING:\nThis is NOT guranteed to work\nThis is ONLY supposed to be used as a LAST RESORT\nConsider rolling back your applications instead if possible" || { echo "FAILED"; exit; } @@ -214,7 +213,7 @@ update_apps(){ midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null && SECONDS=0 || echo -e "FAILED" while [[ "$status" != "STOPPED" ]] do - status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep ""$app_name"," | awk -F ',' '{print $2}') + status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep "$app_name," | awk -F ',' '{print $2}') if [[ "$status" == "STOPPED" ]]; then echo "Stopped" [[ "$verbose" == "true" ]] && echo "Updating.." @@ -250,7 +249,7 @@ if [[ $rollback == "true" ]]; then while [[ "0" != "1" ]] do (( count++ )) - status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep """$app_name""," | awk -F ',' '{print $2}') + status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep "$app_name," | awk -F ',' '{print $2}') if [[ "$status" == "ACTIVE" && "$startstatus" == "STOPPED" ]]; then [[ "$verbose" == "true" ]] && echo "Returing to STOPPED state.." midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null && echo "Stopped"|| echo "FAILED" @@ -279,10 +278,10 @@ if [[ $rollback == "true" ]]; then done else if [[ "$startstatus" == "STOPPED" ]]; then - while [[ "0" != "1" ]] + while [[ "0" != "1" ]] #using a constant while loop, then breaking out of the loop with break commands below. do (( count++ )) - status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep """$app_name""," | awk -F ',' '{print $2}') + status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep "$app_name," | awk -F ',' '{print $2}') if [[ "$status" == "STOPPED" ]]; then [[ "$count" -le 1 && "$verbose" == "true" ]] && echo "Verifying Stopped.." && sleep 15 && continue #if reports stopped on FIRST time through loop, double check [[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports stopped on FIRST time through loop, double check From 920ec3c6313da90bfe5902d83b402af8c1595f5b Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 17 May 2022 21:31:55 -0600 Subject: [PATCH 0088/1229] various fixes/optimizations --- heavy_script.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index 973ca5ee..9e3903f4 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -1,6 +1,6 @@ #!/bin/bash - #If no argument is passed, kill the script. + [[ -z "$*" ]] && echo "This script requires an argument, use -h for help" && exit while getopts ":hsi:mrb:t:uUpSRv" opt @@ -12,7 +12,7 @@ do echo "-b | Back-up your ix-applications dataset, specify a number after -b" echo "-i | Add application to ignore list, one by one, see example below." echo "-R | Roll-back applications if they fail to update" - echo "-S | Shutdown application prior to updating" + echo "-S | Shutdown applications prior to updating" echo "-v | verbose output" echo "-t | Set a custom timeout in seconds when checking if either an App or Mountpoint correctly Started, Stopped or (un)Mounted. Defaults to 500 seconds" echo "-s | sync catalog" @@ -20,6 +20,7 @@ do echo "-U | Update all applications, ignores versions" echo "-u | Update all applications, does not update Major releases" echo "-p | Prune unused/old docker images" + echo "-S | Stop App before attempting update" echo "EX | bash heavy_script.sh -b 14 -i portainer -i arch -i sonarr -i radarr -t 600 -vRsUp" echo "EX | bash /mnt/tank/scripts/heavy_script.sh -t 8812 -m" exit @@ -124,9 +125,9 @@ if [[ $selection == "1" ]]; then list=$(k3s kubectl get pvc -A | sort -u | awk '{print NR-1, "\t" $1 "\t" $2 "\t" $4}' | column -t | sed "s/^0/ /") echo "$list" && read -p "Please type a number : " selection [[ -z "$selection" ]] && echo "Your selection cannot be empty" && exit #Check for valid selection. If none, kill script - app=$(echo -e "$list" | grep ^"$selection" | awk '{print $2}' | cut -c 4- ) + app=$(echo -e "$list" | grep ^"$selection " | awk '{print $2}' | cut -c 4- ) [[ -z "$app" ]] && echo "Invalid Selection: $selection, was not an option" && exit #Check for valid selection. If none, kill script - pvc=$(echo -e "$list" | grep ^"$selection") + pvc=$(echo -e "$list" | grep ^"$selection ") status=$(cli -m csv -c 'app chart_release query name,status' | grep -E "(,|^)$app(,|$)" | awk -F ',' '{print $2}'| tr -d " \t\n\r") if [[ "$status" != "STOPPED" ]]; then [[ -z $timeout ]] && echo -e "\nDefault Timeout: 500" && timeout=500 || echo -e "\nCustom Timeout: $timeout" @@ -137,7 +138,7 @@ if [[ $selection == "1" ]]; then while [[ "$SECONDS" -le "$timeout" && "$status" != "STOPPED" ]] do status=$(cli -m csv -c 'app chart_release query name,status' | grep -E "(,|^)$app(,|$)" | awk -F ',' '{print $2}'| tr -d " \t\n\r") - echo -e "Waiting $((timeout-SECONDS)) more seconds for $app to be STOPPED" && sleep 10 + echo -e "Waiting $((timeout-SECONDS)) more seconds for $app to be STOPPED" && sleep 5 done data_name=$(echo "$pvc" | awk '{print $3}') mount=$(echo "$pvc" | awk '{print $4}') @@ -278,7 +279,7 @@ if [[ $rollback == "true" ]]; then done else if [[ "$startstatus" == "STOPPED" ]]; then - while [[ "0" != "1" ]] #using a constant while loop, then breaking out of the loop with break commands below. + while [[ "0" != "1" ]] #using a constant while loop, then breaking out of the loop with break commands below. do (( count++ )) status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep "$app_name," | awk -F ',' '{print $2}') From 334a22ea1d902edd958bce4073996e1bdb619bbb Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 18 May 2022 03:43:24 +0000 Subject: [PATCH 0089/1229] Remove redundant lines in -h --- heavy_script.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index 66e83dcf..7a8bdbce 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -16,11 +16,9 @@ do echo "-v | verbose output" echo "-t | Set a custom timeout in seconds when checking if either an App or Mountpoint correctly Started, Stopped or (un)Mounted. Defaults to 500 seconds" echo "-s | sync catalog" - echo "-S | Stops App before update with -u or -U and restarts afterwards" echo "-U | Update all applications, ignores versions" echo "-u | Update all applications, does not update Major releases" echo "-p | Prune unused/old docker images" - echo "-S | Stop App before attempting update" echo "EX | bash heavy_script.sh -b 14 -i portainer -i arch -i sonarr -i radarr -t 600 -vRsUp" echo "EX | bash /mnt/tank/scripts/heavy_script.sh -t 8812 -m" exit From b013b09204ef73afccf55453769a8bddac63fc06 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 5 Jun 2022 21:50:10 +0000 Subject: [PATCH 0090/1229] Update Readme --- README.md | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) diff --git a/README.md b/README.md index 1866db89..f98afd30 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,94 @@ git -C /mnt/speed/scripts/heavy_script pull && bash /mnt/speed/scripts/heavy_scr

+ +## How to Install + +### Create a Scripts Dataset + +I created a `scripts` dataset on my Truenas SCALE system, this is where all my scripts will remain. + +### Open a Terminal + +**Change Directory to your scripts folder** +``` +cd /mnt/speed/scripts +``` + +**Git Clone Heavy_Script** +``` +git clone https://github.com/Heavybullets8/heavy_script.git +``` + +**Change Directory to Heavy_Script folder** +``` +cd heavy_script +``` + +From here, you can just run Heavy_Script with `bash heavy_script.sh -ARGUMENTS` + +> Note: `chmod +x` is NOT required. Doing this will break the `git pull` function. Just run the script with `bash heavy_script.sh` + +
+ +## How to Update + +### Manually + +#### Open a Terminal + +**Change Directory to your heavy_script folder** +``` +cd /mnt/speed/scripts/heavy_script +``` + +**git pull** +``` +git pull +``` +
+ +### Update with your Cron Job + +Here, we will update the script prior to running it, incase there is a bugfix, or any new additions to the script + +**Cron Job Command** +``` +git -C /mnt/speed/scripts/heavy_script pull && bash /mnt/speed/scripts/heavy_script/heavy_script.sh -b 14 -Rsup +``` +> The important command here is the `git -C /PATH/TO/HEAVY_SCRIPT_DIRECTORY pull` + +> This command will allow you to preform a `git pull` on a remote directory, which will ensure your script is udated prior to running it + +> `&&` Is used to run a command AFTER the previous command completed successfully +>> So once the `git -C /PATH/TO/HEAVY_SCRIPT_DIRECTORY pull` command completes, THEN it will run the `bash /PATH/TO/HEAVY_SCRIPT_DIRECTORY/heavy_script.sh -b 14 -Rsup` command + +
+
+ +## Creating a Cron Job + +1. Truenas SCALE GUI +2. System Settings +3. Advanced +4. Cron Jobs + 1. Click Add + +| Name | Value | Reason | +|------------------------ |------------------------------------------------------------------------------------------------------------------- |------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `Description` | HeavyScript git pull and Update apps | This is up to you, put whatever you think is a good description in here | +| `Command` | `git -C /PATH/TO/HEAVY_SCRIPT_DIRECTORY pull && bash /PATH/TO/HEAVY_SCRIPT_DIRECTORY/heavy_script.sh -b 14 -Rsup` | This is the command you will be running on your schedule I personally use: `git -C /mnt/speed/scripts/heavy_script pull && bash /mnt/speed/scripts/heavy_script/heavy_script.sh -b 14 -Rsup` | +| `Run As User` | `root` | Running the script as `root` is REQUIRED. You cannot access all of the kubernetes functions without this user. | +| `Schedule` | Up to you, I run mine everyday at `0400` | Again up to you | +| `Hide Standard Output` | `False` or Unticked | I like to receive an email report of how the script ran, what apps updated etc. | +| `Hide Standard Error` | `False` or Unticked | I want to see any errors that occur | +| `Enabled` | `True` or Ticked | This will Enable the script to run on your schedule | + + + +
+
+ ### Additional Informaton #### Verbose vs Non-Verbose From dbfe7f2bb89ec586f96cb4c026125a8b0bcdeab2 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 6 Jun 2022 18:10:39 -0600 Subject: [PATCH 0091/1229] regex improvements --- heavy_script.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index 7a8bdbce..c852fa6b 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -126,7 +126,7 @@ if [[ $selection == "1" ]]; then app=$(echo -e "$list" | grep ^"$selection " | awk '{print $2}' | cut -c 4- ) [[ -z "$app" ]] && echo "Invalid Selection: $selection, was not an option" && exit #Check for valid selection. If none, kill script pvc=$(echo -e "$list" | grep ^"$selection ") - status=$(cli -m csv -c 'app chart_release query name,status' | grep -E "(,|^)$app(,|$)" | awk -F ',' '{print $2}'| tr -d " \t\n\r") + status=$(cli -m csv -c 'app chart_release query name,status' | grep -E "^$app\b" | awk -F ',' '{print $2}'| tr -d " \t\n\r") if [[ "$status" != "STOPPED" ]]; then [[ -z $timeout ]] && echo -e "\nDefault Timeout: 500" && timeout=500 || echo -e "\nCustom Timeout: $timeout" SECONDS=0 && echo -e "\nScaling down $app" && midclt call chart.release.scale "$app" '{"replica_count": 0}' &> /dev/null @@ -135,14 +135,14 @@ if [[ $selection == "1" ]]; then fi while [[ "$SECONDS" -le "$timeout" && "$status" != "STOPPED" ]] do - status=$(cli -m csv -c 'app chart_release query name,status' | grep -E "(,|^)$app(,|$)" | awk -F ',' '{print $2}'| tr -d " \t\n\r") + status=$(cli -m csv -c 'app chart_release query name,status' | grep -E "^$app\b" | awk -F ',' '{print $2}'| tr -d " \t\n\r") echo -e "Waiting $((timeout-SECONDS)) more seconds for $app to be STOPPED" && sleep 5 done data_name=$(echo "$pvc" | awk '{print $3}') mount=$(echo "$pvc" | awk '{print $4}') volume_name=$(echo "$pvc" | awk '{print $4}') full_path=$(zfs list | grep "$volume_name" | awk '{print $1}') - echo -e "\nMounting\n$full_path\nTo\n/mnt/heavyscript/$data_name" && zfs set mountpoint=/heavyscript/"$data_name" "$full_path" && echo -e "Mounted\n\nUnmount with the following command\nzfs set mountpoint=legacy "$full_path" && rmdir /mnt/heavyscript/"$data_name"\nOr use the Unmount All option\n" + echo -e "\nMounting\n$full_path\nTo\n/mnt/heavyscript/$data_name" && zfs set mountpoint=/heavyscript/"$data_name" "$full_path" && echo -e "Mounted\n\nUnmount with:\nzfs set mountpoint=legacy "$full_path" && rmdir /mnt/heavyscript/"$data_name"\n\nOr use the Unmount All option\n" exit elif [[ $selection == "2" ]]; then mapfile -t unmount_array < <(basename -a /mnt/heavyscript/* | sed "s/*//") @@ -152,15 +152,15 @@ elif [[ $selection == "2" ]]; then main=$(k3s kubectl get pvc -A | grep "$i" | awk '{print $1, $2, $4}') app=$(echo "$main" | awk '{print $1}' | cut -c 4-) pvc=$(echo "$main" | awk '{print $3}') - path=$(find /mnt/*/ix-applications/releases/"$app"/volumes/ -maxdepth 0 | cut -c 6-) - safety_check=$(find /mnt/*/ix-applications/releases/"$app"/volumes/ -maxdepth 0 | cut -c 6- | wc -l) #if theres more than one new lines, that means theres more than one application with the same name on another pool. - if [[ "$safety_check" -gt 1 ]]; then #if there is another app with the same name on another pool, use the current pools application, since the other instance is probably old, or unused. + mapfile -t path < <(find /mnt/*/ix-applications/releases/"$app"/volumes/ -maxdepth 0 | cut -c 6-) + if [[ "${#path[@]}" -gt 1 ]]; then #if there is another app with the same name on another pool, use the current pools application, since the other instance is probably old, or unused. echo "$i is a name used on more than one pool.. attempting to use your current kubernetes apps pool" pool=$(cli -c 'app kubernetes config' | grep dataset | awk -F '|' '{print $3}' | awk -F '/' '{print $1}' | tr -d " \t\n\r") full_path=$(find /mnt/"$pool"/ix-applications/releases/"$app"/volumes/ -maxdepth 0 | cut -c 6-) zfs set mountpoint=legacy "$full_path""$pvc" && echo "$i unmounted" && rmdir /mnt/heavyscript/"$i" && continue || echo "failed to unmount $i" + else + zfs set mountpoint=legacy "$path""$pvc" && echo "$i unmounted" && rmdir /mnt/heavyscript/"$i" || echo "failed to unmount $i" fi - zfs set mountpoint=legacy "$path""$pvc" && echo "$i unmounted" && rmdir /mnt/heavyscript/"$i" || echo "failed to unmount $i" done rmdir /mnt/heavyscript else @@ -212,7 +212,7 @@ update_apps(){ midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null && SECONDS=0 || echo -e "FAILED" while [[ "$status" != "STOPPED" ]] do - status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep "$app_name," | awk -F ',' '{print $2}') + status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep "^$app_name," | awk -F ',' '{print $2}') if [[ "$status" == "STOPPED" ]]; then echo "Stopped" [[ "$verbose" == "true" ]] && echo "Updating.." From addef531db16f10c892471cccd8b88ef20cb78d1 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 7 Jun 2022 00:17:58 +0000 Subject: [PATCH 0092/1229] cleanup remove "continue" in unmount feature. Was no longer needed after previous commit. --- heavy_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index c852fa6b..86e02e96 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -157,7 +157,7 @@ elif [[ $selection == "2" ]]; then echo "$i is a name used on more than one pool.. attempting to use your current kubernetes apps pool" pool=$(cli -c 'app kubernetes config' | grep dataset | awk -F '|' '{print $3}' | awk -F '/' '{print $1}' | tr -d " \t\n\r") full_path=$(find /mnt/"$pool"/ix-applications/releases/"$app"/volumes/ -maxdepth 0 | cut -c 6-) - zfs set mountpoint=legacy "$full_path""$pvc" && echo "$i unmounted" && rmdir /mnt/heavyscript/"$i" && continue || echo "failed to unmount $i" + zfs set mountpoint=legacy "$full_path""$pvc" && echo "$i unmounted" && rmdir /mnt/heavyscript/"$i" || echo "failed to unmount $i" else zfs set mountpoint=legacy "$path""$pvc" && echo "$i unmounted" && rmdir /mnt/heavyscript/"$i" || echo "failed to unmount $i" fi From 3317a1fb332a47f6c863a70ee3a864138371e7da Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 9 Jun 2022 13:56:28 -0600 Subject: [PATCH 0093/1229] fix mounting regex --- heavy_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index 86e02e96..0ff1f3bf 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -149,7 +149,7 @@ elif [[ $selection == "2" ]]; then [[ -z $unmount_array ]] && echo "Theres nothing to unmount" && exit for i in "${unmount_array[@]}" do - main=$(k3s kubectl get pvc -A | grep "$i" | awk '{print $1, $2, $4}') + main=$(k3s kubectl get pvc -A | grep -E "\s$i\s" | awk '{print $1, $2, $4}') app=$(echo "$main" | awk '{print $1}' | cut -c 4-) pvc=$(echo "$main" | awk '{print $3}') mapfile -t path < <(find /mnt/*/ix-applications/releases/"$app"/volumes/ -maxdepth 0 | cut -c 6-) From 5d872c952f7945696b2fdd2c1dd9962e0a20c3e7 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 10 Jun 2022 13:36:13 -0600 Subject: [PATCH 0094/1229] commit to beta --- heavy_script.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index 0ff1f3bf..70e327cf 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -155,7 +155,7 @@ elif [[ $selection == "2" ]]; then mapfile -t path < <(find /mnt/*/ix-applications/releases/"$app"/volumes/ -maxdepth 0 | cut -c 6-) if [[ "${#path[@]}" -gt 1 ]]; then #if there is another app with the same name on another pool, use the current pools application, since the other instance is probably old, or unused. echo "$i is a name used on more than one pool.. attempting to use your current kubernetes apps pool" - pool=$(cli -c 'app kubernetes config' | grep dataset | awk -F '|' '{print $3}' | awk -F '/' '{print $1}' | tr -d " \t\n\r") + pool=$(cli -c 'app kubernetes config' | grep -E "dataset\s\|" | awk -F '|' '{print $3}' | awk -F '/' '{print $1}' | tr -d " \t\n\r") full_path=$(find /mnt/"$pool"/ix-applications/releases/"$app"/volumes/ -maxdepth 0 | cut -c 6-) zfs set mountpoint=legacy "$full_path""$pvc" && echo "$i unmounted" && rmdir /mnt/heavyscript/"$i" || echo "failed to unmount $i" else @@ -175,12 +175,12 @@ echo -e "\nSyncing all catalogs, please wait.." && cli -c 'app catalog sync_all' export -f sync prune(){ -echo -e "\nPruning Docker Images" && docker image prune -af | grep Total || echo "Failed to Prune Docker Images" +echo -e "\nPruning Docker Images" && docker image prune -af | grep "^Total" || echo "Failed to Prune Docker Images" } export -f prune update_apps(){ - mapfile -t array < <(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,container_images_update_available,status' | grep ",true" | sort) + mapfile -t array < <(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,container_images_update_available,status' | grep -E ",true(,|$)" | sort) [[ -z $array ]] && echo -e "\nThere are no updates available" && return 0 || echo -e "\n${#array[@]} update(s) available" [[ -z $timeout ]] && echo -e "\nDefault Timeout: 500" && timeout=500 || echo -e "\nCustom Timeout: $timeout" [[ "$timeout" -le 120 ]] && echo "Warning: Your timeout is set low and may lead to premature rollbacks or skips" @@ -192,6 +192,7 @@ update_apps(){ old_chart_ver=$(echo "$i" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}' | awk -F '.' '{print $1}') # Old Chart MAJOR version new_chart_ver=$(echo "$i" | awk -F ',' '{print $5}' | awk -F '_' '{print $2}' | awk -F '.' '{print $1}') # New Chart MAJOR version status=$(echo "$i" | awk -F ',' '{print $2}') #status of the app: STOPPED / DEPLOYING / ACTIVE + startstatus=$status diff_app=$(diff <(echo "$old_app_ver") <(echo "$new_app_ver")) #caluclating difference in major app versions diff_chart=$(diff <(echo "$old_chart_ver") <(echo "$new_chart_ver")) #caluclating difference in Chart versions old_full_ver=$(echo "$i" | awk -F ',' '{print $4}') #Upgraded From @@ -199,7 +200,6 @@ update_apps(){ rollback_version=$(echo "$i" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}') printf '%s\0' "${ignore[@]}" | grep -iFxqz "${app_name}" && echo -e "\n$app_name\nIgnored, skipping" && continue #If application is on ignore list, skip if [[ "$diff_app" == "$diff_chart" || "$update_all_apps" == "true" ]]; then #continue to update - startstatus=$status if [[ $stop_before_update == "true" ]]; then # Check to see if user is using -S or not if [[ "$status" == "STOPPED" ]]; then # if status is already stopped, skip while loop echo -e "\n$app_name" @@ -248,7 +248,7 @@ if [[ $rollback == "true" ]]; then while [[ "0" != "1" ]] do (( count++ )) - status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep "$app_name," | awk -F ',' '{print $2}') + status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep "^$app_name," | awk -F ',' '{print $2}') if [[ "$status" == "ACTIVE" && "$startstatus" == "STOPPED" ]]; then [[ "$verbose" == "true" ]] && echo "Returing to STOPPED state.." midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null && echo "Stopped"|| echo "FAILED" @@ -280,7 +280,7 @@ else while [[ "0" != "1" ]] #using a constant while loop, then breaking out of the loop with break commands below. do (( count++ )) - status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep "$app_name," | awk -F ',' '{print $2}') + status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep "^$app_name," | awk -F ',' '{print $2}') if [[ "$status" == "STOPPED" ]]; then [[ "$count" -le 1 && "$verbose" == "true" ]] && echo "Verifying Stopped.." && sleep 15 && continue #if reports stopped on FIRST time through loop, double check [[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports stopped on FIRST time through loop, double check From 6d1a9fc77bbadbd678fad8f7c2a3282de5ea74a9 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 10 Jun 2022 13:40:35 -0600 Subject: [PATCH 0095/1229] longopts + dns + refactor --- heavy_script.sh | 92 ++++++++++++++++++++++++++++++++++++------------- 1 file changed, 68 insertions(+), 24 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index 70e327cf..0bed593e 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -1,30 +1,49 @@ #!/bin/bash + #If no argument is passed, kill the script. +[[ -z "$*" || "-" == "$*" || "--" == "$*" ]] && echo "This script requires an argument, use --help for help" && exit -[[ -z "$*" ]] && echo "This script requires an argument, use -h for help" && exit -while getopts ":hsi:mrb:t:uUpSRv" opt +while getopts ":si:rb:t:uUpSRv-:" opt do case $opt in - h) - echo "-m | Initiates mounting feature, choose between unmounting and mounting PVC data" - echo "-r | Opens a menu to restore a heavy_script backup that was taken on you ix-applications pool" - echo "-b | Back-up your ix-applications dataset, specify a number after -b" - echo "-i | Add application to ignore list, one by one, see example below." - echo "-R | Roll-back applications if they fail to update" - echo "-S | Shutdown applications prior to updating" - echo "-v | verbose output" - echo "-t | Set a custom timeout in seconds when checking if either an App or Mountpoint correctly Started, Stopped or (un)Mounted. Defaults to 500 seconds" - echo "-s | sync catalog" - echo "-U | Update all applications, ignores versions" - echo "-u | Update all applications, does not update Major releases" - echo "-p | Prune unused/old docker images" - echo "EX | bash heavy_script.sh -b 14 -i portainer -i arch -i sonarr -i radarr -t 600 -vRsUp" - echo "EX | bash /mnt/tank/scripts/heavy_script.sh -t 8812 -m" - exit - ;; + -) + case "${OPTARG}" in + dns) + dns="true" + ;; + restore) + restore="true" + ;; + mount) + mount="true" + ;; + help) + echo "-m | Initiates mounting feature, choose between unmounting and mounting PVC data" + echo "-r | Opens a menu to restore a heavy_script backup that was taken on you ix-applications pool" + echo "-b | Back-up your ix-applications dataset, specify a number after -b" + echo "-i | Add application to ignore list, one by one, see example below." + echo "-R | Roll-back applications if they fail to update" + echo "-S | Shutdown applications prior to updating" + echo "-v | verbose output" + echo "-t | Set a custom timeout in seconds when checking if either an App or Mountpoint correctly Started, Stopped or (un)Mounted. Defaults to 500 seconds" + echo "-s | sync catalog" + echo "-U | Update all applications, ignores versions" + echo "-u | Update all applications, does not update Major releases" + echo "-p | Prune unused/old docker images" + echo "EX | bash heavy_script.sh -b 14 -i portainer -i arch -i sonarr -i radarr -t 600 -vRsUp" + echo "EX | bash /mnt/tank/scripts/heavy_script.sh -t 8812 -m" + exit + ;; + + *) + echo "Invalid Option -$OPTARG, type --help for help" + exit + ;; + esac + ;; \?) - echo "Invalid Option -$OPTARG, type -h for help" + echo "Invalid Option -$OPTARG, type --help for help" exit ;; :) @@ -38,7 +57,7 @@ do [[ "$number_of_backups" -le 0 ]] && echo "Error: Number of backups is required to be at least 1" && exit ;; r) - restore="true" + rollback="true" ;; i) ignore+=("$OPTARG") @@ -48,9 +67,6 @@ do timeout=$OPTARG ! [[ $timeout =~ $re ]] && echo -e "Error: -t needs to be assigned an interger\n\"""$timeout""\" is not an interger" >&2 && exit ;; - m) - mount="true" - ;; s) sync="true" ;; @@ -318,10 +334,38 @@ echo ' |___/ |_| ' echo } export -f title + +dns(){ +clear -x +echo "Generating DNS Names.." +#ignored dependency pods, No change required +ignore="cron|kube-system|nvidia|svclb|NAME|memcached" + +# Pulling pod names + +mapfile -t main < <(k3s kubectl get pods -A | grep -Ev "$ignore" | sort) + +# Pulling all ports +all_ports=$(k3s kubectl get service -A) + +clear -x +count=0 +for i in "${main[@]}" +do + [[ count -le 0 ]] && echo -e "\n" && ((count++)) + appName=$(echo "$i" | awk '{print $2}' | sed 's/-[^-]*-[^-]*$//' | sed 's/-0//') + ixName=$(echo "$i" | awk '{print $1}') + port=$(echo "$all_ports" | grep -E "\s$appName\s" | awk '{print $6}' | grep -Eo "^[[:digit:]]+{1}") + echo -e "$appName.$ixName.svc.cluster.local $port" +done | uniq | nl -b t | sed 's/\s\s\s$/- -------- ----/' | column -t -R 1 -N "#,DNS_Name,Port" -L +} +export -f dns + #exit if incompatable functions are called [[ "$restore" == "true" && "$mount" == "true" ]] && echo -e "The Restore Function(-r)\nand\nMount Function(-m)\nCannot both be called at the same time." && exit [[ "$update_all_apps" == "true" && "$update_apps" == "true" ]] && echo -e "-U and -u cannot BOTH be called" && exit #Continue to call functions in specific order +[[ "$dns" == "true" ]] && dns && exit [[ "$restore" == "true" ]] && restore && exit [[ "$mount" == "true" ]] && mount && exit [[ "$number_of_backups" -ge 1 ]] && backup From 8a2ec69b75b907c27e6951680d5fac95811520b6 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 10 Jun 2022 14:32:39 -0600 Subject: [PATCH 0096/1229] update readme + script --- README.md | 53 ++++++++++++++++++++++++++----------------------- heavy_script.sh | 46 +++++++++++++++++++++++++----------------- 2 files changed, 56 insertions(+), 43 deletions(-) diff --git a/README.md b/README.md index f98afd30..e199193f 100644 --- a/README.md +++ b/README.md @@ -1,34 +1,37 @@ # heavy_script -Update | Backup | Restore | Mount PVC | Rollback Applications | Sync Catalog | Prune Docker Images -| Flag | Example | Parameter | Description | -|------ |------------------------ |----------- |--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| -r | -r | None | Restore HeavyScript specific 'ix-applications dataset' snapshot | -| -m | -m | None | Initiates mounting feature
Choose between unmounting and mounting PVC data | -| -b | -b 14 | int | Backup 'ix-appliactions' dataset
Creates backups up to the number you've chosen | -| -i | -i nextcloud -i sonarr | String | Applications listed will be ignored during updating | -| -R | -R | None | Monitors applications after they update
If the app does not become "ACTIVE" after either:
The custom Timeout, or Default Timeout,
rollback the application. | -| -v | -v | None | Verbose output | -| -S | -S | None | Shutdown applications prior to updating | -| -t | -t 150 | int | Set a custom timeout to be used with either:
-m
- Time the script will wait for application to be "STOPPED"
or
-u/U
- Time the script will wait for application to be either "STOPPED" or "ACTIVE" | -| -s | -s | None | Sync Catalog before updating | -| -U | -U | None | Update applications, ignoring major version changes | -| -u | -u | None | Update applications, do NOT update if there was a major version change | -| -p | -p | None | Prune old/unused docker images | +## Arguments + +| Flag | Example | Parameter | Description | +|----------- |------------------------ |----------- |----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| --restore | --restore | None | Restore HeavyScript specific `ix-applications dataset` snapshot | +| --mount | --mount | None | Initiates mounting feature Choose between unmounting and mounting PVC data | +| --dns | --dns | None | list all of your applications DNS names and their web ports | +| -U | -U | None | Update applications, ignoring major version changes | +| -u | -u | None | Update applications, do NOT update if there was a major version change | +| -b | -b 14 | Integer | Backup `ix-appliactions` dataset Creates backups up to the number you've chosen | +| -i | -i nextcloud -i sonarr | String | Applications listed will be ignored during updating List one application after another as shown in the example | +| (-R\|-r) | -r | None | Monitors applications after they update If the app does not become "ACTIVE" after either: The custom Timeout, or Default Timeout, rollback the application. Warning: deprecating `-R` please begin using `-r` instead | +| -v | -v | None | Verbose Output Look at the bottom of this page for an example | +| -S | -S | None | Shutdown the application prior to updating it | +| -t | -t 150 | Integer | Set a custom timeout to be used with either: `-m` - Time the script will wait for application to be "STOPPED" or `-(u\|U)` - Time the script will wait for application to be either "STOPPED" or "ACTIVE" | +| -s | -s | None | Sync Catalogs prior to updating | +| -p | -p | None | Prune old/unused docker images | +

### Examples #### Typical Cron Job ``` -bash heavy_script.sh -b 14 -i portainer -i arch -i sonarr -i radarr -t 600 -Rsup +bash heavy_script.sh -b 14 -i portainer -i arch -i sonarr -i radarr -t 600 -rsup ``` - -b is set to 14. Up to 14 snapshots of your ix-applications dataset will be saved - -i is set to ignore portainer, arch, sonarr, and radarr. These applications will be ignored when it comes to updates. - -t I set it to 600 seconds, this means the script will wait 600 seconds for the application to become ACTIVE before timing out and continuing to a different application. -- -R Will rollback applications if they fail to deploy after updating. +- -r Will rollback applications if they fail to deploy after updating. - -s will just sync the repositories, ensuring you are downloading the latest updates. - -u update applications as long as the major version has absolutely no change, if it does have a change it will ask the user to update manually. - -p Prune docker images. @@ -36,18 +39,18 @@ bash heavy_script.sh -b 14 -i portainer -i arch -i sonarr -i radarr -t 600 -Rsup #### Mounting PVC Data ``` -bash /mnt/tank/scripts/heavy_script.sh -t 300 -m +bash /mnt/tank/scripts/heavy_script.sh -t 300 --mount ``` #### Restoring ix-applications dataset ``` -bash /mnt/tank/scripts/heavy_script/heavy_script.sh -r +bash /mnt/tank/scripts/heavy_script/heavy_script.sh --restore ``` #### My personal Cron Job ``` -git -C /mnt/speed/scripts/heavy_script pull && bash /mnt/speed/scripts/heavy_script/heavy_script.sh -b 14 -Rsup +git -C /mnt/speed/scripts/heavy_script pull && bash /mnt/speed/scripts/heavy_script/heavy_script.sh -b 14 -rsup ```
@@ -106,14 +109,14 @@ Here, we will update the script prior to running it, incase there is a bugfix, o **Cron Job Command** ``` -git -C /mnt/speed/scripts/heavy_script pull && bash /mnt/speed/scripts/heavy_script/heavy_script.sh -b 14 -Rsup +git -C /mnt/speed/scripts/heavy_script pull && bash /mnt/speed/scripts/heavy_script/heavy_script.sh -b 14 -rsup ``` > The important command here is the `git -C /PATH/TO/HEAVY_SCRIPT_DIRECTORY pull` > This command will allow you to preform a `git pull` on a remote directory, which will ensure your script is udated prior to running it > `&&` Is used to run a command AFTER the previous command completed successfully ->> So once the `git -C /PATH/TO/HEAVY_SCRIPT_DIRECTORY pull` command completes, THEN it will run the `bash /PATH/TO/HEAVY_SCRIPT_DIRECTORY/heavy_script.sh -b 14 -Rsup` command +>> So once the `git -C /PATH/TO/HEAVY_SCRIPT_DIRECTORY pull` command completes, THEN it will run the `bash /PATH/TO/HEAVY_SCRIPT_DIRECTORY/heavy_script.sh -b 14 -rsup` command

@@ -129,7 +132,7 @@ git -C /mnt/speed/scripts/heavy_script pull && bash /mnt/speed/scripts/heavy_scr | Name | Value | Reason | |------------------------ |------------------------------------------------------------------------------------------------------------------- |------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `Description` | HeavyScript git pull and Update apps | This is up to you, put whatever you think is a good description in here | -| `Command` | `git -C /PATH/TO/HEAVY_SCRIPT_DIRECTORY pull && bash /PATH/TO/HEAVY_SCRIPT_DIRECTORY/heavy_script.sh -b 14 -Rsup` | This is the command you will be running on your schedule I personally use: `git -C /mnt/speed/scripts/heavy_script pull && bash /mnt/speed/scripts/heavy_script/heavy_script.sh -b 14 -Rsup` | +| `Command` | `git -C /PATH/TO/HEAVY_SCRIPT_DIRECTORY pull && bash /PATH/TO/HEAVY_SCRIPT_DIRECTORY/heavy_script.sh -b 14 -rsup` | This is the command you will be running on your schedule I personally use: `git -C /mnt/speed/scripts/heavy_script pull && bash /mnt/speed/scripts/heavy_script/heavy_script.sh -b 14 -rsup` | | `Run As User` | `root` | Running the script as `root` is REQUIRED. You cannot access all of the kubernetes functions without this user. | | `Schedule` | Up to you, I run mine everyday at `0400` | Again up to you | | `Hide Standard Output` | `False` or Unticked | I like to receive an email report of how the script ran, what apps updated etc. | @@ -144,8 +147,8 @@ git -C /mnt/speed/scripts/heavy_script pull && bash /mnt/speed/scripts/heavy_scr ### Additional Informaton #### Verbose vs Non-Verbose -- Verbose used `bash heavy_test.sh -b 5 -SRupv` -- Non-Verbose used `bash heavy_test.sh -b 5 -SRup` +- Verbose used `bash heavy_script.sh -b 5 -Srupv` +- Non-Verbose used `bash heavy_script.sh -b 5 -Srup` | Verbose | Non-Verbose | |--------- |------------- | diff --git a/heavy_script.sh b/heavy_script.sh index 0bed593e..899130d4 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -9,6 +9,32 @@ do case $opt in -) case "${OPTARG}" in + help) + clear -x + echo "Basic Utilities" + echo "--mount | Initiates mounting feature, choose between unmounting and mounting PVC data" + echo "--restore | Opens a menu to restore a \"heavy_script\" backup that was taken on your \"ix-applications\" dataset" + echo "--dns | list all of your applications DNS names and their web ports" + echo + echo "Update Options" + echo "-U | Update all applications, ignores versions" + echo "-u | Update all applications, does not update Major releases" + echo "-b | Back-up your ix-applications dataset, specify a number after -b" + echo "-i | Add application to ignore list, one by one, see example below." + echo "-R | THIS OPTION WILL DEPRICATE SOON, USE \"-r\" instead. Roll-back applications if they fail to update" + echo "-r | Roll-back applications if they fail to update" + echo "-S | Shutdown applications prior to updating" + echo "-v | verbose output" + echo "-t | Set a custom timeout in seconds when checking if either an App or Mountpoint correctly Started, Stopped or (un)Mounted. Defaults to 500 seconds" + echo "-s | sync catalog" + echo "-p | Prune unused/old docker images" + echo + echo "Examples" + echo "bash heavy_script.sh -b 14 -i portainer -i arch -i sonarr -i radarr -t 600 -vrsUp" + echo "bash /mnt/tank/scripts/heavy_script.sh -t 8812 -m" + echo "bash /mnt/tank/scripts/heavy_script.sh --mount" + exit + ;; dns) dns="true" ;; @@ -18,23 +44,6 @@ do mount) mount="true" ;; - help) - echo "-m | Initiates mounting feature, choose between unmounting and mounting PVC data" - echo "-r | Opens a menu to restore a heavy_script backup that was taken on you ix-applications pool" - echo "-b | Back-up your ix-applications dataset, specify a number after -b" - echo "-i | Add application to ignore list, one by one, see example below." - echo "-R | Roll-back applications if they fail to update" - echo "-S | Shutdown applications prior to updating" - echo "-v | verbose output" - echo "-t | Set a custom timeout in seconds when checking if either an App or Mountpoint correctly Started, Stopped or (un)Mounted. Defaults to 500 seconds" - echo "-s | sync catalog" - echo "-U | Update all applications, ignores versions" - echo "-u | Update all applications, does not update Major releases" - echo "-p | Prune unused/old docker images" - echo "EX | bash heavy_script.sh -b 14 -i portainer -i arch -i sonarr -i radarr -t 600 -vRsUp" - echo "EX | bash /mnt/tank/scripts/heavy_script.sh -t 8812 -m" - exit - ;; *) echo "Invalid Option -$OPTARG, type --help for help" @@ -84,6 +93,7 @@ do ;; R) rollback="true" + echo "WARNING: -R is being transisitioned to -r, this is due to a refactor in the script. Please Make the change ASAP!" ;; v) verbose="true" @@ -342,7 +352,6 @@ echo "Generating DNS Names.." ignore="cron|kube-system|nvidia|svclb|NAME|memcached" # Pulling pod names - mapfile -t main < <(k3s kubectl get pods -A | grep -Ev "$ignore" | sort) # Pulling all ports @@ -364,6 +373,7 @@ export -f dns #exit if incompatable functions are called [[ "$restore" == "true" && "$mount" == "true" ]] && echo -e "The Restore Function(-r)\nand\nMount Function(-m)\nCannot both be called at the same time." && exit [[ "$update_all_apps" == "true" && "$update_apps" == "true" ]] && echo -e "-U and -u cannot BOTH be called" && exit + #Continue to call functions in specific order [[ "$dns" == "true" ]] && dns && exit [[ "$restore" == "true" ]] && restore && exit From 37be0a61c1aef9e0d573bb2706c2a02ce9abb567 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 10 Jun 2022 15:25:16 -0600 Subject: [PATCH 0097/1229] table of contents --- README.md | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e199193f..ebe23d1a 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,14 @@ # heavy_script +## Table of contents: +* [Arguments](#arguments) +* [Examples](#examples) +* [How to Install](#how-to-install) +* [How to Update](#how-to-update) +* [Creating a Cron Job](#creating-a-cron-job) +* [Additional Information](#additional-information) + +
## Arguments @@ -7,7 +16,7 @@ |----------- |------------------------ |----------- |----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | --restore | --restore | None | Restore HeavyScript specific `ix-applications dataset` snapshot | | --mount | --mount | None | Initiates mounting feature Choose between unmounting and mounting PVC data | -| --dns | --dns | None | list all of your applications DNS names and their web ports | +| --dns | --dns | None | list all of your applications DNS names and their web port | | -U | -U | None | Update applications, ignoring major version changes | | -u | -u | None | Update applications, do NOT update if there was a major version change | | -b | -b 14 | Integer | Backup `ix-appliactions` dataset Creates backups up to the number you've chosen | @@ -123,7 +132,7 @@ git -C /mnt/speed/scripts/heavy_script pull && bash /mnt/speed/scripts/heavy_scr ## Creating a Cron Job -1. Truenas SCALE GUI +1. TrueNAS SCALE GUI 2. System Settings 3. Advanced 4. Cron Jobs @@ -144,7 +153,7 @@ git -C /mnt/speed/scripts/heavy_script pull && bash /mnt/speed/scripts/heavy_scr

-### Additional Informaton +### Additional Information #### Verbose vs Non-Verbose - Verbose used `bash heavy_script.sh -b 5 -Srupv` From ab0fdc24acb0c3fd88e513a4df47da2e695a236e Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 10 Jun 2022 15:37:20 -0600 Subject: [PATCH 0098/1229] readme + help cleanup --- README.md | 20 +++++++++++++------- heavy_script.sh | 5 +++-- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index ebe23d1a..09454c44 100644 --- a/README.md +++ b/README.md @@ -37,13 +37,13 @@ bash heavy_script.sh -b 14 -i portainer -i arch -i sonarr -i radarr -t 600 -rsup ``` -- -b is set to 14. Up to 14 snapshots of your ix-applications dataset will be saved -- -i is set to ignore portainer, arch, sonarr, and radarr. These applications will be ignored when it comes to updates. -- -t I set it to 600 seconds, this means the script will wait 600 seconds for the application to become ACTIVE before timing out and continuing to a different application. -- -r Will rollback applications if they fail to deploy after updating. -- -s will just sync the repositories, ensuring you are downloading the latest updates. -- -u update applications as long as the major version has absolutely no change, if it does have a change it will ask the user to update manually. -- -p Prune docker images. +> `-b` is set to 14. Up to 14 snapshots of your ix-applications dataset will be saved +> `-i` is set to ignore portainer, arch, sonarr, and radarr. These applications will be ignored when it comes to updates. +> `-t` I set it to 600 seconds, this means the script will wait 600 seconds for the application to become ACTIVE before timing out and continuing to a different application. +> `-r` Will rollback applications if they fail to deploy after updating. +> `-s` will just sync the repositories, ensuring you are downloading the latest updates. +> `-u` update applications as long as the major version has absolutely no change, if it does have a change it will ask the user to update manually. +> `-p` Prune docker images. #### Mounting PVC Data @@ -57,6 +57,12 @@ bash /mnt/tank/scripts/heavy_script.sh -t 300 --mount bash /mnt/tank/scripts/heavy_script/heavy_script.sh --restore ``` +#### List All DNS Names + +``` +bash /mnt/tank/scripts/heavy_script/heavy_script.sh --dns +``` + #### My personal Cron Job ``` git -C /mnt/speed/scripts/heavy_script pull && bash /mnt/speed/scripts/heavy_script/heavy_script.sh -b 14 -rsup diff --git a/heavy_script.sh b/heavy_script.sh index 899130d4..2a770c8c 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -31,8 +31,9 @@ do echo echo "Examples" echo "bash heavy_script.sh -b 14 -i portainer -i arch -i sonarr -i radarr -t 600 -vrsUp" - echo "bash /mnt/tank/scripts/heavy_script.sh -t 8812 -m" - echo "bash /mnt/tank/scripts/heavy_script.sh --mount" + echo "bash /mnt/tank/scripts/heavy_script.sh -t 150 --mount" + echo "bash /mnt/tank/scripts/heavy_script.sh --dns" + echo "bash /mnt/tank/scripts/heavy_script.sh --restore" exit ;; dns) From d2beb15cfefa9cd4a8df0692ddc651efee17504d Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 10 Jun 2022 15:37:59 -0600 Subject: [PATCH 0099/1229] spacing? --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 09454c44..6a043d2c 100644 --- a/README.md +++ b/README.md @@ -38,11 +38,17 @@ bash heavy_script.sh -b 14 -i portainer -i arch -i sonarr -i radarr -t 600 -rsup ``` > `-b` is set to 14. Up to 14 snapshots of your ix-applications dataset will be saved + > `-i` is set to ignore portainer, arch, sonarr, and radarr. These applications will be ignored when it comes to updates. + > `-t` I set it to 600 seconds, this means the script will wait 600 seconds for the application to become ACTIVE before timing out and continuing to a different application. + > `-r` Will rollback applications if they fail to deploy after updating. + > `-s` will just sync the repositories, ensuring you are downloading the latest updates. + > `-u` update applications as long as the major version has absolutely no change, if it does have a change it will ask the user to update manually. + > `-p` Prune docker images. #### Mounting PVC Data From 23858a2a8130ab2ad1c9ea4d9e2e695c907f1d19 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 10 Jun 2022 19:48:34 -0600 Subject: [PATCH 0100/1229] delete restore point option --- heavy_script.sh | 38 ++++++++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index 2a770c8c..e5085a50 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -33,7 +33,8 @@ do echo "bash heavy_script.sh -b 14 -i portainer -i arch -i sonarr -i radarr -t 600 -vrsUp" echo "bash /mnt/tank/scripts/heavy_script.sh -t 150 --mount" echo "bash /mnt/tank/scripts/heavy_script.sh --dns" - echo "bash /mnt/tank/scripts/heavy_script.sh --restore" + echo "bash /mnt/tank/scripts/heavy_script.sh --restore" + echo exit ;; dns) @@ -45,9 +46,11 @@ do mount) mount="true" ;; - + delete-backup) + deleteBackup="true" + ;; *) - echo "Invalid Option -$OPTARG, type --help for help" + echo "Invalid Option --$OPTARG, type --help for help" exit ;; esac @@ -148,7 +151,7 @@ echo -e "1 Mount\n2 Unmount All" && read -p "Please type a number: " selection [[ -z "$selection" ]] && echo "Your selection cannot be empty" && exit #Check for valid selection. If none, kill script if [[ $selection == "1" ]]; then list=$(k3s kubectl get pvc -A | sort -u | awk '{print NR-1, "\t" $1 "\t" $2 "\t" $4}' | column -t | sed "s/^0/ /") - echo "$list" && read -p "Please type a number : " selection + echo "$list" && read -p "Please type a number: " selection [[ -z "$selection" ]] && echo "Your selection cannot be empty" && exit #Check for valid selection. If none, kill script app=$(echo -e "$list" | grep ^"$selection " | awk '{print $2}' | cut -c 4- ) [[ -z "$app" ]] && echo "Invalid Selection: $selection, was not an option" && exit #Check for valid selection. If none, kill script @@ -333,6 +336,28 @@ fi } export -f prune + +deleteBackup(){ +clear -x && echo "pulling restore points.." +list_backups=$(cli -c 'app kubernetes list_backups' | grep "HeavyScript_" | sort -t '_' -Vr -k2,7 | tr -d " \t\r" | awk -F '|' '{print $2}' | nl | column -t) +clear -x +[[ -z "$list_backups" ]] && echo "No HeavyScript restore points available" && exit || { title; echo "Choose a restore point" ; } +echo "$list_backups" && read -p "Please type a number: " selection && restore_point=$(echo "$list_backups" | grep ^"$selection " | awk '{print $2}') +[[ -z "$selection" ]] && echo "Your selection cannot be empty" && exit #Check for valid selection. If none, kill script +[[ -z "$restore_point" ]] && echo "Invalid Selection: $selection, was not an option" && exit #Check for valid selection. If none, kill script +echo -e "\nWARNING:\nYou CANNOT go back after deleting your restore point" || { echo "FAILED"; exit; } +echo -e "\n\nYou have chosen:\n$restore_point\n\nWould you like to continue?" && echo -e "1 Yes\n2 No" && read -p "Please type a number: " yesno || { echo "FAILED"; exit; } +if [[ $yesno == "1" ]]; then + echo -e "\nDeleting $restore_point" && cli -c 'app kubernetes delete_backup backup_name=''"'"$restore_point"'"' &>/dev/null && echo "Sucessfully deleted $restore_point" || echo "Deletion Failed" +elif [[ $yesno == "2" ]]; then + echo "You've chosen NO, killing script." +else + echo "Invalid Selection" +fi +} + + + title(){ echo ' _ _ _____ _ _ ' echo '| | | | / ___| (_) | | ' @@ -350,10 +375,10 @@ dns(){ clear -x echo "Generating DNS Names.." #ignored dependency pods, No change required -ignore="cron|kube-system|nvidia|svclb|NAME|memcached" +dep_ignore="cron|kube-system|nvidia|svclb|NAME|memcached" # Pulling pod names -mapfile -t main < <(k3s kubectl get pods -A | grep -Ev "$ignore" | sort) +mapfile -t main < <(k3s kubectl get pods -A | grep -Ev "$dep_ignore" | sort) # Pulling all ports all_ports=$(k3s kubectl get service -A) @@ -376,6 +401,7 @@ export -f dns [[ "$update_all_apps" == "true" && "$update_apps" == "true" ]] && echo -e "-U and -u cannot BOTH be called" && exit #Continue to call functions in specific order +[[ "$deleteBackup" == "true" ]] && deleteBackup && exit [[ "$dns" == "true" ]] && dns && exit [[ "$restore" == "true" ]] && restore && exit [[ "$mount" == "true" ]] && mount && exit From 3c42621a955bb00db6f2192f78c9580feeaef208 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 10 Jun 2022 20:04:52 -0600 Subject: [PATCH 0101/1229] delete backup readme --- README.md | 37 ++++++++++------- heavy_script.sh | 104 +++++++++++++++++++++++++----------------------- 2 files changed, 76 insertions(+), 65 deletions(-) diff --git a/README.md b/README.md index 6a043d2c..8a8cd395 100644 --- a/README.md +++ b/README.md @@ -12,21 +12,22 @@ ## Arguments -| Flag | Example | Parameter | Description | -|----------- |------------------------ |----------- |----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| --restore | --restore | None | Restore HeavyScript specific `ix-applications dataset` snapshot | -| --mount | --mount | None | Initiates mounting feature Choose between unmounting and mounting PVC data | -| --dns | --dns | None | list all of your applications DNS names and their web port | -| -U | -U | None | Update applications, ignoring major version changes | -| -u | -u | None | Update applications, do NOT update if there was a major version change | -| -b | -b 14 | Integer | Backup `ix-appliactions` dataset Creates backups up to the number you've chosen | -| -i | -i nextcloud -i sonarr | String | Applications listed will be ignored during updating List one application after another as shown in the example | -| (-R\|-r) | -r | None | Monitors applications after they update If the app does not become "ACTIVE" after either: The custom Timeout, or Default Timeout, rollback the application. Warning: deprecating `-R` please begin using `-r` instead | -| -v | -v | None | Verbose Output Look at the bottom of this page for an example | -| -S | -S | None | Shutdown the application prior to updating it | -| -t | -t 150 | Integer | Set a custom timeout to be used with either: `-m` - Time the script will wait for application to be "STOPPED" or `-(u\|U)` - Time the script will wait for application to be either "STOPPED" or "ACTIVE" | -| -s | -s | None | Sync Catalogs prior to updating | -| -p | -p | None | Prune old/unused docker images | +| Flag | Example | Parameter | Description | +|----------------- |------------------------ |----------- |------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| --delete-backup | --delete-backup | None | Opens a menu to delete backups >Useful if you need to delete old system backups or backups from other scripts | +| --restore | --restore | None | Restore HeavyScript specific `ix-applications dataset` snapshot | +| --mount | --mount | None | Initiates mounting feature Choose between unmounting and mounting PVC data | +| --dns | --dns | None | list all of your applications DNS names and their web ports | +| -U | -U | None | Update applications, ignoring major version changes | +| -u | -u | None | Update applications, do NOT update if there was a major version change | +| -b | -b 14 | Integer | Backup `ix-appliactions` dataset Creates backups up to the number you've chosen | +| -i | -i nextcloud -i sonarr | String | Applications listed will be ignored during updating List one application after another as shown in the example | +| (-R\|-r) | -r | None | Monitors applications after they update If the app does not become "ACTIVE" after either: The custom Timeout, or Default Timeout, rollback the application. >Warning: deprecating `-R` please begin using `-r` instead | +| -v | -v | None | Verbose Output Look at the bottom of this page for an example | +| -S | -S | None | Shutdown the application prior to updating it | +| -t | -t 150 | Integer | Set a custom timeout to be used with either: `-m` - Time the script will wait for application to be "STOPPED" or `-(u\|U)` - Time the script will wait for application to be either "STOPPED" or "ACTIVE" | +| -s | -s | None | Sync Catalogs prior to updating | +| -p | -p | None | Prune old/unused docker images |

@@ -63,6 +64,12 @@ bash /mnt/tank/scripts/heavy_script.sh -t 300 --mount bash /mnt/tank/scripts/heavy_script/heavy_script.sh --restore ``` +#### Deleting Backups + +``` +bash /mnt/tank/scripts/heavy_script/heavy_script.sh --backup-delete +``` + #### List All DNS Names ``` diff --git a/heavy_script.sh b/heavy_script.sh index e5085a50..54af2d26 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -105,6 +105,27 @@ do esac done + +deleteBackup(){ +clear -x && echo "pulling all restore points.." +list_backups=$(cli -c 'app kubernetes list_backups' | sort -t '_' -Vr -k2,7 | tr -d " \t\r" | awk -F '|' '{print $2}' | nl | column -t) +clear -x +[[ -z "$list_backups" ]] && echo "No restore points available" && exit || { title; echo -e "Choose a restore point to delete\nThese may be out of order if they are not HeavyScript backups" ; } +echo "$list_backups" && read -p "Please type a number: " selection && restore_point=$(echo "$list_backups" | grep ^"$selection " | awk '{print $2}') +[[ -z "$selection" ]] && echo "Your selection cannot be empty" && exit #Check for valid selection. If none, kill script +[[ -z "$restore_point" ]] && echo "Invalid Selection: $selection, was not an option" && exit #Check for valid selection. If none, kill script +echo -e "\nWARNING:\nYou CANNOT go back after deleting your restore point" || { echo "FAILED"; exit; } +echo -e "\n\nYou have chosen:\n$restore_point\n\nWould you like to continue?" && echo -e "1 Yes\n2 No" && read -p "Please type a number: " yesno || { echo "FAILED"; exit; } +if [[ $yesno == "1" ]]; then + echo -e "\nDeleting $restore_point" && cli -c 'app kubernetes delete_backup backup_name=''"'"$restore_point"'"' &>/dev/null && echo "Sucessfully deleted" || echo "Deletion Failed" +elif [[ $yesno == "2" ]]; then + echo "You've chosen NO, killing script." +else + echo "Invalid Selection" +fi +} + + backup(){ echo -e "\nNumber of backups was set to $number_of_backups" date=$(date '+%Y_%m_%d_%H_%M_%S') @@ -124,6 +145,7 @@ fi } export -f backup + restore(){ clear -x && echo "pulling restore points.." list_backups=$(cli -c 'app kubernetes list_backups' | grep "HeavyScript_" | sort -t '_' -Vr -k2,7 | tr -d " \t\r" | awk -F '|' '{print $2}' | nl | column -t) @@ -144,6 +166,33 @@ fi } export -f restore + +dns(){ +clear -x +echo "Generating DNS Names.." +#ignored dependency pods, No change required +dep_ignore="cron|kube-system|nvidia|svclb|NAME|memcached" + +# Pulling pod names +mapfile -t main < <(k3s kubectl get pods -A | grep -Ev "$dep_ignore" | sort) + +# Pulling all ports +all_ports=$(k3s kubectl get service -A) + +clear -x +count=0 +for i in "${main[@]}" +do + [[ count -le 0 ]] && echo -e "\n" && ((count++)) + appName=$(echo "$i" | awk '{print $2}' | sed 's/-[^-]*-[^-]*$//' | sed 's/-0//') + ixName=$(echo "$i" | awk '{print $1}') + port=$(echo "$all_ports" | grep -E "\s$appName\s" | awk '{print $6}' | grep -Eo "^[[:digit:]]+{1}") + echo -e "$appName.$ixName.svc.cluster.local $port" +done | uniq | nl -b t | sed 's/\s\s\s$/- -------- ----/' | column -t -R 1 -N "#,DNS_Name,Port" -L +} +export -f dns + + mount(){ clear -x title @@ -199,15 +248,12 @@ fi } export -f mount + sync(){ echo -e "\nSyncing all catalogs, please wait.." && cli -c 'app catalog sync_all' &> /dev/null && echo -e "Catalog sync complete" } export -f sync -prune(){ -echo -e "\nPruning Docker Images" && docker image prune -af | grep "^Total" || echo "Failed to Prune Docker Images" -} -export -f prune update_apps(){ mapfile -t array < <(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,container_images_update_available,status' | grep -E ",true(,|$)" | sort) @@ -334,29 +380,12 @@ else fi fi } -export -f prune +export -f after_update_actions - -deleteBackup(){ -clear -x && echo "pulling restore points.." -list_backups=$(cli -c 'app kubernetes list_backups' | grep "HeavyScript_" | sort -t '_' -Vr -k2,7 | tr -d " \t\r" | awk -F '|' '{print $2}' | nl | column -t) -clear -x -[[ -z "$list_backups" ]] && echo "No HeavyScript restore points available" && exit || { title; echo "Choose a restore point" ; } -echo "$list_backups" && read -p "Please type a number: " selection && restore_point=$(echo "$list_backups" | grep ^"$selection " | awk '{print $2}') -[[ -z "$selection" ]] && echo "Your selection cannot be empty" && exit #Check for valid selection. If none, kill script -[[ -z "$restore_point" ]] && echo "Invalid Selection: $selection, was not an option" && exit #Check for valid selection. If none, kill script -echo -e "\nWARNING:\nYou CANNOT go back after deleting your restore point" || { echo "FAILED"; exit; } -echo -e "\n\nYou have chosen:\n$restore_point\n\nWould you like to continue?" && echo -e "1 Yes\n2 No" && read -p "Please type a number: " yesno || { echo "FAILED"; exit; } -if [[ $yesno == "1" ]]; then - echo -e "\nDeleting $restore_point" && cli -c 'app kubernetes delete_backup backup_name=''"'"$restore_point"'"' &>/dev/null && echo "Sucessfully deleted $restore_point" || echo "Deletion Failed" -elif [[ $yesno == "2" ]]; then - echo "You've chosen NO, killing script." -else - echo "Invalid Selection" -fi +prune(){ +echo -e "\nPruning Docker Images" && docker image prune -af | grep "^Total" || echo "Failed to Prune Docker Images" } - - +export -f prune title(){ echo ' _ _ _____ _ _ ' @@ -371,31 +400,6 @@ echo } export -f title -dns(){ -clear -x -echo "Generating DNS Names.." -#ignored dependency pods, No change required -dep_ignore="cron|kube-system|nvidia|svclb|NAME|memcached" - -# Pulling pod names -mapfile -t main < <(k3s kubectl get pods -A | grep -Ev "$dep_ignore" | sort) - -# Pulling all ports -all_ports=$(k3s kubectl get service -A) - -clear -x -count=0 -for i in "${main[@]}" -do - [[ count -le 0 ]] && echo -e "\n" && ((count++)) - appName=$(echo "$i" | awk '{print $2}' | sed 's/-[^-]*-[^-]*$//' | sed 's/-0//') - ixName=$(echo "$i" | awk '{print $1}') - port=$(echo "$all_ports" | grep -E "\s$appName\s" | awk '{print $6}' | grep -Eo "^[[:digit:]]+{1}") - echo -e "$appName.$ixName.svc.cluster.local $port" -done | uniq | nl -b t | sed 's/\s\s\s$/- -------- ----/' | column -t -R 1 -N "#,DNS_Name,Port" -L -} -export -f dns - #exit if incompatable functions are called [[ "$restore" == "true" && "$mount" == "true" ]] && echo -e "The Restore Function(-r)\nand\nMount Function(-m)\nCannot both be called at the same time." && exit [[ "$update_all_apps" == "true" && "$update_apps" == "true" ]] && echo -e "-U and -u cannot BOTH be called" && exit From b21c2703f329b882cd770b6d071687fbadce0851 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 10 Jun 2022 20:10:27 -0600 Subject: [PATCH 0102/1229] fix readme again --- README.md | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 8a8cd395..d72edfa2 100644 --- a/README.md +++ b/README.md @@ -12,22 +12,23 @@ ## Arguments -| Flag | Example | Parameter | Description | -|----------------- |------------------------ |----------- |------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| --delete-backup | --delete-backup | None | Opens a menu to delete backups >Useful if you need to delete old system backups or backups from other scripts | -| --restore | --restore | None | Restore HeavyScript specific `ix-applications dataset` snapshot | -| --mount | --mount | None | Initiates mounting feature Choose between unmounting and mounting PVC data | -| --dns | --dns | None | list all of your applications DNS names and their web ports | -| -U | -U | None | Update applications, ignoring major version changes | -| -u | -u | None | Update applications, do NOT update if there was a major version change | -| -b | -b 14 | Integer | Backup `ix-appliactions` dataset Creates backups up to the number you've chosen | -| -i | -i nextcloud -i sonarr | String | Applications listed will be ignored during updating List one application after another as shown in the example | -| (-R\|-r) | -r | None | Monitors applications after they update If the app does not become "ACTIVE" after either: The custom Timeout, or Default Timeout, rollback the application. >Warning: deprecating `-R` please begin using `-r` instead | -| -v | -v | None | Verbose Output Look at the bottom of this page for an example | -| -S | -S | None | Shutdown the application prior to updating it | -| -t | -t 150 | Integer | Set a custom timeout to be used with either: `-m` - Time the script will wait for application to be "STOPPED" or `-(u\|U)` - Time the script will wait for application to be either "STOPPED" or "ACTIVE" | -| -s | -s | None | Sync Catalogs prior to updating | -| -p | -p | None | Prune old/unused docker images | +| Flag | Example | Parameter | Description | +|----------------- |------------------------ |----------- |--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| --delete-backup | --delete-backup | None | Opens a menu to delete backups
_Useful if you need to delete old system backups or backups from other scripts_ | +| --restore | --restore | None | Restore HeavyScript specific `ix-applications dataset` snapshot | +| --mount | --mount | None | Initiates mounting feature
Choose between unmounting and mounting PVC data | +| --dns | --dns | None | list all of your applications DNS names and their web ports | +| -U | -U | None | Update applications, ignoring major version changes | +| -u | -u | None | Update applications, do NOT update if there was a major version change | +| -b | -b 14 | Integer | Backup `ix-appliactions` dataset
_Creates backups up to the number you've chosen_ | +| -i | -i nextcloud -i sonarr | String | Applications listed will be ignored during updating
_List one application after another as shown in the example_ | +| (-R\|-r) | -r | None | Monitors applications after they update
If the app does not become "ACTIVE" after either:
The custom Timeout, or Default Timeout,
rollback the application.
__Warning: deprecating `-R` please begin using `-r` instead__ | +| -v | -v | None | Verbose Output
_Look at the bottom of this page for an example_ | +| -S | -S | None | Shutdown the application prior to updating it | +| -t | -t 150 | Integer | Set a custom timeout to be used with either:
`-m`
_Time the script will wait for application to be "STOPPED"_
or
`-(u\|U)`
_Time the script will wait for application to be either "STOPPED" or "ACTIVE"_ | +| -s | -s | None | Sync Catalogs prior to updating | +| -p | -p | None | Prune old/unused docker images | +

From 6469dab7c460e8a43d1de24ddc8b626ec475e516 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 10 Jun 2022 22:38:50 -0600 Subject: [PATCH 0103/1229] fix help & add read prompt timer --- heavy_script.sh | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index 54af2d26..9e635e55 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -12,9 +12,10 @@ do help) clear -x echo "Basic Utilities" - echo "--mount | Initiates mounting feature, choose between unmounting and mounting PVC data" - echo "--restore | Opens a menu to restore a \"heavy_script\" backup that was taken on your \"ix-applications\" dataset" - echo "--dns | list all of your applications DNS names and their web ports" + echo "--mount | Initiates mounting feature, choose between unmounting and mounting PVC data" + echo "--restore | Opens a menu to restore a \"heavy_script\" backup that was taken on your \"ix-applications\" dataset" + echo "--delete backup | Opens a menu to delete backups on your system" + echo "--dns | list all of your applications DNS names and their web ports" echo echo "Update Options" echo "-U | Update all applications, ignores versions" @@ -34,7 +35,8 @@ do echo "bash /mnt/tank/scripts/heavy_script.sh -t 150 --mount" echo "bash /mnt/tank/scripts/heavy_script.sh --dns" echo "bash /mnt/tank/scripts/heavy_script.sh --restore" - echo + echo "bash /mnt/tank/scripts/heavy_script.sh --delete-backup" + echo exit ;; dns) @@ -111,11 +113,11 @@ clear -x && echo "pulling all restore points.." list_backups=$(cli -c 'app kubernetes list_backups' | sort -t '_' -Vr -k2,7 | tr -d " \t\r" | awk -F '|' '{print $2}' | nl | column -t) clear -x [[ -z "$list_backups" ]] && echo "No restore points available" && exit || { title; echo -e "Choose a restore point to delete\nThese may be out of order if they are not HeavyScript backups" ; } -echo "$list_backups" && read -p "Please type a number: " selection && restore_point=$(echo "$list_backups" | grep ^"$selection " | awk '{print $2}') +echo "$list_backups" && read -t 600 -p "Please type a number: " selection && restore_point=$(echo "$list_backups" | grep ^"$selection " | awk '{print $2}') [[ -z "$selection" ]] && echo "Your selection cannot be empty" && exit #Check for valid selection. If none, kill script [[ -z "$restore_point" ]] && echo "Invalid Selection: $selection, was not an option" && exit #Check for valid selection. If none, kill script echo -e "\nWARNING:\nYou CANNOT go back after deleting your restore point" || { echo "FAILED"; exit; } -echo -e "\n\nYou have chosen:\n$restore_point\n\nWould you like to continue?" && echo -e "1 Yes\n2 No" && read -p "Please type a number: " yesno || { echo "FAILED"; exit; } +echo -e "\n\nYou have chosen:\n$restore_point\n\nWould you like to continue?" && echo -e "1 Yes\n2 No" && read -t 120 -p "Please type a number: " yesno || { echo "FAILED"; exit; } if [[ $yesno == "1" ]]; then echo -e "\nDeleting $restore_point" && cli -c 'app kubernetes delete_backup backup_name=''"'"$restore_point"'"' &>/dev/null && echo "Sucessfully deleted" || echo "Deletion Failed" elif [[ $yesno == "2" ]]; then @@ -151,11 +153,11 @@ clear -x && echo "pulling restore points.." list_backups=$(cli -c 'app kubernetes list_backups' | grep "HeavyScript_" | sort -t '_' -Vr -k2,7 | tr -d " \t\r" | awk -F '|' '{print $2}' | nl | column -t) clear -x [[ -z "$list_backups" ]] && echo "No HeavyScript restore points available" && exit || { title; echo "Choose a restore point" ; } -echo "$list_backups" && read -p "Please type a number: " selection && restore_point=$(echo "$list_backups" | grep ^"$selection " | awk '{print $2}') +echo "$list_backups" && read -t 600 -p "Please type a number: " selection && restore_point=$(echo "$list_backups" | grep ^"$selection " | awk '{print $2}') [[ -z "$selection" ]] && echo "Your selection cannot be empty" && exit #Check for valid selection. If none, kill script [[ -z "$restore_point" ]] && echo "Invalid Selection: $selection, was not an option" && exit #Check for valid selection. If none, kill script echo -e "\nWARNING:\nThis is NOT guranteed to work\nThis is ONLY supposed to be used as a LAST RESORT\nConsider rolling back your applications instead if possible" || { echo "FAILED"; exit; } -echo -e "\n\nYou have chosen:\n$restore_point\n\nWould you like to continue?" && echo -e "1 Yes\n2 No" && read -p "Please type a number: " yesno || { echo "FAILED"; exit; } +echo -e "\n\nYou have chosen:\n$restore_point\n\nWould you like to continue?" && echo -e "1 Yes\n2 No" && read -t 120 -p "Please type a number: " yesno || { echo "FAILED"; exit; } if [[ $yesno == "1" ]]; then echo -e "\nStarting Backup, this will take a LONG time." && cli -c 'app kubernetes restore_backup backup_name=''"'"$restore_point"'"' || echo "Restore FAILED" elif [[ $yesno == "2" ]]; then @@ -196,11 +198,11 @@ export -f dns mount(){ clear -x title -echo -e "1 Mount\n2 Unmount All" && read -p "Please type a number: " selection +echo -e "1 Mount\n2 Unmount All" && read -t 600 -p "Please type a number: " selection [[ -z "$selection" ]] && echo "Your selection cannot be empty" && exit #Check for valid selection. If none, kill script if [[ $selection == "1" ]]; then list=$(k3s kubectl get pvc -A | sort -u | awk '{print NR-1, "\t" $1 "\t" $2 "\t" $4}' | column -t | sed "s/^0/ /") - echo "$list" && read -p "Please type a number: " selection + echo "$list" && read -t 120 -p "Please type a number: " selection [[ -z "$selection" ]] && echo "Your selection cannot be empty" && exit #Check for valid selection. If none, kill script app=$(echo -e "$list" | grep ^"$selection " | awk '{print $2}' | cut -c 4- ) [[ -z "$app" ]] && echo "Invalid Selection: $selection, was not an option" && exit #Check for valid selection. If none, kill script From 9e429e2a5be2fe70fed33c2048961139178d58b1 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 10 Jun 2022 22:41:55 -0600 Subject: [PATCH 0104/1229] remove arg check & readme --- README.md | 2 +- heavy_script.sh | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index d72edfa2..f7717f6e 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,7 @@ bash /mnt/tank/scripts/heavy_script/heavy_script.sh --restore #### Deleting Backups ``` -bash /mnt/tank/scripts/heavy_script/heavy_script.sh --backup-delete +bash /mnt/tank/scripts/heavy_script/heavy_script.sh --delete-backup ``` #### List All DNS Names diff --git a/heavy_script.sh b/heavy_script.sh index 9e635e55..9033eef2 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -403,7 +403,6 @@ echo export -f title #exit if incompatable functions are called -[[ "$restore" == "true" && "$mount" == "true" ]] && echo -e "The Restore Function(-r)\nand\nMount Function(-m)\nCannot both be called at the same time." && exit [[ "$update_all_apps" == "true" && "$update_apps" == "true" ]] && echo -e "-U and -u cannot BOTH be called" && exit #Continue to call functions in specific order From 45127be73ad6c4b9a1bce9cf66166a7c818a7669 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sat, 11 Jun 2022 00:13:09 -0600 Subject: [PATCH 0105/1229] code cleanup --- heavy_script.sh | 395 +++++++++++++++++++++++++----------------------- 1 file changed, 206 insertions(+), 189 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index 9033eef2..a26ab23f 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -4,108 +4,37 @@ [[ -z "$*" || "-" == "$*" || "--" == "$*" ]] && echo "This script requires an argument, use --help for help" && exit -while getopts ":si:rb:t:uUpSRv-:" opt -do - case $opt in - -) - case "${OPTARG}" in - help) - clear -x - echo "Basic Utilities" - echo "--mount | Initiates mounting feature, choose between unmounting and mounting PVC data" - echo "--restore | Opens a menu to restore a \"heavy_script\" backup that was taken on your \"ix-applications\" dataset" - echo "--delete backup | Opens a menu to delete backups on your system" - echo "--dns | list all of your applications DNS names and their web ports" - echo - echo "Update Options" - echo "-U | Update all applications, ignores versions" - echo "-u | Update all applications, does not update Major releases" - echo "-b | Back-up your ix-applications dataset, specify a number after -b" - echo "-i | Add application to ignore list, one by one, see example below." - echo "-R | THIS OPTION WILL DEPRICATE SOON, USE \"-r\" instead. Roll-back applications if they fail to update" - echo "-r | Roll-back applications if they fail to update" - echo "-S | Shutdown applications prior to updating" - echo "-v | verbose output" - echo "-t | Set a custom timeout in seconds when checking if either an App or Mountpoint correctly Started, Stopped or (un)Mounted. Defaults to 500 seconds" - echo "-s | sync catalog" - echo "-p | Prune unused/old docker images" - echo - echo "Examples" - echo "bash heavy_script.sh -b 14 -i portainer -i arch -i sonarr -i radarr -t 600 -vrsUp" - echo "bash /mnt/tank/scripts/heavy_script.sh -t 150 --mount" - echo "bash /mnt/tank/scripts/heavy_script.sh --dns" - echo "bash /mnt/tank/scripts/heavy_script.sh --restore" - echo "bash /mnt/tank/scripts/heavy_script.sh --delete-backup" - echo - exit - ;; - dns) - dns="true" - ;; - restore) - restore="true" - ;; - mount) - mount="true" - ;; - delete-backup) - deleteBackup="true" - ;; - *) - echo "Invalid Option --$OPTARG, type --help for help" - exit - ;; - esac - ;; - \?) - echo "Invalid Option -$OPTARG, type --help for help" - exit - ;; - :) - echo "Option: -$OPTARG requires an argument" >&2 - exit - ;; - b) - re='^[0-9]+$' - number_of_backups=$OPTARG - ! [[ $OPTARG =~ $re ]] && echo -e "Error: -b needs to be assigned an interger\n\"""$number_of_backups""\" is not an interger" >&2 && exit - [[ "$number_of_backups" -le 0 ]] && echo "Error: Number of backups is required to be at least 1" && exit - ;; - r) - rollback="true" - ;; - i) - ignore+=("$OPTARG") - ;; - t) - re='^[0-9]+$' - timeout=$OPTARG - ! [[ $timeout =~ $re ]] && echo -e "Error: -t needs to be assigned an interger\n\"""$timeout""\" is not an interger" >&2 && exit - ;; - s) - sync="true" - ;; - U) - update_all_apps="true" - ;; - u) - update_apps="true" - ;; - S) - stop_before_update="true" - ;; - p) - prune="true" - ;; - R) - rollback="true" - echo "WARNING: -R is being transisitioned to -r, this is due to a refactor in the script. Please Make the change ASAP!" - ;; - v) - verbose="true" - ;; - esac -done +help(){ +[[ $help == "true" ]] && clear -x +echo "Basic Utilities" +echo "--mount | Initiates mounting feature, choose between unmounting and mounting PVC data" +echo "--restore | Opens a menu to restore a \"heavy_script\" backup that was taken on your \"ix-applications\" dataset" +echo "--delete backup | Opens a menu to delete backups on your system" +echo "--dns | list all of your applications DNS names and their web ports" +echo +echo "Update Options" +echo "-U | Update all applications, ignores versions" +echo "-u | Update all applications, does not update Major releases" +echo "-b | Back-up your ix-applications dataset, specify a number after -b" +echo "-i | Add application to ignore list, one by one, see example below." +echo "-R | THIS OPTION WILL DEPRICATE SOON, USE \"-r\" instead. Roll-back applications if they fail to update" +echo "-r | Roll-back applications if they fail to update" +echo "-S | Shutdown applications prior to updating" +echo "-v | verbose output" +echo "-t | Set a custom timeout in seconds when checking if either an App or Mountpoint correctly Started, Stopped or (un)Mounted. Defaults to 500 seconds" +echo "-s | sync catalog" +echo "-p | Prune unused/old docker images" +echo +echo "Examples" +echo "bash heavy_script.sh -b 14 -i portainer -i arch -i sonarr -i radarr -t 600 -vrsUp" +echo "bash /mnt/tank/scripts/heavy_script.sh -t 150 --mount" +echo "bash /mnt/tank/scripts/heavy_script.sh --dns" +echo "bash /mnt/tank/scripts/heavy_script.sh --restore" +echo "bash /mnt/tank/scripts/heavy_script.sh --delete-backup" +echo +exit +} +export -f help deleteBackup(){ @@ -119,13 +48,14 @@ echo "$list_backups" && read -t 600 -p "Please type a number: " selection && res echo -e "\nWARNING:\nYou CANNOT go back after deleting your restore point" || { echo "FAILED"; exit; } echo -e "\n\nYou have chosen:\n$restore_point\n\nWould you like to continue?" && echo -e "1 Yes\n2 No" && read -t 120 -p "Please type a number: " yesno || { echo "FAILED"; exit; } if [[ $yesno == "1" ]]; then - echo -e "\nDeleting $restore_point" && cli -c 'app kubernetes delete_backup backup_name=''"'"$restore_point"'"' &>/dev/null && echo "Sucessfully deleted" || echo "Deletion Failed" + echo -e "\nDeleting $restore_point" && cli -c 'app kubernetes delete_backup backup_name=''"'"$restore_point"'"' &>/dev/null && echo "Sucessfully deleted" || echo "Deletion Failed" elif [[ $yesno == "2" ]]; then - echo "You've chosen NO, killing script." + echo "You've chosen NO, killing script." else - echo "Invalid Selection" + echo "Invalid Selection" fi } +export -f deleteBackup backup(){ @@ -135,14 +65,14 @@ date=$(date '+%Y_%m_%d_%H_%M_%S') [[ -z "$verbose" ]] && echo -e "\nNew Backup Name:" && cli -c 'app kubernetes backup_chart_releases backup_name=''"'HeavyScript_"$date"'"' | tail -n 1 mapfile -t list_backups < <(cli -c 'app kubernetes list_backups' | grep "HeavyScript_" | sort -t '_' -Vr -k2,7 | awk -F '|' '{print $2}'| tr -d " \t\r") if [[ ${#list_backups[@]} -gt "number_of_backups" ]]; then - echo -e "\nDeleting the oldest backup(s) for exceeding limit:" - overflow=$(( ${#list_backups[@]} - "$number_of_backups" )) - mapfile -t list_overflow < <(cli -c 'app kubernetes list_backups' | grep "HeavyScript_" | sort -t '_' -V -k2,7 | awk -F '|' '{print $2}'| tr -d " \t\r" | head -n "$overflow") - for i in "${list_overflow[@]}" - do - cli -c 'app kubernetes delete_backup backup_name=''"'"$i"'"' &> /dev/null || echo "Failed to delete $i" - echo "$i" - done + echo -e "\nDeleting the oldest backup(s) for exceeding limit:" + overflow=$(( ${#list_backups[@]} - "$number_of_backups" )) + mapfile -t list_overflow < <(cli -c 'app kubernetes list_backups' | grep "HeavyScript_" | sort -t '_' -V -k2,7 | awk -F '|' '{print $2}'| tr -d " \t\r" | head -n "$overflow") + for i in "${list_overflow[@]}" + do + cli -c 'app kubernetes delete_backup backup_name=''"'"$i"'"' &> /dev/null || echo "Failed to delete $i" + echo "$i" + done fi } export -f backup @@ -159,11 +89,11 @@ echo "$list_backups" && read -t 600 -p "Please type a number: " selection && res echo -e "\nWARNING:\nThis is NOT guranteed to work\nThis is ONLY supposed to be used as a LAST RESORT\nConsider rolling back your applications instead if possible" || { echo "FAILED"; exit; } echo -e "\n\nYou have chosen:\n$restore_point\n\nWould you like to continue?" && echo -e "1 Yes\n2 No" && read -t 120 -p "Please type a number: " yesno || { echo "FAILED"; exit; } if [[ $yesno == "1" ]]; then - echo -e "\nStarting Backup, this will take a LONG time." && cli -c 'app kubernetes restore_backup backup_name=''"'"$restore_point"'"' || echo "Restore FAILED" + echo -e "\nStarting Backup, this will take a LONG time." && cli -c 'app kubernetes restore_backup backup_name=''"'"$restore_point"'"' || echo "Restore FAILED" elif [[ $yesno == "2" ]]; then - echo "You've chosen NO, killing script. Good luck." + echo "You've chosen NO, killing script. Good luck." else - echo "Invalid Selection" + echo "Invalid Selection" fi } export -f restore @@ -201,51 +131,51 @@ title echo -e "1 Mount\n2 Unmount All" && read -t 600 -p "Please type a number: " selection [[ -z "$selection" ]] && echo "Your selection cannot be empty" && exit #Check for valid selection. If none, kill script if [[ $selection == "1" ]]; then - list=$(k3s kubectl get pvc -A | sort -u | awk '{print NR-1, "\t" $1 "\t" $2 "\t" $4}' | column -t | sed "s/^0/ /") - echo "$list" && read -t 120 -p "Please type a number: " selection - [[ -z "$selection" ]] && echo "Your selection cannot be empty" && exit #Check for valid selection. If none, kill script - app=$(echo -e "$list" | grep ^"$selection " | awk '{print $2}' | cut -c 4- ) - [[ -z "$app" ]] && echo "Invalid Selection: $selection, was not an option" && exit #Check for valid selection. If none, kill script - pvc=$(echo -e "$list" | grep ^"$selection ") - status=$(cli -m csv -c 'app chart_release query name,status' | grep -E "^$app\b" | awk -F ',' '{print $2}'| tr -d " \t\n\r") - if [[ "$status" != "STOPPED" ]]; then - [[ -z $timeout ]] && echo -e "\nDefault Timeout: 500" && timeout=500 || echo -e "\nCustom Timeout: $timeout" - SECONDS=0 && echo -e "\nScaling down $app" && midclt call chart.release.scale "$app" '{"replica_count": 0}' &> /dev/null - else - echo -e "\n$app is already stopped" - fi - while [[ "$SECONDS" -le "$timeout" && "$status" != "STOPPED" ]] + list=$(k3s kubectl get pvc -A | sort -u | awk '{print NR-1, "\t" $1 "\t" $2 "\t" $4}' | column -t | sed "s/^0/ /") + echo "$list" && read -t 120 -p "Please type a number: " selection + [[ -z "$selection" ]] && echo "Your selection cannot be empty" && exit #Check for valid selection. If none, kill script + app=$(echo -e "$list" | grep ^"$selection " | awk '{print $2}' | cut -c 4- ) + [[ -z "$app" ]] && echo "Invalid Selection: $selection, was not an option" && exit #Check for valid selection. If none, kill script + pvc=$(echo -e "$list" | grep ^"$selection ") + status=$(cli -m csv -c 'app chart_release query name,status' | grep -E "^$app\b" | awk -F ',' '{print $2}'| tr -d " \t\n\r") + if [[ "$status" != "STOPPED" ]]; then + [[ -z $timeout ]] && echo -e "\nDefault Timeout: 500" && timeout=500 || echo -e "\nCustom Timeout: $timeout" + SECONDS=0 && echo -e "\nScaling down $app" && midclt call chart.release.scale "$app" '{"replica_count": 0}' &> /dev/null + else + echo -e "\n$app is already stopped" + fi + while [[ "$SECONDS" -le "$timeout" && "$status" != "STOPPED" ]] do - status=$(cli -m csv -c 'app chart_release query name,status' | grep -E "^$app\b" | awk -F ',' '{print $2}'| tr -d " \t\n\r") - echo -e "Waiting $((timeout-SECONDS)) more seconds for $app to be STOPPED" && sleep 5 + status=$(cli -m csv -c 'app chart_release query name,status' | grep -E "^$app\b" | awk -F ',' '{print $2}'| tr -d " \t\n\r") + echo -e "Waiting $((timeout-SECONDS)) more seconds for $app to be STOPPED" && sleep 5 done - data_name=$(echo "$pvc" | awk '{print $3}') - mount=$(echo "$pvc" | awk '{print $4}') - volume_name=$(echo "$pvc" | awk '{print $4}') - full_path=$(zfs list | grep "$volume_name" | awk '{print $1}') - echo -e "\nMounting\n$full_path\nTo\n/mnt/heavyscript/$data_name" && zfs set mountpoint=/heavyscript/"$data_name" "$full_path" && echo -e "Mounted\n\nUnmount with:\nzfs set mountpoint=legacy "$full_path" && rmdir /mnt/heavyscript/"$data_name"\n\nOr use the Unmount All option\n" - exit + data_name=$(echo "$pvc" | awk '{print $3}') + mount=$(echo "$pvc" | awk '{print $4}') + volume_name=$(echo "$pvc" | awk '{print $4}') + full_path=$(zfs list | grep "$volume_name" | awk '{print $1}') + echo -e "\nMounting\n$full_path\nTo\n/mnt/heavyscript/$data_name" && zfs set mountpoint=/heavyscript/"$data_name" "$full_path" && echo -e "Mounted\n\nUnmount with:\nzfs set mountpoint=legacy "$full_path" && rmdir /mnt/heavyscript/"$data_name"\n\nOr use the Unmount All option\n" + exit elif [[ $selection == "2" ]]; then - mapfile -t unmount_array < <(basename -a /mnt/heavyscript/* | sed "s/*//") - [[ -z $unmount_array ]] && echo "Theres nothing to unmount" && exit - for i in "${unmount_array[@]}" + mapfile -t unmount_array < <(basename -a /mnt/heavyscript/* | sed "s/*//") + [[ -z $unmount_array ]] && echo "Theres nothing to unmount" && exit + for i in "${unmount_array[@]}" do - main=$(k3s kubectl get pvc -A | grep -E "\s$i\s" | awk '{print $1, $2, $4}') - app=$(echo "$main" | awk '{print $1}' | cut -c 4-) - pvc=$(echo "$main" | awk '{print $3}') - mapfile -t path < <(find /mnt/*/ix-applications/releases/"$app"/volumes/ -maxdepth 0 | cut -c 6-) - if [[ "${#path[@]}" -gt 1 ]]; then #if there is another app with the same name on another pool, use the current pools application, since the other instance is probably old, or unused. - echo "$i is a name used on more than one pool.. attempting to use your current kubernetes apps pool" - pool=$(cli -c 'app kubernetes config' | grep -E "dataset\s\|" | awk -F '|' '{print $3}' | awk -F '/' '{print $1}' | tr -d " \t\n\r") - full_path=$(find /mnt/"$pool"/ix-applications/releases/"$app"/volumes/ -maxdepth 0 | cut -c 6-) - zfs set mountpoint=legacy "$full_path""$pvc" && echo "$i unmounted" && rmdir /mnt/heavyscript/"$i" || echo "failed to unmount $i" - else - zfs set mountpoint=legacy "$path""$pvc" && echo "$i unmounted" && rmdir /mnt/heavyscript/"$i" || echo "failed to unmount $i" - fi + main=$(k3s kubectl get pvc -A | grep -E "\s$i\s" | awk '{print $1, $2, $4}') + app=$(echo "$main" | awk '{print $1}' | cut -c 4-) + pvc=$(echo "$main" | awk '{print $3}') + mapfile -t path < <(find /mnt/*/ix-applications/releases/"$app"/volumes/ -maxdepth 0 | cut -c 6-) + if [[ "${#path[@]}" -gt 1 ]]; then #if there is another app with the same name on another pool, use the current pools application, since the other instance is probably old, or unused. + echo "$i is a name used on more than one pool.. attempting to use your current kubernetes apps pool" + pool=$(cli -c 'app kubernetes config' | grep -E "dataset\s\|" | awk -F '|' '{print $3}' | awk -F '/' '{print $1}' | tr -d " \t\n\r") + full_path=$(find /mnt/"$pool"/ix-applications/releases/"$app"/volumes/ -maxdepth 0 | cut -c 6-) + zfs set mountpoint=legacy "$full_path""$pvc" && echo "$i unmounted" && rmdir /mnt/heavyscript/"$i" || echo "failed to unmount $i" + else + zfs set mountpoint=legacy "$path""$pvc" && echo "$i unmounted" && rmdir /mnt/heavyscript/"$i" || echo "failed to unmount $i" + fi done - rmdir /mnt/heavyscript + rmdir /mnt/heavyscript else - echo "Invalid selection, type -h for help" + echo "Invalid selection, \"$selection\" was not an option" fi } export -f mount @@ -258,33 +188,33 @@ export -f sync update_apps(){ - mapfile -t array < <(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,container_images_update_available,status' | grep -E ",true(,|$)" | sort) - [[ -z $array ]] && echo -e "\nThere are no updates available" && return 0 || echo -e "\n${#array[@]} update(s) available" - [[ -z $timeout ]] && echo -e "\nDefault Timeout: 500" && timeout=500 || echo -e "\nCustom Timeout: $timeout" - [[ "$timeout" -le 120 ]] && echo "Warning: Your timeout is set low and may lead to premature rollbacks or skips" - for i in "${array[@]}" - do - app_name=$(echo "$i" | awk -F ',' '{print $1}') #print out first catagory, name. - old_app_ver=$(echo "$i" | awk -F ',' '{print $4}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #previous/current Application MAJOR Version - new_app_ver=$(echo "$i" | awk -F ',' '{print $5}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #new Application MAJOR Version - old_chart_ver=$(echo "$i" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}' | awk -F '.' '{print $1}') # Old Chart MAJOR version - new_chart_ver=$(echo "$i" | awk -F ',' '{print $5}' | awk -F '_' '{print $2}' | awk -F '.' '{print $1}') # New Chart MAJOR version - status=$(echo "$i" | awk -F ',' '{print $2}') #status of the app: STOPPED / DEPLOYING / ACTIVE - startstatus=$status - diff_app=$(diff <(echo "$old_app_ver") <(echo "$new_app_ver")) #caluclating difference in major app versions - diff_chart=$(diff <(echo "$old_chart_ver") <(echo "$new_chart_ver")) #caluclating difference in Chart versions - old_full_ver=$(echo "$i" | awk -F ',' '{print $4}') #Upgraded From - new_full_ver=$(echo "$i" | awk -F ',' '{print $5}') #Upraded To - rollback_version=$(echo "$i" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}') - printf '%s\0' "${ignore[@]}" | grep -iFxqz "${app_name}" && echo -e "\n$app_name\nIgnored, skipping" && continue #If application is on ignore list, skip - if [[ "$diff_app" == "$diff_chart" || "$update_all_apps" == "true" ]]; then #continue to update - if [[ $stop_before_update == "true" ]]; then # Check to see if user is using -S or not - if [[ "$status" == "STOPPED" ]]; then # if status is already stopped, skip while loop +mapfile -t array < <(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,container_images_update_available,status' | grep -E ",true(,|$)" | sort) +[[ -z $array ]] && echo -e "\nThere are no updates available" && return 0 || echo -e "\n${#array[@]} update(s) available" +[[ -z $timeout ]] && echo -e "\nDefault Timeout: 500" && timeout=500 || echo -e "\nCustom Timeout: $timeout" +[[ "$timeout" -le 120 ]] && echo "Warning: Your timeout is set low and may lead to premature rollbacks or skips" + for i in "${array[@]}" + do + app_name=$(echo "$i" | awk -F ',' '{print $1}') #print out first catagory, name. + old_app_ver=$(echo "$i" | awk -F ',' '{print $4}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #previous/current Application MAJOR Version + new_app_ver=$(echo "$i" | awk -F ',' '{print $5}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #new Application MAJOR Version + old_chart_ver=$(echo "$i" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}' | awk -F '.' '{print $1}') # Old Chart MAJOR version + new_chart_ver=$(echo "$i" | awk -F ',' '{print $5}' | awk -F '_' '{print $2}' | awk -F '.' '{print $1}') # New Chart MAJOR version + status=$(echo "$i" | awk -F ',' '{print $2}') #status of the app: STOPPED / DEPLOYING / ACTIVE + startstatus=$status + diff_app=$(diff <(echo "$old_app_ver") <(echo "$new_app_ver")) #caluclating difference in major app versions + diff_chart=$(diff <(echo "$old_chart_ver") <(echo "$new_chart_ver")) #caluclating difference in Chart versions + old_full_ver=$(echo "$i" | awk -F ',' '{print $4}') #Upgraded From + new_full_ver=$(echo "$i" | awk -F ',' '{print $5}') #Upraded To + rollback_version=$(echo "$i" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}') + printf '%s\0' "${ignore[@]}" | grep -iFxqz "${app_name}" && echo -e "\n$app_name\nIgnored, skipping" && continue #If application is on ignore list, skip + if [[ "$diff_app" == "$diff_chart" || "$update_all_apps" == "true" ]]; then #continue to update + if [[ $stop_before_update == "true" ]]; then # Check to see if user is using -S or not + if [[ "$status" == "STOPPED" ]]; then # if status is already stopped, skip while loop echo -e "\n$app_name" [[ "$verbose" == "true" ]] && echo "Updating.." cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo -e "Updated\n$old_full_ver\n$new_full_ver" && after_update_actions || echo "FAILED" continue - else # if status was not STOPPED, stop the app prior to updating + else # if status was not STOPPED, stop the app prior to updating echo -e "\n$app_name" [[ "$verbose" == "true" ]] && echo "Stopping prior to update.." midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null && SECONDS=0 || echo -e "FAILED" @@ -305,20 +235,21 @@ update_apps(){ continue fi done - fi - else #user must not be using -S, just update - echo -e "\n$app_name" - [[ "$verbose" == "true" ]] && echo "Updating.." - cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo -e "Updated\n$old_full_ver\n$new_full_ver" && after_update_actions || { echo "FAILED"; continue; } - fi - else - echo -e "\n$app_name\nMajor Release, update manually" - continue - fi - done + fi + else #user must not be using -S, just update + echo -e "\n$app_name" + [[ "$verbose" == "true" ]] && echo "Updating.." + cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo -e "Updated\n$old_full_ver\n$new_full_ver" && after_update_actions || { echo "FAILED"; continue; } + fi + else + echo -e "\n$app_name\nMajor Release, update manually" + continue + fi + done } export -f update_apps + after_update_actions(){ SECONDS=0 count=0 @@ -384,11 +315,13 @@ fi } export -f after_update_actions + prune(){ echo -e "\nPruning Docker Images" && docker image prune -af | grep "^Total" || echo "Failed to Prune Docker Images" } export -f prune + title(){ echo ' _ _ _____ _ _ ' echo '| | | | / ___| (_) | | ' @@ -402,10 +335,94 @@ echo } export -f title + +# Parse script options +while getopts ":si:rb:t:uUpSRv-:" opt +do + case $opt in + -) + case "${OPTARG}" in + help) + help="true" + ;; + dns) + dns="true" + ;; + restore) + restore="true" + ;; + mount) + mount="true" + ;; + delete-backup) + deleteBackup="true" + ;; + *) + echo -e "Invalid Option \"--$OPTARG\"\n" && help + exit + ;; + esac + ;; + \?) + echo -e "Invalid Option \"-$OPTARG\"\n" && help + exit + ;; + :) + echo -e "Option: \"-$OPTARG\" requires an argument\n" && help + exit + ;; + b) + re='^[0-9]+$' + number_of_backups=$OPTARG + ! [[ $OPTARG =~ $re ]] && echo -e "Error: -b needs to be assigned an interger\n\"""$number_of_backups""\" is not an interger" >&2 && exit + [[ "$number_of_backups" -le 0 ]] && echo "Error: Number of backups is required to be at least 1" && exit + ;; + r) + rollback="true" + ;; + i) + ignore+=("$OPTARG") + ;; + t) + re='^[0-9]+$' + timeout=$OPTARG + ! [[ $timeout =~ $re ]] && echo -e "Error: -t needs to be assigned an interger\n\"""$timeout""\" is not an interger" >&2 && exit + ;; + s) + sync="true" + ;; + U) + update_all_apps="true" + ;; + u) + update_apps="true" + ;; + S) + stop_before_update="true" + ;; + p) + prune="true" + ;; + R) + rollback="true" + echo "WARNING: -R is being transisitioned to -r, this is due to a refactor in the script. Please Make the change ASAP!" + ;; + v) + verbose="true" + ;; + *) + echo -e "Invalid Option \"--$OPTARG\"\n" && help + exit + ;; + esac +done + + #exit if incompatable functions are called [[ "$update_all_apps" == "true" && "$update_apps" == "true" ]] && echo -e "-U and -u cannot BOTH be called" && exit #Continue to call functions in specific order +[[ "$help" == "true" ]] && help [[ "$deleteBackup" == "true" ]] && deleteBackup && exit [[ "$dns" == "true" ]] && dns && exit [[ "$restore" == "true" ]] && restore && exit From c89b217943016027d1b12c03a4e68aa560343356 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sat, 11 Jun 2022 01:39:44 -0600 Subject: [PATCH 0106/1229] remove un-needed indentation --- heavy_script.sh | 100 ++++++++++++++++++++++++------------------------ 1 file changed, 50 insertions(+), 50 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index a26ab23f..0f08a004 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -192,60 +192,60 @@ mapfile -t array < <(cli -m csv -c 'app chart_release query name,update_availabl [[ -z $array ]] && echo -e "\nThere are no updates available" && return 0 || echo -e "\n${#array[@]} update(s) available" [[ -z $timeout ]] && echo -e "\nDefault Timeout: 500" && timeout=500 || echo -e "\nCustom Timeout: $timeout" [[ "$timeout" -le 120 ]] && echo "Warning: Your timeout is set low and may lead to premature rollbacks or skips" - for i in "${array[@]}" - do - app_name=$(echo "$i" | awk -F ',' '{print $1}') #print out first catagory, name. - old_app_ver=$(echo "$i" | awk -F ',' '{print $4}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #previous/current Application MAJOR Version - new_app_ver=$(echo "$i" | awk -F ',' '{print $5}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #new Application MAJOR Version - old_chart_ver=$(echo "$i" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}' | awk -F '.' '{print $1}') # Old Chart MAJOR version - new_chart_ver=$(echo "$i" | awk -F ',' '{print $5}' | awk -F '_' '{print $2}' | awk -F '.' '{print $1}') # New Chart MAJOR version - status=$(echo "$i" | awk -F ',' '{print $2}') #status of the app: STOPPED / DEPLOYING / ACTIVE - startstatus=$status - diff_app=$(diff <(echo "$old_app_ver") <(echo "$new_app_ver")) #caluclating difference in major app versions - diff_chart=$(diff <(echo "$old_chart_ver") <(echo "$new_chart_ver")) #caluclating difference in Chart versions - old_full_ver=$(echo "$i" | awk -F ',' '{print $4}') #Upgraded From - new_full_ver=$(echo "$i" | awk -F ',' '{print $5}') #Upraded To - rollback_version=$(echo "$i" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}') - printf '%s\0' "${ignore[@]}" | grep -iFxqz "${app_name}" && echo -e "\n$app_name\nIgnored, skipping" && continue #If application is on ignore list, skip - if [[ "$diff_app" == "$diff_chart" || "$update_all_apps" == "true" ]]; then #continue to update - if [[ $stop_before_update == "true" ]]; then # Check to see if user is using -S or not - if [[ "$status" == "STOPPED" ]]; then # if status is already stopped, skip while loop - echo -e "\n$app_name" - [[ "$verbose" == "true" ]] && echo "Updating.." - cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo -e "Updated\n$old_full_ver\n$new_full_ver" && after_update_actions || echo "FAILED" - continue - else # if status was not STOPPED, stop the app prior to updating - echo -e "\n$app_name" - [[ "$verbose" == "true" ]] && echo "Stopping prior to update.." - midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null && SECONDS=0 || echo -e "FAILED" - while [[ "$status" != "STOPPED" ]] - do - status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep "^$app_name," | awk -F ',' '{print $2}') - if [[ "$status" == "STOPPED" ]]; then - echo "Stopped" - [[ "$verbose" == "true" ]] && echo "Updating.." - cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo -e "Updated\n$old_full_ver\n$new_full_ver" && after_update_actions || echo "Failed to update" - break - elif [[ "$SECONDS" -ge "$timeout" ]]; then - echo "Error: Run Time($SECONDS) has exceeded Timeout($timeout)" - break - elif [[ "$status" != "STOPPED" ]]; then - [[ "$verbose" == "true" ]] && echo "Waiting $((timeout-SECONDS)) more seconds for $app_name to be STOPPED" - sleep 10 - continue - fi - done - fi - else #user must not be using -S, just update +for i in "${array[@]}" +do + app_name=$(echo "$i" | awk -F ',' '{print $1}') #print out first catagory, name. + old_app_ver=$(echo "$i" | awk -F ',' '{print $4}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #previous/current Application MAJOR Version + new_app_ver=$(echo "$i" | awk -F ',' '{print $5}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #new Application MAJOR Version + old_chart_ver=$(echo "$i" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}' | awk -F '.' '{print $1}') # Old Chart MAJOR version + new_chart_ver=$(echo "$i" | awk -F ',' '{print $5}' | awk -F '_' '{print $2}' | awk -F '.' '{print $1}') # New Chart MAJOR version + status=$(echo "$i" | awk -F ',' '{print $2}') #status of the app: STOPPED / DEPLOYING / ACTIVE + startstatus=$status + diff_app=$(diff <(echo "$old_app_ver") <(echo "$new_app_ver")) #caluclating difference in major app versions + diff_chart=$(diff <(echo "$old_chart_ver") <(echo "$new_chart_ver")) #caluclating difference in Chart versions + old_full_ver=$(echo "$i" | awk -F ',' '{print $4}') #Upgraded From + new_full_ver=$(echo "$i" | awk -F ',' '{print $5}') #Upraded To + rollback_version=$(echo "$i" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}') + printf '%s\0' "${ignore[@]}" | grep -iFxqz "${app_name}" && echo -e "\n$app_name\nIgnored, skipping" && continue #If application is on ignore list, skip + if [[ "$diff_app" == "$diff_chart" || "$update_all_apps" == "true" ]]; then #continue to update + if [[ $stop_before_update == "true" ]]; then # Check to see if user is using -S or not + if [[ "$status" == "STOPPED" ]]; then # if status is already stopped, skip while loop echo -e "\n$app_name" [[ "$verbose" == "true" ]] && echo "Updating.." - cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo -e "Updated\n$old_full_ver\n$new_full_ver" && after_update_actions || { echo "FAILED"; continue; } + cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo -e "Updated\n$old_full_ver\n$new_full_ver" && after_update_actions || echo "FAILED" + continue + else # if status was not STOPPED, stop the app prior to updating + echo -e "\n$app_name" + [[ "$verbose" == "true" ]] && echo "Stopping prior to update.." + midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null && SECONDS=0 || echo -e "FAILED" + while [[ "$status" != "STOPPED" ]] + do + status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep "^$app_name," | awk -F ',' '{print $2}') + if [[ "$status" == "STOPPED" ]]; then + echo "Stopped" + [[ "$verbose" == "true" ]] && echo "Updating.." + cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo -e "Updated\n$old_full_ver\n$new_full_ver" && after_update_actions || echo "Failed to update" + break + elif [[ "$SECONDS" -ge "$timeout" ]]; then + echo "Error: Run Time($SECONDS) has exceeded Timeout($timeout)" + break + elif [[ "$status" != "STOPPED" ]]; then + [[ "$verbose" == "true" ]] && echo "Waiting $((timeout-SECONDS)) more seconds for $app_name to be STOPPED" + sleep 10 + continue + fi + done fi - else - echo -e "\n$app_name\nMajor Release, update manually" - continue + else #user must not be using -S, just update + echo -e "\n$app_name" + [[ "$verbose" == "true" ]] && echo "Updating.." + cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo -e "Updated\n$old_full_ver\n$new_full_ver" && after_update_actions || { echo "FAILED"; continue; } fi - done + else + echo -e "\n$app_name\nMajor Release, update manually" + continue + fi +done } export -f update_apps From 9f741e4742df4c99dca3fc99468ea65ace1bf2e6 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sat, 11 Jun 2022 02:02:07 -0600 Subject: [PATCH 0107/1229] more indentation --- heavy_script.sh | 68 ++++++++++++++++++++++++------------------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index 0f08a004..1c28a7b8 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -207,44 +207,44 @@ do new_full_ver=$(echo "$i" | awk -F ',' '{print $5}') #Upraded To rollback_version=$(echo "$i" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}') printf '%s\0' "${ignore[@]}" | grep -iFxqz "${app_name}" && echo -e "\n$app_name\nIgnored, skipping" && continue #If application is on ignore list, skip - if [[ "$diff_app" == "$diff_chart" || "$update_all_apps" == "true" ]]; then #continue to update - if [[ $stop_before_update == "true" ]]; then # Check to see if user is using -S or not - if [[ "$status" == "STOPPED" ]]; then # if status is already stopped, skip while loop - echo -e "\n$app_name" - [[ "$verbose" == "true" ]] && echo "Updating.." - cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo -e "Updated\n$old_full_ver\n$new_full_ver" && after_update_actions || echo "FAILED" - continue - else # if status was not STOPPED, stop the app prior to updating - echo -e "\n$app_name" - [[ "$verbose" == "true" ]] && echo "Stopping prior to update.." - midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null && SECONDS=0 || echo -e "FAILED" - while [[ "$status" != "STOPPED" ]] - do - status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep "^$app_name," | awk -F ',' '{print $2}') - if [[ "$status" == "STOPPED" ]]; then - echo "Stopped" - [[ "$verbose" == "true" ]] && echo "Updating.." - cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo -e "Updated\n$old_full_ver\n$new_full_ver" && after_update_actions || echo "Failed to update" - break - elif [[ "$SECONDS" -ge "$timeout" ]]; then - echo "Error: Run Time($SECONDS) has exceeded Timeout($timeout)" - break - elif [[ "$status" != "STOPPED" ]]; then - [[ "$verbose" == "true" ]] && echo "Waiting $((timeout-SECONDS)) more seconds for $app_name to be STOPPED" - sleep 10 - continue - fi - done - fi - else #user must not be using -S, just update + if [[ "$diff_app" == "$diff_chart" || "$update_all_apps" == "true" ]]; then #continue to update + if [[ $stop_before_update == "true" ]]; then # Check to see if user is using -S or not + if [[ "$status" == "STOPPED" ]]; then # if status is already stopped, skip while loop echo -e "\n$app_name" [[ "$verbose" == "true" ]] && echo "Updating.." - cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo -e "Updated\n$old_full_ver\n$new_full_ver" && after_update_actions || { echo "FAILED"; continue; } + cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo -e "Updated\n$old_full_ver\n$new_full_ver" && after_update_actions || echo "FAILED" + continue + else # if status was not STOPPED, stop the app prior to updating + echo -e "\n$app_name" + [[ "$verbose" == "true" ]] && echo "Stopping prior to update.." + midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null && SECONDS=0 || echo -e "FAILED" + while [[ "$status" != "STOPPED" ]] + do + status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep "^$app_name," | awk -F ',' '{print $2}') + if [[ "$status" == "STOPPED" ]]; then + echo "Stopped" + [[ "$verbose" == "true" ]] && echo "Updating.." + cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo -e "Updated\n$old_full_ver\n$new_full_ver" && after_update_actions || echo "Failed to update" + break + elif [[ "$SECONDS" -ge "$timeout" ]]; then + echo "Error: Run Time($SECONDS) has exceeded Timeout($timeout)" + break + elif [[ "$status" != "STOPPED" ]]; then + [[ "$verbose" == "true" ]] && echo "Waiting $((timeout-SECONDS)) more seconds for $app_name to be STOPPED" + sleep 10 + continue + fi + done fi - else - echo -e "\n$app_name\nMajor Release, update manually" - continue + else #user must not be using -S, just update + echo -e "\n$app_name" + [[ "$verbose" == "true" ]] && echo "Updating.." + cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo -e "Updated\n$old_full_ver\n$new_full_ver" && after_update_actions || { echo "FAILED"; continue; } fi + else + echo -e "\n$app_name\nMajor Release, update manually" + continue + fi done } export -f update_apps From 8e8f46f4a3443e39d76ad5877d907a04370f6988 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 12 Jun 2022 19:35:10 +0000 Subject: [PATCH 0108/1229] typo in --help --- heavy_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index 1c28a7b8..7bd059de 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -9,7 +9,7 @@ help(){ echo "Basic Utilities" echo "--mount | Initiates mounting feature, choose between unmounting and mounting PVC data" echo "--restore | Opens a menu to restore a \"heavy_script\" backup that was taken on your \"ix-applications\" dataset" -echo "--delete backup | Opens a menu to delete backups on your system" +echo "--delete-backup | Opens a menu to delete backups on your system" echo "--dns | list all of your applications DNS names and their web ports" echo echo "Update Options" From e325ab0a3a9997ec6df9d149d5645a8467496676 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 04:48:10 +0000 Subject: [PATCH 0109/1229] fix DNS regex Exclude dependency pods unless they were launched with custom-app. --- heavy_script.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index 7bd059de..8eb2b15b 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -24,14 +24,14 @@ echo "-v | verbose output" echo "-t | Set a custom timeout in seconds when checking if either an App or Mountpoint correctly Started, Stopped or (un)Mounted. Defaults to 500 seconds" echo "-s | sync catalog" echo "-p | Prune unused/old docker images" -echo +echo echo "Examples" echo "bash heavy_script.sh -b 14 -i portainer -i arch -i sonarr -i radarr -t 600 -vrsUp" echo "bash /mnt/tank/scripts/heavy_script.sh -t 150 --mount" echo "bash /mnt/tank/scripts/heavy_script.sh --dns" -echo "bash /mnt/tank/scripts/heavy_script.sh --restore" +echo "bash /mnt/tank/scripts/heavy_script.sh --restore" echo "bash /mnt/tank/scripts/heavy_script.sh --delete-backup" -echo +echo exit } export -f help @@ -102,8 +102,8 @@ export -f restore dns(){ clear -x echo "Generating DNS Names.." -#ignored dependency pods, No change required -dep_ignore="cron|kube-system|nvidia|svclb|NAME|memcached" +#ignored dependency pods, may need to add more in the future. +dep_ignore="\-cronjob\-|^kube-system|\ssvclb|NAME|\-memcached\-.[^custom\-app]|\-postgresql\-.[^custom\-app]|\-redis\-.[^custom\-app]|\-mariadb\-.[^custom\-app]|\-promtail\-.[^custom\-app]" # Pulling pod names mapfile -t main < <(k3s kubectl get pods -A | grep -Ev "$dep_ignore" | sort) From 382b8296be0416fc164cefccd569ca9d363960d9 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 13:30:23 -0600 Subject: [PATCH 0110/1229] testing self update --- heavy_script.sh | 40 +++++++++++++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 7 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index 1c28a7b8..d1a10de2 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -4,12 +4,38 @@ [[ -z "$*" || "-" == "$*" || "--" == "$*" ]] && echo "This script requires an argument, use --help for help" && exit +self_update() { +SCRIPT=$(readlink -f "$0") +SCRIPTPATH=$(dirname "$SCRIPT") +SCRIPTNAME="$0" +ARGS="$@" +BRANCH="beta" + +cd $SCRIPTPATH +git fetch + +[[ -n $(git diff --name-only origin/$BRANCH | grep $SCRIPTNAME) ]] && { + echo "Found a new version of me, updating myself..." + git pull --force + git checkout $BRANCH + git pull --force + echo "Running the new version..." + exec "$SCRIPTNAME" "$@" + + # Now exit this old instance + exit 1 + } + echo "Already the latest version." +} + +self_update + help(){ [[ $help == "true" ]] && clear -x echo "Basic Utilities" echo "--mount | Initiates mounting feature, choose between unmounting and mounting PVC data" echo "--restore | Opens a menu to restore a \"heavy_script\" backup that was taken on your \"ix-applications\" dataset" -echo "--delete backup | Opens a menu to delete backups on your system" +echo "--delete-backup | Opens a menu to delete backups on your system" echo "--dns | list all of your applications DNS names and their web ports" echo echo "Update Options" @@ -24,14 +50,14 @@ echo "-v | verbose output" echo "-t | Set a custom timeout in seconds when checking if either an App or Mountpoint correctly Started, Stopped or (un)Mounted. Defaults to 500 seconds" echo "-s | sync catalog" echo "-p | Prune unused/old docker images" -echo +echo echo "Examples" echo "bash heavy_script.sh -b 14 -i portainer -i arch -i sonarr -i radarr -t 600 -vrsUp" echo "bash /mnt/tank/scripts/heavy_script.sh -t 150 --mount" echo "bash /mnt/tank/scripts/heavy_script.sh --dns" -echo "bash /mnt/tank/scripts/heavy_script.sh --restore" +echo "bash /mnt/tank/scripts/heavy_script.sh --restore" echo "bash /mnt/tank/scripts/heavy_script.sh --delete-backup" -echo +echo exit } export -f help @@ -102,8 +128,8 @@ export -f restore dns(){ clear -x echo "Generating DNS Names.." -#ignored dependency pods, No change required -dep_ignore="cron|kube-system|nvidia|svclb|NAME|memcached" +#ignored dependency pods, may need to add more in the future. +dep_ignore="\-cronjob\-|^kube-system|\ssvclb|NAME|\-memcached\-.[^custom\-app]|\-postgresql\-.[^custom\-app]|\-redis\-.[^custom\-app]|\-mariadb\-.[^custom\-app]|\-promtail\-.[^custom\-app]" # Pulling pod names mapfile -t main < <(k3s kubectl get pods -A | grep -Ev "$dep_ignore" | sort) @@ -430,4 +456,4 @@ done [[ "$number_of_backups" -ge 1 ]] && backup [[ "$sync" == "true" ]] && sync [[ "$update_all_apps" == "true" || "$update_apps" == "true" ]] && update_apps -[[ "$prune" == "true" ]] && prune +[[ "$prune" == "true" ]] && prune \ No newline at end of file From bbb6428466ff74dfbcfde3b68756d615e71434ec Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 13:55:49 -0600 Subject: [PATCH 0111/1229] testing self update --- heavy_script.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index d1a10de2..a9240fd1 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -3,14 +3,14 @@ #If no argument is passed, kill the script. [[ -z "$*" || "-" == "$*" || "--" == "$*" ]] && echo "This script requires an argument, use --help for help" && exit - -self_update() { +ARGS="echo $* | sed s/--self-update//" SCRIPT=$(readlink -f "$0") SCRIPTPATH=$(dirname "$SCRIPT") SCRIPTNAME="$0" -ARGS="$@" BRANCH="beta" +self_update() { + cd $SCRIPTPATH git fetch @@ -20,7 +20,7 @@ git fetch git checkout $BRANCH git pull --force echo "Running the new version..." - exec "$SCRIPTNAME" "$@" + exec "$SCRIPTNAME" "$ARGS" # Now exit this old instance exit 1 @@ -28,7 +28,7 @@ git fetch echo "Already the latest version." } -self_update + help(){ [[ $help == "true" ]] && clear -x @@ -371,6 +371,9 @@ do help) help="true" ;; + self-update) + self_update="true" + ;; dns) dns="true" ;; @@ -448,6 +451,7 @@ done [[ "$update_all_apps" == "true" && "$update_apps" == "true" ]] && echo -e "-U and -u cannot BOTH be called" && exit #Continue to call functions in specific order +[[ "$self_update" == "true" ]] && self_update [[ "$help" == "true" ]] && help [[ "$deleteBackup" == "true" ]] && deleteBackup && exit [[ "$dns" == "true" ]] && dns && exit From e4dd02a78429e33af50044c5baf00781e49b480c Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 13:56:26 -0600 Subject: [PATCH 0112/1229] bash scriptname --- heavy_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index a9240fd1..813f2910 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -20,7 +20,7 @@ git fetch git checkout $BRANCH git pull --force echo "Running the new version..." - exec "$SCRIPTNAME" "$ARGS" + exec bash "$SCRIPTNAME" "$ARGS" # Now exit this old instance exit 1 From f92adc4c0c31e32c128b9bc49f8aee54bae1a9cd Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 13:59:31 -0600 Subject: [PATCH 0113/1229] testing --- heavy_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index 813f2910..1168be69 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -28,7 +28,7 @@ git fetch echo "Already the latest version." } - +echo help(){ [[ $help == "true" ]] && clear -x From cc1d9883a5308299f477675665c81211fa1d943a Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 14:05:27 -0600 Subject: [PATCH 0114/1229] replace string --- heavy_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index 1168be69..ee47c0d3 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -3,7 +3,7 @@ #If no argument is passed, kill the script. [[ -z "$*" || "-" == "$*" || "--" == "$*" ]] && echo "This script requires an argument, use --help for help" && exit -ARGS="echo $* | sed s/--self-update//" +ARGS="$*" ; echo "${ARGS}//--self-update/" SCRIPT=$(readlink -f "$0") SCRIPTPATH=$(dirname "$SCRIPT") SCRIPTNAME="$0" From a1dc4fd99ae90b9c772458dd3fb496211de5cc19 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 14:06:03 -0600 Subject: [PATCH 0115/1229] pushing just to push --- heavy_script.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/heavy_script.sh b/heavy_script.sh index ee47c0d3..986fdafc 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -9,6 +9,8 @@ SCRIPTPATH=$(dirname "$SCRIPT") SCRIPTNAME="$0" BRANCH="beta" + + self_update() { cd $SCRIPTPATH From cad43d63ef13d381d64cec510bdcc47e3e2b06cf Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 14:07:23 -0600 Subject: [PATCH 0116/1229] another push --- heavy_script.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index 986fdafc..3f3cfd98 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -3,7 +3,7 @@ #If no argument is passed, kill the script. [[ -z "$*" || "-" == "$*" || "--" == "$*" ]] && echo "This script requires an argument, use --help for help" && exit -ARGS="$*" ; echo "${ARGS}//--self-update/" +ARGS="$*" ; echo "${ARGS//--self-update/}" SCRIPT=$(readlink -f "$0") SCRIPTPATH=$(dirname "$SCRIPT") SCRIPTNAME="$0" @@ -30,7 +30,7 @@ git fetch echo "Already the latest version." } -echo + help(){ [[ $help == "true" ]] && clear -x From 169c5fe8a3c1603181017df0842d1be8e757cb21 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 14:07:47 -0600 Subject: [PATCH 0117/1229] another --- heavy_script.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index 3f3cfd98..8d029bfa 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -10,7 +10,6 @@ SCRIPTNAME="$0" BRANCH="beta" - self_update() { cd $SCRIPTPATH From eceba192fb2bea328bfc7eaab08a23336310ee2f Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 14:08:45 -0600 Subject: [PATCH 0118/1229] test --- heavy_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index 8d029bfa..6ee5472f 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -3,7 +3,7 @@ #If no argument is passed, kill the script. [[ -z "$*" || "-" == "$*" || "--" == "$*" ]] && echo "This script requires an argument, use --help for help" && exit -ARGS="$*" ; echo "${ARGS//--self-update/}" +ARGS="$*" ; echo "${ARGS//--self-update}" SCRIPT=$(readlink -f "$0") SCRIPTPATH=$(dirname "$SCRIPT") SCRIPTNAME="$0" From 94036179d4695e773f11573a3299bd5ef76a45a3 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 14:09:12 -0600 Subject: [PATCH 0119/1229] test --- heavy_script.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index 6ee5472f..cef2b6cd 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -9,7 +9,6 @@ SCRIPTPATH=$(dirname "$SCRIPT") SCRIPTNAME="$0" BRANCH="beta" - self_update() { cd $SCRIPTPATH From 06e7ad4b27676e0b0f61b032d64ee614af7101c5 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 14:10:28 -0600 Subject: [PATCH 0120/1229] escape hyphens? --- heavy_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index cef2b6cd..b4398a15 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -3,7 +3,7 @@ #If no argument is passed, kill the script. [[ -z "$*" || "-" == "$*" || "--" == "$*" ]] && echo "This script requires an argument, use --help for help" && exit -ARGS="$*" ; echo "${ARGS//--self-update}" +ARGS="$*" ; echo "${ARGS//\-\-self\-update}" SCRIPT=$(readlink -f "$0") SCRIPTPATH=$(dirname "$SCRIPT") SCRIPTNAME="$0" From bb4edf6bf1fe0ecb59b4f55794ca3f5f34e810d3 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 14:10:54 -0600 Subject: [PATCH 0121/1229] test --- heavy_script.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/heavy_script.sh b/heavy_script.sh index b4398a15..610f0392 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -9,6 +9,7 @@ SCRIPTPATH=$(dirname "$SCRIPT") SCRIPTNAME="$0" BRANCH="beta" + self_update() { cd $SCRIPTPATH From 151b37947bed1aa98e0dc4c952955476d5ddecf5 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 14:11:51 -0600 Subject: [PATCH 0122/1229] remove self update form args --- heavy_script.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index 610f0392..054e7ebc 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -3,7 +3,7 @@ #If no argument is passed, kill the script. [[ -z "$*" || "-" == "$*" || "--" == "$*" ]] && echo "This script requires an argument, use --help for help" && exit -ARGS="$*" ; echo "${ARGS//\-\-self\-update}" +ARGS="$*" SCRIPT=$(readlink -f "$0") SCRIPTPATH=$(dirname "$SCRIPT") SCRIPTNAME="$0" @@ -21,7 +21,7 @@ git fetch git checkout $BRANCH git pull --force echo "Running the new version..." - exec bash "$SCRIPTNAME" "$ARGS" + exec bash "$SCRIPTNAME" "${ARGS//\-\-self\-update}" # Now exit this old instance exit 1 From 69393bab6b08a644da74052d25b42864f907d2ce Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 14:12:18 -0600 Subject: [PATCH 0123/1229] only real way to test this unf --- heavy_script.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/heavy_script.sh b/heavy_script.sh index 054e7ebc..300b9a18 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -3,6 +3,7 @@ #If no argument is passed, kill the script. [[ -z "$*" || "-" == "$*" || "--" == "$*" ]] && echo "This script requires an argument, use --help for help" && exit + ARGS="$*" SCRIPT=$(readlink -f "$0") SCRIPTPATH=$(dirname "$SCRIPT") From d2d5f6f7aebb0d71e57b5801108314df228a1fc0 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 14:13:17 -0600 Subject: [PATCH 0124/1229] test --- heavy_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index 300b9a18..ed41f382 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -22,7 +22,7 @@ git fetch git checkout $BRANCH git pull --force echo "Running the new version..." - exec bash "$SCRIPTNAME" "${ARGS//\-\-self\-update}" + bash "$SCRIPTNAME" "${ARGS//\ \-\-self\-update}" # Now exit this old instance exit 1 From ab68827f8ffd975d3eeb01b0b37e555b06c1090e Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 14:13:35 -0600 Subject: [PATCH 0125/1229] test --- heavy_script.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index ed41f382..7456f664 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -10,7 +10,6 @@ SCRIPTPATH=$(dirname "$SCRIPT") SCRIPTNAME="$0" BRANCH="beta" - self_update() { cd $SCRIPTPATH From 362974975c299aa28fbb6d53cc4ac31e0608d567 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 14:14:25 -0600 Subject: [PATCH 0126/1229] once again --- heavy_script.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/heavy_script.sh b/heavy_script.sh index 7456f664..ed41f382 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -10,6 +10,7 @@ SCRIPTPATH=$(dirname "$SCRIPT") SCRIPTNAME="$0" BRANCH="beta" + self_update() { cd $SCRIPTPATH From 7f44d500b89619c93e1044489d5b449de1885ee4 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 14:16:12 -0600 Subject: [PATCH 0127/1229] more testing --- heavy_script.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index ed41f382..7456f664 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -10,7 +10,6 @@ SCRIPTPATH=$(dirname "$SCRIPT") SCRIPTNAME="$0" BRANCH="beta" - self_update() { cd $SCRIPTPATH From e880da61ed8128b6acb6f2ad0b878c64f7418794 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 14:17:23 -0600 Subject: [PATCH 0128/1229] more testing --- heavy_script.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index 7456f664..f2724dbb 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -21,7 +21,7 @@ git fetch git checkout $BRANCH git pull --force echo "Running the new version..." - bash "$SCRIPTNAME" "${ARGS//\ \-\-self\-update}" + bash "$SCRIPTNAME" "${ARGS//\ \-\-self\-update\ }" # Now exit this old instance exit 1 @@ -30,7 +30,6 @@ git fetch } - help(){ [[ $help == "true" ]] && clear -x echo "Basic Utilities" From 5f2df0a69e50c836b876c6cc3367ef1a97edd6eb Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 14:25:37 -0600 Subject: [PATCH 0129/1229] test --- heavy_script.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index f2724dbb..c5d1603d 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -4,7 +4,7 @@ [[ -z "$*" || "-" == "$*" || "--" == "$*" ]] && echo "This script requires an argument, use --help for help" && exit -ARGS="$*" +ARGS="$@" SCRIPT=$(readlink -f "$0") SCRIPTPATH=$(dirname "$SCRIPT") SCRIPTNAME="$0" @@ -21,7 +21,7 @@ git fetch git checkout $BRANCH git pull --force echo "Running the new version..." - bash "$SCRIPTNAME" "${ARGS//\ \-\-self\-update\ }" + exec bash "$SCRIPTNAME" "${ARGS//\ \-\-self\-update\ }" # Now exit this old instance exit 1 From 7e82f95bf24295f893fa10d8316c4291f6439a84 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 14:26:15 -0600 Subject: [PATCH 0130/1229] test --- heavy_script.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/heavy_script.sh b/heavy_script.sh index c5d1603d..0fa18fe7 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -4,6 +4,7 @@ [[ -z "$*" || "-" == "$*" || "--" == "$*" ]] && echo "This script requires an argument, use --help for help" && exit + ARGS="$@" SCRIPT=$(readlink -f "$0") SCRIPTPATH=$(dirname "$SCRIPT") From b50f475743aa009adc80046b3d22b1667834c948 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 14:26:54 -0600 Subject: [PATCH 0131/1229] string --- heavy_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index 0fa18fe7..093b3cd3 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -5,7 +5,7 @@ -ARGS="$@" +ARGS="$*" SCRIPT=$(readlink -f "$0") SCRIPTPATH=$(dirname "$SCRIPT") SCRIPTNAME="$0" From 3fab72b9d9b6ce265c3001f470e7a7c0266be2b4 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 14:27:19 -0600 Subject: [PATCH 0132/1229] test --- heavy_script.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index 093b3cd3..26f70132 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -4,7 +4,6 @@ [[ -z "$*" || "-" == "$*" || "--" == "$*" ]] && echo "This script requires an argument, use --help for help" && exit - ARGS="$*" SCRIPT=$(readlink -f "$0") SCRIPTPATH=$(dirname "$SCRIPT") From 9da93da982e2981176ffefeb9e6bcac36ae401a1 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 14:28:41 -0600 Subject: [PATCH 0133/1229] test --- heavy_script.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index 26f70132..779fda63 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -4,7 +4,7 @@ [[ -z "$*" || "-" == "$*" || "--" == "$*" ]] && echo "This script requires an argument, use --help for help" && exit -ARGS="$*" +ARGS="$@" SCRIPT=$(readlink -f "$0") SCRIPTPATH=$(dirname "$SCRIPT") SCRIPTNAME="$0" @@ -21,7 +21,7 @@ git fetch git checkout $BRANCH git pull --force echo "Running the new version..." - exec bash "$SCRIPTNAME" "${ARGS//\ \-\-self\-update\ }" + exec bash "$SCRIPTNAME" "${ARGS//\-\-self\-update}" # Now exit this old instance exit 1 From 8dc864cae74fcdf9dc380a391a16fbee3df8791e Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 14:29:00 -0600 Subject: [PATCH 0134/1229] test --- heavy_script.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/heavy_script.sh b/heavy_script.sh index 779fda63..c19eb5d2 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -4,6 +4,7 @@ [[ -z "$*" || "-" == "$*" || "--" == "$*" ]] && echo "This script requires an argument, use --help for help" && exit + ARGS="$@" SCRIPT=$(readlink -f "$0") SCRIPTPATH=$(dirname "$SCRIPT") From f11ef25a43fe773cac26e60ffccb615edbfda158 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 14:35:45 -0600 Subject: [PATCH 0135/1229] test --- heavy_script.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index c19eb5d2..77c56652 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -5,7 +5,7 @@ -ARGS="$@" +ARGS=( "$@" ) SCRIPT=$(readlink -f "$0") SCRIPTPATH=$(dirname "$SCRIPT") SCRIPTNAME="$0" @@ -22,7 +22,7 @@ git fetch git checkout $BRANCH git pull --force echo "Running the new version..." - exec bash "$SCRIPTNAME" "${ARGS//\-\-self\-update}" + exec bash "$SCRIPTNAME" "${ARGS[@]//\-\-self\-update}" # Now exit this old instance exit 1 From 29665ca8cf396ec1dca0e641fbdd6a00e572c4c6 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 14:37:02 -0600 Subject: [PATCH 0136/1229] test --- heavy_script.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index 77c56652..e57950ff 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -4,7 +4,6 @@ [[ -z "$*" || "-" == "$*" || "--" == "$*" ]] && echo "This script requires an argument, use --help for help" && exit - ARGS=( "$@" ) SCRIPT=$(readlink -f "$0") SCRIPTPATH=$(dirname "$SCRIPT") From 6c1e4a762fefd327d957dc40699093808f0b97fa Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 14:38:14 -0600 Subject: [PATCH 0137/1229] test --- heavy_script.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/heavy_script.sh b/heavy_script.sh index e57950ff..77c56652 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -4,6 +4,7 @@ [[ -z "$*" || "-" == "$*" || "--" == "$*" ]] && echo "This script requires an argument, use --help for help" && exit + ARGS=( "$@" ) SCRIPT=$(readlink -f "$0") SCRIPTPATH=$(dirname "$SCRIPT") From 0a01f4b0c2e8513bb80514261b67b38874f127cf Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 14:41:15 -0600 Subject: [PATCH 0138/1229] test --- heavy_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index 77c56652..689bffba 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -22,7 +22,7 @@ git fetch git checkout $BRANCH git pull --force echo "Running the new version..." - exec bash "$SCRIPTNAME" "${ARGS[@]//\-\-self\-update}" + exec bash "$SCRIPTNAME" "${ARGS[@]/\-\-self\-update}" # Now exit this old instance exit 1 From 5f40b315f2be192f48159a46fc90277e000afb1d Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 14:41:32 -0600 Subject: [PATCH 0139/1229] test --- heavy_script.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index 689bffba..c62a17fe 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -4,7 +4,6 @@ [[ -z "$*" || "-" == "$*" || "--" == "$*" ]] && echo "This script requires an argument, use --help for help" && exit - ARGS=( "$@" ) SCRIPT=$(readlink -f "$0") SCRIPTPATH=$(dirname "$SCRIPT") From 70f5388b7de8bb2176a5ca1e303839bb991ddb74 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 14:43:16 -0600 Subject: [PATCH 0140/1229] test --- heavy_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index c62a17fe..72cda34c 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -21,7 +21,7 @@ git fetch git checkout $BRANCH git pull --force echo "Running the new version..." - exec bash "$SCRIPTNAME" "${ARGS[@]/\-\-self\-update}" + exec bash "$SCRIPTNAME" "${ARGS[@]/\ \-\-self\-update\ }" # Now exit this old instance exit 1 From 1713d195288a437549b80b83b67a7b6c5237a68f Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 14:43:42 -0600 Subject: [PATCH 0141/1229] test --- heavy_script.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/heavy_script.sh b/heavy_script.sh index 72cda34c..d107139e 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -4,6 +4,7 @@ [[ -z "$*" || "-" == "$*" || "--" == "$*" ]] && echo "This script requires an argument, use --help for help" && exit + ARGS=( "$@" ) SCRIPT=$(readlink -f "$0") SCRIPTPATH=$(dirname "$SCRIPT") From c7f594b63b3aa444c4526a635157d54f811bc66b Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 14:45:11 -0600 Subject: [PATCH 0142/1229] test --- heavy_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index d107139e..eede1ab9 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -22,7 +22,7 @@ git fetch git checkout $BRANCH git pull --force echo "Running the new version..." - exec bash "$SCRIPTNAME" "${ARGS[@]/\ \-\-self\-update\ }" + exec bash "$SCRIPTNAME" "${ARGS[@]/[\ ]\-\-self\-update[\ ]}" # Now exit this old instance exit 1 From b6b7f18f14298cb472aa59e82af3fff50194fd33 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 14:45:29 -0600 Subject: [PATCH 0143/1229] test --- heavy_script.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index eede1ab9..3d8f2766 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -4,7 +4,6 @@ [[ -z "$*" || "-" == "$*" || "--" == "$*" ]] && echo "This script requires an argument, use --help for help" && exit - ARGS=( "$@" ) SCRIPT=$(readlink -f "$0") SCRIPTPATH=$(dirname "$SCRIPT") From a17d0a0faad9e25894e0e757005263b94f7c2257 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 14:46:32 -0600 Subject: [PATCH 0144/1229] test --- heavy_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index 3d8f2766..b31616c8 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -21,7 +21,7 @@ git fetch git checkout $BRANCH git pull --force echo "Running the new version..." - exec bash "$SCRIPTNAME" "${ARGS[@]/[\ ]\-\-self\-update[\ ]}" + exec bash "$SCRIPTNAME" "${ARGS[@]/(\ )\-\-self\-update(\ )}" # Now exit this old instance exit 1 From 8e2d77323ebcb0db9e328dd32561088fa9ee0c9a Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 14:46:45 -0600 Subject: [PATCH 0145/1229] test --- heavy_script.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/heavy_script.sh b/heavy_script.sh index b31616c8..069d89d6 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -4,6 +4,7 @@ [[ -z "$*" || "-" == "$*" || "--" == "$*" ]] && echo "This script requires an argument, use --help for help" && exit + ARGS=( "$@" ) SCRIPT=$(readlink -f "$0") SCRIPTPATH=$(dirname "$SCRIPT") From 8c0cb93fe0b6631f1dfc3d63a42ae55bca7557fb Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 14:51:40 -0600 Subject: [PATCH 0146/1229] test --- heavy_script.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index 069d89d6..800c1747 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -5,7 +5,7 @@ -ARGS=( "$@" ) +ARGS=( "$@" ) SCRIPT=$(readlink -f "$0") SCRIPTPATH=$(dirname "$SCRIPT") SCRIPTNAME="$0" @@ -22,7 +22,7 @@ git fetch git checkout $BRANCH git pull --force echo "Running the new version..." - exec bash "$SCRIPTNAME" "${ARGS[@]/(\ )\-\-self\-update(\ )}" + exec bash "$SCRIPTNAME" "${ARGS[@]/\s?\-\-self\-update\s?}" # Now exit this old instance exit 1 From d39634b39f9e2033491bcf93b5691d1b65d94fdd Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 14:52:03 -0600 Subject: [PATCH 0147/1229] test --- heavy_script.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index 800c1747..be75bac5 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -4,7 +4,6 @@ [[ -z "$*" || "-" == "$*" || "--" == "$*" ]] && echo "This script requires an argument, use --help for help" && exit - ARGS=( "$@" ) SCRIPT=$(readlink -f "$0") SCRIPTPATH=$(dirname "$SCRIPT") From 4c9ee5de13de19e30f2c7dcee0390fb0f31ce73f Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 14:53:01 -0600 Subject: [PATCH 0148/1229] sed --- heavy_script.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index be75bac5..d7abe91e 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -4,7 +4,8 @@ [[ -z "$*" || "-" == "$*" || "--" == "$*" ]] && echo "This script requires an argument, use --help for help" && exit -ARGS=( "$@" ) + +ARGS="$@" ; echo "$ARGS" | sed -e 's/\s?\-\-self\-update\s?//' SCRIPT=$(readlink -f "$0") SCRIPTPATH=$(dirname "$SCRIPT") SCRIPTNAME="$0" @@ -21,7 +22,7 @@ git fetch git checkout $BRANCH git pull --force echo "Running the new version..." - exec bash "$SCRIPTNAME" "${ARGS[@]/\s?\-\-self\-update\s?}" + exec bash "$SCRIPTNAME" "${ARGS[@]}" # Now exit this old instance exit 1 From 8c1db858b8a8bdfa5c0ae8967eeede676b191319 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 14:53:20 -0600 Subject: [PATCH 0149/1229] test --- heavy_script.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index d7abe91e..62db01d7 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -4,7 +4,6 @@ [[ -z "$*" || "-" == "$*" || "--" == "$*" ]] && echo "This script requires an argument, use --help for help" && exit - ARGS="$@" ; echo "$ARGS" | sed -e 's/\s?\-\-self\-update\s?//' SCRIPT=$(readlink -f "$0") SCRIPTPATH=$(dirname "$SCRIPT") From 8ac7b496d9d53d7789e68df0aa55c60f97569f9d Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 14:59:37 -0600 Subject: [PATCH 0150/1229] regex --- heavy_script.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index 62db01d7..d7ce4cce 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -4,7 +4,7 @@ [[ -z "$*" || "-" == "$*" || "--" == "$*" ]] && echo "This script requires an argument, use --help for help" && exit -ARGS="$@" ; echo "$ARGS" | sed -e 's/\s?\-\-self\-update\s?//' +ARGS="$@" ; echo "$ARGS" | sed -e 's/[:space:]\?\-\-self\-update[:space:]\?//' SCRIPT=$(readlink -f "$0") SCRIPTPATH=$(dirname "$SCRIPT") SCRIPTNAME="$0" @@ -21,7 +21,7 @@ git fetch git checkout $BRANCH git pull --force echo "Running the new version..." - exec bash "$SCRIPTNAME" "${ARGS[@]}" + exec bash "$SCRIPTNAME" ${ARGS[@]} # Now exit this old instance exit 1 From 1845d3c9c028f06dd971e6ed483b50cfdd271cd7 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 15:00:09 -0600 Subject: [PATCH 0151/1229] test --- heavy_script.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/heavy_script.sh b/heavy_script.sh index d7ce4cce..3daae58d 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -4,6 +4,7 @@ [[ -z "$*" || "-" == "$*" || "--" == "$*" ]] && echo "This script requires an argument, use --help for help" && exit + ARGS="$@" ; echo "$ARGS" | sed -e 's/[:space:]\?\-\-self\-update[:space:]\?//' SCRIPT=$(readlink -f "$0") SCRIPTPATH=$(dirname "$SCRIPT") From 48d71ffc2e4d3ab17b33d4be10c83100178c8adc Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 15:00:51 -0600 Subject: [PATCH 0152/1229] fix space --- heavy_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index 3daae58d..b148a01d 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -5,7 +5,7 @@ -ARGS="$@" ; echo "$ARGS" | sed -e 's/[:space:]\?\-\-self\-update[:space:]\?//' +ARGS="$@" ; echo "$ARGS" | sed -e 's/[[:space:]]\?\-\-self\-update[[:space:]]\?//' SCRIPT=$(readlink -f "$0") SCRIPTPATH=$(dirname "$SCRIPT") SCRIPTNAME="$0" From af6d65d0d50da00e4f53e9b64261ee08668191bc Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 15:01:51 -0600 Subject: [PATCH 0153/1229] reg --- heavy_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index b148a01d..a5a708ef 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -5,7 +5,7 @@ -ARGS="$@" ; echo "$ARGS" | sed -e 's/[[:space:]]\?\-\-self\-update[[:space:]]\?//' +ARGS="$@" ; echo "$ARGS" | sed -e 's/[[:space:]]\?--self-update[[:space:]]\?//' SCRIPT=$(readlink -f "$0") SCRIPTPATH=$(dirname "$SCRIPT") SCRIPTNAME="$0" From a17ba00666285229245500b1c838b5ac7315b7bb Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 15:02:25 -0600 Subject: [PATCH 0154/1229] test --- heavy_script.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index a5a708ef..a440bec7 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -4,7 +4,6 @@ [[ -z "$*" || "-" == "$*" || "--" == "$*" ]] && echo "This script requires an argument, use --help for help" && exit - ARGS="$@" ; echo "$ARGS" | sed -e 's/[[:space:]]\?--self-update[[:space:]]\?//' SCRIPT=$(readlink -f "$0") SCRIPTPATH=$(dirname "$SCRIPT") From d111b214139bcd821c3d7cee60ea030957f99935 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 15:03:10 -0600 Subject: [PATCH 0155/1229] reg --- heavy_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index a440bec7..28931d09 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -4,7 +4,7 @@ [[ -z "$*" || "-" == "$*" || "--" == "$*" ]] && echo "This script requires an argument, use --help for help" && exit -ARGS="$@" ; echo "$ARGS" | sed -e 's/[[:space:]]\?--self-update[[:space:]]\?//' +ARGS="$@" ; echo "$ARGS" | sed -e 's/[[:space:]]?--self-update[[:space:]]?//' SCRIPT=$(readlink -f "$0") SCRIPTPATH=$(dirname "$SCRIPT") SCRIPTNAME="$0" From 05906fee686cf2244fc533d6b700c12b9aff9e1c Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 15:03:28 -0600 Subject: [PATCH 0156/1229] test --- heavy_script.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/heavy_script.sh b/heavy_script.sh index 28931d09..2f3623fa 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -4,6 +4,7 @@ [[ -z "$*" || "-" == "$*" || "--" == "$*" ]] && echo "This script requires an argument, use --help for help" && exit + ARGS="$@" ; echo "$ARGS" | sed -e 's/[[:space:]]?--self-update[[:space:]]?//' SCRIPT=$(readlink -f "$0") SCRIPTPATH=$(dirname "$SCRIPT") From a0f83bc66a9129417f427b216f5d388295df552f Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 15:05:31 -0600 Subject: [PATCH 0157/1229] :L --- heavy_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index 2f3623fa..3431c131 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -5,7 +5,7 @@ -ARGS="$@" ; echo "$ARGS" | sed -e 's/[[:space:]]?--self-update[[:space:]]?//' +ARGS="$@" ; echo "$ARGS" | sed -E 's/[[:space:]]?--self-update[[:space:]]?//g' SCRIPT=$(readlink -f "$0") SCRIPTPATH=$(dirname "$SCRIPT") SCRIPTNAME="$0" From fec89db940a98d0576128d80c8d4cdd500673b67 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 15:05:59 -0600 Subject: [PATCH 0158/1229] test --- heavy_script.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index 3431c131..e0211266 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -4,7 +4,6 @@ [[ -z "$*" || "-" == "$*" || "--" == "$*" ]] && echo "This script requires an argument, use --help for help" && exit - ARGS="$@" ; echo "$ARGS" | sed -E 's/[[:space:]]?--self-update[[:space:]]?//g' SCRIPT=$(readlink -f "$0") SCRIPTPATH=$(dirname "$SCRIPT") From f289cdf76b3d51f0e4da3b6911cc3f8a21f9d7ee Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 15:07:28 -0600 Subject: [PATCH 0159/1229] test --- heavy_script.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index e0211266..62d8373b 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -4,7 +4,8 @@ [[ -z "$*" || "-" == "$*" || "--" == "$*" ]] && echo "This script requires an argument, use --help for help" && exit -ARGS="$@" ; echo "$ARGS" | sed -E 's/[[:space:]]?--self-update[[:space:]]?//g' +ARGS=( echo "$@" | sed -E 's/[[:space:]]?--self-update[[:space:]]?//g') + SCRIPT=$(readlink -f "$0") SCRIPTPATH=$(dirname "$SCRIPT") SCRIPTNAME="$0" From 8030dbf2b5de0f3404fc9fa4686271982f24778d Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 15:08:30 -0600 Subject: [PATCH 0160/1229] fix --- heavy_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index 62d8373b..6eb77eb7 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -4,7 +4,7 @@ [[ -z "$*" || "-" == "$*" || "--" == "$*" ]] && echo "This script requires an argument, use --help for help" && exit -ARGS=( echo "$@" | sed -E 's/[[:space:]]?--self-update[[:space:]]?//g') +ARGS=$(echo "$@" | sed -E 's/[[:space:]]?--self-update[[:space:]]?//g') SCRIPT=$(readlink -f "$0") SCRIPTPATH=$(dirname "$SCRIPT") From 3bd1013b3d03166d2bebb5f965d29a50bb6ed087 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 15:10:05 -0600 Subject: [PATCH 0161/1229] non array --- heavy_script.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index 6eb77eb7..edbca1b6 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -4,7 +4,7 @@ [[ -z "$*" || "-" == "$*" || "--" == "$*" ]] && echo "This script requires an argument, use --help for help" && exit -ARGS=$(echo "$@" | sed -E 's/[[:space:]]?--self-update[[:space:]]?//g') +ARGS=$(echo "$*" | sed -E 's/[[:space:]]?--self-update[[:space:]]?//g') SCRIPT=$(readlink -f "$0") SCRIPTPATH=$(dirname "$SCRIPT") @@ -22,7 +22,7 @@ git fetch git checkout $BRANCH git pull --force echo "Running the new version..." - exec bash "$SCRIPTNAME" ${ARGS[@]} + exec bash "$SCRIPTNAME" "$ARGS" # Now exit this old instance exit 1 From 83b1e286e800ff82212e5dd0cd2ba7f7eb7f4925 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 15:10:24 -0600 Subject: [PATCH 0162/1229] test --- heavy_script.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/heavy_script.sh b/heavy_script.sh index edbca1b6..8825fcca 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -4,6 +4,7 @@ [[ -z "$*" || "-" == "$*" || "--" == "$*" ]] && echo "This script requires an argument, use --help for help" && exit + ARGS=$(echo "$*" | sed -E 's/[[:space:]]?--self-update[[:space:]]?//g') SCRIPT=$(readlink -f "$0") From 4c8cc6bb2c1070c9f5e74a1f853a99d42624a60f Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 15:10:57 -0600 Subject: [PATCH 0163/1229] test --- heavy_script.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index 8825fcca..edbca1b6 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -4,7 +4,6 @@ [[ -z "$*" || "-" == "$*" || "--" == "$*" ]] && echo "This script requires an argument, use --help for help" && exit - ARGS=$(echo "$*" | sed -E 's/[[:space:]]?--self-update[[:space:]]?//g') SCRIPT=$(readlink -f "$0") From 2ad456b905169bf57291868481f167042b9ff00e Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 15:13:46 -0600 Subject: [PATCH 0164/1229] test --- heavy_script.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index edbca1b6..89022099 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -4,7 +4,7 @@ [[ -z "$*" || "-" == "$*" || "--" == "$*" ]] && echo "This script requires an argument, use --help for help" && exit -ARGS=$(echo "$*" | sed -E 's/[[:space:]]?--self-update[[:space:]]?//g') +ARGS=$( "$@" ) SCRIPT=$(readlink -f "$0") SCRIPTPATH=$(dirname "$SCRIPT") @@ -22,7 +22,7 @@ git fetch git checkout $BRANCH git pull --force echo "Running the new version..." - exec bash "$SCRIPTNAME" "$ARGS" + exec bash "$SCRIPTNAME" "${ARGS[@]/[[:space:]]?--self-update[[:space:]]?}" # Now exit this old instance exit 1 From 41f49eb4ff587633c64178e74fdd9345f06e7752 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 15:14:05 -0600 Subject: [PATCH 0165/1229] test --- heavy_script.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/heavy_script.sh b/heavy_script.sh index 89022099..221eb93d 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -4,6 +4,7 @@ [[ -z "$*" || "-" == "$*" || "--" == "$*" ]] && echo "This script requires an argument, use --help for help" && exit + ARGS=$( "$@" ) SCRIPT=$(readlink -f "$0") From 113fc93d913e671668bd35f5dd338c8a1d5d16d9 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 15:16:40 -0600 Subject: [PATCH 0166/1229] test --- heavy_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index 221eb93d..afa51e61 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -23,7 +23,7 @@ git fetch git checkout $BRANCH git pull --force echo "Running the new version..." - exec bash "$SCRIPTNAME" "${ARGS[@]/[[:space:]]?--self-update[[:space:]]?}" + exec bash "$SCRIPTNAME" "${ARGS[@]//[[:space:]]?--self-update[[:space:]]?}" # Now exit this old instance exit 1 From e4c54be187a64b0b70f1176f09a7e3d68706e242 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 15:16:56 -0600 Subject: [PATCH 0167/1229] test --- heavy_script.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index afa51e61..f5792fc7 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -4,7 +4,6 @@ [[ -z "$*" || "-" == "$*" || "--" == "$*" ]] && echo "This script requires an argument, use --help for help" && exit - ARGS=$( "$@" ) SCRIPT=$(readlink -f "$0") From 7b07ea3a33278ede33498a1b4aa363761ddb3a45 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 15:22:53 -0600 Subject: [PATCH 0168/1229] for --- heavy_script.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index f5792fc7..774b0ce7 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -22,7 +22,13 @@ git fetch git checkout $BRANCH git pull --force echo "Running the new version..." - exec bash "$SCRIPTNAME" "${ARGS[@]//[[:space:]]?--self-update[[:space:]]?}" + count=0 + for i in ${ARGS[@]} + do + [[ "$i" == "//[[:space:]]?--self-update[[:space:]]?" ]] && unset "${ARGS[$count]}" + ((count++)) + done + exec bash "$SCRIPTNAME" "${ARGS[@]}" # Now exit this old instance exit 1 From de661f0ef0c7d9d54af28fc756ebaac647d2eb11 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 15:23:11 -0600 Subject: [PATCH 0169/1229] test --- heavy_script.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/heavy_script.sh b/heavy_script.sh index 774b0ce7..c43390ca 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -4,6 +4,7 @@ [[ -z "$*" || "-" == "$*" || "--" == "$*" ]] && echo "This script requires an argument, use --help for help" && exit + ARGS=$( "$@" ) SCRIPT=$(readlink -f "$0") From 1a46cb1ffd8d88ef58543f4250f091c827764507 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 15:28:47 -0600 Subject: [PATCH 0170/1229] test --- heavy_script.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index c43390ca..ab9b8eb6 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -5,7 +5,8 @@ -ARGS=$( "$@" ) +ARGS=("$@") + SCRIPT=$(readlink -f "$0") SCRIPTPATH=$(dirname "$SCRIPT") From 2e8a4dbdaa14166187b6a34456a0334ec75a30a0 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 15:29:16 -0600 Subject: [PATCH 0171/1229] test --- heavy_script.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/heavy_script.sh b/heavy_script.sh index ab9b8eb6..ca77e300 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -8,6 +8,7 @@ ARGS=("$@") + SCRIPT=$(readlink -f "$0") SCRIPTPATH=$(dirname "$SCRIPT") SCRIPTNAME="$0" From 338499585bf730f8c0b359db9cf457d043f2b639 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 15:30:19 -0600 Subject: [PATCH 0172/1229] test --- heavy_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index ca77e300..02799f99 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -28,7 +28,7 @@ git fetch count=0 for i in ${ARGS[@]} do - [[ "$i" == "//[[:space:]]?--self-update[[:space:]]?" ]] && unset "${ARGS[$count]}" + [[ "$i" == "--self-update" ]] && unset "${ARGS[$count]}" ((count++)) done exec bash "$SCRIPTNAME" "${ARGS[@]}" From 64d3371c21148cff4882aace0aea35a0cb975ff9 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 15:30:39 -0600 Subject: [PATCH 0173/1229] test --- heavy_script.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index 02799f99..409f2dbf 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -8,7 +8,6 @@ ARGS=("$@") - SCRIPT=$(readlink -f "$0") SCRIPTPATH=$(dirname "$SCRIPT") SCRIPTNAME="$0" From 2309076a709d25b35b71da1f04a168521312f264 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 15:34:07 -0600 Subject: [PATCH 0174/1229] syntax --- heavy_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index 409f2dbf..5de1f109 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -27,7 +27,7 @@ git fetch count=0 for i in ${ARGS[@]} do - [[ "$i" == "--self-update" ]] && unset "${ARGS[$count]}" + [[ "$i" == "--self-update" ]] && unset "ARGS[$count]" ((count++)) done exec bash "$SCRIPTNAME" "${ARGS[@]}" From 54a96475fc6428020670f0c6003306bcf5684b74 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 15:34:33 -0600 Subject: [PATCH 0175/1229] test --- heavy_script.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/heavy_script.sh b/heavy_script.sh index 5de1f109..82590268 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -8,6 +8,7 @@ ARGS=("$@") + SCRIPT=$(readlink -f "$0") SCRIPTPATH=$(dirname "$SCRIPT") SCRIPTNAME="$0" From 749c033a68d3222fa2d82ff902584d77feb614a1 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 15:35:50 -0600 Subject: [PATCH 0176/1229] ooooo --- heavy_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index 82590268..ef62901a 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -28,7 +28,7 @@ git fetch count=0 for i in ${ARGS[@]} do - [[ "$i" == "--self-update" ]] && unset "ARGS[$count]" + [[ "$i" == "--self-update" ]] && unset "ARGS[$count]" && break ((count++)) done exec bash "$SCRIPTNAME" "${ARGS[@]}" From b99cb44b7ab420e32ba7d6ee2bf05233231b4796 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 15:40:09 -0600 Subject: [PATCH 0177/1229] lowercase --- heavy_script.sh | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index ef62901a..dcff7967 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -5,17 +5,13 @@ -ARGS=("$@") - - +args=("$@") +self_update() { SCRIPT=$(readlink -f "$0") SCRIPTPATH=$(dirname "$SCRIPT") SCRIPTNAME="$0" BRANCH="beta" - -self_update() { - cd $SCRIPTPATH git fetch @@ -26,12 +22,12 @@ git fetch git pull --force echo "Running the new version..." count=0 - for i in ${ARGS[@]} + for i in "${args[@]}" do - [[ "$i" == "--self-update" ]] && unset "ARGS[$count]" && break + [[ "$i" == "--self-update" ]] && unset "args[$count]" && break ((count++)) done - exec bash "$SCRIPTNAME" "${ARGS[@]}" + exec bash "$SCRIPTNAME" "${args[@]}" # Now exit this old instance exit 1 From 5f028225ccba2a5408ad87dbb33f148f1160e58d Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 15:41:16 -0600 Subject: [PATCH 0178/1229] almost done --- heavy_script.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index dcff7967..54361cdb 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -4,7 +4,6 @@ [[ -z "$*" || "-" == "$*" || "--" == "$*" ]] && echo "This script requires an argument, use --help for help" && exit - args=("$@") self_update() { From 01fc4f6c9101a210eac4432baf32740d46f92f1f Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 15:42:24 -0600 Subject: [PATCH 0179/1229] test --- heavy_script.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/heavy_script.sh b/heavy_script.sh index 54361cdb..dcff7967 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -4,6 +4,7 @@ [[ -z "$*" || "-" == "$*" || "--" == "$*" ]] && echo "This script requires an argument, use --help for help" && exit + args=("$@") self_update() { From 6658586651e514929dc9de67d5bea0cd699bd4a4 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 15:45:22 -0600 Subject: [PATCH 0180/1229] delete branch --- heavy_script.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index dcff7967..3ebd69e2 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -11,15 +11,12 @@ self_update() { SCRIPT=$(readlink -f "$0") SCRIPTPATH=$(dirname "$SCRIPT") SCRIPTNAME="$0" -BRANCH="beta" cd $SCRIPTPATH git fetch [[ -n $(git diff --name-only origin/$BRANCH | grep $SCRIPTNAME) ]] && { echo "Found a new version of me, updating myself..." git pull --force - git checkout $BRANCH - git pull --force echo "Running the new version..." count=0 for i in "${args[@]}" From bf5f1a0dc212cf42529d9d4c60192dca080af36d Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 15:50:20 -0600 Subject: [PATCH 0181/1229] test --- heavy_script.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index 3ebd69e2..575bc6c3 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -14,9 +14,9 @@ SCRIPTNAME="$0" cd $SCRIPTPATH git fetch -[[ -n $(git diff --name-only origin/$BRANCH | grep $SCRIPTNAME) ]] && { +[[ -n $(git diff --name-only origin/beta | grep $SCRIPTNAME) ]] && { echo "Found a new version of me, updating myself..." - git pull --force + git pull --force &> /dev/null echo "Running the new version..." count=0 for i in "${args[@]}" From 546cb6892f42199b52ebc2963e7defe1cb99027b Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 15:52:22 -0600 Subject: [PATCH 0182/1229] test --- heavy_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index 575bc6c3..7c2ed973 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -12,7 +12,7 @@ SCRIPT=$(readlink -f "$0") SCRIPTPATH=$(dirname "$SCRIPT") SCRIPTNAME="$0" cd $SCRIPTPATH -git fetch +git fetch &> /dev/null [[ -n $(git diff --name-only origin/beta | grep $SCRIPTNAME) ]] && { echo "Found a new version of me, updating myself..." From 083269cdffe933fb38809c56ecf143e5e406ee2e Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 15:55:14 -0600 Subject: [PATCH 0183/1229] test --- heavy_script.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index 7c2ed973..90d45d44 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -4,7 +4,6 @@ [[ -z "$*" || "-" == "$*" || "--" == "$*" ]] && echo "This script requires an argument, use --help for help" && exit - args=("$@") self_update() { From 7f99e9e46e1779ccd3bcf0cc9de35fbb20025cef Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 15:56:01 -0600 Subject: [PATCH 0184/1229] formatting --- heavy_script.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index 90d45d44..d1e26776 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -16,7 +16,7 @@ git fetch &> /dev/null [[ -n $(git diff --name-only origin/beta | grep $SCRIPTNAME) ]] && { echo "Found a new version of me, updating myself..." git pull --force &> /dev/null - echo "Running the new version..." + echo -e "Running the new version...\n" count=0 for i in "${args[@]}" do @@ -28,7 +28,7 @@ git fetch &> /dev/null # Now exit this old instance exit 1 } - echo "Already the latest version." + echo -e "Already the latest version.\n" } From 799629013b7bc90ce859e4c39541638b1838cc82 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 15:56:50 -0600 Subject: [PATCH 0185/1229] test --- heavy_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index d1e26776..8efd5417 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -23,7 +23,7 @@ git fetch &> /dev/null [[ "$i" == "--self-update" ]] && unset "args[$count]" && break ((count++)) done - exec bash "$SCRIPTNAME" "${args[@]}" + bash "$SCRIPTNAME" "${args[@]}" # Now exit this old instance exit 1 From 455ab485393d2f937c44af120b6936b8210083bc Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 15:57:13 -0600 Subject: [PATCH 0186/1229] test --- heavy_script.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/heavy_script.sh b/heavy_script.sh index 8efd5417..5b0dd8b6 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -4,6 +4,7 @@ [[ -z "$*" || "-" == "$*" || "--" == "$*" ]] && echo "This script requires an argument, use --help for help" && exit + args=("$@") self_update() { From 2c7cf84674bc78600af59a9780fbc61c4d235649 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 15:57:42 -0600 Subject: [PATCH 0187/1229] test --- heavy_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index 5b0dd8b6..22bf5103 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -3,7 +3,7 @@ #If no argument is passed, kill the script. [[ -z "$*" || "-" == "$*" || "--" == "$*" ]] && echo "This script requires an argument, use --help for help" && exit - +echo "yep" args=("$@") From 97b0236def42b41be9ca1ce915d213b877cdb251 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 15:58:32 -0600 Subject: [PATCH 0188/1229] test --- heavy_script.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index 22bf5103..2462458d 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -3,7 +3,6 @@ #If no argument is passed, kill the script. [[ -z "$*" || "-" == "$*" || "--" == "$*" ]] && echo "This script requires an argument, use --help for help" && exit -echo "yep" args=("$@") @@ -15,7 +14,7 @@ cd $SCRIPTPATH git fetch &> /dev/null [[ -n $(git diff --name-only origin/beta | grep $SCRIPTNAME) ]] && { - echo "Found a new version of me, updating myself..." + echo "Found a new version of HeavyScript, updating myself..." git pull --force &> /dev/null echo -e "Running the new version...\n" count=0 From 27516ff497c6b78dc8912f221b3b46ae1a66a22a Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 15:59:08 -0600 Subject: [PATCH 0189/1229] sleep --- heavy_script.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index 2462458d..9b1c290e 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -23,7 +23,8 @@ git fetch &> /dev/null [[ "$i" == "--self-update" ]] && unset "args[$count]" && break ((count++)) done - bash "$SCRIPTNAME" "${args[@]}" + sleep 5 + exec bash "$SCRIPTNAME" "${args[@]}" # Now exit this old instance exit 1 From 993475135b9394b2fb104a551e4198b768240c73 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 15:59:42 -0600 Subject: [PATCH 0190/1229] test --- heavy_script.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/heavy_script.sh b/heavy_script.sh index 9b1c290e..176a0582 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -3,6 +3,7 @@ #If no argument is passed, kill the script. [[ -z "$*" || "-" == "$*" || "--" == "$*" ]] && echo "This script requires an argument, use --help for help" && exit +echo "yep" args=("$@") From 893004fe5838a5c86748f60d128105e96a928a52 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 16:20:35 -0600 Subject: [PATCH 0191/1229] add self update option --- README.md | 24 ++++++++++-------------- heavy_script.sh | 35 ++++++++++++++++++++++++++++++++++- 2 files changed, 44 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index f7717f6e..d41f2613 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,7 @@ | Flag | Example | Parameter | Description | |----------------- |------------------------ |----------- |--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| --self-update | --self-update | None | Updates HeavyScript prior to running it
_You no longer need to git pull_ | | --delete-backup | --delete-backup | None | Opens a menu to delete backups
_Useful if you need to delete old system backups or backups from other scripts_ | | --restore | --restore | None | Restore HeavyScript specific `ix-applications dataset` snapshot | | --mount | --mount | None | Initiates mounting feature
Choose between unmounting and mounting PVC data | @@ -36,7 +37,7 @@ ### Examples #### Typical Cron Job ``` -bash heavy_script.sh -b 14 -i portainer -i arch -i sonarr -i radarr -t 600 -rsup +bash heavy_script.sh --self-update -b 14 -i portainer -i arch -i sonarr -i radarr -t 600 -rsup ``` > `-b` is set to 14. Up to 14 snapshots of your ix-applications dataset will be saved @@ -53,6 +54,8 @@ bash heavy_script.sh -b 14 -i portainer -i arch -i sonarr -i radarr -t 600 -rsup > `-p` Prune docker images. +> `--self-update` Will update the script prior to running anything else. + #### Mounting PVC Data ``` @@ -79,7 +82,7 @@ bash /mnt/tank/scripts/heavy_script/heavy_script.sh --dns #### My personal Cron Job ``` -git -C /mnt/speed/scripts/heavy_script pull && bash /mnt/speed/scripts/heavy_script/heavy_script.sh -b 14 -rsup +bash /mnt/speed/scripts/heavy_script/heavy_script.sh --self-update -b 14 -rsup ```
@@ -111,7 +114,7 @@ cd heavy_script From here, you can just run Heavy_Script with `bash heavy_script.sh -ARGUMENTS` -> Note: `chmod +x` is NOT required. Doing this will break the `git pull` function. Just run the script with `bash heavy_script.sh` +> Note: `chmod +x` is NOT required. Doing this will break the `git pull` (or self update) function. Just run the script with `bash heavy_script.sh`
@@ -132,20 +135,13 @@ git pull ```
-### Update with your Cron Job +### Update with the scripts built-in option -Here, we will update the script prior to running it, incase there is a bugfix, or any new additions to the script - -**Cron Job Command** ``` -git -C /mnt/speed/scripts/heavy_script pull && bash /mnt/speed/scripts/heavy_script/heavy_script.sh -b 14 -rsup +bash heavyscript --self-update -b 14 -supr ``` -> The important command here is the `git -C /PATH/TO/HEAVY_SCRIPT_DIRECTORY pull` +> The important argument here is the `--self-update`, you can still use all of your same arguments with this option. -> This command will allow you to preform a `git pull` on a remote directory, which will ensure your script is udated prior to running it - -> `&&` Is used to run a command AFTER the previous command completed successfully ->> So once the `git -C /PATH/TO/HEAVY_SCRIPT_DIRECTORY pull` command completes, THEN it will run the `bash /PATH/TO/HEAVY_SCRIPT_DIRECTORY/heavy_script.sh -b 14 -rsup` command

@@ -161,7 +157,7 @@ git -C /mnt/speed/scripts/heavy_script pull && bash /mnt/speed/scripts/heavy_scr | Name | Value | Reason | |------------------------ |------------------------------------------------------------------------------------------------------------------- |------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `Description` | HeavyScript git pull and Update apps | This is up to you, put whatever you think is a good description in here | -| `Command` | `git -C /PATH/TO/HEAVY_SCRIPT_DIRECTORY pull && bash /PATH/TO/HEAVY_SCRIPT_DIRECTORY/heavy_script.sh -b 14 -rsup` | This is the command you will be running on your schedule I personally use: `git -C /mnt/speed/scripts/heavy_script pull && bash /mnt/speed/scripts/heavy_script/heavy_script.sh -b 14 -rsup` | +| `Command` | `bash /PATH/TO/HEAVY_SCRIPT_DIRECTORY/heavy_script.sh --self-update -b 14 -rsup` | This is the command you will be running on your schedule I personally use: `bash /mnt/speed/scripts/heavy_script/heavy_script.sh --self-update -b 14 -rsup` | | `Run As User` | `root` | Running the script as `root` is REQUIRED. You cannot access all of the kubernetes functions without this user. | | `Schedule` | Up to you, I run mine everyday at `0400` | Again up to you | | `Hide Standard Output` | `False` or Unticked | I like to receive an email report of how the script ran, what apps updated etc. | diff --git a/heavy_script.sh b/heavy_script.sh index 8eb2b15b..4ba89019 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -3,6 +3,35 @@ #If no argument is passed, kill the script. [[ -z "$*" || "-" == "$*" || "--" == "$*" ]] && echo "This script requires an argument, use --help for help" && exit +args=("$@") + +self_update() { +SCRIPT=$(readlink -f "$0") +SCRIPTPATH=$(dirname "$SCRIPT") +SCRIPTNAME="$0" +cd $SCRIPTPATH +git fetch &> /dev/null + +[[ -n $(git diff --name-only origin/main | grep $SCRIPTNAME) ]] && { + echo "Found a new version of HeavyScript, updating myself..." + git pull --force &> /dev/null + echo -e "Running the new version...\n" + count=0 + for i in "${args[@]}" + do + [[ "$i" == "--self-update" ]] && unset "args[$count]" && break + ((count++)) + done + sleep 5 + exec bash "$SCRIPTNAME" "${args[@]}" + + # Now exit this old instance + exit + } + echo -e "HeavyScript is already the latest version.\n" +} + + help(){ [[ $help == "true" ]] && clear -x @@ -342,9 +371,12 @@ do case $opt in -) case "${OPTARG}" in - help) + help) help="true" ;; + self-update) + self_update="true" + ;; dns) dns="true" ;; @@ -423,6 +455,7 @@ done #Continue to call functions in specific order [[ "$help" == "true" ]] && help +[[ "$self_update" == "true" ]] && self_update [[ "$deleteBackup" == "true" ]] && deleteBackup && exit [[ "$dns" == "true" ]] && dns && exit [[ "$restore" == "true" ]] && restore && exit From b984d2873e88c4e2b73ea6ff1df992ac4f2c6991 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 22:22:29 +0000 Subject: [PATCH 0192/1229] typo in readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d41f2613..c1529c08 100644 --- a/README.md +++ b/README.md @@ -138,7 +138,7 @@ git pull ### Update with the scripts built-in option ``` -bash heavyscript --self-update -b 14 -supr +bash heavyscript.sh --self-update -b 14 -supr ``` > The important argument here is the `--self-update`, you can still use all of your same arguments with this option. From 4d34c42f38a75b0928ec6e625a3c98a16738f531 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 13 Jun 2022 22:23:34 +0000 Subject: [PATCH 0193/1229] remove whitespace --- heavy_script.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index 4ba89019..f8d87e8c 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -32,7 +32,6 @@ git fetch &> /dev/null } - help(){ [[ $help == "true" ]] && clear -x echo "Basic Utilities" From 975493bb853f25e7aae752bf95ccc640ae8ce292 Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Tue, 14 Jun 2022 10:36:45 +0200 Subject: [PATCH 0194/1229] New Version of TrueTool --- .github/workflows/shellcheck.yml | 26 ++ .../workflows/test-and-upload-to-testpypi.yml | 58 ----- .github/workflows/upload-to-pip.yml | 43 ---- .gitignore | 7 - .pre-commit-config.yaml | 21 ++ README.md | 135 +++++++--- includes/backup.sh | 82 ++++++ includes/chores.sh | 31 +++ includes/colors.sh | 113 +++++++++ includes/dns.sh | 27 ++ includes/help.sh | 34 +++ includes/mount.sh | 57 +++++ includes/no_args.sh | 67 +++++ includes/title.sh | 22 ++ includes/update.sh | 123 +++++++++ includes/update_self.sh | 31 +++ setup.py | 55 ---- tests/__init__.py | 0 truetool.sh | 166 ++++++++++++ truetool/__init__.py | 238 ------------------ truetool/command_line.py | 4 - 21 files changed, 907 insertions(+), 433 deletions(-) create mode 100644 .github/workflows/shellcheck.yml delete mode 100644 .github/workflows/test-and-upload-to-testpypi.yml delete mode 100644 .github/workflows/upload-to-pip.yml delete mode 100644 .gitignore create mode 100644 .pre-commit-config.yaml create mode 100755 includes/backup.sh create mode 100755 includes/chores.sh create mode 100755 includes/colors.sh create mode 100755 includes/dns.sh create mode 100755 includes/help.sh create mode 100755 includes/mount.sh create mode 100644 includes/no_args.sh create mode 100755 includes/title.sh create mode 100755 includes/update.sh create mode 100755 includes/update_self.sh delete mode 100644 setup.py delete mode 100644 tests/__init__.py create mode 100755 truetool.sh delete mode 100644 truetool/__init__.py delete mode 100644 truetool/command_line.py diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml new file mode 100644 index 00000000..b8cf09dd --- /dev/null +++ b/.github/workflows/shellcheck.yml @@ -0,0 +1,26 @@ +on: + push: + pull_request: + workflow_dispatch: + +name: 'Lint and Test' + +jobs: + shellcheck: + name: Shellcheck + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Run ShellCheck + uses: ludeeus/action-shellcheck@master + with: + check_together: 'yes' + env: + SHELLCHECK_OPTS: -e SC2154 + + pre-commit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v3 + - uses: pre-commit/action@v3.0.0 diff --git a/.github/workflows/test-and-upload-to-testpypi.yml b/.github/workflows/test-and-upload-to-testpypi.yml deleted file mode 100644 index d73bc96e..00000000 --- a/.github/workflows/test-and-upload-to-testpypi.yml +++ /dev/null @@ -1,58 +0,0 @@ -# This is a basic workflow to help you get started with Actions - -name: Test & Upload to TestPyPI - -# Controls when the action will run. -on: - # Triggers the workflow on push to the master branch - push: - branches: [ main ] - - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - -# A workflow run is made up of one or more jobs that can run sequentially or in parallel -jobs: - # This workflow contains a single job called "build" - build: - # The type of runner that the job will run on - runs-on: ubuntu-latest - - # Steps represent a sequence of tasks that will be executed as part of the job - steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v2 - - # Sets up python3 - - uses: actions/setup-python@v2 - with: - python-version: 3.8 - - # Installs and upgrades pip, installs other dependencies and installs the package from setup.py - - name: "Installs and upgrades pip, installs other dependencies and installs the package from setup.py" - run: | - # Upgrade pip - python3 -m pip install --upgrade pip - # Install build deps - python3 -m pip install setuptools wheel twine - # If requirements.txt exists, install from it - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - # Install the package from setup.py - python3 setup.py install - - # Tests with unittest - - name: Test with unittest - run: | - cd tests - python3 -m unittest discover - cd .. - - # Upload to TestPyPI - - name: Build and Upload to TestPyPI - run: | - python3 setup.py sdist bdist_wheel - python3 -m twine upload dist/* - env: - TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{ secrets.TWINE_TEST_TOKEN }} - TWINE_REPOSITORY: testpypi diff --git a/.github/workflows/upload-to-pip.yml b/.github/workflows/upload-to-pip.yml deleted file mode 100644 index ddd77d85..00000000 --- a/.github/workflows/upload-to-pip.yml +++ /dev/null @@ -1,43 +0,0 @@ -# This is a basic workflow to help you get started with Actions - -name: Upload to PIP - -# Controls when the action will run. -on: - # Triggers the workflow when a release is created - release: - types: [created] - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - -# A workflow run is made up of one or more jobs that can run sequentially or in parallel -jobs: - # This workflow contains a single job called "upload" - upload: - # The type of runner that the job will run on - runs-on: ubuntu-latest - - # Steps represent a sequence of tasks that will be executed as part of the job - steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v2 - - # Sets up python - - uses: actions/setup-python@v2 - with: - python-version: 3.8 - - # Install dependencies - - name: "Installs dependencies" - run: | - python3 -m pip install --upgrade pip - python3 -m pip install setuptools wheel twine - - # Build and upload to PyPI - - name: "Builds and uploads to PyPI" - run: | - python3 setup.py sdist bdist_wheel - python3 -m twine upload dist/* - env: - TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{ secrets.TWINE_TOKEN }} diff --git a/.gitignore b/.gitignore deleted file mode 100644 index f17f07b3..00000000 --- a/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -__pycache__/ -build/ -dist/ -*.egg-info/ -*.egg -venv/ -.env diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..cce767d4 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,21 @@ +# See https://pre-commit.com for more information +repos: +- repo: https://github.com/Lucas-C/pre-commit-hooks + rev: v1.1.10 + hooks: + - id: remove-tabs + +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.0.1 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: fix-byte-order-marker + - id: mixed-line-ending + - id: check-merge-conflict + - id: check-case-conflict + - id: check-executables-have-shebangs + - id: check-docstring-first + - id: check-symlinks + - id: destroyed-symlinks + - id: fix-byte-order-marker diff --git a/README.md b/README.md index d90d398b..93789fbe 100644 --- a/README.md +++ b/README.md @@ -1,50 +1,129 @@ # truetool + A easy tool for frequently used TrueNAS SCALE CLI utilities. -Previously known as "trueupdate" -## How to install +## Table of contents: +* [Synopsis](#synopsis) +* [Arguments](#arguments) +* [How to Install](#how-to-install) +* [How to Update](#how-to-update) +* [Creating a Cron Job](#creating-a-cron-job) +* [Additional Information](#additional-information) -run `pip install truetool` +
-Please be aware you will need to reinstall after every SCALE update +## Synopsis + +TrueTool is a commandline tool, designed to enable some features of TrueNAS SCALE that are either not-enabled by default or not-available in the Web-GUI. +It also offers a few handy shortcuts for commonly required chores, like: Enabling Apt or Helm + +## Arguments + +| Flag | Example | Parameter | Description | +|----------------- |------------------------ |----------- |--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| --delete-backup | --delete-backup | None | Opens a menu to delete backups
_Useful if you need to delete old system backups or backups from other scripts_ | +| --restore | --restore | None | Restore TrueTool specific `ix-applications dataset` snapshot | +| --mount | --mount | None | Initiates mounting feature
Choose between unmounting and mounting PVC data | +| --dns | --dns | None | list all of your applications DNS names and their web ports +| --list-backups | --list-backups | None | Prints a list of backups available +| --helm-enable | --helm-enable | None | Enables Helm command access on SCALE +| --apt-enable | --apt-enable | None | Enables Apt command access on SCALE +| --no-color | --no-color | None | Disables showing colors in terminal output, usefull for SCALE Email output +| -U | -U | None | Update applications, ignoring major version changes | +| -u | -u | None | Update applications, do NOT update if there was a major version change | +| -b | -b 14 | Integer | Backup `ix-appliactions` dataset
_Creates backups up to the number you've chosen_ | +| -i | -i nextcloud -i sonarr | String | Applications listed will be ignored during updating
_List one application after another as shown in the example_ | +| -v | -v | None | Verbose Output
_Look at the bottom of this page for an example_ | +| -t | -t 150 | Integer | Set a custom timeout to be used with either:
`-m`
_Time the script will wait for application to be "STOPPED"_
or
`-(u\|U)`
_Time the script will wait for application to be either "STOPPED" or "ACTIVE"_ | +| -s | -s | None | Sync Catalogs prior to updating | +| -p | -p | None | Prune old/unused docker images | + + +
+
+ + +## How to Install + +### Create a Scripts Dataset + +In this example we created a `scripts` dataset on the Truenas SCALE system, feel free to use another folder. + +### Open a Terminal + +**Change Directory to your scripts folder** +``` +cd /mnt/pool/scripts +``` + +**Git Clone truetool** +``` +git clone https://github.com/truecharts/truetool.git +``` + +**Change Directory to truetool folder** +``` +cd truetool +``` + +From here, you can just run truetool with `bash truetool.sh -ARGUMENTS` + +
## How to Update -run `pip install --upgrade truetool` +TrueTool updates itself automatically. -## How to use +
-running `truetool` should be a good start. +### Update with your Cron Job -Additional options are available: +Here, we will update the script prior to running it, incase there is a bugfix, or any new additions to the script -### Help +**Cron Job Command** +``` +bash /mnt/pool/scripts/truetool/truetool.sh -b 14 -rsup +``` -- `truetool -h` for the CLI help page +
+
+ +## Creating a Cron Job + +1. TrueNAS SCALE GUI +2. System Settings +3. Advanced +4. Cron Jobs + 1. Click Add + +| Name | Value | Reason | +|------------------------ |------------------------------------------------------------------------------------------------------------------- |------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `Description` | TrueTool Update apps | This is up to you, put whatever you think is a good description in here | +| `Command` | `bash /PATH/TO/truetool_DIRECTORY/truetool.sh --no-color -b 14 -sup` | This is the command you will be running on your schedule, example: `bash /mnt/speed/scripts/truetool/truetool.sh -b 14 -rsup` | +| `Run As User` | `root` | Running the script as `root` is REQUIRED. You cannot access all of the kubernetes functions without this user. | +| `Schedule` | Up to you, example: `0400` | Again up to you | +| `Hide Standard Output` | `False` or Unticked | It's best to keep an eye on updates and enable this to recieve email reports | +| `Hide Standard Error` | `False` or Unticked | We definately want to see what errors occured during updating | +| `Enabled` | `True` or Ticked | This will Enable the script to run on your schedule | -### Update -- `truetool -u` or ` truetool --update` updates TrueNAS SCALE Apps +
+
+ +### Additional Information -- `truetool --catalog CATALOGNAME` where CATALOGNAME is the name of the catalog you want to process in caps -- `truetool --versioning SCHEME` where SCHEME is the highest semver version you want to process. options: `patch`, `minor` and `major` -- `truetool -a` or ` truetool --all` updates both active (running) and non-active (stuck or stopped) Apps +#### TrueTool vs HeavyScript +TrueTool and HeavyScript are based, in essence, based on the the original (python based) TrueUpdate and TrueTool. +Then Support-Manager for TrueCharts, HeavyBullets8, ported this to Bash and started adding some additional logic and options for tasks we frequently needed our users to do, such as mounting PVC's. -### Backup -- `truetool -b` or ` truetool --backup` backup the complete Apps system prior to updates. Deletes old backups prior, number of old backups can be set, 14 by default -- `truetool -r` or ` truetool --restore` restores a specific backup by name -- `truetool -d` or ` truetool --delete` deletes a specific backup by name +After a month or so, the TrueCharts Team officially started refactoring this expanded bash-port. Due to personal reasons, HeavyBullets by then decided to seperate from TrueCharts after merging the TrueCharts refactor into his own work. The beauty of OpenSource. -### Other +From this point onwards the HeavyScript and TrueTool diverged a bit. +We internally review changes within our staff team, to verify we somewhat stick to best-practices. This means, in some cases, we decided not to port certain features from HeavyScript and did decide to add features we think are usefull and safe. +But this also means we can give guarantees TrueTool works optimally with our Catalog of TrueNAS SCALE Apps, as well as official Apps. -- `truetool -s` or ` truetool --sync` to sync the catalogs before running updates -- `truetool -p` or ` truetool --prune` to prune (remove) old docker images after running auto-update - -### Important note - -Please use the above arguments seperatly, combining them might not work as you would expect. -So use: `truetool -u -b -p -s -a` -not: `truetool -ubpsa` \ No newline at end of file +Users from HeavyScript can safely start using TrueTool, as we've made precautions to ensure the backups take over smoothly. +We, however, do *not* advice using HeavyScript with TrueCharts Apps. Not because it's a bad App, but because we offer an alternative that is validated by our Staff. diff --git a/includes/backup.sh b/includes/backup.sh new file mode 100755 index 00000000..1f412c6c --- /dev/null +++ b/includes/backup.sh @@ -0,0 +1,82 @@ +#!/bin/bash + +## Simple shortcut to just list the backups without promts and such +listBackups(){ +echo -e "${BWhite}Backup Listing Tool${Color_Off}" +clear -x && echo "pulling all restore points.." +list_backups=$(cli -c 'app kubernetes list_backups' | grep -v system-update | sort -t '_' -Vr -k2,7 | tr -d " \t\r" | awk -F '|' '{print $2}' | nl | column -t) +[[ -z "$list_backups" ]] && echo -e "${IRed}No restore points available${Color_Off}" && exit || echo "Detected Backups:" && echo "$list_backups" +} +export -f listBackups + +## Lists backups, except system-created backups, and promts which one to delete +deleteBackup(){ +echo -e "${BWhite}Backup Deletion Tool${Color_Off}" +clear -x && echo "pulling all restore points.." +list_delete_backups=$(cli -c 'app kubernetes list_delete_backups' | grep -v system-update | sort -t '_' -Vr -k2,7 | tr -d " \t\r" | awk -F '|' '{print $2}' | nl | column -t) +clear -x +# shellcheck disable=SC2015 +[[ -z "$list_delete_backups" ]] && echo -e "${IRed}No restore points available${Color_Off}" && exit || { title; echo -e "Choose a restore point to delete\nThese may be out of order if they are not TrueTool backups" ; } +# shellcheck disable=SC2015 +echo "$list_delete_backups" && read -rt 600 -p "Please type a number: " selection && restore_point=$(echo "$list_delete_backups" | grep ^"$selection " | awk '{print $2}') +[[ -z "$selection" ]] && echo "${IRed}Your selection cannot be empty${Color_Off}" && exit #Check for valid selection. If none, kill script +[[ -z "$restore_point" ]] && echo "Invalid Selection: $selection, was not an option" && exit #Check for valid selection. If none, kill script +echo -e "\nWARNING:\nYou CANNOT go back after deleting your restore point" || { echo "${IRed}FAILED${Color_Off}"; exit; } +# shellcheck disable=SC2015 +echo -e "\n\nYou have chosen:\n$restore_point\n\nWould you like to continue?" && echo -e "1 Yes\n2 No" && read -rt 120 -p "Please type a number: " yesno || { echo "${IRed}FAILED${Color_Off}"; exit; } +if [[ $yesno == "1" ]]; then + echo -e "\nDeleting $restore_point" && cli -c 'app kubernetes delete_backup backup_name=''"'"$restore_point"'"' &>/dev/null && echo -e "${IGreen}Sucessfully deleted${Color_Off}" || echo -e "${IRed}Deletion FAILED${Color_Off}" +elif [[ $yesno == "2" ]]; then + echo "You've chosen NO, killing script." +else + echo -e "${IRed}Invalid Selection${Color_Off}" +fi +} +export -f deleteBackup + +## Creates backups and deletes backups if a "backups to keep"-count is exceeded. +# backups-to-keep takes only heavyscript and truetool created backups into account, as other backups aren't guaranteed to be sorted correctly +backup(){ +echo -e "${BWhite}Backup Tool${Color_Off}" +echo -e "\nNumber of backups was set to $number_of_backups" +date=$(date '+%Y_%m_%d_%H_%M_%S') +[[ "$verbose" == "true" ]] && cli -c 'app kubernetes backup_chart_releases backup_name=''"'TrueTool_"$date"'"' +[[ -z "$verbose" ]] && echo -e "\nNew Backup Name:" && cli -c 'app kubernetes backup_chart_releases backup_name=''"'TrueTool_"$date"'"' | tail -n 1 +mapfile -t list_create_backups < <(cli -c 'app kubernetes list_create_backups' | grep 'HeavyScript\|TrueTool_' | sort -t '_' -Vr -k2,7 | awk -F '|' '{print $2}'| tr -d " \t\r") +# shellcheck disable=SC2309 +if [[ ${#list_create_backups[@]} -gt "number_of_backups" ]]; then + echo -e "\nDeleting the oldest backup(s) for exceeding limit:" + overflow=$(( ${#list_create_backups[@]} - "$number_of_backups" )) + mapfile -t list_overflow < <(cli -c 'app kubernetes list_create_backups' | grep "TrueTool_" | sort -t '_' -V -k2,7 | awk -F '|' '{print $2}'| tr -d " \t\r" | head -n "$overflow") + for i in "${list_overflow[@]}" + do + cli -c 'app kubernetes delete_backup backup_name=''"'"$i"'"' &> /dev/null || echo "${IRed}FAILED${Color_Off} to delete $i" + echo "$i" + done +fi +} +export -f backup + +## Lists available backup and prompts the users to select a backup to restore +restore(){ +echo -e "${BWhite}Backup Restoration Tool${Color_Off}" +clear -x && echo "pulling restore points.." +list_restore_backups=$(cli -c 'app kubernetes list_restore_backups' | grep "TrueTool_" | sort -t '_' -Vr -k2,7 | tr -d " \t\r" | awk -F '|' '{print $2}' | nl | column -t) +clear -x +# shellcheck disable=SC2015 +[[ -z "$list_restore_backups" ]] && echo "No TrueTool restore points available" && exit || { title; echo "Choose a restore point" ; } +echo "$list_restore_backups" && read -rt 600 -p "Please type a number: " selection && restore_point=$(echo "$list_restore_backups" | grep ^"$selection " | awk '{print $2}') +[[ -z "$selection" ]] && echo "Your selection cannot be empty" && exit #Check for valid selection. If none, kill script +[[ -z "$restore_point" ]] && echo "Invalid Selection: $selection, was not an option" && exit #Check for valid selection. If none, kill script +echo -e "\nWARNING:\nThis is NOT guranteed to work\nThis is ONLY supposed to be used as a LAST RESORT\nConsider rolling back your applications instead if possible" || { echo "${IRed}FAILED${Color_Off}"; exit; } +# shellcheck disable=SC2015 +echo -e "\n\nYou have chosen:\n$restore_point\n\nWould you like to continue?" && echo -e "1 Yes\n2 No" && read -rt 120 -p "Please type a number: " yesno || { echo "${IRed}FAILED${Color_Off}"; exit; } +if [[ $yesno == "1" ]]; then + echo -e "\nStarting Backup, this will take a ${BWhite}LONG${Color_Off} time." && cli -c 'app kubernetes restore_backup backup_name=''"'"$restore_point"'"' || echo "Restore ${IRed}FAILED${Color_Off}" +elif [[ $yesno == "2" ]]; then + echo "You've chosen NO, killing script. Good luck." +else + echo -e "${IRed}Invalid Selection${Color_Off}" +fi +} +export -f restore diff --git a/includes/chores.sh b/includes/chores.sh new file mode 100755 index 00000000..df6d3a73 --- /dev/null +++ b/includes/chores.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +helmEnable(){ +echo -e "${BWhite}Enabling Helm${Color_Off}" +export KUBECONFIG=/etc/rancher/k3s/k3s.yaml && echo -e "${IGreen}Helm Enabled${Color_Off}"|| echo -e "${IRed}Helm Enable FAILED${Color_Off}" +} +export -f helmEnable + +aptEnable(){ +echo -e "${BWhite}Enabling Apt-Commands${Color_Off}" +chmod +x /usr/bin/apt* && echo -e "${IGreen}APT enabled${Color_Off}"|| echo -e "${IRed}APT Enable FAILED${Color_Off}" +} +export -f aptEnable + +# Prune unused docker images to prevent dataset/snapshot bloat related slowdowns on SCALE +prune(){ +echo -e "${BWhite}Docker Prune${Color_Off}" +echo "Pruning Docker Images..." +docker image prune -af | grep "^Total" && echo -e "${IGreen}Docker Prune Successfull${Color_Off}" || echo "Docker Prune ${IRed}FAILED${Color_Off}" + +# TODO Switch to middleware prune on next release +# midclt call container.prune '{"remove_unused_images": true, "remove_stopped_containers": true}' &> /dev/null && echo "Docker Prune completed"|| echo "Docker Prune ${IRed}FAILED${Color_Off}" +} +export -f prune + +# +sync(){ +echo -e "${BWhite}Starting Catalog Sync...${Color_Off}" +cli -c 'app catalog sync_all' &> /dev/null && echo -e "${IGreen}Catalog sync complete${Color_Off}" || echo -e "${IRed}Catalog Sync Failed${Color_Off}" +} +export -f sync diff --git a/includes/colors.sh b/includes/colors.sh new file mode 100755 index 00000000..a1f8cbdd --- /dev/null +++ b/includes/colors.sh @@ -0,0 +1,113 @@ +#!/bin/bash +# shellcheck disable=SC2034 + +# Reset +Color_Off='\033[0m' # Text Reset + +# Regular Colors +Black='\033[0;30m' # Black +Red='\033[0;31m' # Red +Green='\033[0;32m' # Green +Yellow='\033[0;33m' # Yellow +Blue='\033[0;34m' # Blue +Purple='\033[0;35m' # Purple +Cyan='\033[0;36m' # Cyan +White='\033[0;37m' # White + +# Bold +BBlack='\033[1;30m' # Black +BRed='\033[1;31m' # Red +BGreen='\033[1;32m' # Green +BYellow='\033[1;33m' # Yellow +BBlue='\033[1;34m' # Blue +BPurple='\033[1;35m' # Purple +BCyan='\033[1;36m' # Cyan +BWhite='\033[1;37m' # White + +# Underline +UBlack='\033[4;30m' # Black +URed='\033[4;31m' # Red +UGreen='\033[4;32m' # Green +UYellow='\033[4;33m' # Yellow +UBlue='\033[4;34m' # Blue +UPurple='\033[4;35m' # Purple +UCyan='\033[4;36m' # Cyan +UWhite='\033[4;37m' # White + +# High Intensity +IBlack='\033[0;90m' # Black +IRed='\033[0;91m' # Red +IGreen='\033[0;92m' # Green +IYellow='\033[0;93m' # Yellow +IBlue='\033[0;94m' # Blue +IPurple='\033[0;95m' # Purple +ICyan='\033[0;96m' # Cyan +IWhite='\033[0;97m' # White + + +# Bold High Intensity +BIBlack='\033[1;90m' # Black +BIRed='\033[1;91m' # Red +BIGreen='\033[1;92m' # Green +BIYellow='\033[1;93m' # Yellow +BIBlue='\033[1;94m' # Blue +BIPurple='\033[1;95m' # Purple +BICyan='\033[1;96m' # Cyan +BIWhite='\033[1;97m' # White + +noColor(){ +# Reset +Color_Off="" + +# Regular Colors +Black="" +Red="" +Green="" +Yellow="" +Blue="" +Purple="" +Cyan="" +White="" + +# Bold +BBlack="" +BRed="" +BGreen="" +BYellow="" +BBlue="" +BPurple="" +BCyan="" +BWhite="" + +# Underline +UBlack="" +URed="" +UGreen="" +UYellow="" +UBlue="" +UPurple="" +UCyan="" +UWhite="" + +# High Intensity +IBlack="" +IRed="" +IGreen="" +IYellow="" +IBlue="" +IPurple="" +ICyan="" +IWhite="" + + +# Bold High Intensity +BIBlack="" +BIRed="" +BIGreen="" +BIYellow="" +BIBlue="" +BIPurple="" +BICyan="" +BIWhite="" + } + export -f noColor diff --git a/includes/dns.sh b/includes/dns.sh new file mode 100755 index 00000000..0e12e90a --- /dev/null +++ b/includes/dns.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +dns(){ + echo -e "${BWhite}Service DNS Names Tool${Color_Off}" +clear -x +echo "Generating Internal Service DNS Names..." +#ignored dependency pods, may need to add more in the future. +dep_ignore="\-cronjob\-|^kube-system|\ssvclb|NAME|\-memcached\-.[^custom\-app]|\-postgresql\-.[^custom\-app]|\-redis\-.[^custom\-app]|\-mariadb\-.[^custom\-app]|\-promtail\-.[^custom\-app]" + +# Pulling pod names +mapfile -t main < <(k3s kubectl get pods -A | grep -Ev "$dep_ignore" | sort) + +# Pulling all ports +all_ports=$(k3s kubectl get service -A) + +clear -x +count=0 +for i in "${main[@]}" +do + [[ count -le 0 ]] && echo -e "\n" && ((count++)) + appName=$(echo "$i" | awk '{print $2}' | sed 's/-[^-]*-[^-]*$//' | sed 's/-0//') + ixName=$(echo "$i" | awk '{print $1}') + port=$(echo "$all_ports" | grep -E "\s$appName\s" | awk '{print $6}' | grep -Eo "^[[:digit:]]+{1}") + [[ -n "$port" ]] && echo -e "$appName.$ixName.svc.cluster.local $port" +done | uniq | nl -b t | sed 's/\s\s\s$/- -------- ----/' | column -t -R 1 -N "#,DNS_Name,Port" -L +} +export -f dns diff --git a/includes/help.sh b/includes/help.sh new file mode 100755 index 00000000..5b778c75 --- /dev/null +++ b/includes/help.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +help(){ +[[ $help == "true" ]] && clear -x +echo "" +echo -e "${BWhite}Basic Utilities${Color_Off}" +echo "--mount | Initiates mounting feature, choose between unmounting and mounting PVC data" +echo "--restore | Opens a menu to restore a \"truetool\" backup that was taken on your \"ix-applications\" dataset" +echo "--delete-backup | Opens a menu to delete backups on your system" +echo "--list-backups | Prints a list of backups available" +echo "--helm-enable | Enables Helm command access on SCALE" +echo "--apt-enable | Enables Apt command access on SCALE" +echo "--dns | list all of your applications DNS names and their web ports" +echo +echo -e "${BWhite}Update Options${Color_Off}" +echo "-U | Update all applications, ignores versions" +echo "-u | Update all applications, does not update Major releases" +echo "-b | Back-up your ix-applications dataset, specify a number after -b" +echo "-i | Add application to ignore list, one by one, see example below." +echo "-v | verbose output" +echo "-t | Set a custom timeout in seconds when checking if either an App or Mountpoint correctly Started, Stopped or (un)Mounted. Defaults to 500 seconds" +echo "-s | sync catalog" +echo "-p | Prune unused/old docker images" +echo +echo -e "${BWhite}Examples${Color_Off}" +echo "bash truetool.sh -b 14 -i portainer -i arch -i sonarr -i radarr -t 600 -vrsUp" +echo "bash /mnt/tank/scripts/truetool.sh -t 150 --mount" +echo "bash /mnt/tank/scripts/truetool.sh --dns" +echo "bash /mnt/tank/scripts/truetool.sh --restore" +echo "bash /mnt/tank/scripts/truetool.sh --delete-backup" +echo +exit +} +export -f help diff --git a/includes/mount.sh b/includes/mount.sh new file mode 100755 index 00000000..7d5a6019 --- /dev/null +++ b/includes/mount.sh @@ -0,0 +1,57 @@ +#!/bin/bash + +mountPVC(){ +echo -e "${BWhite}PVC Mounting Tool${Color_Off}" +clear -x +title +echo -e "1 Mount\n2 Unmount All" && read -rt 600 -p "Please type a number: " selection +[[ -z "$selection" ]] && echo "Your selection cannot be empty" && exit #Check for valid selection. If none, kill script +if [[ $selection == "1" ]]; then + list=$(k3s kubectl get pvc -A | sort -u | awk '{print NR-1, "\t" $1 "\t" $2 "\t" $4}' | column -t | sed "s/^0/ /") + echo "$list" && read -rt 120 -p "Please type a number: " selection + [[ -z "$selection" ]] && echo "Your selection cannot be empty" && exit #Check for valid selection. If none, kill script + app=$(echo -e "$list" | grep ^"$selection " | awk '{print $2}' | cut -c 4- ) + [[ -z "$app" ]] && echo "Invalid Selection: $selection, was not an option" && exit #Check for valid selection. If none, kill script + pvc=$(echo -e "$list" | grep ^"$selection ") + status=$(cli -m csv -c 'app chart_release query name,status' | grep -E "^$app\b" | awk -F ',' '{print $2}'| tr -d " \t\n\r") + if [[ "$status" != "STOPPED" ]]; then + [[ -z $timeout ]] && echo -e "\nDefault Timeout: 500" && timeout=500 || echo -e "\nCustom Timeout: $timeout" + SECONDS=0 && echo -e "\nScaling down $app" && midclt call chart.release.scale "$app" '{"replica_count": 0}' &> /dev/null + else + echo -e "\n$app is already stopped" + fi + while [[ "$SECONDS" -le "$timeout" && "$status" != "STOPPED" ]] + do + status=$(cli -m csv -c 'app chart_release query name,status' | grep -E "^$app\b" | awk -F ',' '{print $2}'| tr -d " \t\n\r") + echo -e "Waiting $((timeout-SECONDS)) more seconds for $app to be STOPPED" && sleep 5 + done + data_name=$(echo "$pvc" | awk '{print $3}') + volume_name=$(echo "$pvc" | awk '{print $4}') + full_path=$(zfs list | grep "$volume_name" | awk '{print $1}') + echo -e "\nMounting\n$full_path\nTo\n/mnt/truetool/$data_name" && zfs set mountpoint="/truetool/$data_name" "$full_path" && echo -e "Mounted, Use the Unmount All option to unmount\n" + exit +elif [[ $selection == "2" ]]; then + mapfile -t unmount_array < <(basename -a /mnt/truetool/* | sed "s/*//") + [[ -z ${unmount_array[*]} ]] && echo "Theres nothing to unmount" && exit + for i in "${unmount_array[@]}" + do + main=$(k3s kubectl get pvc -A | grep -E "\s$i\s" | awk '{print $1, $2, $4}') + app=$(echo "$main" | awk '{print $1}' | cut -c 4-) + pvc=$(echo "$main" | awk '{print $3}') + mapfile -t path < <(find /mnt/*/ix-applications/releases/"$app"/volumes/ -maxdepth 0 | cut -c 6-) + if [[ "${#path[@]}" -gt 1 ]]; then #if there is another app with the same name on another pool, use the current pools application, since the other instance is probably old, or unused. + echo "$i is a name used on more than one pool.. attempting to use your current kubernetes apps pool" + pool=$(cli -c 'app kubernetes config' | grep -E "dataset\s\|" | awk -F '|' '{print $3}' | awk -F '/' '{print $1}' | tr -d " \t\n\r") + full_path=$(find /mnt/"$pool"/ix-applications/releases/"$app"/volumes/ -maxdepth 0 | cut -c 6-) + zfs set mountpoint=legacy "$full_path""$pvc" && echo "$i unmounted" && rmdir /mnt/truetool/"$i" || echo "${IRed}FAILED${Color_Off} to unmount $i" + else + # shellcheck disable=SC2128 + zfs set mountpoint=legacy "$path""$pvc" && echo "$i unmounted" && rmdir /mnt/truetool/"$i" || echo "${IRed}FAILED${Color_Off} to unmount $i" + fi + done + rmdir /mnt/truetool +else + echo -e "${IRed}Invalid selection, \"$selection\" was not an option${Color_Off}" +fi +} +export -f mountPVC diff --git a/includes/no_args.sh b/includes/no_args.sh new file mode 100644 index 00000000..7db6e4a5 --- /dev/null +++ b/includes/no_args.sh @@ -0,0 +1,67 @@ +#!/bin/bash + +no_args(){ + echo "0 Show Help" + echo "1 List Internal Service DNS Names" + echo "2 Mount and Unmount PVC storage for easy access" + echo "3 List Backups" + echo "4 Create a Backup" + echo "5 Restore a Backup" + echo "6 Delete a Backup" + echo "7 Enable Helm Commands" + echo "8 Enable Apt and Apt-Get Commands" + echo "9 Update All Apps" + read -rt 600 -p "Please select an option by number: " selection + + case $selection in + 1) + help="true" + ;; + 2) + dns="true" + ;; + 3) + mountPVC="true" + ;; + 4) + listBackups="true" + ;; + 5) + read -rt 600 -p "Please type the max number of backups to keep: " backups + re='^[0-9]+$' + number_of_backups=$backups + ! [[ $backups =~ $re ]] && echo -e "Error: -b needs to be assigned an interger\n\"""$number_of_backups""\" is not an interger" >&2 && exit + [[ "$number_of_backups" -le 0 ]] && echo "Error: Number of backups is required to be at least 1" && exit + ;; + 6) + restore="true" + ;; + 7) + deleteBackup="true" + ;; + 8) + helmEnable="true" + ;; + 9) + aptEnable="true" + ;; + 10) + echo "" + echo "1 Update Apps Excluding likely breaking major changes" + echo "2 Update Apps Including likely breaking major changes" + read -rt 600 -p "Please select an option by number: " updateType + if [[ "$updateType" == "1" ]]; then + update_apps="true" + elif [[ "$updateType" == "2" ]]; then + update_all_apps="true" + else + echo "INVALID ENTRY" && exit 1 + fi + ;; + *) + echo "Unknown option" && exit 1 + ;; + esac + echo "" +} +export -f no_args diff --git a/includes/title.sh b/includes/title.sh new file mode 100755 index 00000000..b6c9e740 --- /dev/null +++ b/includes/title.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +# Fancy ascii title. +title(){ +if [[ -z $titleShown ]]; then + echo -e "${IRed} _______ _____ _ _ "; + echo " |__ __| / ____| | | | "; + echo " | |_ __ _ _ ___| | | |__ __ _ _ __| |_ ___ "; + echo -e "${IYellow} | | '__| | | |/ _ \ | | '_ \ / _\` | '__| __/ __|"; + echo " | | | | |_| | __/ |____| | | | (_| | | | |_\__ \\"; + echo -e "${IGreen} __|_|_| \__,_|\___|\_____|_| |_|\__,_|_| \__|___/"; + echo " |__ __| |__ __| | | "; + echo -e "${IBlue} | |_ __ _ _ ___| | ___ ___ | | "; + echo " | | '__| | | |/ _ \ |/ _ \ / _ \| | "; + echo -e "${IPurple} | | | | |_| | __/ | (_) | (_) | | "; + echo " |_|_| \__,_|\___|_|\___/ \___/|_| "; + echo " "; + echo -e "${Color_Off} "; +fi +titleShown='true' +} +export -f title diff --git a/includes/update.sh b/includes/update.sh new file mode 100755 index 00000000..0aaa7506 --- /dev/null +++ b/includes/update.sh @@ -0,0 +1,123 @@ +#!/bin/bash + +update_apps(){ +echo -e "${BWhite}App Updater${Color_Off}" +[[ -z $timeout ]] && echo -e "Default Timeout: 500" && timeout=500 || echo -e "\nCustom Timeout: $timeout" +[[ "$timeout" -le 120 ]] && echo "Warning: Your timeout is set low and may lead to premature rollbacks or skips" + +echo "" +echo "Creating list of Apps to update..." + +# Render a list of ignored applications, so users can verify their ignores got parsed correctly. +if [[ -z ${ignore[*]} ]]; then + echo "No apps added to ignore list, continuing..." +else + echo "ignored applications:" + for ignored in "${ignore[@]}" + do + echo "${ignored}" + done +fi +echo "" + +mapfile -t array < <(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,container_images_update_available,status' | grep -E ",true(,|$)" | sort) +[[ -z ${array[*]} ]] && echo -e "\nThere are no updates available or middleware timed out" && return 0 || echo -e "\n${#array[@]} update(s) available:" +PIDlist=() + +# Draft a list of app names, seperate from actuall execution +# This prevents outputs getting mixed together +for i in "${array[@]}" +do + app_name=$(echo "$i" | awk -F ',' '{print $1}') #print out first catagory, name. + echo "$app_name" +done + +echo "" +echo "Updating Apps..." + +# Create a background task for each update as async solution +for i in "${array[@]}" +do + executeUpdate "${i}" & + PIDlist+=($!) +done +echo "" +echo "Waiting for update results..." + +# Wait for all the async updates to complete +for p in "${PIDlist[@]}" +do + wait "${p}" ||: +done + +} +export -f update_apps + + + +# This is a combination of stopping previously-stopped apps and apps stuck Deploying after update +after_update_actions(){ +SECONDS=0 +count=0 +sleep 15 + +# Keep this running and exit the endless-loop based on a timer, instead of a countered-while-loop +# shellcheck disable=SC2050 +while [[ "0" != "1" ]] +do + (( count++ )) + status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep "^$app_name," | awk -F ',' '{print $2}') + if [[ "$status" == "ACTIVE" && "$startstatus" == "STOPPED" ]]; then + [[ "$verbose" == "true" ]] && echo "Returing to STOPPED state.." + midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null && echo "Stopped"|| echo "FAILED" + break + elif [[ "$SECONDS" -ge "$timeout" && "$status" == "DEPLOYING" && "$failed" != "true" ]]; then + echo -e "Error: Run Time($SECONDS) for $app_name has exceeded Timeout($timeout)\nIf this is a slow starting application, set a higher timeout with -t\nIf this applicaion is always DEPLOYING, you can disable all probes under the Healthcheck Probes Liveness section in the edit configuration\nReverting update.." + midclt call chart.release.rollback "$app_name" "{\"item_version\": \"$rollback_version\"}" &> /dev/null + [[ "$startstatus" == "STOPPED" ]] && failed="true" && after_update_actions && unset failed #run back after_update_actions function if the app was stopped prior to update + break + elif [[ "$SECONDS" -ge "$timeout" && "$status" == "DEPLOYING" && "$failed" == "true" ]]; then + echo -e "Error: Run Time($SECONDS) for $app_name has exceeded Timeout($timeout)\nThe application failed to be ACTIVE even after a rollback,\nManual intervention is required\nAbandoning" + break + elif [[ "$status" == "STOPPED" ]]; then + [[ "$count" -le 1 && "$verbose" == "true" ]] && echo "Verifying Stopped.." && sleep 15 && continue #if reports stopped on FIRST time through loop, double check + [[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports stopped on FIRST time through loop, double check + echo "Stopped" && break #if reports stopped any time after the first loop, assume its extermal services. + elif [[ "$status" == "ACTIVE" ]]; then + [[ "$count" -le 1 && "$verbose" == "true" ]] && echo "Verifying Active.." && sleep 15 && continue #if reports active on FIRST time through loop, double check + [[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports active on FIRST time through loop, double check + echo "Active" && break #if reports active any time after the first loop, assume actually active. + else + [[ "$verbose" == "true" ]] && echo "Waiting $((timeout-SECONDS)) more seconds for $app_name to be ACTIVE" + sleep 15 + continue + fi +done +} +export -f after_update_actions + +# Determine what all the required information for the App to update, check it and execute the update using the SCALE API +executeUpdate(){ + app_name=$(echo "$1" | awk -F ',' '{print $1}') #print out first catagory, name. + old_app_ver=$(echo "$1" | awk -F ',' '{print $4}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #previous/current Application MAJOR Version + new_app_ver=$(echo "$1" | awk -F ',' '{print $5}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #new Application MAJOR Version + old_chart_ver=$(echo "$1" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}' | awk -F '.' '{print $1}') # Old Chart MAJOR version + new_chart_ver=$(echo "$1" | awk -F ',' '{print $5}' | awk -F '_' '{print $2}' | awk -F '.' '{print $1}') # New Chart MAJOR version + status=$(echo "$1" | awk -F ',' '{print $2}') #status of the app: STOPPED / DEPLOYING / ACTIVE + startstatus=$status + diff_app=$(diff <(echo "$old_app_ver") <(echo "$new_app_ver")) #caluclating difference in major app versions + diff_chart=$(diff <(echo "$old_chart_ver") <(echo "$new_chart_ver")) #caluclating difference in Chart versions + old_full_ver=$(echo "$1" | awk -F ',' '{print $4}') #Upgraded From + new_full_ver=$(echo "$1" | awk -F ',' '{print $5}') #Upraded To + rollback_version=$(echo "$1" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}') + printf '%s\0' "${ignore[@]}" | grep -iFxqz "${app_name}" && echo -e "\n$app_name\nIgnored, skipping" && return #If application is on ignore list, skip + if [[ "$diff_app" == "$diff_chart" || "$update_all_apps" == "true" ]]; then #continue to update + [[ "$verbose" == "true" ]] && echo "Updating.." + # shellcheck disable=SC2015 + cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo -e "Updated $app_name\n$old_full_ver\n$new_full_ver" && after_update_actions || { echo -e "$app_name: update ${IRed}FAILED${Color_Off}"; return; } + else + echo -e "\n$app_name\nMajor Release, update manually" + return + fi +} +export -f executeUpdate diff --git a/includes/update_self.sh b/includes/update_self.sh new file mode 100755 index 00000000..7ade24e2 --- /dev/null +++ b/includes/update_self.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +## AutoUpdate TrueTool using Git +updater(){ +echo -e "${BWhite}Checking for updates...${Color_Off}" +git remote set-url origin "${targetRepo}" +BRANCH=$(git rev-parse --abbrev-ref HEAD) +git fetch -q +git update-index -q --refresh +if [[ $(git status --branch --porcelain) == *"behind"* ]]; then + echo -e "${IPurple}TrueTool requires update${Color_Off}" + git reset --hard -q + git checkout -q "${BRANCH}" + git pull -q + echo "script updated" + if [[ "$CHANGED" == "true" ]]; then + echo "LOOP DETECTED, exiting" + exit 1 + else + echo "restarting script after update..." + export CHANGED="true" + . "${SCRIPT_DIR}/truetool.sh" "$@" + exit + fi +else + echo -e "${IGreen}script up-to-date${Color_Off}" + export CHANGED="false" +fi +echo "" +} +export -f updater diff --git a/setup.py b/setup.py deleted file mode 100644 index fee39cbb..00000000 --- a/setup.py +++ /dev/null @@ -1,55 +0,0 @@ -from setuptools import setup, find_packages -from os.path import abspath, dirname, join - -# Fetches the content from README.md -# This will be used for the "long_description" field. -README_MD = open(join(dirname(abspath(__file__)), "README.md")).read() - -setup( - name="truetool", - version="3.0.3", - - # The packages that constitute your project. - # For my project, I have only one - "pydash". - # Either you could write the name of the package, or - # alternatively use setuptools.findpackages() - # - # If you only have one file, instead of a package, - # you can instead use the py_modules field instead. - # EITHER py_modules OR packages should be present. - packages=find_packages(), - - entry_points = { - 'console_scripts': ['truetool=truetool.command_line:main'], - }, - - # The description that will be shown on PyPI. - # Keep it short and concise - # This field is OPTIONAL - description="An easy utility to managed frequently used TrueNAS SCALE CLI features", - - # The content that will be shown on your project page. - # In this case, we're displaying whatever is there in our README.md file - # This field is OPTIONAL - long_description=README_MD, - - # Now, we'll tell PyPI what language our README file is in. - # In my case it is in Markdown, so I'll write "text/markdown" - # Some people use reStructuredText instead, so you should write "text/x-rst" - # If your README is just a text file, you have to write "text/plain" - # This field is OPTIONAL - long_description_content_type="text/markdown", - - # The url field should contain a link to a git repository, the project's website - # or the project's documentation. I'll leave a link to this project's Github repository. - # This field is OPTIONAL - url="https://github.com/truecharts/truetool", - - # The author name and email fields are self explanatory. - # These fields are OPTIONAL - author_name="truecharts", - author_email="into@truecharts.org", - - # For additional fields, check: - # https://github.com/pypa/sampleproject/blob/master/setup.py -) diff --git a/tests/__init__.py b/tests/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/truetool.sh b/truetool.sh new file mode 100755 index 00000000..a7cffded --- /dev/null +++ b/truetool.sh @@ -0,0 +1,166 @@ +#!/bin/bash + +# Constants +SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]:-$0}"; )" &> /dev/null && pwd 2> /dev/null; )"; +dir=$(basename "$SCRIPT_DIR") + +# Change this if you want to fork the project +enableUpdate="true" +targetRepo="https://github.com/truecharts/truetool.git" + + +# Includes +# shellcheck source=includes/backup.sh +source includes/backup.sh +# shellcheck source=includes/chores.sh +source includes/chores.sh +# shellcheck source=includes/colors.sh +source includes/colors.sh +# shellcheck source=includes/dns.sh +source includes/dns.sh +# shellcheck source=includes/help.sh +source includes/help.sh +# shellcheck source=includes/mount.sh +source includes/mount.sh +# shellcheck source=includes/no_args.sh +source includes/no_args.sh +# shellcheck source=includes/title.sh +source includes/title.sh +# shellcheck source=includes/update.sh +source includes/update.sh +# shellcheck source=includes/update_self.sh +source includes/update_self.sh + +# CD to the folder containing the script to ensure consistent runs +cd "${SCRIPT_DIR}" || echo -e "${IRed}ERROR: Something went wrong accessing the script directory${Color_Off}" + +title + +[[ "$enableUpdate" == "true" ]] && updater "$@" + +#If no argument is passed, kill the script. +if [[ -z "$*" || "-" == "$*" || "--" == "$*" ]]; then + no_args +else + + # Parse script options + while getopts ":si:b:t:uUpSv-:" opt + do + case $opt in + -) + case "${OPTARG}" in + help) + help="true" + ;; + dns) + dns="true" + ;; + mount) + mountPVC="true" + ;; + restore) + restore="true" + ;; + delete-backup) + deleteBackup="true" + ;; + list-backups) + listBackups="true" + ;; + helm-enable) + helmEnable="true" + ;; + apt-enable) + aptEnable="true" + ;; + no-color) + noColor + ;; + *) + echo -e "Invalid Option \"--$OPTARG\"\n" && help + exit + ;; + esac + ;; + \?) + echo -e "Invalid Option \"-$OPTARG\"\n" && help + exit + ;; + :) + echo -e "Option: \"-$OPTARG\" requires an argument\n" && help + exit + ;; + b) + re='^[0-9]+$' + number_of_backups=$OPTARG + ! [[ $OPTARG =~ $re ]] && echo -e "Error: -b needs to be assigned an interger\n\"""$number_of_backups""\" is not an interger" >&2 && exit + [[ "$number_of_backups" -le 0 ]] && echo "Error: Number of backups is required to be at least 1" && exit + ;; + i) + ignore+=("$OPTARG") + ;; + t) + re='^[0-9]+$' + timeout=$OPTARG + ! [[ $timeout =~ $re ]] && echo -e "Error: -t needs to be assigned an interger\n\"""$timeout""\" is not an interger" >&2 && exit + ;; + s) + sync="true" + ;; + U) + update_all_apps="true" + ;; + u) + update_apps="true" + ;; + p) + prune="true" + ;; + v) + verbose="true" + ;; + *) + echo -e "Invalid Option \"--$OPTARG\"\n" && help + exit + ;; + esac + done +fi + +## Exit if incompatable functions are called +[[ "$update_all_apps" == "true" && "$update_apps" == "true" ]] && echo -e "-U and -u cannot BOTH be called" && exit + +## Exit if unsafe combinations are used +# Restore and update right after eachother, might cause super weird issues tha are hard to bugtrace +[[ ( "$update_all_apps" == "true" || "$update_apps" == "true" ) && ( "$restore" == "true" ) ]] && echo -e "Update and Restore cannot both be done in the same run..." && exit + +# Backup Deletion is generally considered to be a "once in a while" thing and not great to sync with automated updates for that reason +[[ ( "$update_all_apps" == "true" || "$update_apps" == "true" ) && ( "$deleteBackup" == "true" ) ]] && echo -e "Update Backup-Deletion cannot both be done in the same run..." && exit + +# Backup Deletion is generally considered to be a "once in a while" thing and not great to sync with automated updates for that reason +[[ ( "$update_all_apps" == "true" || "$update_apps" == "true" ) && ( "$deleteBackup" == "true" ) ]] && echo -e "Update and Backup-Deletion cannot both be done in the same run..." && exit + +# Backup listing is a printout, which would either clutter the output or be already outdated when combined with backup +[[ ( "$update_all_apps" == "true" || "$update_apps" == "true" ) && ( "$listBackups" == "true" ) ]] && echo -e "Update and Listing Backups cannot both be done in the same run..." && exit + +# Backup backup would be done after a backup is restored, which would lead to a backup that is... the same as the one restored... +[[ ( "$restore" == "true" && "$number_of_backups" -ge 1 )]] && echo -e "Restoring a backup and making a backup cannot both be done in the same run..." && exit + +# While technically possible, this is asking for user error... where a user by habit mistakes one prompt, for the other. +[[ ( "$restore" == "true" && "$deleteBackup" == "true" )]] && echo -e "restoring a backup and deleting a backup cannot both be done in the same run..." && exit + + +# Continue to call functions in specific order +[[ "$help" == "true" ]] && help +[[ "$helmEnable" == "true" ]] && helmEnable +[[ "$aptEnable" == "true" ]] && aptEnable +[[ "$aptEnable" == "true" || "$helmEnable" == "true" ]] && exit +[[ "$listBackups" == "true" ]] && listBackups && exit +[[ "$deleteBackup" == "true" ]] && deleteBackup && exit +[[ "$dns" == "true" ]] && dns && exit +[[ "$restore" == "true" ]] && restore && exit +[[ "$mountPVC" == "true" ]] && mountPVC && exit +[[ "$number_of_backups" -ge 1 ]] && backup +[[ "$sync" == "true" ]] && sync +[[ "$update_all_apps" == "true" || "$update_apps" == "true" ]] && update_apps +[[ "$prune" == "true" ]] && prune diff --git a/truetool/__init__.py b/truetool/__init__.py deleted file mode 100644 index cb06dc45..00000000 --- a/truetool/__init__.py +++ /dev/null @@ -1,238 +0,0 @@ -import subprocess -import sys -import argparse -import time -from datetime import datetime - -class Chart(object): - def __setattr__(self, name, value): - if name == 'status': - value = value.casefold() - if 'update_available' in name: - value = True if value.casefold() == "true" else False - super(Chart, self).__setattr__(name, value) - - def new_attr(self, attr): - setattr(self, attr, attr) - -INSTALLED_CHARTS = [] - -def parse_headers(charts: str): - for line in charts.split("\n"): - if line.startswith("+-"): - continue - if "name" in line.casefold(): - return [col.strip() for col in line.casefold().strip().split("|") if col and col != ""] - -def parse_charts(charts: str): - headers = parse_headers(charts) - table_data = charts.split("\n")[3:-2:] # Skip the header part of the table - for row in table_data: - row = [section.strip() for section in row.split("|") if section and section != ""] - chart = Chart() - for item in zip(headers, row): - setattr(chart, item[0], item[1]) - INSTALLED_CHARTS.append(chart) - -def check_semver(current: str, latest: str): - split_current_semver = current.split(".", 3) - split_latest_semver = latest.split(".", 3) - if split_current_semver[0] != split_latest_semver[0]: - type="major" - if VERSIONING == "major": - return True - if split_current_semver[1] != split_latest_semver[1]: - type="minor" - if VERSIONING != "patch": - return True - if split_current_semver[2] != split_latest_semver[2]: - type="patch" - return True - return False - - -def execute_upgrades(): - if UPDATE: - if ALL: - if CATALOG == "ALL": - filtered = filter(lambda a: a.update_available, INSTALLED_CHARTS) - else: - filtered = filter(lambda a: a.update_available and a.catalog == CATALOG, INSTALLED_CHARTS) - else: - if CATALOG == "ALL": - filtered = filter(lambda a: a.update_available and a.status == "active", INSTALLED_CHARTS) - else: - filtered = filter(lambda a: a.update_available and a.status == "active" and a.catalog == CATALOG, INSTALLED_CHARTS) - for chart in filtered: - pre_update_ver = chart.human_version - post_update_ver = chart.human_latest_version - split_current_version = chart.human_version.split("_", 1) - current_version = split_current_version[1] - split_latest = chart.human_latest_version.split("_", 1) - latest_version = split_latest[1] - if check_semver(current_version, latest_version): - print(f"Updating {chart.name}... \n") - pre_update_ver = chart.human_version - result = subprocess.run(['cli', '-c', f'app chart_release upgrade release_name="{chart.name}"'], capture_output=True) - post_update_ver = chart.human_latest_version - if "Upgrade complete" not in result.stdout.decode('utf-8'): - print(f"{chart.name} failed to upgrade. \n{result.stdout.decode('utf-8')}") - else: - print(f"{chart.name} upgraded ({pre_update_ver} --> {post_update_ver})") - else: - print("Update disabled, skipping...") - -def fetch_charts(): - rawcharts = subprocess.run(["cli", "-c", "app chart_release query"], stdout=subprocess.PIPE) - charts = rawcharts.stdout.decode('utf-8') - return(charts) - -def process_args(): - global CATALOG - global VERSIONING - global SYNC - global PRUNE - global ALL - global BACKUP - global UPDATE - global RESTORE - global LIST - global DELETE - parser = argparse.ArgumentParser(description='TrueCharts CLI Tool. Warning: please do NOT combine short arguments like -ubs always use -u -b -s etc.') - parser.add_argument('-c', '--catalog', nargs='?', default='ALL', help='name of the catalog you want to process in caps. Or "ALL" to render all catalogs.') - parser.add_argument('-v', '--versioning', nargs='?', default='minor', help='Name of the versioning scheme you want to update. Options: major, minor or patch. Defaults to minor') - parser.add_argument('-b', '--backup', nargs='?', const='14', help='backup the complete Apps system prior to updates, add a number to specify the max old backups to keep') - parser.add_argument('-r', '--restore', nargs='?', help='restore a previous backup, disables all other features') - parser.add_argument('-d', '--delete', nargs='?', help='delete a specific backup') - parser.add_argument('-s', '--sync', action="store_true", help='sync catalogs before trying to update') - parser.add_argument('-u', '--update', action="store_true", help='update the Apps in the selected catalog') - parser.add_argument('-p', '--prune', action="store_true", help='prune old docker images after update') - parser.add_argument('-a', '--all', action="store_true", help='update all apps for said catalog, including "stopped" or "stuck" apps') - parser.add_argument('-l', '--list', action="store_true", help='lists existing backups') - args = parser.parse_args() - CATALOG = args.catalog - VERSIONING = args.versioning - RESTORE = args.restore - BACKUP = args.backup - DELETE = args.delete - if args.update: - UPDATE = True - else: - UPDATE = False - if args.sync: - SYNC = True - else: - SYNC = False - if args.prune: - PRUNE = True - else: - PRUNE = False - if args.all: - ALL = True - else: - ALL = False - if args.list: - LIST = True - else: - LIST = False - - -def sync_catalog(): - if SYNC: - print("Syncing Catalogs...\n") - process = subprocess.Popen(["cli", "-c", "app catalog sync_all"], stdout=subprocess.PIPE) - while process.poll() is None: - lines = process.stdout.readline() - print (lines.decode('utf-8')) - temp = process.stdout.read() - if temp: - print (temp.decode('utf-8')) - else: - print("Catalog Sync disabled, skipping...") - -def docker_prune(): - if PRUNE: - print("Pruning old docker images...\n") - process = subprocess.run(["docker", "image", "prune", "-af"], stdout=subprocess.PIPE) - print("Images pruned.\n") - else: - print("Container Image Pruning disabled, skipping...") - -def apps_backup(): - if BACKUP: - print(f"Cleaning old backups to a max. of {BACKUP}...\n") - backups_fetch = get_backups_names() - backups_cleaned = [k for k in backups_fetch if 'TrueTool' in k] - backups_remove = backups_cleaned[:len(backups_cleaned)-int(BACKUP)] - for backup in backups_remove: - backups_delete(backup) - - print("Running App Backup...\n") - now = datetime.now() - command = "app kubernetes backup_chart_releases backup_name=TrueTool_"+now.strftime("%Y_%m_%d_%H_%M_%S") - process = subprocess.Popen(["cli", "-c", command], stdout=subprocess.PIPE) - while process.poll() is None: - lines = process.stdout.readline() - print (lines.decode('utf-8')) - temp = process.stdout.read() - if temp: - print (temp.decode('utf-8')) - else: - print("Backup disabled, skipping...") - -def backups_list(): - if LIST: - print("Generating Backup list...\n") - backups = get_backups_names() - for backup in backups: - print(f"{backup}") - -def backups_delete(backup: str): - print(f"removing {backup}...") - process = subprocess.run(["midclt", "call", "kubernetes.delete_backup", backup], stdout=subprocess.PIPE) - -def get_backups_names(): - names = [] - process = subprocess.run(["cli", "-c", "app kubernetes list_backups"], stdout=subprocess.PIPE) - output = process.stdout.decode('utf-8') - for line in output.split("\n"): - if line.startswith("+-"): - continue - else: - rowlist = [col.strip() for col in line.strip().split("|") if col and col != ""] - if rowlist: - names.append(rowlist[0]) - names.sort() - return names - -def apps_restore(): - print("Running Backup Restore...\n") - process = subprocess.run(["midclt", "call", "kubernetes.restore_backup", RESTORE], stdout=subprocess.PIPE) - time.sleep(5) - print("Restoration started, please check the restoration process in the TrueNAS SCALE Web GUI...\n") - print("Please remember: This can take a LONG time.\n") - -def run(): - process_args() - print("Starting TrueCharts TrueTool...\n") - if RESTORE: - apps_restore() - elif LIST: - backups_list() - elif DELETE: - backups_delete(DELETE) - else: - apps_backup() - sync_catalog() - charts = fetch_charts() - parse_charts(charts) - print("Executing Updates...\n") - execute_upgrades() - docker_prune() - print("TrueTool Finished\n") - exit(0) - - -if __name__ == '__main__': - run() - diff --git a/truetool/command_line.py b/truetool/command_line.py deleted file mode 100644 index 33e703bc..00000000 --- a/truetool/command_line.py +++ /dev/null @@ -1,4 +0,0 @@ -import truetool - -def main(): - truetool.run() \ No newline at end of file From ff6a406fd92275cb46c35efa10475fd023a4e46e Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Tue, 14 Jun 2022 22:11:10 +0200 Subject: [PATCH 0195/1229] enable execution on new scriptfile --- includes/no_args.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 includes/no_args.sh diff --git a/includes/no_args.sh b/includes/no_args.sh old mode 100644 new mode 100755 From 5bedc2119ebbcea64aba3e50f080c9991d6e2d88 Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Tue, 14 Jun 2022 22:12:33 +0200 Subject: [PATCH 0196/1229] fix mistakes with include pathing --- truetool.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/truetool.sh b/truetool.sh index a7cffded..f7ce4b4e 100755 --- a/truetool.sh +++ b/truetool.sh @@ -8,6 +8,8 @@ dir=$(basename "$SCRIPT_DIR") enableUpdate="true" targetRepo="https://github.com/truecharts/truetool.git" +# CD to the folder containing the script to ensure consistent runs +cd "${SCRIPT_DIR}" || echo -e "ERROR: Something went wrong accessing the script directory" # Includes # shellcheck source=includes/backup.sh @@ -31,9 +33,6 @@ source includes/update.sh # shellcheck source=includes/update_self.sh source includes/update_self.sh -# CD to the folder containing the script to ensure consistent runs -cd "${SCRIPT_DIR}" || echo -e "${IRed}ERROR: Something went wrong accessing the script directory${Color_Off}" - title [[ "$enableUpdate" == "true" ]] && updater "$@" From 3833f8b67262b56ee38a988fe5c363dae8538d8d Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Tue, 14 Jun 2022 22:14:50 +0200 Subject: [PATCH 0197/1229] fix mistake in menu mapping --- includes/no_args.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/includes/no_args.sh b/includes/no_args.sh index 7db6e4a5..7bac99a0 100755 --- a/includes/no_args.sh +++ b/includes/no_args.sh @@ -14,38 +14,38 @@ no_args(){ read -rt 600 -p "Please select an option by number: " selection case $selection in - 1) + 0) help="true" ;; - 2) + 1) dns="true" ;; - 3) + 2) mountPVC="true" ;; - 4) + 3) listBackups="true" ;; - 5) + 4) read -rt 600 -p "Please type the max number of backups to keep: " backups re='^[0-9]+$' number_of_backups=$backups ! [[ $backups =~ $re ]] && echo -e "Error: -b needs to be assigned an interger\n\"""$number_of_backups""\" is not an interger" >&2 && exit [[ "$number_of_backups" -le 0 ]] && echo "Error: Number of backups is required to be at least 1" && exit ;; - 6) + 5) restore="true" ;; - 7) + 6) deleteBackup="true" ;; - 8) + 7) helmEnable="true" ;; - 9) + 8) aptEnable="true" ;; - 10) + 9) echo "" echo "1 Update Apps Excluding likely breaking major changes" echo "2 Update Apps Including likely breaking major changes" From d5eb5ac16e8e264f01e9fd409a7fe9a21b844fb1 Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Tue, 14 Jun 2022 22:16:42 +0200 Subject: [PATCH 0198/1229] ignore some useless shellcheck feedback --- includes/no_args.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/includes/no_args.sh b/includes/no_args.sh index 7bac99a0..951f009b 100755 --- a/includes/no_args.sh +++ b/includes/no_args.sh @@ -1,4 +1,5 @@ #!/bin/bash +# shellcheck disable=SC2034 no_args(){ echo "0 Show Help" From c022f1d2aa0aecc733c403062a4cbba90e834f5f Mon Sep 17 00:00:00 2001 From: ZasX Date: Tue, 14 Jun 2022 23:02:13 +0200 Subject: [PATCH 0199/1229] Update backup.sh Fixed some kubernetes list_backups commands --- includes/backup.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/includes/backup.sh b/includes/backup.sh index 1f412c6c..bc219890 100755 --- a/includes/backup.sh +++ b/includes/backup.sh @@ -13,7 +13,7 @@ export -f listBackups deleteBackup(){ echo -e "${BWhite}Backup Deletion Tool${Color_Off}" clear -x && echo "pulling all restore points.." -list_delete_backups=$(cli -c 'app kubernetes list_delete_backups' | grep -v system-update | sort -t '_' -Vr -k2,7 | tr -d " \t\r" | awk -F '|' '{print $2}' | nl | column -t) +list_delete_backups=$(cli -c 'app kubernetes list_backups' | grep -v system-update | sort -t '_' -Vr -k2,7 | tr -d " \t\r" | awk -F '|' '{print $2}' | nl | column -t) clear -x # shellcheck disable=SC2015 [[ -z "$list_delete_backups" ]] && echo -e "${IRed}No restore points available${Color_Off}" && exit || { title; echo -e "Choose a restore point to delete\nThese may be out of order if they are not TrueTool backups" ; } @@ -42,12 +42,12 @@ echo -e "\nNumber of backups was set to $number_of_backups" date=$(date '+%Y_%m_%d_%H_%M_%S') [[ "$verbose" == "true" ]] && cli -c 'app kubernetes backup_chart_releases backup_name=''"'TrueTool_"$date"'"' [[ -z "$verbose" ]] && echo -e "\nNew Backup Name:" && cli -c 'app kubernetes backup_chart_releases backup_name=''"'TrueTool_"$date"'"' | tail -n 1 -mapfile -t list_create_backups < <(cli -c 'app kubernetes list_create_backups' | grep 'HeavyScript\|TrueTool_' | sort -t '_' -Vr -k2,7 | awk -F '|' '{print $2}'| tr -d " \t\r") +mapfile -t list_create_backups < <(cli -c 'app kubernetes list_backups' | grep 'HeavyScript\|TrueTool_' | sort -t '_' -Vr -k2,7 | awk -F '|' '{print $2}'| tr -d " \t\r") # shellcheck disable=SC2309 if [[ ${#list_create_backups[@]} -gt "number_of_backups" ]]; then echo -e "\nDeleting the oldest backup(s) for exceeding limit:" overflow=$(( ${#list_create_backups[@]} - "$number_of_backups" )) - mapfile -t list_overflow < <(cli -c 'app kubernetes list_create_backups' | grep "TrueTool_" | sort -t '_' -V -k2,7 | awk -F '|' '{print $2}'| tr -d " \t\r" | head -n "$overflow") + mapfile -t list_overflow < <(cli -c 'app kubernetes list_backups' | grep "TrueTool_" | sort -t '_' -V -k2,7 | awk -F '|' '{print $2}'| tr -d " \t\r" | head -n "$overflow") for i in "${list_overflow[@]}" do cli -c 'app kubernetes delete_backup backup_name=''"'"$i"'"' &> /dev/null || echo "${IRed}FAILED${Color_Off} to delete $i" @@ -61,7 +61,7 @@ export -f backup restore(){ echo -e "${BWhite}Backup Restoration Tool${Color_Off}" clear -x && echo "pulling restore points.." -list_restore_backups=$(cli -c 'app kubernetes list_restore_backups' | grep "TrueTool_" | sort -t '_' -Vr -k2,7 | tr -d " \t\r" | awk -F '|' '{print $2}' | nl | column -t) +list_restore_backups=$(cli -c 'app kubernetes list_backups' | grep "TrueTool_" | sort -t '_' -Vr -k2,7 | tr -d " \t\r" | awk -F '|' '{print $2}' | nl | column -t) clear -x # shellcheck disable=SC2015 [[ -z "$list_restore_backups" ]] && echo "No TrueTool restore points available" && exit || { title; echo "Choose a restore point" ; } From 4fa845679e1b0c3d33ef503a148bc0c0d5380600 Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Wed, 15 Jun 2022 00:16:49 +0200 Subject: [PATCH 0200/1229] shuffle things to allow for no-color fix to apply correctly --- truetool.sh | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/truetool.sh b/truetool.sh index f7ce4b4e..a4881eb3 100755 --- a/truetool.sh +++ b/truetool.sh @@ -33,13 +33,9 @@ source includes/update.sh # shellcheck source=includes/update_self.sh source includes/update_self.sh -title - -[[ "$enableUpdate" == "true" ]] && updater "$@" - -#If no argument is passed, kill the script. +#If no argument is passed, set flag to show menu if [[ -z "$*" || "-" == "$*" || "--" == "$*" ]]; then - no_args + no_args="true" else # Parse script options @@ -126,6 +122,15 @@ else done fi +title + +[[ "$enableUpdate" == "true" ]] && updater "$@" + +#If no argument is passed, set flag to show menu +if [[ "$no_args" == "true" ]]; then + no_args +fi + ## Exit if incompatable functions are called [[ "$update_all_apps" == "true" && "$update_apps" == "true" ]] && echo -e "-U and -u cannot BOTH be called" && exit From ca455cd9a5f916731f85fea9c5200d0a6e9fb440 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 14 Jun 2022 23:28:13 +0000 Subject: [PATCH 0201/1229] cleanup add git reset in the event a user chmod +x the script. remove continue from if statement.. it didn't do anything --- heavy_script.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index f8d87e8c..e0ae0adb 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -14,13 +14,14 @@ git fetch &> /dev/null [[ -n $(git diff --name-only origin/main | grep $SCRIPTNAME) ]] && { echo "Found a new version of HeavyScript, updating myself..." - git pull --force &> /dev/null + git reset --hard -q + git pull --force -q echo -e "Running the new version...\n" count=0 for i in "${args[@]}" do - [[ "$i" == "--self-update" ]] && unset "args[$count]" && break - ((count++)) + [[ "$i" == "--self-update" ]] && unset "args[$count]" && break + ((count++)) done sleep 5 exec bash "$SCRIPTNAME" "${args[@]}" @@ -57,7 +58,7 @@ echo "Examples" echo "bash heavy_script.sh -b 14 -i portainer -i arch -i sonarr -i radarr -t 600 -vrsUp" echo "bash /mnt/tank/scripts/heavy_script.sh -t 150 --mount" echo "bash /mnt/tank/scripts/heavy_script.sh --dns" -echo "bash /mnt/tank/scripts/heavy_script.sh --restore" +echo "bash --restore" echo "bash /mnt/tank/scripts/heavy_script.sh --delete-backup" echo exit @@ -267,7 +268,7 @@ do else #user must not be using -S, just update echo -e "\n$app_name" [[ "$verbose" == "true" ]] && echo "Updating.." - cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo -e "Updated\n$old_full_ver\n$new_full_ver" && after_update_actions || { echo "FAILED"; continue; } + cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo -e "Updated\n$old_full_ver\n$new_full_ver" && after_update_actions || echo "FAILED" fi else echo -e "\n$app_name\nMajor Release, update manually" From c04f9aa26146d768969d7e3a520b0d4ece51d0f8 Mon Sep 17 00:00:00 2001 From: StevenMcElligott <89483932+StevenMcElligott@users.noreply.github.com> Date: Tue, 14 Jun 2022 22:37:50 -0400 Subject: [PATCH 0202/1229] Removing -r from the README Fixed a couple of small details --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 93789fbe..60f50274 100644 --- a/README.md +++ b/README.md @@ -82,7 +82,7 @@ Here, we will update the script prior to running it, incase there is a bugfix, o **Cron Job Command** ``` -bash /mnt/pool/scripts/truetool/truetool.sh -b 14 -rsup +bash /mnt/pool/scripts/truetool/truetool.sh -b 14 -sup ```
@@ -99,7 +99,7 @@ bash /mnt/pool/scripts/truetool/truetool.sh -b 14 -rsup | Name | Value | Reason | |------------------------ |------------------------------------------------------------------------------------------------------------------- |------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `Description` | TrueTool Update apps | This is up to you, put whatever you think is a good description in here | -| `Command` | `bash /PATH/TO/truetool_DIRECTORY/truetool.sh --no-color -b 14 -sup` | This is the command you will be running on your schedule, example: `bash /mnt/speed/scripts/truetool/truetool.sh -b 14 -rsup` | +| `Command` | `bash /PATH/TO/truetool_DIRECTORY/truetool.sh --no-color -b 14 -sup` | This is the command you will be running on your schedule, example: `bash /mnt/speed/scripts/truetool/truetool.sh -b 14 -sup` | | `Run As User` | `root` | Running the script as `root` is REQUIRED. You cannot access all of the kubernetes functions without this user. | | `Schedule` | Up to you, example: `0400` | Again up to you | | `Hide Standard Output` | `False` or Unticked | It's best to keep an eye on updates and enable this to recieve email reports | From 4bcd059b40fe36666f5160199aaaaf3f7df16e2b Mon Sep 17 00:00:00 2001 From: Stavros kois Date: Thu, 16 Jun 2022 13:09:40 +0300 Subject: [PATCH 0203/1229] Update wording and formatting --- README.md | 77 +++++++++++++++++++++++++++---------------------------- 1 file changed, 38 insertions(+), 39 deletions(-) diff --git a/README.md b/README.md index 60f50274..ffdd3541 100644 --- a/README.md +++ b/README.md @@ -14,54 +14,55 @@ A easy tool for frequently used TrueNAS SCALE CLI utilities. ## Synopsis -TrueTool is a commandline tool, designed to enable some features of TrueNAS SCALE that are either not-enabled by default or not-available in the Web-GUI. +TrueTool is a command line tool, designed to enable some features of TrueNAS SCALE that are either not-enabled by default or not-available in the Web-GUI. It also offers a few handy shortcuts for commonly required chores, like: Enabling Apt or Helm ## Arguments -| Flag | Example | Parameter | Description | -|----------------- |------------------------ |----------- |--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| --delete-backup | --delete-backup | None | Opens a menu to delete backups
_Useful if you need to delete old system backups or backups from other scripts_ | -| --restore | --restore | None | Restore TrueTool specific `ix-applications dataset` snapshot | -| --mount | --mount | None | Initiates mounting feature
Choose between unmounting and mounting PVC data | -| --dns | --dns | None | list all of your applications DNS names and their web ports -| --list-backups | --list-backups | None | Prints a list of backups available -| --helm-enable | --helm-enable | None | Enables Helm command access on SCALE -| --apt-enable | --apt-enable | None | Enables Apt command access on SCALE -| --no-color | --no-color | None | Disables showing colors in terminal output, usefull for SCALE Email output -| -U | -U | None | Update applications, ignoring major version changes | -| -u | -u | None | Update applications, do NOT update if there was a major version change | -| -b | -b 14 | Integer | Backup `ix-appliactions` dataset
_Creates backups up to the number you've chosen_ | -| -i | -i nextcloud -i sonarr | String | Applications listed will be ignored during updating
_List one application after another as shown in the example_ | -| -v | -v | None | Verbose Output
_Look at the bottom of this page for an example_ | -| -t | -t 150 | Integer | Set a custom timeout to be used with either:
`-m`
_Time the script will wait for application to be "STOPPED"_
or
`-(u\|U)`
_Time the script will wait for application to be either "STOPPED" or "ACTIVE"_ | -| -s | -s | None | Sync Catalogs prior to updating | -| -p | -p | None | Prune old/unused docker images | - +| Flag | Example | Parameter | Description | +| --------------- | ---------------------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| --delete-backup | --delete-backup | None | Opens a menu to delete backups
_Useful if you need to delete old system backups or backups from other scripts_ | +| --restore | --restore | None | Restore TrueTool specific `ix-applications dataset` snapshot | +| --mount | --mount | None | Initiates mounting feature
Choose between unmounting and mounting PVC data | +| --dns | --dns | None | list all of your applications DNS names and their web ports | +| --list-backups | --list-backups | None | Prints a list of backups available | +| --helm-enable | --helm-enable | None | Enables Helm command access on SCALE | +| --apt-enable | --apt-enable | None | Enables Apt command access on SCALE | +| --no-color | --no-color | None | Disables showing colors in terminal output, usefull for SCALE Email output | +| -U | -U | None | Update applications, ignoring major version changes | +| -u | -u | None | Update applications, do NOT update if there was a major version change | +| -b | -b 14 | Integer | Backup `ix-appliactions` dataset
_Creates backups up to the number you've chosen_ | +| -i | -i nextcloud -i sonarr | String | Applications listed will be ignored during updating
_List one application after another as shown in the example_ | +| -v | -v | None | Verbose Output
_Look at the bottom of this page for an example_ | +| -t | -t 150 | Integer | Set a custom timeout to be used with either:
`-m`
_Time the script will wait for application to be "STOPPED"_
or
`-(u\|U)`
_Time the script will wait for application to be either "STOPPED" or "ACTIVE"_ | +| -s | -s | None | Sync Catalogs prior to updating | +| -p | -p | None | Prune old/unused docker images |

- ## How to Install ### Create a Scripts Dataset -In this example we created a `scripts` dataset on the Truenas SCALE system, feel free to use another folder. +In this example we created a `scripts` dataset on the TrueNAS SCALE system, feel free to use another folder. ### Open a Terminal **Change Directory to your scripts folder** + ``` cd /mnt/pool/scripts ``` **Git Clone truetool** + ``` git clone https://github.com/truecharts/truetool.git ``` **Change Directory to truetool folder** + ``` cd truetool ``` @@ -76,11 +77,12 @@ TrueTool updates itself automatically.
-### Update with your Cron Job +### Update apps with on a schedule -Here, we will update the script prior to running it, incase there is a bugfix, or any new additions to the script +Here, we will update the apps using a cronjob **Cron Job Command** + ``` bash /mnt/pool/scripts/truetool/truetool.sh -b 14 -sup ``` @@ -96,34 +98,31 @@ bash /mnt/pool/scripts/truetool/truetool.sh -b 14 -sup 4. Cron Jobs 1. Click Add -| Name | Value | Reason | -|------------------------ |------------------------------------------------------------------------------------------------------------------- |------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `Description` | TrueTool Update apps | This is up to you, put whatever you think is a good description in here | -| `Command` | `bash /PATH/TO/truetool_DIRECTORY/truetool.sh --no-color -b 14 -sup` | This is the command you will be running on your schedule, example: `bash /mnt/speed/scripts/truetool/truetool.sh -b 14 -sup` | -| `Run As User` | `root` | Running the script as `root` is REQUIRED. You cannot access all of the kubernetes functions without this user. | -| `Schedule` | Up to you, example: `0400` | Again up to you | -| `Hide Standard Output` | `False` or Unticked | It's best to keep an eye on updates and enable this to recieve email reports | -| `Hide Standard Error` | `False` or Unticked | We definately want to see what errors occured during updating | -| `Enabled` | `True` or Ticked | This will Enable the script to run on your schedule | - - +| Name | Value | Reason | +| ---------------------- | -------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | +| `Description` | TrueTool Update apps | This is up to you, put whatever you think is a good description in here | +| `Command` | `bash /PATH/TO/truetool_DIRECTORY/truetool.sh --no-color -b 14 -sup` | This is the command you will be running on your schedule, example: `bash /mnt/speed/scripts/truetool/truetool.sh -b 14 -sup` | +| `Run As User` | `root` | Running the script as `root` is REQUIRED. You cannot access all of the kubernetes functions without this user. | +| `Schedule` | Up to you, example: `0400` | Again up to you | +| `Hide Standard Output` | `False` or Un-ticked | It's best to keep an eye on updates and enable this to receive email reports | +| `Hide Standard Error` | `False` or Un-ticked | We definitely want to see what errors occurred during updating | +| `Enabled` | `True` or Ticked | This will Enable the script to run on your schedule |

### Additional Information - #### TrueTool vs HeavyScript TrueTool and HeavyScript are based, in essence, based on the the original (python based) TrueUpdate and TrueTool. Then Support-Manager for TrueCharts, HeavyBullets8, ported this to Bash and started adding some additional logic and options for tasks we frequently needed our users to do, such as mounting PVC's. -After a month or so, the TrueCharts Team officially started refactoring this expanded bash-port. Due to personal reasons, HeavyBullets by then decided to seperate from TrueCharts after merging the TrueCharts refactor into his own work. The beauty of OpenSource. +After a month or so, the TrueCharts Team officially started refactoring this expanded bash-port. Due to personal reasons, HeavyBullets by then decided to separate from TrueCharts after merging the TrueCharts refactor into his own work. The beauty of OpenSource. From this point onwards the HeavyScript and TrueTool diverged a bit. -We internally review changes within our staff team, to verify we somewhat stick to best-practices. This means, in some cases, we decided not to port certain features from HeavyScript and did decide to add features we think are usefull and safe. +We internally review changes within our staff team, to verify we somewhat stick to best-practices. This means, in some cases, we decided not to port certain features from HeavyScript and did decide to add features we think are useful and safe. But this also means we can give guarantees TrueTool works optimally with our Catalog of TrueNAS SCALE Apps, as well as official Apps. Users from HeavyScript can safely start using TrueTool, as we've made precautions to ensure the backups take over smoothly. -We, however, do *not* advice using HeavyScript with TrueCharts Apps. Not because it's a bad App, but because we offer an alternative that is validated by our Staff. +We, however, do _not_ advice using HeavyScript with TrueCharts Apps. Not because it's a bad App, but because we offer an alternative that is validated by our Staff. From 73839cb0e1c4cf89ddb896e467f30e0802da15c0 Mon Sep 17 00:00:00 2001 From: Stavros kois Date: Thu, 16 Jun 2022 13:13:28 +0300 Subject: [PATCH 0204/1229] update --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ffdd3541..a711ad71 100644 --- a/README.md +++ b/README.md @@ -79,7 +79,7 @@ TrueTool updates itself automatically. ### Update apps with on a schedule -Here, we will update the apps using a cronjob +You can update your apps automatically using a cronjob **Cron Job Command** From c67849a3939b5a35200ac21daf0be0a614629191 Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Thu, 16 Jun 2022 12:15:31 +0200 Subject: [PATCH 0205/1229] docs changes --- README.md | 26 ++++++++++++-------------- truetool.sh | 2 +- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 93789fbe..36f877a4 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ It also offers a few handy shortcuts for commonly required chores, like: Enablin | -u | -u | None | Update applications, do NOT update if there was a major version change | | -b | -b 14 | Integer | Backup `ix-appliactions` dataset
_Creates backups up to the number you've chosen_ | | -i | -i nextcloud -i sonarr | String | Applications listed will be ignored during updating
_List one application after another as shown in the example_ | -| -v | -v | None | Verbose Output
_Look at the bottom of this page for an example_ | +| -v | -v | None | Verbose Output
_ | | -t | -t 150 | Integer | Set a custom timeout to be used with either:
`-m`
_Time the script will wait for application to be "STOPPED"_
or
`-(u\|U)`
_Time the script will wait for application to be either "STOPPED" or "ACTIVE"_ | | -s | -s | None | Sync Catalogs prior to updating | | -p | -p | None | Prune old/unused docker images | @@ -45,10 +45,20 @@ It also offers a few handy shortcuts for commonly required chores, like: Enablin ## How to Install -### Create a Scripts Dataset +### Choose a folder + +It's important to save the script in a folder that is persistent across TrueNAS System Updates. +This saves you from reinstalling or experiencing an accidental lack-of-backups after an update. + +##### New dataset In this example we created a `scripts` dataset on the Truenas SCALE system, feel free to use another folder. +##### Root folder + +The `/root` folder houses files for the root user. +It's also persistent across updates and hence can be safely used for storing the script. + ### Open a Terminal **Change Directory to your scripts folder** @@ -76,18 +86,6 @@ TrueTool updates itself automatically.
-### Update with your Cron Job - -Here, we will update the script prior to running it, incase there is a bugfix, or any new additions to the script - -**Cron Job Command** -``` -bash /mnt/pool/scripts/truetool/truetool.sh -b 14 -rsup -``` - -
-
- ## Creating a Cron Job 1. TrueNAS SCALE GUI diff --git a/truetool.sh b/truetool.sh index a4881eb3..c73b7411 100755 --- a/truetool.sh +++ b/truetool.sh @@ -126,7 +126,7 @@ title [[ "$enableUpdate" == "true" ]] && updater "$@" -#If no argument is passed, set flag to show menu +# Show menu if menu flag is set if [[ "$no_args" == "true" ]]; then no_args fi From 934cd0a89e446288e2875bdada6d581e9879b3a7 Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Thu, 16 Jun 2022 12:29:35 +0200 Subject: [PATCH 0206/1229] Create renovate.yml --- .github/workflows/renovate.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/workflows/renovate.yml diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml new file mode 100644 index 00000000..dcc72e9e --- /dev/null +++ b/.github/workflows/renovate.yml @@ -0,0 +1,18 @@ +name: Renovate +on: + workflow_dispatch: + schedule: + - cron: "0 */6 * * *" +jobs: + renovate: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2 + with: + token: ${{ secrets.BOT_TOKEN }} + - name: Self-hosted Renovate + uses: renovatebot/github-action@1a23916296098cf63a0e9571f03d52cf14d00daa # tag=v32.88.0 + with: + configurationFile: .github/renovate-config.js + token: ${{ secrets.BOT_TOKEN }} From 56dec8eba9512d25773b40c650db900d7114d282 Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Thu, 16 Jun 2022 12:31:05 +0200 Subject: [PATCH 0207/1229] Create renovate-config.js --- .github/renovate-config.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/renovate-config.js diff --git a/.github/renovate-config.js b/.github/renovate-config.js new file mode 100644 index 00000000..94f7dec2 --- /dev/null +++ b/.github/renovate-config.js @@ -0,0 +1,25 @@ +module.exports = { + dryRun: false, + username: 'truecharts-bot', + gitAuthor: 'truecharts-bot ', + onboarding: false, + platform: 'github', + repositories: [ + 'truecharts/truetool', + ], + packageRules: [ + { + description: 'lockFileMaintenance', + matchUpdateTypes: [ + 'pin', + 'digest', + 'patch', + 'minor', + 'major', + 'lockFileMaintenance', + ], + dependencyDashboardApproval: false, + stabilityDays: 0, + }, + ], +}; From 6370ffab45b5f31fdd1b59f04026c5e1833c44a0 Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Thu, 16 Jun 2022 12:31:27 +0200 Subject: [PATCH 0208/1229] Delete renovate.json --- renovate.json | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 renovate.json diff --git a/renovate.json b/renovate.json deleted file mode 100644 index f45d8f11..00000000 --- a/renovate.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "extends": [ - "config:base" - ] -} From 8d269d1138d60e6f3cf36bd3606e1a0e8610ef93 Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Thu, 16 Jun 2022 12:33:05 +0200 Subject: [PATCH 0209/1229] Create renovate.json5 --- .github/renovate.json5 | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/renovate.json5 diff --git a/.github/renovate.json5 b/.github/renovate.json5 new file mode 100644 index 00000000..788702b7 --- /dev/null +++ b/.github/renovate.json5 @@ -0,0 +1,23 @@ +{ + "semanticCommits": "enabled", + "extends": ["helpers:pinGitHubActionDigests"], + "dependencyDashboard": true, + "dependencyDashboardTitle": "Renovate Dashboard 🤖", + "suppressNotifications": ["prIgnoreNotification"], + "commitMessageTopic": "{{depName}}", + "commitMessageExtra": "to {{newVersion}}", + "commitMessageSuffix": "", + "rebaseWhen": "conflicted", + "prConcurrentLimit": 100, + "pinDigests": true, + "automerge": true, + "gitAuthor": "TrueCharts-Bot ", + "packageRules": [ + // Setup datasources for github actions + { + "matchManagers": ["github-actions"], + "commitMessageTopic": "github-action {{depName}} [skip ci]", + "automerge": true, + } + ] +} From 98c37e5df200a39c74024f4be94c6624a1cc862f Mon Sep 17 00:00:00 2001 From: TrueCharts-Bot Date: Thu, 16 Jun 2022 10:40:50 +0000 Subject: [PATCH 0210/1229] chore(deps): pin dependencies --- .github/workflows/shellcheck.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml index b8cf09dd..e4f16d76 100644 --- a/.github/workflows/shellcheck.yml +++ b/.github/workflows/shellcheck.yml @@ -10,7 +10,7 @@ jobs: name: Shellcheck runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@7884fcad6b5d53d10323aee724dc68d8b9096a2e # tag=v2 - name: Run ShellCheck uses: ludeeus/action-shellcheck@master with: @@ -21,6 +21,6 @@ jobs: pre-commit: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v3 - - uses: pre-commit/action@v3.0.0 + - uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3 + - uses: actions/setup-python@98f2ad02fd48d057ee3b4d4f66525b231c3e52b6 # tag=v3 + - uses: pre-commit/action@646c83fcd040023954eafda54b4db0192ce70507 # tag=v3.0.0 From 848d157978e981a5920f0d8fdd266cca0c6395ab Mon Sep 17 00:00:00 2001 From: TrueCharts-Bot Date: Thu, 16 Jun 2022 10:47:04 +0000 Subject: [PATCH 0211/1229] chore(deps): update github-action actions/checkout [skip ci] to v3 --- .github/workflows/shellcheck.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml index e4f16d76..f7d74e7d 100644 --- a/.github/workflows/shellcheck.yml +++ b/.github/workflows/shellcheck.yml @@ -10,7 +10,7 @@ jobs: name: Shellcheck runs-on: ubuntu-latest steps: - - uses: actions/checkout@7884fcad6b5d53d10323aee724dc68d8b9096a2e # tag=v2 + - uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3 - name: Run ShellCheck uses: ludeeus/action-shellcheck@master with: From 1a121aed126c2a42512196223a7e8e49fef31318 Mon Sep 17 00:00:00 2001 From: TrueCharts-Bot Date: Thu, 16 Jun 2022 10:47:07 +0000 Subject: [PATCH 0212/1229] chore(deps): update github-action actions/setup-python [skip ci] to v4 --- .github/workflows/shellcheck.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml index e4f16d76..9cd261f4 100644 --- a/.github/workflows/shellcheck.yml +++ b/.github/workflows/shellcheck.yml @@ -22,5 +22,5 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3 - - uses: actions/setup-python@98f2ad02fd48d057ee3b4d4f66525b231c3e52b6 # tag=v3 + - uses: actions/setup-python@d09bd5e6005b175076f227b13d9730d56e9dcfcb # tag=v4 - uses: pre-commit/action@646c83fcd040023954eafda54b4db0192ce70507 # tag=v3.0.0 From 78d6ab6b63292ec8309db7c2b2166ae40bdc6022 Mon Sep 17 00:00:00 2001 From: NeoToxic Date: Thu, 16 Jun 2022 15:23:49 +0200 Subject: [PATCH 0213/1229] Update help.sh --- includes/help.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/help.sh b/includes/help.sh index 5b778c75..28258c9d 100755 --- a/includes/help.sh +++ b/includes/help.sh @@ -23,7 +23,7 @@ echo "-s | sync catalog" echo "-p | Prune unused/old docker images" echo echo -e "${BWhite}Examples${Color_Off}" -echo "bash truetool.sh -b 14 -i portainer -i arch -i sonarr -i radarr -t 600 -vrsUp" +echo "bash truetool.sh -b 14 -i portainer -i arch -i sonarr -i radarr -t 600 -vsUp" echo "bash /mnt/tank/scripts/truetool.sh -t 150 --mount" echo "bash /mnt/tank/scripts/truetool.sh --dns" echo "bash /mnt/tank/scripts/truetool.sh --restore" From f373911c320a438479dd9a31653857f541ff242c Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Thu, 16 Jun 2022 21:12:45 +0200 Subject: [PATCH 0214/1229] Revert "chore(deps): update github-action actions/setup-python [skip ci] to v4" --- .github/workflows/shellcheck.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml index e2464a82..f7d74e7d 100644 --- a/.github/workflows/shellcheck.yml +++ b/.github/workflows/shellcheck.yml @@ -22,5 +22,5 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3 - - uses: actions/setup-python@d09bd5e6005b175076f227b13d9730d56e9dcfcb # tag=v4 + - uses: actions/setup-python@98f2ad02fd48d057ee3b4d4f66525b231c3e52b6 # tag=v3 - uses: pre-commit/action@646c83fcd040023954eafda54b4db0192ce70507 # tag=v3.0.0 From b35c7724a48b75d2d851f54bdab3b05df8ba2301 Mon Sep 17 00:00:00 2001 From: TrueCharts-Bot Date: Fri, 17 Jun 2022 00:29:35 +0000 Subject: [PATCH 0215/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.89.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index dcc72e9e..86f683e7 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@1a23916296098cf63a0e9571f03d52cf14d00daa # tag=v32.88.0 + uses: renovatebot/github-action@60e6246511c9ab719773841d0be1b7c44f388a19 # tag=v32.89.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 72ec7013e42eba29d3596c6f9235ce221dbaa7c9 Mon Sep 17 00:00:00 2001 From: TrueCharts-Bot Date: Fri, 17 Jun 2022 18:08:22 +0000 Subject: [PATCH 0216/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.89.1 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 86f683e7..49407759 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@60e6246511c9ab719773841d0be1b7c44f388a19 # tag=v32.89.0 + uses: renovatebot/github-action@487909a67560ceb4779f9e7707eb77a0649da6d5 # tag=v32.89.1 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 84d9b0620ac245c66e172f20fb7ea81a14c38c71 Mon Sep 17 00:00:00 2001 From: TrueCharts-Bot Date: Sun, 19 Jun 2022 06:08:29 +0000 Subject: [PATCH 0217/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.90.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 49407759..f0bf1359 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@487909a67560ceb4779f9e7707eb77a0649da6d5 # tag=v32.89.1 + uses: renovatebot/github-action@5eb9afcf82a6989e754f020f0558c8c5d4e572b2 # tag=v32.90.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From bbdf8d53c7375912e0d8704999f6f3f279851713 Mon Sep 17 00:00:00 2001 From: TrueCharts-Bot Date: Tue, 21 Jun 2022 00:36:33 +0000 Subject: [PATCH 0218/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.91.1 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index f0bf1359..64f92e33 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@5eb9afcf82a6989e754f020f0558c8c5d4e572b2 # tag=v32.90.0 + uses: renovatebot/github-action@0a6d27f663f95dc81120fffc750dd968394e2845 # tag=v32.91.1 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 8b4fcab2a32c51a8ca23006f0b4b92ab3cdc9bf3 Mon Sep 17 00:00:00 2001 From: TrueCharts-Bot Date: Tue, 21 Jun 2022 18:07:34 +0000 Subject: [PATCH 0219/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.92.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 64f92e33..b21ce456 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@0a6d27f663f95dc81120fffc750dd968394e2845 # tag=v32.91.1 + uses: renovatebot/github-action@d1f9e6051ce43ea9d187d6e6c1077c3e69c51abe # tag=v32.92.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From b9eedafcc2f7c7611e675216c1b871ea5f5f361b Mon Sep 17 00:00:00 2001 From: TrueCharts-Bot Date: Wed, 22 Jun 2022 12:12:55 +0000 Subject: [PATCH 0220/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.92.1 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index b21ce456..86487d7f 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@d1f9e6051ce43ea9d187d6e6c1077c3e69c51abe # tag=v32.92.0 + uses: renovatebot/github-action@9c151fee146a65ae80c329a630d23b2f14b82ae8 # tag=v32.92.1 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 61b8ab3444c9f72f76de11b8f0d6d3f61ddc0956 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 22 Jun 2022 22:33:34 -0600 Subject: [PATCH 0221/1229] Typo in --help --- heavy_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index e0ae0adb..3da300dd 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -58,7 +58,7 @@ echo "Examples" echo "bash heavy_script.sh -b 14 -i portainer -i arch -i sonarr -i radarr -t 600 -vrsUp" echo "bash /mnt/tank/scripts/heavy_script.sh -t 150 --mount" echo "bash /mnt/tank/scripts/heavy_script.sh --dns" -echo "bash --restore" +echo "bash heavy_script.sh --restore" echo "bash /mnt/tank/scripts/heavy_script.sh --delete-backup" echo exit From 14807a999b99dc9c2d27a5da88df6818f192c6d0 Mon Sep 17 00:00:00 2001 From: TrueCharts-Bot Date: Thu, 23 Jun 2022 06:08:40 +0000 Subject: [PATCH 0222/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.94.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 86487d7f..1f27869f 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@9c151fee146a65ae80c329a630d23b2f14b82ae8 # tag=v32.92.1 + uses: renovatebot/github-action@9e6190d6bf439fc11beaa479a92357f7de1d2b40 # tag=v32.94.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From e11b8ec85794fafb49bdc3825da7984153b78b11 Mon Sep 17 00:00:00 2001 From: TrueCharts-Bot Date: Fri, 24 Jun 2022 12:11:43 +0000 Subject: [PATCH 0223/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.96.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 1f27869f..32939ac7 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@9e6190d6bf439fc11beaa479a92357f7de1d2b40 # tag=v32.94.0 + uses: renovatebot/github-action@7669f209b1c4c8fd9a6179f65d51cccffcd6a891 # tag=v32.96.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From aaf6f387409cd32d7380b42809d3f874bffe7756 Mon Sep 17 00:00:00 2001 From: TrueCharts-Bot Date: Sat, 25 Jun 2022 00:35:50 +0000 Subject: [PATCH 0224/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.97.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 32939ac7..2ff6649e 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@7669f209b1c4c8fd9a6179f65d51cccffcd6a891 # tag=v32.96.0 + uses: renovatebot/github-action@2d52a00b5b74cb6b17f101f9abc454088fe84222 # tag=v32.97.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 117cbd48e5935243a632ef36b60dc44bde13c0f8 Mon Sep 17 00:00:00 2001 From: TrueCharts-Bot Date: Sun, 26 Jun 2022 00:39:47 +0000 Subject: [PATCH 0225/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.99.1 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 2ff6649e..3f1144f2 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@2d52a00b5b74cb6b17f101f9abc454088fe84222 # tag=v32.97.0 + uses: renovatebot/github-action@654ee867b7395d3386cc18b97ec16abbb88dced2 # tag=v32.99.1 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 2703a7c19f49fdfcc5ef46353ce3af1c804ca99e Mon Sep 17 00:00:00 2001 From: TrueCharts-Bot Date: Sun, 26 Jun 2022 18:07:37 +0000 Subject: [PATCH 0226/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.99.5 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 3f1144f2..b171a95c 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@654ee867b7395d3386cc18b97ec16abbb88dced2 # tag=v32.99.1 + uses: renovatebot/github-action@1776c11c201a779c37b88719482e54f39444c114 # tag=v32.99.5 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 341190139796d77f51bc46ef95118aea6eb64ad7 Mon Sep 17 00:00:00 2001 From: TrueCharts-Bot Date: Wed, 29 Jun 2022 00:34:29 +0000 Subject: [PATCH 0227/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.99.9 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index b171a95c..0f5e60b2 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@1776c11c201a779c37b88719482e54f39444c114 # tag=v32.99.5 + uses: renovatebot/github-action@b1441cc761b1eea5570b75e3c24e15fb4bed097b # tag=v32.99.9 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 853304ea27f103096d36c82efc374607b41725e2 Mon Sep 17 00:00:00 2001 From: TrueCharts-Bot Date: Thu, 30 Jun 2022 06:08:45 +0000 Subject: [PATCH 0228/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.100.1 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 0f5e60b2..6c870abb 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@b1441cc761b1eea5570b75e3c24e15fb4bed097b # tag=v32.99.9 + uses: renovatebot/github-action@ddc6482068a73bf2b3c10834601dca55208868c4 # tag=v32.100.1 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 66ae041dc6d99cdb09e99773defe2f88c3db4eee Mon Sep 17 00:00:00 2001 From: TrueCharts-Bot Date: Thu, 30 Jun 2022 18:08:25 +0000 Subject: [PATCH 0229/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.100.3 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 6c870abb..a9a4403c 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@ddc6482068a73bf2b3c10834601dca55208868c4 # tag=v32.100.1 + uses: renovatebot/github-action@73b3b4d823f73b91f7d713b588a265705ac77d8e # tag=v32.100.3 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 80fd8fc1e1052b17caa0950a82f1b0da9e09c633 Mon Sep 17 00:00:00 2001 From: TrueCharts-Bot Date: Fri, 1 Jul 2022 12:12:49 +0000 Subject: [PATCH 0230/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.100.4 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index a9a4403c..db8320d3 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@73b3b4d823f73b91f7d713b588a265705ac77d8e # tag=v32.100.3 + uses: renovatebot/github-action@272c0a666a2d813b7c4c83e56d4fcd85bdd30ee5 # tag=v32.100.4 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From d5ed1c9041bc9dfe702bdf1bcb3632d6b716d2ff Mon Sep 17 00:00:00 2001 From: TrueCharts-Bot Date: Sat, 2 Jul 2022 00:37:30 +0000 Subject: [PATCH 0231/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.102.2 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index db8320d3..eb5c7106 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@272c0a666a2d813b7c4c83e56d4fcd85bdd30ee5 # tag=v32.100.4 + uses: renovatebot/github-action@43673d7b5a65e8db78c8a266e042530c7ecfa292 # tag=v32.102.2 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 5718512236ec1b664e12783c1619b2daa8ba7277 Mon Sep 17 00:00:00 2001 From: TrueCharts-Bot Date: Sat, 2 Jul 2022 18:07:55 +0000 Subject: [PATCH 0232/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.103.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index eb5c7106..a6bb170c 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@43673d7b5a65e8db78c8a266e042530c7ecfa292 # tag=v32.102.2 + uses: renovatebot/github-action@d08ab462384dac1c9b93e4a7c5acc0be37e4996e # tag=v32.103.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 4eb62a03aaa6d431dc41eaa1cb2ce239dd818c42 Mon Sep 17 00:00:00 2001 From: TrueCharts-Bot Date: Sun, 3 Jul 2022 06:09:07 +0000 Subject: [PATCH 0233/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.103.2 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index a6bb170c..eb21b5a7 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@d08ab462384dac1c9b93e4a7c5acc0be37e4996e # tag=v32.103.0 + uses: renovatebot/github-action@4f82b503174aac54081febb4db084b2381b34aa0 # tag=v32.103.2 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 4fa231974406b9f1cf74b54d4fd80fca6df43204 Mon Sep 17 00:00:00 2001 From: TrueCharts-Bot Date: Sun, 3 Jul 2022 18:07:56 +0000 Subject: [PATCH 0234/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.103.3 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index eb21b5a7..2964b627 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@4f82b503174aac54081febb4db084b2381b34aa0 # tag=v32.103.2 + uses: renovatebot/github-action@4174dae1307f2b87b6bffedd04ee728d298dcc65 # tag=v32.103.3 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From e958721d73378904cefb3121779334b60fe48612 Mon Sep 17 00:00:00 2001 From: TrueCharts-Bot Date: Mon, 4 Jul 2022 06:13:04 +0000 Subject: [PATCH 0235/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.105.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 2964b627..8c9e8a86 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@4174dae1307f2b87b6bffedd04ee728d298dcc65 # tag=v32.103.3 + uses: renovatebot/github-action@c749caf81d7f7041c866d6321ae046d846cfc26b # tag=v32.105.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 9abd14c628fa78d1f5320587acab26ab46c0bd04 Mon Sep 17 00:00:00 2001 From: TrueCharts-Bot Date: Wed, 6 Jul 2022 06:09:31 +0000 Subject: [PATCH 0236/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.105.1 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 8c9e8a86..5c8c3479 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@c749caf81d7f7041c866d6321ae046d846cfc26b # tag=v32.105.0 + uses: renovatebot/github-action@16a202b182fa53a1f7cbb7c4fb1f9409ca0edb02 # tag=v32.105.1 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 3f4ece0859c477667a66d09b3459ccf8e72acaac Mon Sep 17 00:00:00 2001 From: TrueCharts-Bot Date: Wed, 6 Jul 2022 18:08:12 +0000 Subject: [PATCH 0237/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.105.2 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 5c8c3479..e037d673 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@16a202b182fa53a1f7cbb7c4fb1f9409ca0edb02 # tag=v32.105.1 + uses: renovatebot/github-action@51a80842596649313fe1034b2f9756d09270880d # tag=v32.105.2 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 0246e170eb9106572439825f2aedaf94516f4107 Mon Sep 17 00:00:00 2001 From: TrueCharts-Bot Date: Thu, 7 Jul 2022 06:08:53 +0000 Subject: [PATCH 0238/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.105.4 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index e037d673..16c94635 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@51a80842596649313fe1034b2f9756d09270880d # tag=v32.105.2 + uses: renovatebot/github-action@25b1ab6b1dcd02233fe9b791e2680819dc645fd7 # tag=v32.105.4 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From d8d05b8122ddcdc4fb8abd0ad37c0dcbf995d307 Mon Sep 17 00:00:00 2001 From: TrueCharts-Bot Date: Fri, 8 Jul 2022 06:09:34 +0000 Subject: [PATCH 0239/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.107.1 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 16c94635..bc455a03 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@25b1ab6b1dcd02233fe9b791e2680819dc645fd7 # tag=v32.105.4 + uses: renovatebot/github-action@616b098440386a76a03f6fed10354fb9624b8ad1 # tag=v32.107.1 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From d30d4d8f78b7d9d0e472003481581f20f51b7246 Mon Sep 17 00:00:00 2001 From: TrueCharts-Bot Date: Sat, 9 Jul 2022 00:30:39 +0000 Subject: [PATCH 0240/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.107.2 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index bc455a03..cbdbe14c 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@616b098440386a76a03f6fed10354fb9624b8ad1 # tag=v32.107.1 + uses: renovatebot/github-action@6516337de4bcce0ba5d46b65d542209ac1b74915 # tag=v32.107.2 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 865ef5fcdec1a2261cb447c3290f7a9dc8a41a83 Mon Sep 17 00:00:00 2001 From: TrueCharts-Bot Date: Sat, 9 Jul 2022 18:07:22 +0000 Subject: [PATCH 0241/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.108.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index cbdbe14c..468d8796 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@6516337de4bcce0ba5d46b65d542209ac1b74915 # tag=v32.107.2 + uses: renovatebot/github-action@2a81d17e1c989bec12a56aa2095dbdf2dabd40f4 # tag=v32.108.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 65172ae265e574e9956b68f7af83495e2d511ca3 Mon Sep 17 00:00:00 2001 From: TrueCharts-Bot Date: Mon, 11 Jul 2022 00:35:29 +0000 Subject: [PATCH 0242/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.109.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 468d8796..fb8039f0 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@2a81d17e1c989bec12a56aa2095dbdf2dabd40f4 # tag=v32.108.0 + uses: renovatebot/github-action@c1b3632b738575a7bcb361764ae5f82786438d45 # tag=v32.109.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From c1bbf8a0b16417a2787356648b92d5c6c56c1424 Mon Sep 17 00:00:00 2001 From: TrueCharts-Bot Date: Tue, 12 Jul 2022 06:12:07 +0000 Subject: [PATCH 0243/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.110.2 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index fb8039f0..4b0d1b1e 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@c1b3632b738575a7bcb361764ae5f82786438d45 # tag=v32.109.0 + uses: renovatebot/github-action@044d6ea093bf9cbc4c8b19321cfd885fd605ba8d # tag=v32.110.2 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From b58473b985742630114b49b1e74209593efd414e Mon Sep 17 00:00:00 2001 From: TrueCharts-Bot Date: Wed, 13 Jul 2022 00:35:52 +0000 Subject: [PATCH 0244/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.111.1 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 4b0d1b1e..7c704fec 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@044d6ea093bf9cbc4c8b19321cfd885fd605ba8d # tag=v32.110.2 + uses: renovatebot/github-action@4df4ec7de51fbb816968121886a8f09d57ef4a41 # tag=v32.111.1 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 7c1b62dd7dab83c96ac7c6c0fb9bcdcfe5cd228b Mon Sep 17 00:00:00 2001 From: TrueCharts-Bot Date: Wed, 13 Jul 2022 18:07:49 +0000 Subject: [PATCH 0245/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.111.2 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 7c704fec..9604c159 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@4df4ec7de51fbb816968121886a8f09d57ef4a41 # tag=v32.111.1 + uses: renovatebot/github-action@b9b7418fafc461b09987f5bee52efd45f6ff2525 # tag=v32.111.2 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 4489d82d3e64378d0583c27e36b59b1d6b8435dc Mon Sep 17 00:00:00 2001 From: TrueCharts-Bot Date: Thu, 14 Jul 2022 06:09:27 +0000 Subject: [PATCH 0246/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.112.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 9604c159..6e25db72 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@b9b7418fafc461b09987f5bee52efd45f6ff2525 # tag=v32.111.2 + uses: renovatebot/github-action@a43a92b250af9c0980ae79ec789a638cbb62cfa4 # tag=v32.112.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From bc08af3e0396544b07f8c768b713293f96d9304a Mon Sep 17 00:00:00 2001 From: TrueCharts-Bot Date: Fri, 15 Jul 2022 00:42:20 +0000 Subject: [PATCH 0247/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.115.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 6e25db72..ca6bfdaf 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@a43a92b250af9c0980ae79ec789a638cbb62cfa4 # tag=v32.112.0 + uses: renovatebot/github-action@d603b383e97629592e9cb69fb7e2ccaca2e5257c # tag=v32.115.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 747b7221fb73eb793342772cb53392d337acff16 Mon Sep 17 00:00:00 2001 From: TrueCharts-Bot Date: Sat, 16 Jul 2022 06:08:42 +0000 Subject: [PATCH 0248/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.117.1 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index ca6bfdaf..9e694939 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@d603b383e97629592e9cb69fb7e2ccaca2e5257c # tag=v32.115.0 + uses: renovatebot/github-action@8ebea087a8b2fa820d7edb7c2fa33dfba0bb872d # tag=v32.117.1 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 2af7161532f29412d9198737e635ae3fccbf6472 Mon Sep 17 00:00:00 2001 From: Stavros Kois <47820033+stavros-k@users.noreply.github.com> Date: Sun, 17 Jul 2022 02:26:16 +0300 Subject: [PATCH 0249/1229] Add link to important note on readme --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index ff9224bd..450048c4 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ A easy tool for frequently used TrueNAS SCALE CLI utilities. +Please before using this tool, [read this note](https://truecharts.org/docs/manual/SCALE%20Apps/Quick-Start%20Guides/Important-MUST-READ) + ## Table of contents: * [Synopsis](#synopsis) * [Arguments](#arguments) From d177b5532d7ac83472dd96e44f2f5e7ec7bcf443 Mon Sep 17 00:00:00 2001 From: TrueCharts-Bot Date: Sat, 16 Jul 2022 18:07:51 +0000 Subject: [PATCH 0250/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.117.2 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 9e694939..e9cf3067 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@8ebea087a8b2fa820d7edb7c2fa33dfba0bb872d # tag=v32.117.1 + uses: renovatebot/github-action@8b1e0555669bcb7ac6d54380ab0e64361c80675b # tag=v32.117.2 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 4fa32d0557bdd4cc2873f8e94f9bdd3f9e1a63ca Mon Sep 17 00:00:00 2001 From: TrueCharts-Bot Date: Sun, 17 Jul 2022 06:08:33 +0000 Subject: [PATCH 0251/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.117.3 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index e9cf3067..fe56b186 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@8b1e0555669bcb7ac6d54380ab0e64361c80675b # tag=v32.117.2 + uses: renovatebot/github-action@89c869c1037542648e94923965ccfeb98563a3a9 # tag=v32.117.3 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From a9f04c09bdb30ec90f70546e454ffffd3a97a27b Mon Sep 17 00:00:00 2001 From: TrueCharts-Bot Date: Sun, 17 Jul 2022 12:10:46 +0000 Subject: [PATCH 0252/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.118.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index fe56b186..ae1081e1 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@89c869c1037542648e94923965ccfeb98563a3a9 # tag=v32.117.3 + uses: renovatebot/github-action@06d258e10d02b7ed57293967da248126b1d82cc7 # tag=v32.118.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 957e0d8d23ae428c29859f97b1095cf5e9470a14 Mon Sep 17 00:00:00 2001 From: TrueCharts-Bot Date: Mon, 18 Jul 2022 18:08:07 +0000 Subject: [PATCH 0253/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.119.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index ae1081e1..6dbca144 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@06d258e10d02b7ed57293967da248126b1d82cc7 # tag=v32.118.0 + uses: renovatebot/github-action@b6f4d29312df24bf55396af4db07d33a5051881f # tag=v32.119.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From f77ce52a2e81b1f19b77d9a2422630cbe6febe46 Mon Sep 17 00:00:00 2001 From: TrueCharts-Bot Date: Tue, 19 Jul 2022 06:12:18 +0000 Subject: [PATCH 0254/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.119.1 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 6dbca144..7501d375 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@b6f4d29312df24bf55396af4db07d33a5051881f # tag=v32.119.0 + uses: renovatebot/github-action@41f689d8312cf4c40df023c1f6c79068c8c2bf80 # tag=v32.119.1 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From d4cdf67ea5074713cf850ef5ce967c5cb6ffedc2 Mon Sep 17 00:00:00 2001 From: TrueCharts-Bot Date: Tue, 19 Jul 2022 18:08:18 +0000 Subject: [PATCH 0255/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.119.2 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 7501d375..450c4642 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@41f689d8312cf4c40df023c1f6c79068c8c2bf80 # tag=v32.119.1 + uses: renovatebot/github-action@a4f78294f4056465bec76e6b6b908c6372cb3fc1 # tag=v32.119.2 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From ec6e0884ef1ce5067895a25385975b37cca55ae8 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 20 Jul 2022 05:52:34 -0600 Subject: [PATCH 0256/1229] testing new self update --- heavy_script.sh | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index 176a0582..f52fb90e 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -3,8 +3,6 @@ #If no argument is passed, kill the script. [[ -z "$*" || "-" == "$*" || "--" == "$*" ]] && echo "This script requires an argument, use --help for help" && exit -echo "yep" - args=("$@") self_update() { @@ -14,23 +12,27 @@ SCRIPTNAME="$0" cd $SCRIPTPATH git fetch &> /dev/null -[[ -n $(git diff --name-only origin/beta | grep $SCRIPTNAME) ]] && { +if [[ -n $(git diff --name-only origin/main | grep $SCRIPTNAME) ]]; then echo "Found a new version of HeavyScript, updating myself..." - git pull --force &> /dev/null + git reset --hard -q + git pull --force -q echo -e "Running the new version...\n" count=0 for i in "${args[@]}" do - [[ "$i" == "--self-update" ]] && unset "args[$count]" && break - ((count++)) + [[ "$i" == "--self-update" ]] && unset "args[$count]" && args+=("--updated") && break + ((count++)) done sleep 5 exec bash "$SCRIPTNAME" "${args[@]}" # Now exit this old instance - exit 1 - } - echo -e "Already the latest version.\n" + exit +elif [[ $self_update == "true" ]]; then + echo -e "HeavyScript has been updated\n" +else + echo -e "HeavyScript is already the latest version\n" +fi } @@ -59,7 +61,7 @@ echo "Examples" echo "bash heavy_script.sh -b 14 -i portainer -i arch -i sonarr -i radarr -t 600 -vrsUp" echo "bash /mnt/tank/scripts/heavy_script.sh -t 150 --mount" echo "bash /mnt/tank/scripts/heavy_script.sh --dns" -echo "bash /mnt/tank/scripts/heavy_script.sh --restore" +echo "bash heavy_script.sh --restore" echo "bash /mnt/tank/scripts/heavy_script.sh --delete-backup" echo exit @@ -218,7 +220,7 @@ export -f sync update_apps(){ -mapfile -t array < <(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,container_images_update_available,status' | grep -E ",true(,|$)" | sort) +mapfile -t array < <(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,container_images_update_available,status' | grep -E ",true(,|\b)" | sort) [[ -z $array ]] && echo -e "\nThere are no updates available" && return 0 || echo -e "\n${#array[@]} update(s) available" [[ -z $timeout ]] && echo -e "\nDefault Timeout: 500" && timeout=500 || echo -e "\nCustom Timeout: $timeout" [[ "$timeout" -le 120 ]] && echo "Warning: Your timeout is set low and may lead to premature rollbacks or skips" @@ -269,7 +271,7 @@ do else #user must not be using -S, just update echo -e "\n$app_name" [[ "$verbose" == "true" ]] && echo "Updating.." - cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo -e "Updated\n$old_full_ver\n$new_full_ver" && after_update_actions || { echo "FAILED"; continue; } + cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo -e "Updated\n$old_full_ver\n$new_full_ver" && after_update_actions || echo "FAILED" fi else echo -e "\n$app_name\nMajor Release, update manually" @@ -372,10 +374,10 @@ do case $opt in -) case "${OPTARG}" in - help) + help) help="true" ;; - self-update) + self-update) self_update="true" ;; dns) @@ -390,6 +392,9 @@ do delete-backup) deleteBackup="true" ;; + updated) + self_update="true" + ;; *) echo -e "Invalid Option \"--$OPTARG\"\n" && help exit @@ -455,8 +460,8 @@ done [[ "$update_all_apps" == "true" && "$update_apps" == "true" ]] && echo -e "-U and -u cannot BOTH be called" && exit #Continue to call functions in specific order -[[ "$self_update" == "true" ]] && self_update [[ "$help" == "true" ]] && help +[[ "$self_update" == "true" ]] && self_update [[ "$deleteBackup" == "true" ]] && deleteBackup && exit [[ "$dns" == "true" ]] && dns && exit [[ "$restore" == "true" ]] && restore && exit @@ -464,4 +469,4 @@ done [[ "$number_of_backups" -ge 1 ]] && backup [[ "$sync" == "true" ]] && sync [[ "$update_all_apps" == "true" || "$update_apps" == "true" ]] && update_apps -[[ "$prune" == "true" ]] && prune \ No newline at end of file +[[ "$prune" == "true" ]] && prune From cf004dd928faa0f627fc23b2d84e5889e31e52a3 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 20 Jul 2022 05:54:30 -0600 Subject: [PATCH 0257/1229] beta --- heavy_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index f52fb90e..f04acab5 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -12,7 +12,7 @@ SCRIPTNAME="$0" cd $SCRIPTPATH git fetch &> /dev/null -if [[ -n $(git diff --name-only origin/main | grep $SCRIPTNAME) ]]; then +if [[ -n $(git diff --name-only origin/beta | grep $SCRIPTNAME) ]]; then echo "Found a new version of HeavyScript, updating myself..." git reset --hard -q git pull --force -q From 0237617ba2bf9e31ef7ab9296e767e62a1496647 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 20 Jul 2022 05:56:59 -0600 Subject: [PATCH 0258/1229] var name --- heavy_script.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index f04acab5..042d0d0c 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -28,7 +28,7 @@ if [[ -n $(git diff --name-only origin/beta | grep $SCRIPTNAME) ]]; then # Now exit this old instance exit -elif [[ $self_update == "true" ]]; then +elif [[ $self_updated == "true" ]]; then echo -e "HeavyScript has been updated\n" else echo -e "HeavyScript is already the latest version\n" @@ -393,7 +393,7 @@ do deleteBackup="true" ;; updated) - self_update="true" + self_updated="true" ;; *) echo -e "Invalid Option \"--$OPTARG\"\n" && help From 8d410dfb2e48390a76f11dd37220c7e497c7508b Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 20 Jul 2022 05:59:54 -0600 Subject: [PATCH 0259/1229] null change --- heavy_script.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/heavy_script.sh b/heavy_script.sh index 042d0d0c..078b570c 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -36,6 +36,7 @@ fi } + help(){ [[ $help == "true" ]] && clear -x echo "Basic Utilities" From 9468664baec6684b231d5bc25808bd1023afac52 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 20 Jul 2022 06:04:16 -0600 Subject: [PATCH 0260/1229] test --- heavy_script.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index 078b570c..6baba984 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -28,8 +28,6 @@ if [[ -n $(git diff --name-only origin/beta | grep $SCRIPTNAME) ]]; then # Now exit this old instance exit -elif [[ $self_updated == "true" ]]; then - echo -e "HeavyScript has been updated\n" else echo -e "HeavyScript is already the latest version\n" fi @@ -462,6 +460,7 @@ done #Continue to call functions in specific order [[ "$help" == "true" ]] && help +[[ $self_updated == "true" ]] && echo -e "HeavyScript has been updated\n" [[ "$self_update" == "true" ]] && self_update [[ "$deleteBackup" == "true" ]] && deleteBackup && exit [[ "$dns" == "true" ]] && dns && exit From e6966744861c680677ebf2829fba4543ad78c4bf Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 20 Jul 2022 06:16:33 -0600 Subject: [PATCH 0261/1229] self update + regex fixes --- heavy_script.sh | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index 3da300dd..4ef4d342 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -12,7 +12,7 @@ SCRIPTNAME="$0" cd $SCRIPTPATH git fetch &> /dev/null -[[ -n $(git diff --name-only origin/main | grep $SCRIPTNAME) ]] && { +if git diff --name-only origin/main | grep -q $SCRIPTNAME ; then echo "Found a new version of HeavyScript, updating myself..." git reset --hard -q git pull --force -q @@ -20,7 +20,7 @@ git fetch &> /dev/null count=0 for i in "${args[@]}" do - [[ "$i" == "--self-update" ]] && unset "args[$count]" && break + [[ "$i" == "--self-update" ]] && unset "args[$count]" && args+=("--updated") && break ((count++)) done sleep 5 @@ -28,11 +28,13 @@ git fetch &> /dev/null # Now exit this old instance exit - } - echo -e "HeavyScript is already the latest version.\n" +else + echo -e "HeavyScript is already the latest version\n" +fi } + help(){ [[ $help == "true" ]] && clear -x echo "Basic Utilities" @@ -217,7 +219,7 @@ export -f sync update_apps(){ -mapfile -t array < <(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,container_images_update_available,status' | grep -E ",true(,|$)" | sort) +mapfile -t array < <(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,container_images_update_available,status' | grep -E ",true(,|\b)" | sort) [[ -z $array ]] && echo -e "\nThere are no updates available" && return 0 || echo -e "\n${#array[@]} update(s) available" [[ -z $timeout ]] && echo -e "\nDefault Timeout: 500" && timeout=500 || echo -e "\nCustom Timeout: $timeout" [[ "$timeout" -le 120 ]] && echo "Warning: Your timeout is set low and may lead to premature rollbacks or skips" @@ -389,6 +391,9 @@ do delete-backup) deleteBackup="true" ;; + updated) + self_updated="true" + ;; *) echo -e "Invalid Option \"--$OPTARG\"\n" && help exit @@ -455,6 +460,7 @@ done #Continue to call functions in specific order [[ "$help" == "true" ]] && help +[[ $self_updated == "true" ]] && echo -e "HeavyScript has been updated\n" [[ "$self_update" == "true" ]] && self_update [[ "$deleteBackup" == "true" ]] && deleteBackup && exit [[ "$dns" == "true" ]] && dns && exit From 2b8a4f1593ecc76d32bc83979106ea262eb2f727 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 20 Jul 2022 06:18:58 -0600 Subject: [PATCH 0262/1229] remove whitespace --- heavy_script.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index 4ef4d342..ab1282c4 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -34,7 +34,6 @@ fi } - help(){ [[ $help == "true" ]] && clear -x echo "Basic Utilities" From 31c1c7cd9b1d6a47d244a3a3c80e972bcf4fd357 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 20 Jul 2022 06:20:40 -0600 Subject: [PATCH 0263/1229] quoting var --- heavy_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index ab1282c4..f19bb3f5 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -459,7 +459,7 @@ done #Continue to call functions in specific order [[ "$help" == "true" ]] && help -[[ $self_updated == "true" ]] && echo -e "HeavyScript has been updated\n" +[[ "$self_updated" == "true" ]] && echo -e "HeavyScript has been updated\n" [[ "$self_update" == "true" ]] && self_update [[ "$deleteBackup" == "true" ]] && deleteBackup && exit [[ "$dns" == "true" ]] && dns && exit From 9241f27c2d9c91522e849c8ce0731c31be6f8162 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 20 Jul 2022 06:29:29 -0600 Subject: [PATCH 0264/1229] quoting --- heavy_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index f19bb3f5..71827226 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -12,7 +12,7 @@ SCRIPTNAME="$0" cd $SCRIPTPATH git fetch &> /dev/null -if git diff --name-only origin/main | grep -q $SCRIPTNAME ; then +if git diff --name-only origin/main | grep -q "$SCRIPTNAME" ; then echo "Found a new version of HeavyScript, updating myself..." git reset --hard -q git pull --force -q From d3fe6a6954a6645aad954f1c9a53ac276ccef508 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 20 Jul 2022 06:35:32 -0600 Subject: [PATCH 0265/1229] fix self update --- heavy_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index 71827226..42539763 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -8,7 +8,7 @@ args=("$@") self_update() { SCRIPT=$(readlink -f "$0") SCRIPTPATH=$(dirname "$SCRIPT") -SCRIPTNAME="$0" +SCRIPTNAME="heavy_script.sh" cd $SCRIPTPATH git fetch &> /dev/null From 3eb9a1a28c8f4e8a76fbcec4f5ee8e09e6b80264 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 20 Jul 2022 06:38:51 -0600 Subject: [PATCH 0266/1229] self update fixes --- heavy_script.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index 42539763..f35243d8 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -6,13 +6,13 @@ args=("$@") self_update() { -SCRIPT=$(readlink -f "$0") -SCRIPTPATH=$(dirname "$SCRIPT") -SCRIPTNAME="heavy_script.sh" -cd $SCRIPTPATH +script=$(readlink -f "$0") +script_path=$(dirname "$script") +script_name="heavy_script.sh" +cd "$script_path" || exit git fetch &> /dev/null -if git diff --name-only origin/main | grep -q "$SCRIPTNAME" ; then +if git diff --name-only origin/main | grep -q "$script_name" ; then echo "Found a new version of HeavyScript, updating myself..." git reset --hard -q git pull --force -q @@ -24,7 +24,7 @@ if git diff --name-only origin/main | grep -q "$SCRIPTNAME" ; then ((count++)) done sleep 5 - exec bash "$SCRIPTNAME" "${args[@]}" + exec bash "$script_name" "${args[@]}" # Now exit this old instance exit From 36f0c0b485675e5fb939737af106c95ef5c56c4e Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 20 Jul 2022 06:45:22 -0600 Subject: [PATCH 0267/1229] remove updated --- heavy_script.sh | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index f35243d8..1a3dcf2c 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -20,7 +20,7 @@ if git diff --name-only origin/main | grep -q "$script_name" ; then count=0 for i in "${args[@]}" do - [[ "$i" == "--self-update" ]] && unset "args[$count]" && args+=("--updated") && break + [[ "$i" == "--self-update" ]] && unset "args[$count]" && break ((count++)) done sleep 5 @@ -390,9 +390,6 @@ do delete-backup) deleteBackup="true" ;; - updated) - self_updated="true" - ;; *) echo -e "Invalid Option \"--$OPTARG\"\n" && help exit @@ -459,7 +456,6 @@ done #Continue to call functions in specific order [[ "$help" == "true" ]] && help -[[ "$self_updated" == "true" ]] && echo -e "HeavyScript has been updated\n" [[ "$self_update" == "true" ]] && self_update [[ "$deleteBackup" == "true" ]] && deleteBackup && exit [[ "$dns" == "true" ]] && dns && exit From 264fda6d121979552b62e91bf3f229bc9af76b91 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 20 Jul 2022 06:52:09 -0600 Subject: [PATCH 0268/1229] force change --- heavy_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index 1a3dcf2c..8d38d6bf 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -464,4 +464,4 @@ done [[ "$number_of_backups" -ge 1 ]] && backup [[ "$sync" == "true" ]] && sync [[ "$update_all_apps" == "true" || "$update_apps" == "true" ]] && update_apps -[[ "$prune" == "true" ]] && prune +[[ "$prune" == "true" ]] && prune \ No newline at end of file From 319f65d7d65e49379a31565b45753b4725cc8225 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 20 Jul 2022 07:28:15 -0600 Subject: [PATCH 0269/1229] todo --- heavy_script.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/heavy_script.sh b/heavy_script.sh index 8d38d6bf..8f38bfad 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -218,6 +218,8 @@ export -f sync update_apps(){ +# Replace with line below after testing +# cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,container_images_update_available,status' | tr -d " \t\r" | grep -E ",true($|,)" | sort mapfile -t array < <(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,container_images_update_available,status' | grep -E ",true(,|\b)" | sort) [[ -z $array ]] && echo -e "\nThere are no updates available" && return 0 || echo -e "\n${#array[@]} update(s) available" [[ -z $timeout ]] && echo -e "\nDefault Timeout: 500" && timeout=500 || echo -e "\nCustom Timeout: $timeout" From 2404f60aa3e8910534d1beaf5f44a882342d92bb Mon Sep 17 00:00:00 2001 From: TrueCharts-Bot Date: Wed, 20 Jul 2022 18:08:59 +0000 Subject: [PATCH 0270/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.120.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 450c4642..f88d1a5f 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@a4f78294f4056465bec76e6b6b908c6372cb3fc1 # tag=v32.119.2 + uses: renovatebot/github-action@98ac503bfdd3f5bbf440262546726b22c5ce1cc9 # tag=v32.120.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From a1d5af9c6f1b7614ec74fd6b71b8da107f15077a Mon Sep 17 00:00:00 2001 From: TrueCharts-Bot Date: Fri, 22 Jul 2022 06:09:30 +0000 Subject: [PATCH 0271/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.122.2 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index f88d1a5f..95892f0c 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@98ac503bfdd3f5bbf440262546726b22c5ce1cc9 # tag=v32.120.0 + uses: renovatebot/github-action@536ffbfd94b04b88c252ad54236b64780e44a0b8 # tag=v32.122.2 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From e09fec1e1042ec3167d946b2bc2e51ce80e6269e Mon Sep 17 00:00:00 2001 From: TrueCharts-Bot Date: Sat, 23 Jul 2022 00:36:42 +0000 Subject: [PATCH 0272/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.125.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 95892f0c..b623b0f5 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@536ffbfd94b04b88c252ad54236b64780e44a0b8 # tag=v32.122.2 + uses: renovatebot/github-action@7321ae5f43795a2456f3a1379e7cfce25891dbcf # tag=v32.125.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 1af355a8f6fa112210f576cc736c4b235291eac3 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 24 Jul 2022 19:15:56 -0600 Subject: [PATCH 0273/1229] bring in changes from stable --- heavy_script.sh | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index 176a0582..8f38bfad 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -3,34 +3,34 @@ #If no argument is passed, kill the script. [[ -z "$*" || "-" == "$*" || "--" == "$*" ]] && echo "This script requires an argument, use --help for help" && exit -echo "yep" - args=("$@") self_update() { -SCRIPT=$(readlink -f "$0") -SCRIPTPATH=$(dirname "$SCRIPT") -SCRIPTNAME="$0" -cd $SCRIPTPATH +script=$(readlink -f "$0") +script_path=$(dirname "$script") +script_name="heavy_script.sh" +cd "$script_path" || exit git fetch &> /dev/null -[[ -n $(git diff --name-only origin/beta | grep $SCRIPTNAME) ]] && { +if git diff --name-only origin/main | grep -q "$script_name" ; then echo "Found a new version of HeavyScript, updating myself..." - git pull --force &> /dev/null + git reset --hard -q + git pull --force -q echo -e "Running the new version...\n" count=0 for i in "${args[@]}" do - [[ "$i" == "--self-update" ]] && unset "args[$count]" && break - ((count++)) + [[ "$i" == "--self-update" ]] && unset "args[$count]" && break + ((count++)) done sleep 5 - exec bash "$SCRIPTNAME" "${args[@]}" + exec bash "$script_name" "${args[@]}" # Now exit this old instance - exit 1 - } - echo -e "Already the latest version.\n" + exit +else + echo -e "HeavyScript is already the latest version\n" +fi } @@ -59,7 +59,7 @@ echo "Examples" echo "bash heavy_script.sh -b 14 -i portainer -i arch -i sonarr -i radarr -t 600 -vrsUp" echo "bash /mnt/tank/scripts/heavy_script.sh -t 150 --mount" echo "bash /mnt/tank/scripts/heavy_script.sh --dns" -echo "bash /mnt/tank/scripts/heavy_script.sh --restore" +echo "bash heavy_script.sh --restore" echo "bash /mnt/tank/scripts/heavy_script.sh --delete-backup" echo exit @@ -218,7 +218,9 @@ export -f sync update_apps(){ -mapfile -t array < <(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,container_images_update_available,status' | grep -E ",true(,|$)" | sort) +# Replace with line below after testing +# cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,container_images_update_available,status' | tr -d " \t\r" | grep -E ",true($|,)" | sort +mapfile -t array < <(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,container_images_update_available,status' | grep -E ",true(,|\b)" | sort) [[ -z $array ]] && echo -e "\nThere are no updates available" && return 0 || echo -e "\n${#array[@]} update(s) available" [[ -z $timeout ]] && echo -e "\nDefault Timeout: 500" && timeout=500 || echo -e "\nCustom Timeout: $timeout" [[ "$timeout" -le 120 ]] && echo "Warning: Your timeout is set low and may lead to premature rollbacks or skips" @@ -269,7 +271,7 @@ do else #user must not be using -S, just update echo -e "\n$app_name" [[ "$verbose" == "true" ]] && echo "Updating.." - cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo -e "Updated\n$old_full_ver\n$new_full_ver" && after_update_actions || { echo "FAILED"; continue; } + cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo -e "Updated\n$old_full_ver\n$new_full_ver" && after_update_actions || echo "FAILED" fi else echo -e "\n$app_name\nMajor Release, update manually" @@ -372,10 +374,10 @@ do case $opt in -) case "${OPTARG}" in - help) + help) help="true" ;; - self-update) + self-update) self_update="true" ;; dns) @@ -455,8 +457,8 @@ done [[ "$update_all_apps" == "true" && "$update_apps" == "true" ]] && echo -e "-U and -u cannot BOTH be called" && exit #Continue to call functions in specific order -[[ "$self_update" == "true" ]] && self_update [[ "$help" == "true" ]] && help +[[ "$self_update" == "true" ]] && self_update [[ "$deleteBackup" == "true" ]] && deleteBackup && exit [[ "$dns" == "true" ]] && dns && exit [[ "$restore" == "true" ]] && restore && exit From 8c762f436b8f3b0ea74cd3ca0e9d529931112ec0 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 24 Jul 2022 19:22:10 -0600 Subject: [PATCH 0274/1229] update to stable --- heavy_script.sh | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index 41a001f4..8f38bfad 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -34,7 +34,6 @@ fi } - help(){ [[ $help == "true" ]] && clear -x echo "Basic Utilities" @@ -393,9 +392,6 @@ do delete-backup) deleteBackup="true" ;; - updated) - self_updated="true" - ;; *) echo -e "Invalid Option \"--$OPTARG\"\n" && help exit @@ -470,4 +466,4 @@ done [[ "$number_of_backups" -ge 1 ]] && backup [[ "$sync" == "true" ]] && sync [[ "$update_all_apps" == "true" || "$update_apps" == "true" ]] && update_apps -[[ "$prune" == "true" ]] && prune +[[ "$prune" == "true" ]] && prune \ No newline at end of file From 34de2750d8b7a7149911d96ab97f634b9a389cd8 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 24 Jul 2022 20:29:58 -0600 Subject: [PATCH 0275/1229] refactor --- functions/backup.sh | 74 ++++++++ functions/dns.sh | 27 +++ functions/misc.sh | 57 ++++++ functions/mount.sh | 63 +++++++ functions/self_update.sh | 32 ++++ functions/update_apps.sh | 132 ++++++++++++++ heavy_script.sh | 374 ++------------------------------------- 7 files changed, 397 insertions(+), 362 deletions(-) create mode 100644 functions/backup.sh create mode 100644 functions/dns.sh create mode 100644 functions/misc.sh create mode 100644 functions/mount.sh create mode 100644 functions/self_update.sh create mode 100644 functions/update_apps.sh diff --git a/functions/backup.sh b/functions/backup.sh new file mode 100644 index 00000000..a4684ca1 --- /dev/null +++ b/functions/backup.sh @@ -0,0 +1,74 @@ +#!/bin/bash + + +backup(){ +echo -e "\nNumber of backups was set to $number_of_backups" +date=$(date '+%Y_%m_%d_%H_%M_%S') +[[ "$verbose" == "true" ]] && cli -c 'app kubernetes backup_chart_releases backup_name=''"'HeavyScript_"$date"'"' +[[ -z "$verbose" ]] && echo -e "\nNew Backup Name:" && cli -c 'app kubernetes backup_chart_releases backup_name=''"'HeavyScript_"$date"'"' | tail -n 1 +mapfile -t list_backups < <(cli -c 'app kubernetes list_backups' | grep "HeavyScript_" | sort -t '_' -Vr -k2,7 | awk -F '|' '{print $2}'| tr -d " \t\r") +if [[ ${#list_backups[@]} -gt "number_of_backups" ]]; then + echo -e "\nDeleting the oldest backup(s) for exceeding limit:" + overflow=$(( ${#list_backups[@]} - "$number_of_backups" )) + mapfile -t list_overflow < <(cli -c 'app kubernetes list_backups' | grep "HeavyScript_" | sort -t '_' -V -k2,7 | awk -F '|' '{print $2}'| tr -d " \t\r" | head -n "$overflow") + for i in "${list_overflow[@]}" + do + cli -c 'app kubernetes delete_backup backup_name=''"'"$i"'"' &> /dev/null || echo "Failed to delete $i" + echo "$i" + done +fi +} +export -f backup + + + +deleteBackup(){ +clear -x && echo "pulling all restore points.." +list_backups=$(cli -c 'app kubernetes list_backups' | sort -t '_' -Vr -k2,7 | tr -d " \t\r" | awk -F '|' '{print $2}' | nl | column -t) +clear -x +[[ -z "$list_backups" ]] && echo "No restore points available" && exit +title +echo -e "Choose a restore point to delete\nThese may be out of order if they are not all HeavyScript backups" +echo "$list_backups" +read -pr -t 600 "Please type a number: " selection +restore_point=$(echo "$list_backups" | grep ^"$selection " | awk '{print $2}') +if [[ -z "$selection" ]]; then #Check for valid selection. If none, kill script + echo "Your selection cannot be empty" + exit +elif [[ -z "$restore_point" ]]; then #Check for valid selection. If none, kill script + echo "Invalid Selection: $selection, was not an option" + exit +fi +echo -e "\nWARNING:\nYou CANNOT go back after deleting your restore point" +echo -e "\n\nYou have chosen:\n$restore_point\n\nWould you like to continue?" && echo -e "1 Yes\n2 No" +read -rp -t 120 "Please type a number: " yesno || { echo "Failed to make a valid selection"; exit; } +if [[ $yesno == "1" ]]; then + echo -e "\nDeleting $restore_point" && cli -c 'app kubernetes delete_backup backup_name=''"'"$restore_point"'"' &>/dev/null && echo "Sucessfully deleted" || echo "Deletion Failed" +elif [[ $yesno == "2" ]]; then + echo "You've chosen NO, killing script." +else + echo "Invalid Selection" +fi +} +export -f deleteBackup + + +restore(){ +clear -x && echo "pulling restore points.." +list_backups=$(cli -c 'app kubernetes list_backups' | grep "HeavyScript_" | sort -t '_' -Vr -k2,7 | tr -d " \t\r" | awk -F '|' '{print $2}' | nl | column -t) +clear -x +[[ -z "$list_backups" ]] && echo "No HeavyScript restore points available" && exit || { title; echo "Choose a restore point" ; } +echo "$list_backups" && read -t 600 -p "Please type a number: " selection && restore_point=$(echo "$list_backups" | grep ^"$selection " | awk '{print $2}') +[[ -z "$selection" ]] && echo "Your selection cannot be empty" && exit #Check for valid selection. If none, kill script +[[ -z "$restore_point" ]] && echo "Invalid Selection: $selection, was not an option" && exit #Check for valid selection. If none, kill script +echo -e "\nWARNING:\nThis is NOT guranteed to work\nThis is ONLY supposed to be used as a LAST RESORT\nConsider rolling back your applications instead if possible" || { echo "FAILED"; exit; } +echo -e "\n\nYou have chosen:\n$restore_point\n\nWould you like to continue?" && echo -e "1 Yes\n2 No" && read -t 120 -p "Please type a number: " yesno || { echo "FAILED"; exit; } +if [[ $yesno == "1" ]]; then + echo -e "\nStarting Backup, this will take a LONG time." && cli -c 'app kubernetes restore_backup backup_name=''"'"$restore_point"'"' || echo "Restore FAILED" +elif [[ $yesno == "2" ]]; then + echo "You've chosen NO, killing script. Good luck." +else + echo "Invalid Selection" +fi +} +export -f restore \ No newline at end of file diff --git a/functions/dns.sh b/functions/dns.sh new file mode 100644 index 00000000..c4316139 --- /dev/null +++ b/functions/dns.sh @@ -0,0 +1,27 @@ +#!/bin/bash + + +dns(){ +clear -x +echo "Generating DNS Names.." +#ignored dependency pods, may need to add more in the future. +dep_ignore="\-cronjob\-|^kube-system|\ssvclb|NAME|\-memcached\-.[^custom\-app]|\-postgresql\-.[^custom\-app]|\-redis\-.[^custom\-app]|\-mariadb\-.[^custom\-app]|\-promtail\-.[^custom\-app]" + +# Pulling pod names +mapfile -t main < <(k3s kubectl get pods -A | grep -Ev "$dep_ignore" | sort) + +# Pulling all ports +all_ports=$(k3s kubectl get service -A) + +clear -x +count=0 +for i in "${main[@]}" +do + [[ count -le 0 ]] && echo -e "\n" && ((count++)) + appName=$(echo "$i" | awk '{print $2}' | sed 's/-[^-]*-[^-]*$//' | sed 's/-0//') + ixName=$(echo "$i" | awk '{print $1}') + port=$(echo "$all_ports" | grep -E "\s$appName\s" | awk '{print $6}' | grep -Eo "^[[:digit:]]+{1}") + echo -e "$appName.$ixName.svc.cluster.local $port" +done | uniq | nl -b t | sed 's/\s\s\s$/- -------- ----/' | column -t -R 1 -N "#,DNS_Name,Port" -L +} +export -f dns \ No newline at end of file diff --git a/functions/misc.sh b/functions/misc.sh new file mode 100644 index 00000000..f854381b --- /dev/null +++ b/functions/misc.sh @@ -0,0 +1,57 @@ +#!/bin/bash + + +sync(){ +echo -e "\nSyncing all catalogs, please wait.." && cli -c 'app catalog sync_all' &> /dev/null && echo -e "Catalog sync complete" +} +export -f sync + +prune(){ +echo -e "\nPruning Docker Images" && docker image prune -af | grep "^Total" || echo "Failed to Prune Docker Images" +} +export -f prune + +title(){ +echo ' _ _ _____ _ _ ' +echo '| | | | / ___| (_) | | ' +echo '| |_| | ___ __ ___ ___ _\ `--. ___ _ __ _ _ __ | |_' +echo "| _ |/ _ \/ _\` \ \ / / | | |\`--. \/ __| '__| | '_ \| __|" +echo '| | | | __/ (_| |\ V /| |_| /\__/ / (__| | | | |_) | |_ ' +echo '\_| |_/\___|\__,_| \_/ \__, \____/ \___|_| |_| .__/ \__|' +echo ' __/ | | | ' +echo ' |___/ |_| ' +echo +} +export -f title + +help(){ +[[ $help == "true" ]] && clear -x +echo "Basic Utilities" +echo "--mount | Initiates mounting feature, choose between unmounting and mounting PVC data" +echo "--restore | Opens a menu to restore a \"heavy_script\" backup that was taken on your \"ix-applications\" dataset" +echo "--delete-backup | Opens a menu to delete backups on your system" +echo "--dns | list all of your applications DNS names and their web ports" +echo +echo "Update Options" +echo "-U | Update all applications, ignores versions" +echo "-u | Update all applications, does not update Major releases" +echo "-b | Back-up your ix-applications dataset, specify a number after -b" +echo "-i | Add application to ignore list, one by one, see example below." +echo "-R | THIS OPTION WILL DEPRICATE SOON, USE \"-r\" instead. Roll-back applications if they fail to update" +echo "-r | Roll-back applications if they fail to update" +echo "-S | Shutdown applications prior to updating" +echo "-v | verbose output" +echo "-t | Set a custom timeout in seconds when checking if either an App or Mountpoint correctly Started, Stopped or (un)Mounted. Defaults to 500 seconds" +echo "-s | sync catalog" +echo "-p | Prune unused/old docker images" +echo +echo "Examples" +echo "bash heavy_script.sh -b 14 -i portainer -i arch -i sonarr -i radarr -t 600 -vrsUp" +echo "bash /mnt/tank/scripts/heavy_script.sh -t 150 --mount" +echo "bash /mnt/tank/scripts/heavy_script.sh --dns" +echo "bash heavy_script.sh --restore" +echo "bash /mnt/tank/scripts/heavy_script.sh --delete-backup" +echo +exit +} +export -f help \ No newline at end of file diff --git a/functions/mount.sh b/functions/mount.sh new file mode 100644 index 00000000..88d9af21 --- /dev/null +++ b/functions/mount.sh @@ -0,0 +1,63 @@ +#!/bin/bash + +mount(){ +clear -x +title +echo -e "1 Mount\n2 Unmount All" && read -t 600 -p "Please type a number: " selection +[[ -z "$selection" ]] && echo "Your selection cannot be empty" && exit #Check for valid selection. If none, kill script +if [[ $selection == "1" ]]; then + list=$(k3s kubectl get pvc -A | sort -u | awk '{print NR-1, "\t" $1 "\t" $2 "\t" $4}' | column -t | sed "s/^0/ /") + echo "$list" && read -t 120 -p "Please type a number: " selection + [[ -z "$selection" ]] && echo "Your selection cannot be empty" && exit #Check for valid selection. If none, kill script + app=$(echo -e "$list" | grep ^"$selection " | awk '{print $2}' | cut -c 4- ) + [[ -z "$app" ]] && echo "Invalid Selection: $selection, was not an option" && exit #Check for valid selection. If none, kill script + pvc=$(echo -e "$list" | grep ^"$selection ") + status=$(cli -m csv -c 'app chart_release query name,status' | grep -E "^$app\b" | awk -F ',' '{print $2}'| tr -d " \t\n\r") + if [[ "$status" != "STOPPED" ]]; then + [[ -z $timeout ]] && echo -e "\nDefault Timeout: 500" && timeout=500 || echo -e "\nCustom Timeout: $timeout" + SECONDS=0 && echo -e "\nScaling down $app" && midclt call chart.release.scale "$app" '{"replica_count": 0}' &> /dev/null + else + echo -e "\n$app is already stopped" + fi + while [[ "$SECONDS" -le "$timeout" && "$status" != "STOPPED" ]] + do + status=$(cli -m csv -c 'app chart_release query name,status' | grep -E "^$app\b" | awk -F ',' '{print $2}'| tr -d " \t\n\r") + echo -e "Waiting $((timeout-SECONDS)) more seconds for $app to be STOPPED" && sleep 5 + done + data_name=$(echo "$pvc" | awk '{print $3}') + mount=$(echo "$pvc" | awk '{print $4}') + volume_name=$(echo "$pvc" | awk '{print $4}') + mapfile -t full_path < <(zfs list | grep "$volume_name" | awk '{print $1}') + if [[ "${#full_path[@]}" -gt 1 ]]; then #if there is another app with the same name on another pool, use the current pools application, since the other instance is probably old, or unused, or a backup. + echo "$app is a name used on more than one pool.. attempting to use your current kubernetes apps pool" + pool=$(cli -c 'app kubernetes config' | grep -E "dataset\s\|" | awk -F '|' '{print $3}' | awk -F '/' '{print $1}' | tr -d " \t\n\r") + full_path=$(zfs list | grep "$volume_name" | grep "$pool" | awk '{print $1}') + fi + echo -e "\nMounting\n$full_path\nTo\n/mnt/heavyscript/$data_name" + zfs set mountpoint=/heavyscript/"$data_name" "$full_path" || echo "Failed to mount $app" + echo -e "Mounted\n\nUnmount with:\nzfs set mountpoint=legacy $full_path && rmdir /mnt/heavyscript/$data_name\n\nOr use the Unmount All option\n" + exit +elif [[ $selection == "2" ]]; then + mapfile -t unmount_array < <(basename -a /mnt/heavyscript/* | sed "s/*//") + [[ -z $unmount_array ]] && echo "Theres nothing to unmount" && exit + for i in "${unmount_array[@]}" + do + main=$(k3s kubectl get pvc -A | grep -E "\s$i\s" | awk '{print $1, $2, $4}') + app=$(echo "$main" | awk '{print $1}' | cut -c 4-) + pvc=$(echo "$main" | awk '{print $3}') + mapfile -t path < <(find /mnt/*/ix-applications/releases/"$app"/volumes/ -maxdepth 0 | cut -c 6-) + if [[ "${#path[@]}" -gt 1 ]]; then #if there is another app with the same name on another pool, use the current pools application, since the other instance is probably old, or unused, or a backup. + echo "$i is a name used on more than one pool.. attempting to use your current kubernetes apps pool" + pool=$(cli -c 'app kubernetes config' | grep -E "dataset\s\|" | awk -F '|' '{print $3}' | awk -F '/' '{print $1}' | tr -d " \t\n\r") + full_path=$(find /mnt/"$pool"/ix-applications/releases/"$app"/volumes/ -maxdepth 0 | cut -c 6-) + zfs set mountpoint=legacy "$full_path""$pvc" && echo "$i unmounted" && rmdir /mnt/heavyscript/"$i" || echo "failed to unmount $i" + else + zfs set mountpoint=legacy "$path""$pvc" && echo "$i unmounted" && rmdir /mnt/heavyscript/"$i" || echo "failed to unmount $i" + fi + done + rmdir /mnt/heavyscript +else + echo "Invalid selection, \"$selection\" was not an option" +fi +} +export -f mount \ No newline at end of file diff --git a/functions/self_update.sh b/functions/self_update.sh new file mode 100644 index 00000000..340d5a5d --- /dev/null +++ b/functions/self_update.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +args=("$@") + +self_update() { +script=$(readlink -f "$0") +script_path=$(dirname "$script") +script_name="heavy_script.sh" +cd "$script_path" || exit +git fetch &> /dev/null + +if git diff --name-only origin/main | grep -q "$script_name" ; then + echo "Found a new version of HeavyScript, updating myself..." + git reset --hard -q + git pull --force -q + echo -e "Running the new version...\n" + count=0 + for i in "${args[@]}" + do + [[ "$i" == "--self-update" ]] && unset "args[$count]" && break + ((count++)) + done + sleep 5 + exec bash "$script_name" "${args[@]}" + + # Now exit this old instance + exit +else + echo -e "HeavyScript is already the latest version\n" +fi +} +export -f self_update \ No newline at end of file diff --git a/functions/update_apps.sh b/functions/update_apps.sh new file mode 100644 index 00000000..a406e46d --- /dev/null +++ b/functions/update_apps.sh @@ -0,0 +1,132 @@ +#!/bin/bash + + +update_apps(){ +# Replace with line below after testing +# cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,container_images_update_available,status' | tr -d " \t\r" | grep -E ",true($|,)" | sort +mapfile -t array < <(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,container_images_update_available,status' | grep -E ",true(,|\b)" | sort) +[[ -z $array ]] && echo -e "\nThere are no updates available" && return 0 || echo -e "\n${#array[@]} update(s) available" +[[ -z $timeout ]] && echo -e "\nDefault Timeout: 500" && timeout=500 || echo -e "\nCustom Timeout: $timeout" +[[ "$timeout" -le 120 ]] && echo "Warning: Your timeout is set low and may lead to premature rollbacks or skips" +for i in "${array[@]}" +do + app_name=$(echo "$i" | awk -F ',' '{print $1}') #print out first catagory, name. + old_app_ver=$(echo "$i" | awk -F ',' '{print $4}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #previous/current Application MAJOR Version + new_app_ver=$(echo "$i" | awk -F ',' '{print $5}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #new Application MAJOR Version + old_chart_ver=$(echo "$i" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}' | awk -F '.' '{print $1}') # Old Chart MAJOR version + new_chart_ver=$(echo "$i" | awk -F ',' '{print $5}' | awk -F '_' '{print $2}' | awk -F '.' '{print $1}') # New Chart MAJOR version + status=$(echo "$i" | awk -F ',' '{print $2}') #status of the app: STOPPED / DEPLOYING / ACTIVE + startstatus=$status + diff_app=$(diff <(echo "$old_app_ver") <(echo "$new_app_ver")) #caluclating difference in major app versions + diff_chart=$(diff <(echo "$old_chart_ver") <(echo "$new_chart_ver")) #caluclating difference in Chart versions + old_full_ver=$(echo "$i" | awk -F ',' '{print $4}') #Upgraded From + new_full_ver=$(echo "$i" | awk -F ',' '{print $5}') #Upraded To + rollback_version=$(echo "$i" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}') + printf '%s\0' "${ignore[@]}" | grep -iFxqz "${app_name}" && echo -e "\n$app_name\nIgnored, skipping" && continue #If application is on ignore list, skip + if [[ "$diff_app" == "$diff_chart" || "$update_all_apps" == "true" ]]; then #continue to update + if [[ $stop_before_update == "true" ]]; then # Check to see if user is using -S or not + if [[ "$status" == "STOPPED" ]]; then # if status is already stopped, skip while loop + echo -e "\n$app_name" + [[ "$verbose" == "true" ]] && echo "Updating.." + cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo -e "Updated\n$old_full_ver\n$new_full_ver" && after_update_actions || echo "FAILED" + continue + else # if status was not STOPPED, stop the app prior to updating + echo -e "\n$app_name" + [[ "$verbose" == "true" ]] && echo "Stopping prior to update.." + midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null && SECONDS=0 || echo -e "FAILED" + while [[ "$status" != "STOPPED" ]] + do + status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep "^$app_name," | awk -F ',' '{print $2}') + if [[ "$status" == "STOPPED" ]]; then + echo "Stopped" + [[ "$verbose" == "true" ]] && echo "Updating.." + cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo -e "Updated\n$old_full_ver\n$new_full_ver" && after_update_actions || echo "Failed to update" + break + elif [[ "$SECONDS" -ge "$timeout" ]]; then + echo "Error: Run Time($SECONDS) has exceeded Timeout($timeout)" + break + elif [[ "$status" != "STOPPED" ]]; then + [[ "$verbose" == "true" ]] && echo "Waiting $((timeout-SECONDS)) more seconds for $app_name to be STOPPED" + sleep 10 + continue + fi + done + fi + else #user must not be using -S, just update + echo -e "\n$app_name" + [[ "$verbose" == "true" ]] && echo "Updating.." + cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo -e "Updated\n$old_full_ver\n$new_full_ver" && after_update_actions || echo "FAILED" + fi + else + echo -e "\n$app_name\nMajor Release, update manually" + continue + fi +done +} +export -f update_apps + + +after_update_actions(){ +SECONDS=0 +count=0 +if [[ $rollback == "true" ]]; then + while true + do + (( count++ )) + status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep "^$app_name," | awk -F ',' '{print $2}') + if [[ "$status" == "ACTIVE" && "$startstatus" == "STOPPED" ]]; then + [[ "$verbose" == "true" ]] && echo "Returing to STOPPED state.." + midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null && echo "Stopped"|| echo "FAILED" + break + elif [[ "$SECONDS" -ge "$timeout" && "$status" == "DEPLOYING" && "$failed" != "true" ]]; then + echo -e "Error: Run Time($SECONDS) for $app_name has exceeded Timeout($timeout)\nIf this is a slow starting application, set a higher timeout with -t\nIf this applicaion is always DEPLOYING, you can disable all probes under the Healthcheck Probes Liveness section in the edit configuration\nReverting update.." + midclt call chart.release.rollback "$app_name" "{\"item_version\": \"$rollback_version\"}" &> /dev/null + [[ "$startstatus" == "STOPPED" ]] && failed="true" && after_update_actions && unset failed #run back after_update_actions function if the app was stopped prior to update + break + elif [[ "$SECONDS" -ge "$timeout" && "$status" == "DEPLOYING" && "$failed" == "true" ]]; then + echo -e "Error: Run Time($SECONDS) for $app_name has exceeded Timeout($timeout)\nThe application failed to be ACTIVE even after a rollback,\nManual intervention is required\nAbandoning" + break + elif [[ "$status" == "STOPPED" ]]; then + [[ "$count" -le 1 && "$verbose" == "true" ]] && echo "Verifying Stopped.." && sleep 15 && continue #if reports stopped on FIRST time through loop, double check + [[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports stopped on FIRST time through loop, double check + echo "Stopped" && break #if reports stopped any time after the first loop, assume its extermal services. + elif [[ "$status" == "ACTIVE" ]]; then + [[ "$count" -le 1 && "$verbose" == "true" ]] && echo "Verifying Active.." && sleep 15 && continue #if reports active on FIRST time through loop, double check + [[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports active on FIRST time through loop, double check + echo "Active" && break #if reports active any time after the first loop, assume actually active. + else + [[ "$verbose" == "true" ]] && echo "Waiting $((timeout-SECONDS)) more seconds for $app_name to be ACTIVE" + sleep 15 + continue + fi + done +else + if [[ "$startstatus" == "STOPPED" ]]; then + while true #using a constant while loop, then breaking out of the loop with break commands below. + do + (( count++ )) + status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep "^$app_name," | awk -F ',' '{print $2}') + if [[ "$status" == "STOPPED" ]]; then + [[ "$count" -le 1 && "$verbose" == "true" ]] && echo "Verifying Stopped.." && sleep 15 && continue #if reports stopped on FIRST time through loop, double check + [[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports stopped on FIRST time through loop, double check + echo "Stopped" && break #assume actually stopped anytime AFTER the first loop + break + elif [[ "$status" == "ACTIVE" ]]; then + [[ "$count" -le 1 && "$verbose" == "true" ]] && echo "Verifying Active.." && sleep 15 && continue #if reports active on FIRST time through loop, double check + [[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports active on FIRST time through loop, double check + [[ "$verbose" == "true" ]] && echo "Returing to STOPPED state.." + midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null && echo "Stopped"|| echo "FAILED" + break + elif [[ "$SECONDS" -ge "$timeout" ]]; then + echo "Error: Run Time($SECONDS) has exceeded Timeout($timeout)" + break + else + [[ "$verbose" == "true" ]] && echo "Waiting $((timeout-SECONDS)) more seconds for $app_name to be ACTIVE" + sleep 10 + continue + fi + done + fi +fi +} +export -f after_update_actions \ No newline at end of file diff --git a/heavy_script.sh b/heavy_script.sh index 8f38bfad..90eb0575 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -3,369 +3,19 @@ #If no argument is passed, kill the script. [[ -z "$*" || "-" == "$*" || "--" == "$*" ]] && echo "This script requires an argument, use --help for help" && exit -args=("$@") -self_update() { -script=$(readlink -f "$0") -script_path=$(dirname "$script") -script_name="heavy_script.sh" -cd "$script_path" || exit -git fetch &> /dev/null - -if git diff --name-only origin/main | grep -q "$script_name" ; then - echo "Found a new version of HeavyScript, updating myself..." - git reset --hard -q - git pull --force -q - echo -e "Running the new version...\n" - count=0 - for i in "${args[@]}" - do - [[ "$i" == "--self-update" ]] && unset "args[$count]" && break - ((count++)) - done - sleep 5 - exec bash "$script_name" "${args[@]}" - - # Now exit this old instance - exit -else - echo -e "HeavyScript is already the latest version\n" -fi -} - - -help(){ -[[ $help == "true" ]] && clear -x -echo "Basic Utilities" -echo "--mount | Initiates mounting feature, choose between unmounting and mounting PVC data" -echo "--restore | Opens a menu to restore a \"heavy_script\" backup that was taken on your \"ix-applications\" dataset" -echo "--delete-backup | Opens a menu to delete backups on your system" -echo "--dns | list all of your applications DNS names and their web ports" -echo -echo "Update Options" -echo "-U | Update all applications, ignores versions" -echo "-u | Update all applications, does not update Major releases" -echo "-b | Back-up your ix-applications dataset, specify a number after -b" -echo "-i | Add application to ignore list, one by one, see example below." -echo "-R | THIS OPTION WILL DEPRICATE SOON, USE \"-r\" instead. Roll-back applications if they fail to update" -echo "-r | Roll-back applications if they fail to update" -echo "-S | Shutdown applications prior to updating" -echo "-v | verbose output" -echo "-t | Set a custom timeout in seconds when checking if either an App or Mountpoint correctly Started, Stopped or (un)Mounted. Defaults to 500 seconds" -echo "-s | sync catalog" -echo "-p | Prune unused/old docker images" -echo -echo "Examples" -echo "bash heavy_script.sh -b 14 -i portainer -i arch -i sonarr -i radarr -t 600 -vrsUp" -echo "bash /mnt/tank/scripts/heavy_script.sh -t 150 --mount" -echo "bash /mnt/tank/scripts/heavy_script.sh --dns" -echo "bash heavy_script.sh --restore" -echo "bash /mnt/tank/scripts/heavy_script.sh --delete-backup" -echo -exit -} -export -f help - - -deleteBackup(){ -clear -x && echo "pulling all restore points.." -list_backups=$(cli -c 'app kubernetes list_backups' | sort -t '_' -Vr -k2,7 | tr -d " \t\r" | awk -F '|' '{print $2}' | nl | column -t) -clear -x -[[ -z "$list_backups" ]] && echo "No restore points available" && exit || { title; echo -e "Choose a restore point to delete\nThese may be out of order if they are not HeavyScript backups" ; } -echo "$list_backups" && read -t 600 -p "Please type a number: " selection && restore_point=$(echo "$list_backups" | grep ^"$selection " | awk '{print $2}') -[[ -z "$selection" ]] && echo "Your selection cannot be empty" && exit #Check for valid selection. If none, kill script -[[ -z "$restore_point" ]] && echo "Invalid Selection: $selection, was not an option" && exit #Check for valid selection. If none, kill script -echo -e "\nWARNING:\nYou CANNOT go back after deleting your restore point" || { echo "FAILED"; exit; } -echo -e "\n\nYou have chosen:\n$restore_point\n\nWould you like to continue?" && echo -e "1 Yes\n2 No" && read -t 120 -p "Please type a number: " yesno || { echo "FAILED"; exit; } -if [[ $yesno == "1" ]]; then - echo -e "\nDeleting $restore_point" && cli -c 'app kubernetes delete_backup backup_name=''"'"$restore_point"'"' &>/dev/null && echo "Sucessfully deleted" || echo "Deletion Failed" -elif [[ $yesno == "2" ]]; then - echo "You've chosen NO, killing script." -else - echo "Invalid Selection" -fi -} -export -f deleteBackup - - -backup(){ -echo -e "\nNumber of backups was set to $number_of_backups" -date=$(date '+%Y_%m_%d_%H_%M_%S') -[[ "$verbose" == "true" ]] && cli -c 'app kubernetes backup_chart_releases backup_name=''"'HeavyScript_"$date"'"' -[[ -z "$verbose" ]] && echo -e "\nNew Backup Name:" && cli -c 'app kubernetes backup_chart_releases backup_name=''"'HeavyScript_"$date"'"' | tail -n 1 -mapfile -t list_backups < <(cli -c 'app kubernetes list_backups' | grep "HeavyScript_" | sort -t '_' -Vr -k2,7 | awk -F '|' '{print $2}'| tr -d " \t\r") -if [[ ${#list_backups[@]} -gt "number_of_backups" ]]; then - echo -e "\nDeleting the oldest backup(s) for exceeding limit:" - overflow=$(( ${#list_backups[@]} - "$number_of_backups" )) - mapfile -t list_overflow < <(cli -c 'app kubernetes list_backups' | grep "HeavyScript_" | sort -t '_' -V -k2,7 | awk -F '|' '{print $2}'| tr -d " \t\r" | head -n "$overflow") - for i in "${list_overflow[@]}" - do - cli -c 'app kubernetes delete_backup backup_name=''"'"$i"'"' &> /dev/null || echo "Failed to delete $i" - echo "$i" - done -fi -} -export -f backup - - -restore(){ -clear -x && echo "pulling restore points.." -list_backups=$(cli -c 'app kubernetes list_backups' | grep "HeavyScript_" | sort -t '_' -Vr -k2,7 | tr -d " \t\r" | awk -F '|' '{print $2}' | nl | column -t) -clear -x -[[ -z "$list_backups" ]] && echo "No HeavyScript restore points available" && exit || { title; echo "Choose a restore point" ; } -echo "$list_backups" && read -t 600 -p "Please type a number: " selection && restore_point=$(echo "$list_backups" | grep ^"$selection " | awk '{print $2}') -[[ -z "$selection" ]] && echo "Your selection cannot be empty" && exit #Check for valid selection. If none, kill script -[[ -z "$restore_point" ]] && echo "Invalid Selection: $selection, was not an option" && exit #Check for valid selection. If none, kill script -echo -e "\nWARNING:\nThis is NOT guranteed to work\nThis is ONLY supposed to be used as a LAST RESORT\nConsider rolling back your applications instead if possible" || { echo "FAILED"; exit; } -echo -e "\n\nYou have chosen:\n$restore_point\n\nWould you like to continue?" && echo -e "1 Yes\n2 No" && read -t 120 -p "Please type a number: " yesno || { echo "FAILED"; exit; } -if [[ $yesno == "1" ]]; then - echo -e "\nStarting Backup, this will take a LONG time." && cli -c 'app kubernetes restore_backup backup_name=''"'"$restore_point"'"' || echo "Restore FAILED" -elif [[ $yesno == "2" ]]; then - echo "You've chosen NO, killing script. Good luck." -else - echo "Invalid Selection" -fi -} -export -f restore - - -dns(){ -clear -x -echo "Generating DNS Names.." -#ignored dependency pods, may need to add more in the future. -dep_ignore="\-cronjob\-|^kube-system|\ssvclb|NAME|\-memcached\-.[^custom\-app]|\-postgresql\-.[^custom\-app]|\-redis\-.[^custom\-app]|\-mariadb\-.[^custom\-app]|\-promtail\-.[^custom\-app]" - -# Pulling pod names -mapfile -t main < <(k3s kubectl get pods -A | grep -Ev "$dep_ignore" | sort) - -# Pulling all ports -all_ports=$(k3s kubectl get service -A) - -clear -x -count=0 -for i in "${main[@]}" -do - [[ count -le 0 ]] && echo -e "\n" && ((count++)) - appName=$(echo "$i" | awk '{print $2}' | sed 's/-[^-]*-[^-]*$//' | sed 's/-0//') - ixName=$(echo "$i" | awk '{print $1}') - port=$(echo "$all_ports" | grep -E "\s$appName\s" | awk '{print $6}' | grep -Eo "^[[:digit:]]+{1}") - echo -e "$appName.$ixName.svc.cluster.local $port" -done | uniq | nl -b t | sed 's/\s\s\s$/- -------- ----/' | column -t -R 1 -N "#,DNS_Name,Port" -L -} -export -f dns - - -mount(){ -clear -x -title -echo -e "1 Mount\n2 Unmount All" && read -t 600 -p "Please type a number: " selection -[[ -z "$selection" ]] && echo "Your selection cannot be empty" && exit #Check for valid selection. If none, kill script -if [[ $selection == "1" ]]; then - list=$(k3s kubectl get pvc -A | sort -u | awk '{print NR-1, "\t" $1 "\t" $2 "\t" $4}' | column -t | sed "s/^0/ /") - echo "$list" && read -t 120 -p "Please type a number: " selection - [[ -z "$selection" ]] && echo "Your selection cannot be empty" && exit #Check for valid selection. If none, kill script - app=$(echo -e "$list" | grep ^"$selection " | awk '{print $2}' | cut -c 4- ) - [[ -z "$app" ]] && echo "Invalid Selection: $selection, was not an option" && exit #Check for valid selection. If none, kill script - pvc=$(echo -e "$list" | grep ^"$selection ") - status=$(cli -m csv -c 'app chart_release query name,status' | grep -E "^$app\b" | awk -F ',' '{print $2}'| tr -d " \t\n\r") - if [[ "$status" != "STOPPED" ]]; then - [[ -z $timeout ]] && echo -e "\nDefault Timeout: 500" && timeout=500 || echo -e "\nCustom Timeout: $timeout" - SECONDS=0 && echo -e "\nScaling down $app" && midclt call chart.release.scale "$app" '{"replica_count": 0}' &> /dev/null - else - echo -e "\n$app is already stopped" - fi - while [[ "$SECONDS" -le "$timeout" && "$status" != "STOPPED" ]] - do - status=$(cli -m csv -c 'app chart_release query name,status' | grep -E "^$app\b" | awk -F ',' '{print $2}'| tr -d " \t\n\r") - echo -e "Waiting $((timeout-SECONDS)) more seconds for $app to be STOPPED" && sleep 5 - done - data_name=$(echo "$pvc" | awk '{print $3}') - mount=$(echo "$pvc" | awk '{print $4}') - volume_name=$(echo "$pvc" | awk '{print $4}') - full_path=$(zfs list | grep "$volume_name" | awk '{print $1}') - echo -e "\nMounting\n$full_path\nTo\n/mnt/heavyscript/$data_name" && zfs set mountpoint=/heavyscript/"$data_name" "$full_path" && echo -e "Mounted\n\nUnmount with:\nzfs set mountpoint=legacy "$full_path" && rmdir /mnt/heavyscript/"$data_name"\n\nOr use the Unmount All option\n" - exit -elif [[ $selection == "2" ]]; then - mapfile -t unmount_array < <(basename -a /mnt/heavyscript/* | sed "s/*//") - [[ -z $unmount_array ]] && echo "Theres nothing to unmount" && exit - for i in "${unmount_array[@]}" - do - main=$(k3s kubectl get pvc -A | grep -E "\s$i\s" | awk '{print $1, $2, $4}') - app=$(echo "$main" | awk '{print $1}' | cut -c 4-) - pvc=$(echo "$main" | awk '{print $3}') - mapfile -t path < <(find /mnt/*/ix-applications/releases/"$app"/volumes/ -maxdepth 0 | cut -c 6-) - if [[ "${#path[@]}" -gt 1 ]]; then #if there is another app with the same name on another pool, use the current pools application, since the other instance is probably old, or unused. - echo "$i is a name used on more than one pool.. attempting to use your current kubernetes apps pool" - pool=$(cli -c 'app kubernetes config' | grep -E "dataset\s\|" | awk -F '|' '{print $3}' | awk -F '/' '{print $1}' | tr -d " \t\n\r") - full_path=$(find /mnt/"$pool"/ix-applications/releases/"$app"/volumes/ -maxdepth 0 | cut -c 6-) - zfs set mountpoint=legacy "$full_path""$pvc" && echo "$i unmounted" && rmdir /mnt/heavyscript/"$i" || echo "failed to unmount $i" - else - zfs set mountpoint=legacy "$path""$pvc" && echo "$i unmounted" && rmdir /mnt/heavyscript/"$i" || echo "failed to unmount $i" - fi - done - rmdir /mnt/heavyscript -else - echo "Invalid selection, \"$selection\" was not an option" -fi -} -export -f mount - - -sync(){ -echo -e "\nSyncing all catalogs, please wait.." && cli -c 'app catalog sync_all' &> /dev/null && echo -e "Catalog sync complete" -} -export -f sync - - -update_apps(){ -# Replace with line below after testing -# cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,container_images_update_available,status' | tr -d " \t\r" | grep -E ",true($|,)" | sort -mapfile -t array < <(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,container_images_update_available,status' | grep -E ",true(,|\b)" | sort) -[[ -z $array ]] && echo -e "\nThere are no updates available" && return 0 || echo -e "\n${#array[@]} update(s) available" -[[ -z $timeout ]] && echo -e "\nDefault Timeout: 500" && timeout=500 || echo -e "\nCustom Timeout: $timeout" -[[ "$timeout" -le 120 ]] && echo "Warning: Your timeout is set low and may lead to premature rollbacks or skips" -for i in "${array[@]}" -do - app_name=$(echo "$i" | awk -F ',' '{print $1}') #print out first catagory, name. - old_app_ver=$(echo "$i" | awk -F ',' '{print $4}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #previous/current Application MAJOR Version - new_app_ver=$(echo "$i" | awk -F ',' '{print $5}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #new Application MAJOR Version - old_chart_ver=$(echo "$i" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}' | awk -F '.' '{print $1}') # Old Chart MAJOR version - new_chart_ver=$(echo "$i" | awk -F ',' '{print $5}' | awk -F '_' '{print $2}' | awk -F '.' '{print $1}') # New Chart MAJOR version - status=$(echo "$i" | awk -F ',' '{print $2}') #status of the app: STOPPED / DEPLOYING / ACTIVE - startstatus=$status - diff_app=$(diff <(echo "$old_app_ver") <(echo "$new_app_ver")) #caluclating difference in major app versions - diff_chart=$(diff <(echo "$old_chart_ver") <(echo "$new_chart_ver")) #caluclating difference in Chart versions - old_full_ver=$(echo "$i" | awk -F ',' '{print $4}') #Upgraded From - new_full_ver=$(echo "$i" | awk -F ',' '{print $5}') #Upraded To - rollback_version=$(echo "$i" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}') - printf '%s\0' "${ignore[@]}" | grep -iFxqz "${app_name}" && echo -e "\n$app_name\nIgnored, skipping" && continue #If application is on ignore list, skip - if [[ "$diff_app" == "$diff_chart" || "$update_all_apps" == "true" ]]; then #continue to update - if [[ $stop_before_update == "true" ]]; then # Check to see if user is using -S or not - if [[ "$status" == "STOPPED" ]]; then # if status is already stopped, skip while loop - echo -e "\n$app_name" - [[ "$verbose" == "true" ]] && echo "Updating.." - cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo -e "Updated\n$old_full_ver\n$new_full_ver" && after_update_actions || echo "FAILED" - continue - else # if status was not STOPPED, stop the app prior to updating - echo -e "\n$app_name" - [[ "$verbose" == "true" ]] && echo "Stopping prior to update.." - midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null && SECONDS=0 || echo -e "FAILED" - while [[ "$status" != "STOPPED" ]] - do - status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep "^$app_name," | awk -F ',' '{print $2}') - if [[ "$status" == "STOPPED" ]]; then - echo "Stopped" - [[ "$verbose" == "true" ]] && echo "Updating.." - cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo -e "Updated\n$old_full_ver\n$new_full_ver" && after_update_actions || echo "Failed to update" - break - elif [[ "$SECONDS" -ge "$timeout" ]]; then - echo "Error: Run Time($SECONDS) has exceeded Timeout($timeout)" - break - elif [[ "$status" != "STOPPED" ]]; then - [[ "$verbose" == "true" ]] && echo "Waiting $((timeout-SECONDS)) more seconds for $app_name to be STOPPED" - sleep 10 - continue - fi - done - fi - else #user must not be using -S, just update - echo -e "\n$app_name" - [[ "$verbose" == "true" ]] && echo "Updating.." - cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo -e "Updated\n$old_full_ver\n$new_full_ver" && after_update_actions || echo "FAILED" - fi - else - echo -e "\n$app_name\nMajor Release, update manually" - continue - fi -done -} -export -f update_apps - - -after_update_actions(){ -SECONDS=0 -count=0 -if [[ $rollback == "true" ]]; then - while [[ "0" != "1" ]] - do - (( count++ )) - status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep "^$app_name," | awk -F ',' '{print $2}') - if [[ "$status" == "ACTIVE" && "$startstatus" == "STOPPED" ]]; then - [[ "$verbose" == "true" ]] && echo "Returing to STOPPED state.." - midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null && echo "Stopped"|| echo "FAILED" - break - elif [[ "$SECONDS" -ge "$timeout" && "$status" == "DEPLOYING" && "$failed" != "true" ]]; then - echo -e "Error: Run Time($SECONDS) for $app_name has exceeded Timeout($timeout)\nIf this is a slow starting application, set a higher timeout with -t\nIf this applicaion is always DEPLOYING, you can disable all probes under the Healthcheck Probes Liveness section in the edit configuration\nReverting update.." - midclt call chart.release.rollback "$app_name" "{\"item_version\": \"$rollback_version\"}" &> /dev/null - [[ "$startstatus" == "STOPPED" ]] && failed="true" && after_update_actions && unset failed #run back after_update_actions function if the app was stopped prior to update - break - elif [[ "$SECONDS" -ge "$timeout" && "$status" == "DEPLOYING" && "$failed" == "true" ]]; then - echo -e "Error: Run Time($SECONDS) for $app_name has exceeded Timeout($timeout)\nThe application failed to be ACTIVE even after a rollback,\nManual intervention is required\nAbandoning" - break - elif [[ "$status" == "STOPPED" ]]; then - [[ "$count" -le 1 && "$verbose" == "true" ]] && echo "Verifying Stopped.." && sleep 15 && continue #if reports stopped on FIRST time through loop, double check - [[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports stopped on FIRST time through loop, double check - echo "Stopped" && break #if reports stopped any time after the first loop, assume its extermal services. - elif [[ "$status" == "ACTIVE" ]]; then - [[ "$count" -le 1 && "$verbose" == "true" ]] && echo "Verifying Active.." && sleep 15 && continue #if reports active on FIRST time through loop, double check - [[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports active on FIRST time through loop, double check - echo "Active" && break #if reports active any time after the first loop, assume actually active. - else - [[ "$verbose" == "true" ]] && echo "Waiting $((timeout-SECONDS)) more seconds for $app_name to be ACTIVE" - sleep 15 - continue - fi - done -else - if [[ "$startstatus" == "STOPPED" ]]; then - while [[ "0" != "1" ]] #using a constant while loop, then breaking out of the loop with break commands below. - do - (( count++ )) - status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep "^$app_name," | awk -F ',' '{print $2}') - if [[ "$status" == "STOPPED" ]]; then - [[ "$count" -le 1 && "$verbose" == "true" ]] && echo "Verifying Stopped.." && sleep 15 && continue #if reports stopped on FIRST time through loop, double check - [[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports stopped on FIRST time through loop, double check - echo "Stopped" && break #assume actually stopped anytime AFTER the first loop - break - elif [[ "$status" == "ACTIVE" ]]; then - [[ "$count" -le 1 && "$verbose" == "true" ]] && echo "Verifying Active.." && sleep 15 && continue #if reports active on FIRST time through loop, double check - [[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports active on FIRST time through loop, double check - [[ "$verbose" == "true" ]] && echo "Returing to STOPPED state.." - midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null && echo "Stopped"|| echo "FAILED" - break - elif [[ "$SECONDS" -ge "$timeout" ]]; then - echo "Error: Run Time($SECONDS) has exceeded Timeout($timeout)" - break - else - [[ "$verbose" == "true" ]] && echo "Waiting $((timeout-SECONDS)) more seconds for $app_name to be ACTIVE" - sleep 10 - continue - fi - done - fi -fi -} -export -f after_update_actions - - -prune(){ -echo -e "\nPruning Docker Images" && docker image prune -af | grep "^Total" || echo "Failed to Prune Docker Images" -} -export -f prune - - -title(){ -echo ' _ _ _____ _ _ ' -echo '| | | | / ___| (_) | | ' -echo '| |_| | ___ __ ___ ___ _\ `--. ___ _ __ _ _ __ | |_' -echo "| _ |/ _ \/ _\` \ \ / / | | |\`--. \/ __| '__| | '_ \| __|" -echo '| | | | __/ (_| |\ V /| |_| /\__/ / (__| | | | |_) | |_ ' -echo '\_| |_/\___|\__,_| \_/ \__, \____/ \___|_| |_| .__/ \__|' -echo ' __/ | | | ' -echo ' |___/ |_| ' -echo -} -export -f title +# shellcheck source=functions/backup.sh +source functions/backup.sh +# shellcheck source=functions/dns.sh +source functions/dns.sh +# shellcheck source=functions/misc.sh +source functions/misc.sh +# shellcheck source=functions/mount.sh +source functions/mount.sh +# shellcheck source=functions/self_update.sh +source functions/self_update.sh +# shellcheck source=functions/update_apps.sh +source functions/update_apps.sh # Parse script options From d7136fe270da807791f0fdf10312b422e48e0cc0 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 24 Jul 2022 22:03:57 -0600 Subject: [PATCH 0276/1229] test --- functions/update_apps.sh | 54 +++++++++++++++++++++++----------------- 1 file changed, 31 insertions(+), 23 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index a406e46d..dcce0351 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -1,35 +1,45 @@ #!/bin/bash -update_apps(){ -# Replace with line below after testing -# cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,container_images_update_available,status' | tr -d " \t\r" | grep -E ",true($|,)" | sort -mapfile -t array < <(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,container_images_update_available,status' | grep -E ",true(,|\b)" | sort) +mapfile -t array < <(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,container_images_update_available,status' | tr -d " \t\r" | grep -E ",true($|,)" | sort) [[ -z $array ]] && echo -e "\nThere are no updates available" && return 0 || echo -e "\n${#array[@]} update(s) available" [[ -z $timeout ]] && echo -e "\nDefault Timeout: 500" && timeout=500 || echo -e "\nCustom Timeout: $timeout" [[ "$timeout" -le 120 ]] && echo "Warning: Your timeout is set low and may lead to premature rollbacks or skips" -for i in "${array[@]}" -do - app_name=$(echo "$i" | awk -F ',' '{print $1}') #print out first catagory, name. - old_app_ver=$(echo "$i" | awk -F ',' '{print $4}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #previous/current Application MAJOR Version - new_app_ver=$(echo "$i" | awk -F ',' '{print $5}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #new Application MAJOR Version - old_chart_ver=$(echo "$i" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}' | awk -F '.' '{print $1}') # Old Chart MAJOR version - new_chart_ver=$(echo "$i" | awk -F ',' '{print $5}' | awk -F '_' '{print $2}' | awk -F '.' '{print $1}') # New Chart MAJOR version - status=$(echo "$i" | awk -F ',' '{print $2}') #status of the app: STOPPED / DEPLOYING / ACTIVE - startstatus=$status - diff_app=$(diff <(echo "$old_app_ver") <(echo "$new_app_ver")) #caluclating difference in major app versions - diff_chart=$(diff <(echo "$old_chart_ver") <(echo "$new_chart_ver")) #caluclating difference in Chart versions - old_full_ver=$(echo "$i" | awk -F ',' '{print $4}') #Upgraded From - new_full_ver=$(echo "$i" | awk -F ',' '{print $5}') #Upraded To - rollback_version=$(echo "$i" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}') - printf '%s\0' "${ignore[@]}" | grep -iFxqz "${app_name}" && echo -e "\n$app_name\nIgnored, skipping" && continue #If application is on ignore list, skip + +update_limit=5 +count=0 + for i in "${array[@]}" + do + update_apps "$i" & + (( count++ )) + while [[ "$count" -ge "$update_limit" ]] + do + wait + done + done + + +update_apps(){ +app_name=$(echo "$i" | awk -F ',' '{print $1}') #print out first catagory, name. +old_app_ver=$(echo "$i" | awk -F ',' '{print $4}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #previous/current Application MAJOR Version +new_app_ver=$(echo "$i" | awk -F ',' '{print $5}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #new Application MAJOR Version +old_chart_ver=$(echo "$i" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}' | awk -F '.' '{print $1}') # Old Chart MAJOR version +new_chart_ver=$(echo "$i" | awk -F ',' '{print $5}' | awk -F '_' '{print $2}' | awk -F '.' '{print $1}') # New Chart MAJOR version +status=$(echo "$i" | awk -F ',' '{print $2}') #status of the app: STOPPED / DEPLOYING / ACTIVE +startstatus=$status +diff_app=$(diff <(echo "$old_app_ver") <(echo "$new_app_ver")) #caluclating difference in major app versions +diff_chart=$(diff <(echo "$old_chart_ver") <(echo "$new_chart_ver")) #caluclating difference in Chart versions +old_full_ver=$(echo "$i" | awk -F ',' '{print $4}') #Upgraded From +new_full_ver=$(echo "$i" | awk -F ',' '{print $5}') #Upraded To +rollback_version=$(echo "$i" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}') +printf '%s\0' "${ignore[@]}" | grep -iFxqz "${app_name}" && echo -e "\n$app_name\nIgnored, skipping" && return #If application is on ignore list, skip if [[ "$diff_app" == "$diff_chart" || "$update_all_apps" == "true" ]]; then #continue to update if [[ $stop_before_update == "true" ]]; then # Check to see if user is using -S or not if [[ "$status" == "STOPPED" ]]; then # if status is already stopped, skip while loop echo -e "\n$app_name" [[ "$verbose" == "true" ]] && echo "Updating.." cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo -e "Updated\n$old_full_ver\n$new_full_ver" && after_update_actions || echo "FAILED" - continue + return else # if status was not STOPPED, stop the app prior to updating echo -e "\n$app_name" [[ "$verbose" == "true" ]] && echo "Stopping prior to update.." @@ -48,7 +58,6 @@ do elif [[ "$status" != "STOPPED" ]]; then [[ "$verbose" == "true" ]] && echo "Waiting $((timeout-SECONDS)) more seconds for $app_name to be STOPPED" sleep 10 - continue fi done fi @@ -59,9 +68,8 @@ do fi else echo -e "\n$app_name\nMajor Release, update manually" - continue + return fi -done } export -f update_apps From a0104e65e2f1aae45444c168f92af3a8b66aab9e Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 24 Jul 2022 22:07:24 -0600 Subject: [PATCH 0277/1229] waiting --- functions/update_apps.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index dcce0351..dea780d6 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -14,6 +14,7 @@ count=0 (( count++ )) while [[ "$count" -ge "$update_limit" ]] do + echo "waiting for free space" wait done done From 63ec2b586adc3a585f9dc2d36600e1282cdf9605 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 24 Jul 2022 22:11:04 -0600 Subject: [PATCH 0278/1229] commander func --- functions/update_apps.sh | 5 +++-- heavy_script.sh | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index dea780d6..e5691bce 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -1,6 +1,6 @@ #!/bin/bash - +commander(){ mapfile -t array < <(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,container_images_update_available,status' | tr -d " \t\r" | grep -E ",true($|,)" | sort) [[ -z $array ]] && echo -e "\nThere are no updates available" && return 0 || echo -e "\n${#array[@]} update(s) available" [[ -z $timeout ]] && echo -e "\nDefault Timeout: 500" && timeout=500 || echo -e "\nCustom Timeout: $timeout" @@ -18,7 +18,8 @@ count=0 wait done done - +} +export -f commander update_apps(){ app_name=$(echo "$i" | awk -F ',' '{print $1}') #print out first catagory, name. diff --git a/heavy_script.sh b/heavy_script.sh index 90eb0575..905e50de 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -115,5 +115,5 @@ done [[ "$mount" == "true" ]] && mount && exit [[ "$number_of_backups" -ge 1 ]] && backup [[ "$sync" == "true" ]] && sync -[[ "$update_all_apps" == "true" || "$update_apps" == "true" ]] && update_apps +[[ "$update_all_apps" == "true" || "$update_apps" == "true" ]] && commander [[ "$prune" == "true" ]] && prune \ No newline at end of file From c60593da882782789c396e386d352627c6d607a9 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 24 Jul 2022 22:12:46 -0600 Subject: [PATCH 0279/1229] reset count --- functions/update_apps.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index e5691bce..8bf95187 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -16,6 +16,7 @@ count=0 do echo "waiting for free space" wait + count=0 done done } From 9079cf7a3318ca39e94778af44e1a664f609e370 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 24 Jul 2022 22:19:14 -0600 Subject: [PATCH 0280/1229] return --- functions/update_apps.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 8bf95187..8b4f3431 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -139,5 +139,6 @@ else done fi fi +return } export -f after_update_actions \ No newline at end of file From 1b89f902302038a39d4a763ec7d39aeef2d15bff Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 24 Jul 2022 22:23:57 -0600 Subject: [PATCH 0281/1229] wait --- functions/update_apps.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 8b4f3431..5284beab 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -12,6 +12,7 @@ count=0 do update_apps "$i" & (( count++ )) + processes+=($!) while [[ "$count" -ge "$update_limit" ]] do echo "waiting for free space" @@ -19,6 +20,12 @@ count=0 count=0 done done + +for proc in "${processes[@]}" +do + wait "$proc" +done + } export -f commander From 5d17035dffb7c71b99cd8a6e333cd5b317cc39b1 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 24 Jul 2022 22:26:43 -0600 Subject: [PATCH 0282/1229] wait --- functions/update_apps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 5284beab..c28f9f55 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -16,7 +16,7 @@ count=0 while [[ "$count" -ge "$update_limit" ]] do echo "waiting for free space" - wait + wait -n "${processes[@]}" count=0 done done From bed013a5840c60dc964bc8ae3244a1082f2fba43 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 24 Jul 2022 22:27:41 -0600 Subject: [PATCH 0283/1229] count --- functions/update_apps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index c28f9f55..b91cb9b6 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -17,7 +17,7 @@ count=0 do echo "waiting for free space" wait -n "${processes[@]}" - count=0 + (( count-- )) done done From 7268ae55949b971bac7818f932a04dd2435fb91b Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 24 Jul 2022 22:39:27 -0600 Subject: [PATCH 0284/1229] jobs --- functions/update_apps.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index b91cb9b6..d02ea7c5 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -15,9 +15,11 @@ count=0 processes+=($!) while [[ "$count" -ge "$update_limit" ]] do + jobs -p + pidcount=0 echo "waiting for free space" - wait -n "${processes[@]}" - (( count-- )) + wait -n "${processes[pidcount]}" && (( count-- )) + (( pidcount ++ )) done done From f2143d7330ca6e0fc74d6b71e0a547c628e41d72 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 24 Jul 2022 22:39:53 -0600 Subject: [PATCH 0285/1229] jobs --- functions/update_apps.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index d02ea7c5..46d647db 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -13,6 +13,7 @@ count=0 update_apps "$i" & (( count++ )) processes+=($!) + jobs -p while [[ "$count" -ge "$update_limit" ]] do jobs -p From 9cf49ed6c32c656115435acfe6e8c28ec365f83e Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 24 Jul 2022 22:45:38 -0600 Subject: [PATCH 0286/1229] output supress --- functions/update_apps.sh | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 46d647db..7af4f387 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -13,14 +13,10 @@ count=0 update_apps "$i" & (( count++ )) processes+=($!) - jobs -p while [[ "$count" -ge "$update_limit" ]] do - jobs -p - pidcount=0 echo "waiting for free space" - wait -n "${processes[pidcount]}" && (( count-- )) - (( pidcount ++ )) + wait -n "${processes[@]}" &> /dev/null && (( count-- )) done done From 4fe1589aef2d62ab4550d7fd1e253f8f8080bb58 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 24 Jul 2022 23:12:15 -0600 Subject: [PATCH 0287/1229] proccount --- functions/update_apps.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 7af4f387..2c01edb0 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -11,12 +11,14 @@ count=0 for i in "${array[@]}" do update_apps "$i" & - (( count++ )) processes+=($!) - while [[ "$count" -ge "$update_limit" ]] + proc_count=0 + while [[ "${#processes[@]}" -ge "$update_limit" ]] do echo "waiting for free space" - wait -n "${processes[@]}" &> /dev/null && (( count-- )) + wait -n "${processes[$proc_count]}" &> /dev/null + (( proc_count++ )) + unset "processes[$proc_count]" done done From 9000d47a18af80d5f21519182643c8224e65238f Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 24 Jul 2022 23:34:20 -0600 Subject: [PATCH 0288/1229] revamp --- functions/update_apps.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 2c01edb0..027d53d5 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -13,12 +13,14 @@ count=0 update_apps "$i" & processes+=($!) proc_count=0 + count=$(jobs -p | wc -l) while [[ "${#processes[@]}" -ge "$update_limit" ]] do - echo "waiting for free space" - wait -n "${processes[$proc_count]}" &> /dev/null - (( proc_count++ )) - unset "processes[$proc_count]" + for proc in "${processes[@]}" + do + kill -0 "$proc" || unset "processes[$proc_count]" + (( proc_count++ )) + done done done From c347a7c5f8dc84ace276af4ac3bfd0fa16bb3c09 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 24 Jul 2022 23:35:03 -0600 Subject: [PATCH 0289/1229] lower app limit for test --- functions/update_apps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 027d53d5..ebd6aa51 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -6,7 +6,7 @@ mapfile -t array < <(cli -m csv -c 'app chart_release query name,update_availabl [[ -z $timeout ]] && echo -e "\nDefault Timeout: 500" && timeout=500 || echo -e "\nCustom Timeout: $timeout" [[ "$timeout" -le 120 ]] && echo "Warning: Your timeout is set low and may lead to premature rollbacks or skips" -update_limit=5 +update_limit=2 count=0 for i in "${array[@]}" do From 7cd8de351af27118ecd65d1a301cc124c346d908 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 24 Jul 2022 23:38:14 -0600 Subject: [PATCH 0290/1229] test --- functions/update_apps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index ebd6aa51..f3e8d22d 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -18,7 +18,7 @@ count=0 do for proc in "${processes[@]}" do - kill -0 "$proc" || unset "processes[$proc_count]" + kill -0 "$proc" || { unset "processes[$proc_count]"; break; } (( proc_count++ )) done done From f8a1721b645a8118e4ba87580783f2fe4b81eb2d Mon Sep 17 00:00:00 2001 From: TrueCharts-Bot Date: Mon, 25 Jul 2022 00:38:54 +0000 Subject: [PATCH 0291/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.127.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index b623b0f5..313a9be3 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@7321ae5f43795a2456f3a1379e7cfce25891dbcf # tag=v32.125.0 + uses: renovatebot/github-action@fa1bc90d63a63594fc8db7ee030d357615b2e38c # tag=v32.127.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From b6ec4d4c67fd62bc8d72998147c5218f26859666 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 25 Jul 2022 14:06:40 -0600 Subject: [PATCH 0292/1229] new method --- functions/update_apps.sh | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index f3e8d22d..db857f38 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -7,20 +7,15 @@ mapfile -t array < <(cli -m csv -c 'app chart_release query name,update_availabl [[ "$timeout" -le 120 ]] && echo "Warning: Your timeout is set low and may lead to premature rollbacks or skips" update_limit=2 -count=0 +current_updates=0 for i in "${array[@]}" do update_apps "$i" & + (( current_updates++ )) processes+=($!) - proc_count=0 - count=$(jobs -p | wc -l) - while [[ "${#processes[@]}" -ge "$update_limit" ]] + while [[ current_updates -ge "$update_limit" ]] do - for proc in "${processes[@]}" - do - kill -0 "$proc" || { unset "processes[$proc_count]"; break; } - (( proc_count++ )) - done + sleep 5 done done @@ -45,13 +40,14 @@ diff_chart=$(diff <(echo "$old_chart_ver") <(echo "$new_chart_ver")) #caluclatin old_full_ver=$(echo "$i" | awk -F ',' '{print $4}') #Upgraded From new_full_ver=$(echo "$i" | awk -F ',' '{print $5}') #Upraded To rollback_version=$(echo "$i" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}') -printf '%s\0' "${ignore[@]}" | grep -iFxqz "${app_name}" && echo -e "\n$app_name\nIgnored, skipping" && return #If application is on ignore list, skip +printf '%s\0' "${ignore[@]}" | grep -iFxqz "${app_name}" && echo -e "\n$app_name\nIgnored, skipping" && (( current_updates-- )) && return #If application is on ignore list, skip if [[ "$diff_app" == "$diff_chart" || "$update_all_apps" == "true" ]]; then #continue to update if [[ $stop_before_update == "true" ]]; then # Check to see if user is using -S or not if [[ "$status" == "STOPPED" ]]; then # if status is already stopped, skip while loop echo -e "\n$app_name" [[ "$verbose" == "true" ]] && echo "Updating.." cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo -e "Updated\n$old_full_ver\n$new_full_ver" && after_update_actions || echo "FAILED" + (( current_updates-- )) return else # if status was not STOPPED, stop the app prior to updating echo -e "\n$app_name" @@ -81,8 +77,10 @@ printf '%s\0' "${ignore[@]}" | grep -iFxqz "${app_name}" && echo -e "\n$app_name fi else echo -e "\n$app_name\nMajor Release, update manually" + (( current_updates-- )) return fi +(( current_updates-- )) } export -f update_apps @@ -149,6 +147,5 @@ else done fi fi -return } export -f after_update_actions \ No newline at end of file From 96a412387ce703490d34f1ad8fbdbaef19957e37 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 25 Jul 2022 14:10:57 -0600 Subject: [PATCH 0293/1229] uhh --- functions/update_apps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index db857f38..3d6b125b 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -13,7 +13,7 @@ current_updates=0 update_apps "$i" & (( current_updates++ )) processes+=($!) - while [[ current_updates -ge "$update_limit" ]] + while [[ "$current_updates" -ge "$update_limit" ]] do sleep 5 done From 53a7048dc4e7270927db0193b13f4125266e2516 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 25 Jul 2022 14:16:08 -0600 Subject: [PATCH 0294/1229] global --- functions/update_apps.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 3d6b125b..a4f3ff49 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -1,13 +1,14 @@ #!/bin/bash +current_updates=0 + commander(){ mapfile -t array < <(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,container_images_update_available,status' | tr -d " \t\r" | grep -E ",true($|,)" | sort) [[ -z $array ]] && echo -e "\nThere are no updates available" && return 0 || echo -e "\n${#array[@]} update(s) available" [[ -z $timeout ]] && echo -e "\nDefault Timeout: 500" && timeout=500 || echo -e "\nCustom Timeout: $timeout" [[ "$timeout" -le 120 ]] && echo "Warning: Your timeout is set low and may lead to premature rollbacks or skips" - update_limit=2 -current_updates=0 + for i in "${array[@]}" do update_apps "$i" & From 13a13cdbd7a796e22d32ccc3242821d92a83946a Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 25 Jul 2022 14:28:04 -0600 Subject: [PATCH 0295/1229] who knowws --- functions/update_apps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index a4f3ff49..092609e4 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -11,7 +11,7 @@ update_limit=2 for i in "${array[@]}" do - update_apps "$i" & + update_apps "$i" && (( current_updates-- )) & (( current_updates++ )) processes+=($!) while [[ "$current_updates" -ge "$update_limit" ]] From a12ead1bef8742997e210c1110a3c213c5da0fcf Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 25 Jul 2022 14:42:57 -0600 Subject: [PATCH 0296/1229] huih --- functions/update_apps.sh | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 092609e4..28758d57 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -1,6 +1,5 @@ #!/bin/bash -current_updates=0 commander(){ mapfile -t array < <(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,container_images_update_available,status' | tr -d " \t\r" | grep -E ",true($|,)" | sort) @@ -8,17 +7,33 @@ mapfile -t array < <(cli -m csv -c 'app chart_release query name,update_availabl [[ -z $timeout ]] && echo -e "\nDefault Timeout: 500" && timeout=500 || echo -e "\nCustom Timeout: $timeout" [[ "$timeout" -le 120 ]] && echo "Warning: Your timeout is set low and may lead to premature rollbacks or skips" update_limit=2 +current_updates=0 - for i in "${array[@]}" - do - update_apps "$i" && (( current_updates-- )) & - (( current_updates++ )) - processes+=($!) - while [[ "$current_updates" -ge "$update_limit" ]] + +while true +do + if [[ current_updates -ge "$update_limit" ]]; then + sleep 5 + else + for i in "${array[@]}" do - sleep 5 + update_apps "$i" && (( current_updates-- )) & (( current_updates++ )) + processes+=($!) done - done + fi +done + + + + + + + + + + + + for proc in "${processes[@]}" do From 2d5987229be8813178de55cd41387a85a196b1a1 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 25 Jul 2022 14:45:43 -0600 Subject: [PATCH 0297/1229] test --- functions/update_apps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 28758d57..f013b78c 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -17,7 +17,7 @@ do else for i in "${array[@]}" do - update_apps "$i" && (( current_updates-- )) & (( current_updates++ )) + { update_apps "$i"; (( current_updates-- )) ;} & (( current_updates++ )) processes+=($!) done fi From 10cb46633b2839772a679aea3b303643024f7c89 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 25 Jul 2022 15:02:47 -0600 Subject: [PATCH 0298/1229] while loop --- functions/update_apps.sh | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index f013b78c..29770ad2 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -9,32 +9,22 @@ mapfile -t array < <(cli -m csv -c 'app chart_release query name,update_availabl update_limit=2 current_updates=0 - -while true +it=0 +while [[ $it -lt ${#array[@]} ]] do - if [[ current_updates -ge "$update_limit" ]]; then - sleep 5 + jobs=$(jobs -p | wc -l) + if [[ "$jobs" -ge "$update_limit" ]]; then + sleep 3 else - for i in "${array[@]}" - do - { update_apps "$i"; (( current_updates-- )) ;} & (( current_updates++ )) - processes+=($!) - done + update_apps "${#array[$it]}" & + processes+=($!) + ((it++)) fi done - - - - - - - - - for proc in "${processes[@]}" do wait "$proc" From f0e7624c51bbdd468a13131d8f691859aaf711e3 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 25 Jul 2022 15:06:18 -0600 Subject: [PATCH 0299/1229] whoops --- functions/update_apps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 29770ad2..b5cf1632 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -16,7 +16,7 @@ do if [[ "$jobs" -ge "$update_limit" ]]; then sleep 3 else - update_apps "${#array[$it]}" & + update_apps "${array[$it]}" & processes+=($!) ((it++)) fi From 69875f8fda58ddb19cfa3aa7e1424471241d482e Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 25 Jul 2022 15:15:25 -0600 Subject: [PATCH 0300/1229] huh --- functions/update_apps.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index b5cf1632..6344be3b 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -7,7 +7,6 @@ mapfile -t array < <(cli -m csv -c 'app chart_release query name,update_availabl [[ -z $timeout ]] && echo -e "\nDefault Timeout: 500" && timeout=500 || echo -e "\nCustom Timeout: $timeout" [[ "$timeout" -le 120 ]] && echo "Warning: Your timeout is set low and may lead to premature rollbacks or skips" update_limit=2 -current_updates=0 it=0 while [[ $it -lt ${#array[@]} ]] @@ -16,15 +15,14 @@ do if [[ "$jobs" -ge "$update_limit" ]]; then sleep 3 else - update_apps "${array[$it]}" & + application="${array[$it]}" + update_apps "$application" & processes+=($!) ((it++)) fi done - - for proc in "${processes[@]}" do wait "$proc" From 26bfaf5306a8de5bb94bfaacfe282bf46c8e8667 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 25 Jul 2022 15:17:35 -0600 Subject: [PATCH 0301/1229] update --- functions/update_apps.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 6344be3b..6651e331 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -15,8 +15,7 @@ do if [[ "$jobs" -ge "$update_limit" ]]; then sleep 3 else - application="${array[$it]}" - update_apps "$application" & + update_apps "${array[$it]}" & processes+=($!) ((it++)) fi @@ -32,6 +31,7 @@ done export -f commander update_apps(){ +i=${array[$it]} app_name=$(echo "$i" | awk -F ',' '{print $1}') #print out first catagory, name. old_app_ver=$(echo "$i" | awk -F ',' '{print $4}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #previous/current Application MAJOR Version new_app_ver=$(echo "$i" | awk -F ',' '{print $5}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #new Application MAJOR Version From 36cc4c1143a08db3c4267a8ed6835943167a9cab Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 25 Jul 2022 15:20:32 -0600 Subject: [PATCH 0302/1229] async --- functions/update_apps.sh | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 6651e331..6ff12b6f 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -31,27 +31,25 @@ done export -f commander update_apps(){ -i=${array[$it]} -app_name=$(echo "$i" | awk -F ',' '{print $1}') #print out first catagory, name. -old_app_ver=$(echo "$i" | awk -F ',' '{print $4}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #previous/current Application MAJOR Version -new_app_ver=$(echo "$i" | awk -F ',' '{print $5}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #new Application MAJOR Version -old_chart_ver=$(echo "$i" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}' | awk -F '.' '{print $1}') # Old Chart MAJOR version -new_chart_ver=$(echo "$i" | awk -F ',' '{print $5}' | awk -F '_' '{print $2}' | awk -F '.' '{print $1}') # New Chart MAJOR version -status=$(echo "$i" | awk -F ',' '{print $2}') #status of the app: STOPPED / DEPLOYING / ACTIVE +app_name=$(echo "${array[$it]}" | awk -F ',' '{print $1}') #print out first catagory, name. +old_app_ver=$(echo "${array[$it]}" | awk -F ',' '{print $4}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #previous/current Application MAJOR Version +new_app_ver=$(echo "${array[$it]}" | awk -F ',' '{print $5}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #new Application MAJOR Version +old_chart_ver=$(echo "${array[$it]}" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}' | awk -F '.' '{print $1}') # Old Chart MAJOR version +new_chart_ver=$(echo "${array[$it]}" | awk -F ',' '{print $5}' | awk -F '_' '{print $2}' | awk -F '.' '{print $1}') # New Chart MAJOR version +status=$(echo "${array[$it]}" | awk -F ',' '{print $2}') #status of the app: STOPPED / DEPLOYING / ACTIVE startstatus=$status diff_app=$(diff <(echo "$old_app_ver") <(echo "$new_app_ver")) #caluclating difference in major app versions diff_chart=$(diff <(echo "$old_chart_ver") <(echo "$new_chart_ver")) #caluclating difference in Chart versions -old_full_ver=$(echo "$i" | awk -F ',' '{print $4}') #Upgraded From -new_full_ver=$(echo "$i" | awk -F ',' '{print $5}') #Upraded To -rollback_version=$(echo "$i" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}') -printf '%s\0' "${ignore[@]}" | grep -iFxqz "${app_name}" && echo -e "\n$app_name\nIgnored, skipping" && (( current_updates-- )) && return #If application is on ignore list, skip +old_full_ver=$(echo "${array[$it]}" | awk -F ',' '{print $4}') #Upgraded From +new_full_ver=$(echo "${array[$it]}" | awk -F ',' '{print $5}') #Upraded To +rollback_version=$(echo "${array[$it]}" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}') +printf '%s\0' "${ignore[@]}" | grep -iFxqz "${app_name}" && echo -e "\n$app_name\nIgnored, skipping" && return #If application is on ignore list, skip if [[ "$diff_app" == "$diff_chart" || "$update_all_apps" == "true" ]]; then #continue to update if [[ $stop_before_update == "true" ]]; then # Check to see if user is using -S or not if [[ "$status" == "STOPPED" ]]; then # if status is already stopped, skip while loop echo -e "\n$app_name" [[ "$verbose" == "true" ]] && echo "Updating.." cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo -e "Updated\n$old_full_ver\n$new_full_ver" && after_update_actions || echo "FAILED" - (( current_updates-- )) return else # if status was not STOPPED, stop the app prior to updating echo -e "\n$app_name" @@ -81,10 +79,8 @@ printf '%s\0' "${ignore[@]}" | grep -iFxqz "${app_name}" && echo -e "\n$app_name fi else echo -e "\n$app_name\nMajor Release, update manually" - (( current_updates-- )) return fi -(( current_updates-- )) } export -f update_apps From 71dca98533faf4c21bb9b361ee48cdd4397256c0 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 25 Jul 2022 15:21:26 -0600 Subject: [PATCH 0303/1229] update limit --- functions/update_apps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 6ff12b6f..e0b813ba 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -6,7 +6,7 @@ mapfile -t array < <(cli -m csv -c 'app chart_release query name,update_availabl [[ -z $array ]] && echo -e "\nThere are no updates available" && return 0 || echo -e "\n${#array[@]} update(s) available" [[ -z $timeout ]] && echo -e "\nDefault Timeout: 500" && timeout=500 || echo -e "\nCustom Timeout: $timeout" [[ "$timeout" -le 120 ]] && echo "Warning: Your timeout is set low and may lead to premature rollbacks or skips" -update_limit=2 +update_limit=4 it=0 while [[ $it -lt ${#array[@]} ]] From 0de879ef38f0bca88d77fe2f56b448fa70658fb7 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 25 Jul 2022 15:59:51 -0600 Subject: [PATCH 0304/1229] idk --- functions/update_apps.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index e0b813ba..84221570 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -15,18 +15,20 @@ do if [[ "$jobs" -ge "$update_limit" ]]; then sleep 3 else - update_apps "${array[$it]}" & + output=$(update_apps "${array[$it]}" &) processes+=($!) ((it++)) fi done - +echo "$output" for proc in "${processes[@]}" do wait "$proc" done + + } export -f commander From 8f3b9e99228499fc9905866cb148d0ab51832b52 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 25 Jul 2022 16:04:43 -0600 Subject: [PATCH 0305/1229] array? --- functions/update_apps.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 84221570..bdf438e0 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -15,12 +15,16 @@ do if [[ "$jobs" -ge "$update_limit" ]]; then sleep 3 else - output=$(update_apps "${array[$it]}" &) + mapfile -t output < <(update_apps "${array[$it]}" &) processes+=($!) ((it++)) fi done -echo "$output" + +for i in "${output[@]}" +do + echo "$i" +done for proc in "${processes[@]}" do From 017edabaf0a0f0184cd3d5236d9f39fbd5f213df Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 25 Jul 2022 16:05:37 -0600 Subject: [PATCH 0306/1229] wait for processes first --- functions/update_apps.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index bdf438e0..8fb9a588 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -21,15 +21,17 @@ do fi done +for proc in "${processes[@]}" +do + wait "$proc" +done + + for i in "${output[@]}" do echo "$i" done -for proc in "${processes[@]}" -do - wait "$proc" -done From a8d26c072ee878ea7cc6421d4579682c0fca4d7c Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 25 Jul 2022 16:08:05 -0600 Subject: [PATCH 0307/1229] hmm --- functions/update_apps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 8fb9a588..d3239c49 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -15,7 +15,7 @@ do if [[ "$jobs" -ge "$update_limit" ]]; then sleep 3 else - mapfile -t output < <(update_apps "${array[$it]}" &) + mapfile -t output < <(update_apps "${array[$it]}") & processes+=($!) ((it++)) fi From b499b87dc177f0734d540f9dbb40e9deb6639001 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 25 Jul 2022 16:23:50 -0600 Subject: [PATCH 0308/1229] uh --- functions/update_apps.sh | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index d3239c49..a97238ff 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -15,7 +15,7 @@ do if [[ "$jobs" -ge "$update_limit" ]]; then sleep 3 else - mapfile -t output < <(update_apps "${array[$it]}") & + coproc update_appsfd { update_apps "${array[$it]}" ; } processes+=($!) ((it++)) fi @@ -26,13 +26,9 @@ do wait "$proc" done +IFS= read -r -d '' -u "${update_appsfd[0]}" update_output -for i in "${output[@]}" -do - echo "$i" -done - - +echo "$update_output" } From 749b591c46070ae63c583ac3fa09b9749a9c7797 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 25 Jul 2022 16:46:05 -0600 Subject: [PATCH 0309/1229] test --- functions/update_apps.sh | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index a97238ff..23a8eee2 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -9,13 +9,14 @@ mapfile -t array < <(cli -m csv -c 'app chart_release query name,update_availabl update_limit=4 it=0 + while [[ $it -lt ${#array[@]} ]] do jobs=$(jobs -p | wc -l) if [[ "$jobs" -ge "$update_limit" ]]; then sleep 3 else - coproc update_appsfd { update_apps "${array[$it]}" ; } + update_apps "${array[$it]}" processes+=($!) ((it++)) fi @@ -26,10 +27,6 @@ do wait "$proc" done -IFS= read -r -d '' -u "${update_appsfd[0]}" update_output - -echo "$update_output" - } export -f commander @@ -85,7 +82,7 @@ printf '%s\0' "${ignore[@]}" | grep -iFxqz "${app_name}" && echo -e "\n$app_name echo -e "\n$app_name\nMajor Release, update manually" return fi -} +} | sort export -f update_apps From 143326d0cb5152b649048c54ff88007c64454fa0 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 25 Jul 2022 16:48:17 -0600 Subject: [PATCH 0310/1229] asdf --- functions/update_apps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 23a8eee2..2544c030 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -16,7 +16,7 @@ do if [[ "$jobs" -ge "$update_limit" ]]; then sleep 3 else - update_apps "${array[$it]}" + update_apps "${array[$it]}" & processes+=($!) ((it++)) fi From 0bc4d50e777c94e7390f121c312ef6d86379e159 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 25 Jul 2022 16:50:44 -0600 Subject: [PATCH 0311/1229] append output to array --- functions/update_apps.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 2544c030..dd6d80fd 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -44,7 +44,7 @@ diff_chart=$(diff <(echo "$old_chart_ver") <(echo "$new_chart_ver")) #caluclatin old_full_ver=$(echo "${array[$it]}" | awk -F ',' '{print $4}') #Upgraded From new_full_ver=$(echo "${array[$it]}" | awk -F ',' '{print $5}') #Upraded To rollback_version=$(echo "${array[$it]}" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}') -printf '%s\0' "${ignore[@]}" | grep -iFxqz "${app_name}" && echo -e "\n$app_name\nIgnored, skipping" && return #If application is on ignore list, skip +printf '%s\0' "${ignore[@]}" | grep -iFxqz "${app_name}" && echo_array+=(echo -e "\n$app_name\nIgnored, skipping") && return #If application is on ignore list, skip if [[ "$diff_app" == "$diff_chart" || "$update_all_apps" == "true" ]]; then #continue to update if [[ $stop_before_update == "true" ]]; then # Check to see if user is using -S or not if [[ "$status" == "STOPPED" ]]; then # if status is already stopped, skip while loop @@ -82,7 +82,7 @@ printf '%s\0' "${ignore[@]}" | grep -iFxqz "${app_name}" && echo -e "\n$app_name echo -e "\n$app_name\nMajor Release, update manually" return fi -} | sort +} export -f update_apps From 394486c7a32e5bc541a6436ceb3dced8b3b8b5a7 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 25 Jul 2022 16:52:51 -0600 Subject: [PATCH 0312/1229] dump array --- functions/update_apps.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index dd6d80fd..476078f1 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -82,6 +82,13 @@ printf '%s\0' "${ignore[@]}" | grep -iFxqz "${app_name}" && echo_array+=(echo -e echo -e "\n$app_name\nMajor Release, update manually" return fi + +#dump array +for i in "${echo_array[@]}" +do + echo "$i" +done + } export -f update_apps From 015f0df2c121a32c0bf3588006668796e4ebf76e Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 25 Jul 2022 16:56:40 -0600 Subject: [PATCH 0313/1229] array --- functions/update_apps.sh | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 476078f1..93ae1598 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -44,42 +44,42 @@ diff_chart=$(diff <(echo "$old_chart_ver") <(echo "$new_chart_ver")) #caluclatin old_full_ver=$(echo "${array[$it]}" | awk -F ',' '{print $4}') #Upgraded From new_full_ver=$(echo "${array[$it]}" | awk -F ',' '{print $5}') #Upraded To rollback_version=$(echo "${array[$it]}" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}') -printf '%s\0' "${ignore[@]}" | grep -iFxqz "${app_name}" && echo_array+=(echo -e "\n$app_name\nIgnored, skipping") && return #If application is on ignore list, skip +printf '%s\0' "${ignore[@]}" | grep -iFxqz "${app_name}" && echo -e "\n$app_name\nIgnored, skipping" && return #If application is on ignore list, skip if [[ "$diff_app" == "$diff_chart" || "$update_all_apps" == "true" ]]; then #continue to update if [[ $stop_before_update == "true" ]]; then # Check to see if user is using -S or not if [[ "$status" == "STOPPED" ]]; then # if status is already stopped, skip while loop - echo -e "\n$app_name" - [[ "$verbose" == "true" ]] && echo "Updating.." - cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo -e "Updated\n$old_full_ver\n$new_full_ver" && after_update_actions || echo "FAILED" + echo_array+=(echo -e "\n$app_name") + [[ "$verbose" == "true" ]] && echo_array+=(echo "Updating..") + cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo_array+=(echo -e "Updated\n$old_full_ver\n$new_full_ver") && after_update_actions || echo_array+=(echo "FAILED") return else # if status was not STOPPED, stop the app prior to updating - echo -e "\n$app_name" - [[ "$verbose" == "true" ]] && echo "Stopping prior to update.." - midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null && SECONDS=0 || echo -e "FAILED" + echo_array+=(echo -e "\n$app_name") + [[ "$verbose" == "true" ]] && echo_array+=(echo "Stopping prior to update..") + midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null && SECONDS=0 || echo_array+=(echo -e "FAILED") while [[ "$status" != "STOPPED" ]] do status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep "^$app_name," | awk -F ',' '{print $2}') if [[ "$status" == "STOPPED" ]]; then - echo "Stopped" - [[ "$verbose" == "true" ]] && echo "Updating.." - cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo -e "Updated\n$old_full_ver\n$new_full_ver" && after_update_actions || echo "Failed to update" + echo_array+=(echo "Stopped") + [[ "$verbose" == "true" ]] && echo_array+=(echo "Updating..") + cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo_array+=(echo -e "Updated\n$old_full_ver\n$new_full_ver") && after_update_actions || echo "Failed to update" break elif [[ "$SECONDS" -ge "$timeout" ]]; then - echo "Error: Run Time($SECONDS) has exceeded Timeout($timeout)" + echo_array+=(echo "Error: Run Time($SECONDS) has exceeded Timeout($timeout)") break elif [[ "$status" != "STOPPED" ]]; then - [[ "$verbose" == "true" ]] && echo "Waiting $((timeout-SECONDS)) more seconds for $app_name to be STOPPED" + [[ "$verbose" == "true" ]] && echo_array+=(echo "Waiting $((timeout-SECONDS)) more seconds for $app_name to be STOPPED") sleep 10 fi done fi else #user must not be using -S, just update - echo -e "\n$app_name" - [[ "$verbose" == "true" ]] && echo "Updating.." - cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo -e "Updated\n$old_full_ver\n$new_full_ver" && after_update_actions || echo "FAILED" + echo_array+=(echo -e "\n$app_name") + [[ "$verbose" == "true" ]] && echo_array+=(echo "Updating..") + cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo_array+=(echo -e "Updated\n$old_full_ver\n$new_full_ver") && after_update_actions || echo "FAILED" fi else - echo -e "\n$app_name\nMajor Release, update manually" + echo_array+=(echo -e "\n$app_name\nMajor Release, update manually") return fi From 337c6faa9e3e10408e1c240571f119385e48ea39 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 25 Jul 2022 16:57:56 -0600 Subject: [PATCH 0314/1229] huh --- functions/update_apps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 93ae1598..a69ddfe7 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -86,7 +86,7 @@ printf '%s\0' "${ignore[@]}" | grep -iFxqz "${app_name}" && echo -e "\n$app_name #dump array for i in "${echo_array[@]}" do - echo "$i" + echo -e "$i" done } From 25236e8b15c2e955915415a04ea4dbd5db4b7ec2 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 25 Jul 2022 17:06:59 -0600 Subject: [PATCH 0315/1229] remove echo --- functions/update_apps.sh | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index a69ddfe7..a274a3b5 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -48,38 +48,38 @@ printf '%s\0' "${ignore[@]}" | grep -iFxqz "${app_name}" && echo -e "\n$app_name if [[ "$diff_app" == "$diff_chart" || "$update_all_apps" == "true" ]]; then #continue to update if [[ $stop_before_update == "true" ]]; then # Check to see if user is using -S or not if [[ "$status" == "STOPPED" ]]; then # if status is already stopped, skip while loop - echo_array+=(echo -e "\n$app_name") - [[ "$verbose" == "true" ]] && echo_array+=(echo "Updating..") - cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo_array+=(echo -e "Updated\n$old_full_ver\n$new_full_ver") && after_update_actions || echo_array+=(echo "FAILED") + echo_array+=("\n$app_name") + [[ "$verbose" == "true" ]] && echo_array+=("Updating..") + cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo_array+=("Updated\n$old_full_ver\n$new_full_ver") && after_update_actions || echo_array+=("FAILED") return else # if status was not STOPPED, stop the app prior to updating - echo_array+=(echo -e "\n$app_name") - [[ "$verbose" == "true" ]] && echo_array+=(echo "Stopping prior to update..") - midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null && SECONDS=0 || echo_array+=(echo -e "FAILED") + echo_array+=("\n$app_name") + [[ "$verbose" == "true" ]] && echo_array+=("Stopping prior to update..") + midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null && SECONDS=0 || echo_array+=("FAILED") while [[ "$status" != "STOPPED" ]] do status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep "^$app_name," | awk -F ',' '{print $2}') if [[ "$status" == "STOPPED" ]]; then - echo_array+=(echo "Stopped") - [[ "$verbose" == "true" ]] && echo_array+=(echo "Updating..") - cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo_array+=(echo -e "Updated\n$old_full_ver\n$new_full_ver") && after_update_actions || echo "Failed to update" + echo_array+=("Stopped") + [[ "$verbose" == "true" ]] && echo_array+=("Updating..") + cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo_array+=("Updated\n$old_full_ver\n$new_full_ver") && after_update_actions || echo "Failed to update" break elif [[ "$SECONDS" -ge "$timeout" ]]; then - echo_array+=(echo "Error: Run Time($SECONDS) has exceeded Timeout($timeout)") + echo_array+=("Error: Run Time($SECONDS) has exceeded Timeout($timeout)") break elif [[ "$status" != "STOPPED" ]]; then - [[ "$verbose" == "true" ]] && echo_array+=(echo "Waiting $((timeout-SECONDS)) more seconds for $app_name to be STOPPED") + [[ "$verbose" == "true" ]] && echo_array+=("Waiting $((timeout-SECONDS)) more seconds for $app_name to be STOPPED") sleep 10 fi done fi else #user must not be using -S, just update - echo_array+=(echo -e "\n$app_name") - [[ "$verbose" == "true" ]] && echo_array+=(echo "Updating..") - cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo_array+=(echo -e "Updated\n$old_full_ver\n$new_full_ver") && after_update_actions || echo "FAILED" + echo_array+=("\n$app_name") + [[ "$verbose" == "true" ]] && echo_array+=("Updating..") + cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo_array+=("Updated\n$old_full_ver\n$new_full_ver") && after_update_actions || echo "FAILED" fi else - echo_array+=(echo -e "\n$app_name\nMajor Release, update manually") + echo_array+=("\n$app_name\nMajor Release, update manually") return fi From 3e125a009ef4b6eb081745b36606c49645b3df3e Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 25 Jul 2022 17:11:56 -0600 Subject: [PATCH 0316/1229] losing --- functions/update_apps.sh | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index a274a3b5..503ef0b3 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -62,7 +62,7 @@ printf '%s\0' "${ignore[@]}" | grep -iFxqz "${app_name}" && echo -e "\n$app_name if [[ "$status" == "STOPPED" ]]; then echo_array+=("Stopped") [[ "$verbose" == "true" ]] && echo_array+=("Updating..") - cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo_array+=("Updated\n$old_full_ver\n$new_full_ver") && after_update_actions || echo "Failed to update" + cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo_array+=("Updated\n$old_full_ver\n$new_full_ver") && after_update_actions || echo_array+=("Failed to update") break elif [[ "$SECONDS" -ge "$timeout" ]]; then echo_array+=("Error: Run Time($SECONDS) has exceeded Timeout($timeout)") @@ -76,7 +76,7 @@ printf '%s\0' "${ignore[@]}" | grep -iFxqz "${app_name}" && echo -e "\n$app_name else #user must not be using -S, just update echo_array+=("\n$app_name") [[ "$verbose" == "true" ]] && echo_array+=("Updating..") - cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo_array+=("Updated\n$old_full_ver\n$new_full_ver") && after_update_actions || echo "FAILED" + cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo_array+=("Updated\n$old_full_ver\n$new_full_ver") && after_update_actions || echo_array+=("FAILED") fi else echo_array+=("\n$app_name\nMajor Release, update manually") @@ -102,27 +102,27 @@ if [[ $rollback == "true" ]]; then (( count++ )) status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep "^$app_name," | awk -F ',' '{print $2}') if [[ "$status" == "ACTIVE" && "$startstatus" == "STOPPED" ]]; then - [[ "$verbose" == "true" ]] && echo "Returing to STOPPED state.." - midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null && echo "Stopped"|| echo "FAILED" + [[ "$verbose" == "true" ]] && echo_array+=("Returing to STOPPED state..") + midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null && echo_array+=("Stopped")|| echo_array+=("FAILED") break elif [[ "$SECONDS" -ge "$timeout" && "$status" == "DEPLOYING" && "$failed" != "true" ]]; then - echo -e "Error: Run Time($SECONDS) for $app_name has exceeded Timeout($timeout)\nIf this is a slow starting application, set a higher timeout with -t\nIf this applicaion is always DEPLOYING, you can disable all probes under the Healthcheck Probes Liveness section in the edit configuration\nReverting update.." + echo_array+=("Error: Run Time($SECONDS) for $app_name has exceeded Timeout($timeout)\nIf this is a slow starting application, set a higher timeout with -t\nIf this applicaion is always DEPLOYING, you can disable all probes under the Healthcheck Probes Liveness section in the edit configuration\nReverting update..") midclt call chart.release.rollback "$app_name" "{\"item_version\": \"$rollback_version\"}" &> /dev/null [[ "$startstatus" == "STOPPED" ]] && failed="true" && after_update_actions && unset failed #run back after_update_actions function if the app was stopped prior to update break elif [[ "$SECONDS" -ge "$timeout" && "$status" == "DEPLOYING" && "$failed" == "true" ]]; then - echo -e "Error: Run Time($SECONDS) for $app_name has exceeded Timeout($timeout)\nThe application failed to be ACTIVE even after a rollback,\nManual intervention is required\nAbandoning" + echo_array+=("Error: Run Time($SECONDS) for $app_name has exceeded Timeout($timeout)\nThe application failed to be ACTIVE even after a rollback,\nManual intervention is required\nAbandoning") break elif [[ "$status" == "STOPPED" ]]; then - [[ "$count" -le 1 && "$verbose" == "true" ]] && echo "Verifying Stopped.." && sleep 15 && continue #if reports stopped on FIRST time through loop, double check + [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Stopped..") && sleep 15 && continue #if reports stopped on FIRST time through loop, double check [[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports stopped on FIRST time through loop, double check - echo "Stopped" && break #if reports stopped any time after the first loop, assume its extermal services. + echo_array+=("Stopped") && break #if reports stopped any time after the first loop, assume its extermal services. elif [[ "$status" == "ACTIVE" ]]; then - [[ "$count" -le 1 && "$verbose" == "true" ]] && echo "Verifying Active.." && sleep 15 && continue #if reports active on FIRST time through loop, double check + [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Active..") && sleep 15 && continue #if reports active on FIRST time through loop, double check [[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports active on FIRST time through loop, double check echo "Active" && break #if reports active any time after the first loop, assume actually active. else - [[ "$verbose" == "true" ]] && echo "Waiting $((timeout-SECONDS)) more seconds for $app_name to be ACTIVE" + [[ "$verbose" == "true" ]] && echo_array+=("Waiting $((timeout-SECONDS)) more seconds for $app_name to be ACTIVE") sleep 15 continue fi @@ -134,21 +134,21 @@ else (( count++ )) status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep "^$app_name," | awk -F ',' '{print $2}') if [[ "$status" == "STOPPED" ]]; then - [[ "$count" -le 1 && "$verbose" == "true" ]] && echo "Verifying Stopped.." && sleep 15 && continue #if reports stopped on FIRST time through loop, double check + [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Stopped..") && sleep 15 && continue #if reports stopped on FIRST time through loop, double check [[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports stopped on FIRST time through loop, double check - echo "Stopped" && break #assume actually stopped anytime AFTER the first loop + echo_array+=("Stopped") && break #assume actually stopped anytime AFTER the first loop break elif [[ "$status" == "ACTIVE" ]]; then - [[ "$count" -le 1 && "$verbose" == "true" ]] && echo "Verifying Active.." && sleep 15 && continue #if reports active on FIRST time through loop, double check + [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Active..") && sleep 15 && continue #if reports active on FIRST time through loop, double check [[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports active on FIRST time through loop, double check - [[ "$verbose" == "true" ]] && echo "Returing to STOPPED state.." - midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null && echo "Stopped"|| echo "FAILED" + [[ "$verbose" == "true" ]] && echo_array+=("Returing to STOPPED state..") + midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null && echo_array+=("Stopped")|| echo_array+=("FAILED") break elif [[ "$SECONDS" -ge "$timeout" ]]; then - echo "Error: Run Time($SECONDS) has exceeded Timeout($timeout)" + echo_array+=("Error: Run Time($SECONDS) has exceeded Timeout($timeout)") break else - [[ "$verbose" == "true" ]] && echo "Waiting $((timeout-SECONDS)) more seconds for $app_name to be ACTIVE" + [[ "$verbose" == "true" ]] && echo_array+=("Waiting $((timeout-SECONDS)) more seconds for $app_name to be ACTIVE") sleep 10 continue fi From b0c122098b99eda6a519e5486a840fb1f6a72292 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 25 Jul 2022 17:21:41 -0600 Subject: [PATCH 0317/1229] move dunmp to after action --- functions/update_apps.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 503ef0b3..dc13a2ff 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -83,11 +83,6 @@ printf '%s\0' "${ignore[@]}" | grep -iFxqz "${app_name}" && echo -e "\n$app_name return fi -#dump array -for i in "${echo_array[@]}" -do - echo -e "$i" -done } export -f update_apps @@ -155,5 +150,13 @@ else done fi fi + +#dump array +for i in "${echo_array[@]}" +do + echo -e "$i" +done + + } export -f after_update_actions \ No newline at end of file From ee7608b1da88f6ad7f9e8c075ab88982a4618666 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 25 Jul 2022 17:38:10 -0600 Subject: [PATCH 0318/1229] forgot echo --- functions/update_apps.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index dc13a2ff..ed1a11f2 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -115,7 +115,7 @@ if [[ $rollback == "true" ]]; then elif [[ "$status" == "ACTIVE" ]]; then [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Active..") && sleep 15 && continue #if reports active on FIRST time through loop, double check [[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports active on FIRST time through loop, double check - echo "Active" && break #if reports active any time after the first loop, assume actually active. + echo_array+=(echo "Active") && break #if reports active any time after the first loop, assume actually active. else [[ "$verbose" == "true" ]] && echo_array+=("Waiting $((timeout-SECONDS)) more seconds for $app_name to be ACTIVE") sleep 15 @@ -151,7 +151,7 @@ else fi fi -#dump array +#Dump the echo_array, ensures all output is in a neat order. for i in "${echo_array[@]}" do echo -e "$i" From c13153959049d97b26585e0b738355fa3167da31 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 25 Jul 2022 17:40:05 -0600 Subject: [PATCH 0319/1229] remove redun echo --- functions/update_apps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index ed1a11f2..df93a344 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -115,7 +115,7 @@ if [[ $rollback == "true" ]]; then elif [[ "$status" == "ACTIVE" ]]; then [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Active..") && sleep 15 && continue #if reports active on FIRST time through loop, double check [[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports active on FIRST time through loop, double check - echo_array+=(echo "Active") && break #if reports active any time after the first loop, assume actually active. + echo_array+=("Active") && break #if reports active any time after the first loop, assume actually active. else [[ "$verbose" == "true" ]] && echo_array+=("Waiting $((timeout-SECONDS)) more seconds for $app_name to be ACTIVE") sleep 15 From 02aa8b6c22eb5ebb911a33f51fa3e495b453a0b3 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 25 Jul 2022 17:45:35 -0600 Subject: [PATCH 0320/1229] enhance --- functions/update_apps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index df93a344..917fbfdf 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -14,7 +14,7 @@ while [[ $it -lt ${#array[@]} ]] do jobs=$(jobs -p | wc -l) if [[ "$jobs" -ge "$update_limit" ]]; then - sleep 3 + sleep 1 else update_apps "${array[$it]}" & processes+=($!) From 7f41fd1d8d50deaa6e06a6ddee22256e0550df7a Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 25 Jul 2022 21:47:14 -0600 Subject: [PATCH 0321/1229] test --- heavy_script.sh | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index 905e50de..d0df8bed 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -52,10 +52,10 @@ do echo -e "Invalid Option \"-$OPTARG\"\n" && help exit ;; - :) - echo -e "Option: \"-$OPTARG\" requires an argument\n" && help - exit - ;; + # :) + # echo -e "Option: \"-$OPTARG\" requires an argument\n" && help + # exit + # ;; b) re='^[0-9]+$' number_of_backups=$OPTARG @@ -66,6 +66,7 @@ do rollback="true" ;; i) + [[ -z "$OPTARG" ]] && echo "\"-i\" requires an argument" && exit ignore+=("$OPTARG") ;; t) @@ -88,10 +89,6 @@ do p) prune="true" ;; - R) - rollback="true" - echo "WARNING: -R is being transisitioned to -r, this is due to a refactor in the script. Please Make the change ASAP!" - ;; v) verbose="true" ;; From 00e765a14d84ea41a3b94b37a0008370766712d1 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 25 Jul 2022 21:49:47 -0600 Subject: [PATCH 0322/1229] test --- heavy_script.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index d0df8bed..5ee2afcc 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -66,8 +66,8 @@ do rollback="true" ;; i) - [[ -z "$OPTARG" ]] && echo "\"-i\" requires an argument" && exit ignore+=("$OPTARG") + [[ -z "$ignore" ]] && echo "\"-i\" requires an argument" && exit ;; t) re='^[0-9]+$' @@ -93,7 +93,7 @@ do verbose="true" ;; *) - echo -e "Invalid Option \"--$OPTARG\"\n" && help + echo -e "Invalid Option \"-$OPTARG\"\n" && help exit ;; esac From eec9afa5dffdca56ead282df07d48fd9a7bb2282 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 25 Jul 2022 21:55:46 -0600 Subject: [PATCH 0323/1229] test --- heavy_script.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index 5ee2afcc..1edaf814 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -19,7 +19,7 @@ source functions/update_apps.sh # Parse script options -while getopts ":si:rb:t:uUpSRv-:" opt +while getopts ":sii:rb:t:uUpSRv-:" opt do case $opt in -) @@ -67,7 +67,7 @@ do ;; i) ignore+=("$OPTARG") - [[ -z "$ignore" ]] && echo "\"-i\" requires an argument" && exit + [[ -z "$OPTARG" ]] && echo "\"-i\" requires an argument" && exit ;; t) re='^[0-9]+$' From 54dc8969e5afc7ea96cdc7d3ca37f4d63a3403e5 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 25 Jul 2022 21:59:00 -0600 Subject: [PATCH 0324/1229] test --- heavy_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index 1edaf814..89eef577 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -67,7 +67,7 @@ do ;; i) ignore+=("$OPTARG") - [[ -z "$OPTARG" ]] && echo "\"-i\" requires an argument" && exit + [[ -z "$ignore" ]] && echo "\"-i\" requires an argument" && exit ;; t) re='^[0-9]+$' From b92627c77f45de4c9fcf836f760cb1faee8fff69 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 25 Jul 2022 22:02:19 -0600 Subject: [PATCH 0325/1229] test --- heavy_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index 89eef577..5ee2afcc 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -19,7 +19,7 @@ source functions/update_apps.sh # Parse script options -while getopts ":sii:rb:t:uUpSRv-:" opt +while getopts ":si:rb:t:uUpSRv-:" opt do case $opt in -) From 0367588c65bea5d4f4be839e7149bd4fd4c52c23 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 25 Jul 2022 22:05:55 -0600 Subject: [PATCH 0326/1229] test --- heavy_script.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index 5ee2afcc..3c453ca6 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -48,10 +48,6 @@ do ;; esac ;; - \?) - echo -e "Invalid Option \"-$OPTARG\"\n" && help - exit - ;; # :) # echo -e "Option: \"-$OPTARG\" requires an argument\n" && help # exit @@ -92,6 +88,10 @@ do v) verbose="true" ;; + \?) + echo -e "Invalid Option \"-$OPTARG\"\n" && help + exit + ;; *) echo -e "Invalid Option \"-$OPTARG\"\n" && help exit From f468cfbd8227b021794134f76b4a973de7b466a3 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 25 Jul 2022 22:11:51 -0600 Subject: [PATCH 0327/1229] test --- heavy_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index 3c453ca6..36e82e6f 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -19,7 +19,7 @@ source functions/update_apps.sh # Parse script options -while getopts ":si:rb:t:uUpSRv-:" opt +while getopts ":si::rb:t:uUpSRv-:" opt do case $opt in -) From 07be73ce57c42311cf26a520d9b2af598dbbe21b Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 25 Jul 2022 22:19:07 -0600 Subject: [PATCH 0328/1229] test --- heavy_script.sh | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index 36e82e6f..4abeeccb 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -19,7 +19,7 @@ source functions/update_apps.sh # Parse script options -while getopts ":si::rb:t:uUpSRv-:" opt +while getopts ":sirb:t:uUpSRv-:" opt do case $opt in -) @@ -48,10 +48,10 @@ do ;; esac ;; - # :) - # echo -e "Option: \"-$OPTARG\" requires an argument\n" && help - # exit - # ;; + :) + echo -e "Option: \"-$OPTARG\" requires an argument\n" && help + exit + ;; b) re='^[0-9]+$' number_of_backups=$OPTARG @@ -62,8 +62,15 @@ do rollback="true" ;; i) - ignore+=("$OPTARG") - [[ -z "$ignore" ]] && echo "\"-i\" requires an argument" && exit + # Check next positional parameter + eval nextopt=${!OPTIND} + # existing or starting with dash? + if [[ -n $nextopt && $nextopt != -* ]] ; then + OPTIND=$((OPTIND + 1)) + ignore+=("$OPTARG") + else + echo "Option: \"-i\" requires an argument" + fi ;; t) re='^[0-9]+$' From 738765a5f6ee0608e010934804904e4e8e04951d Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 25 Jul 2022 22:20:06 -0600 Subject: [PATCH 0329/1229] forgot exit --- heavy_script.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/heavy_script.sh b/heavy_script.sh index 4abeeccb..c9ac1957 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -70,6 +70,7 @@ do ignore+=("$OPTARG") else echo "Option: \"-i\" requires an argument" + exit fi ;; t) From d71e2494229380d67ae22ab27ab88e44e8c30802 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 25 Jul 2022 22:24:26 -0600 Subject: [PATCH 0330/1229] test --- functions/update_apps.sh | 2 +- heavy_script.sh | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 917fbfdf..a4a9d8a7 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -6,7 +6,7 @@ mapfile -t array < <(cli -m csv -c 'app chart_release query name,update_availabl [[ -z $array ]] && echo -e "\nThere are no updates available" && return 0 || echo -e "\n${#array[@]} update(s) available" [[ -z $timeout ]] && echo -e "\nDefault Timeout: 500" && timeout=500 || echo -e "\nCustom Timeout: $timeout" [[ "$timeout" -le 120 ]] && echo "Warning: Your timeout is set low and may lead to premature rollbacks or skips" -update_limit=4 +echo "Asynchronous Updates: 1" it=0 diff --git a/heavy_script.sh b/heavy_script.sh index c9ac1957..0b1292c6 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -83,9 +83,27 @@ do ;; U) update_all_apps="true" + # Check next positional parameter + eval nextopt=${!OPTIND} + # existing or starting with dash? + if [[ -n $nextopt && $nextopt != -* ]] ; then + OPTIND=$((OPTIND + 1)) + update_limit=("$OPTARG") + else + update_limit=1 + fi ;; u) update_apps="true" + # Check next positional parameter + eval nextopt=${!OPTIND} + # existing or starting with dash? + if [[ -n $nextopt && $nextopt != -* ]] ; then + OPTIND=$((OPTIND + 1)) + update_limit=("$OPTARG") + else + update_limit=1 + fi ;; S) stop_before_update="true" From d511df4fb4d08f09dd0077579b5520ba5776c8e9 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 25 Jul 2022 22:25:14 -0600 Subject: [PATCH 0331/1229] reporting --- functions/update_apps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index a4a9d8a7..55b772fc 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -6,7 +6,7 @@ mapfile -t array < <(cli -m csv -c 'app chart_release query name,update_availabl [[ -z $array ]] && echo -e "\nThere are no updates available" && return 0 || echo -e "\n${#array[@]} update(s) available" [[ -z $timeout ]] && echo -e "\nDefault Timeout: 500" && timeout=500 || echo -e "\nCustom Timeout: $timeout" [[ "$timeout" -le 120 ]] && echo "Warning: Your timeout is set low and may lead to premature rollbacks or skips" -echo "Asynchronous Updates: 1" +echo "Asynchronous Updates: $update_limit" it=0 From 5b1b0a73d903d358b149a7d1b5613d6046b823ef Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 25 Jul 2022 22:28:16 -0600 Subject: [PATCH 0332/1229] fix --- heavy_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index 0b1292c6..7f319681 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -100,7 +100,7 @@ do # existing or starting with dash? if [[ -n $nextopt && $nextopt != -* ]] ; then OPTIND=$((OPTIND + 1)) - update_limit=("$OPTARG") + update_limit=$OPTARG else update_limit=1 fi From c3fcc5a10d1ee50a7b5c3855e028fd1dd88549cc Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 25 Jul 2022 22:34:07 -0600 Subject: [PATCH 0333/1229] hmm --- functions/update_apps.sh | 1 - heavy_script.sh | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 55b772fc..2dba0fab 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -9,7 +9,6 @@ mapfile -t array < <(cli -m csv -c 'app chart_release query name,update_availabl echo "Asynchronous Updates: $update_limit" it=0 - while [[ $it -lt ${#array[@]} ]] do jobs=$(jobs -p | wc -l) diff --git a/heavy_script.sh b/heavy_script.sh index 7f319681..82087420 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -88,7 +88,7 @@ do # existing or starting with dash? if [[ -n $nextopt && $nextopt != -* ]] ; then OPTIND=$((OPTIND + 1)) - update_limit=("$OPTARG") + update_limit="$OPTARG" else update_limit=1 fi @@ -100,7 +100,7 @@ do # existing or starting with dash? if [[ -n $nextopt && $nextopt != -* ]] ; then OPTIND=$((OPTIND + 1)) - update_limit=$OPTARG + update_limit="$OPTARG" else update_limit=1 fi From 3547a67f0193c9387a6b2935bc4bfda90d54cbb6 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 25 Jul 2022 22:37:21 -0600 Subject: [PATCH 0334/1229] test --- heavy_script.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index 82087420..29f90c3e 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -87,8 +87,8 @@ do eval nextopt=${!OPTIND} # existing or starting with dash? if [[ -n $nextopt && $nextopt != -* ]] ; then - OPTIND=$((OPTIND + 1)) - update_limit="$OPTARG" + OPTIND=$((OPTIND++)) + update_limit="$nextopt" else update_limit=1 fi @@ -99,8 +99,8 @@ do eval nextopt=${!OPTIND} # existing or starting with dash? if [[ -n $nextopt && $nextopt != -* ]] ; then - OPTIND=$((OPTIND + 1)) - update_limit="$OPTARG" + OPTIND=$((OPTIND++)) + update_limit="$nextopt" else update_limit=1 fi From 6c24507dd71274a7f06c56f819b3c65b61182f96 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 25 Jul 2022 22:40:05 -0600 Subject: [PATCH 0335/1229] woo --- heavy_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index 29f90c3e..a452cbd8 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -67,7 +67,7 @@ do # existing or starting with dash? if [[ -n $nextopt && $nextopt != -* ]] ; then OPTIND=$((OPTIND + 1)) - ignore+=("$OPTARG") + ignore+=("$nextopt") else echo "Option: \"-i\" requires an argument" exit From dc083bf59f913e168ab4d042ba76fa9cdad59ab7 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 25 Jul 2022 22:45:19 -0600 Subject: [PATCH 0336/1229] ignore return code --- functions/update_apps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 2dba0fab..81b3acd9 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -43,7 +43,7 @@ diff_chart=$(diff <(echo "$old_chart_ver") <(echo "$new_chart_ver")) #caluclatin old_full_ver=$(echo "${array[$it]}" | awk -F ',' '{print $4}') #Upgraded From new_full_ver=$(echo "${array[$it]}" | awk -F ',' '{print $5}') #Upraded To rollback_version=$(echo "${array[$it]}" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}') -printf '%s\0' "${ignore[@]}" | grep -iFxqz "${app_name}" && echo -e "\n$app_name\nIgnored, skipping" && return #If application is on ignore list, skip +printf '%s\0' "${ignore[@]}" | grep -iFxqz "${app_name}" && echo -e "\n$app_name\nIgnored, skipping" && return 0 #If application is on ignore list, skip if [[ "$diff_app" == "$diff_chart" || "$update_all_apps" == "true" ]]; then #continue to update if [[ $stop_before_update == "true" ]]; then # Check to see if user is using -S or not if [[ "$status" == "STOPPED" ]]; then # if status is already stopped, skip while loop From 118e921306682efb84ad6fc67b95de0bbed9126f Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 25 Jul 2022 22:47:08 -0600 Subject: [PATCH 0337/1229] uhh --- functions/update_apps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 81b3acd9..b712d348 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -43,7 +43,7 @@ diff_chart=$(diff <(echo "$old_chart_ver") <(echo "$new_chart_ver")) #caluclatin old_full_ver=$(echo "${array[$it]}" | awk -F ',' '{print $4}') #Upgraded From new_full_ver=$(echo "${array[$it]}" | awk -F ',' '{print $5}') #Upraded To rollback_version=$(echo "${array[$it]}" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}') -printf '%s\0' "${ignore[@]}" | grep -iFxqz "${app_name}" && echo -e "\n$app_name\nIgnored, skipping" && return 0 #If application is on ignore list, skip +printf '%s\0' "${ignore[@]}" | grep -iFxqz "${app_name}" && echo -e "\n$app_name\nIgnored, skipping" && exit #If application is on ignore list, skip if [[ "$diff_app" == "$diff_chart" || "$update_all_apps" == "true" ]]; then #continue to update if [[ $stop_before_update == "true" ]]; then # Check to see if user is using -S or not if [[ "$status" == "STOPPED" ]]; then # if status is already stopped, skip while loop From 11dfd4a1a7981e45a7c6461bd6a279aa9d53163e Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 25 Jul 2022 22:51:54 -0600 Subject: [PATCH 0338/1229] test --- functions/update_apps.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index b712d348..fff889fa 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -43,14 +43,14 @@ diff_chart=$(diff <(echo "$old_chart_ver") <(echo "$new_chart_ver")) #caluclatin old_full_ver=$(echo "${array[$it]}" | awk -F ',' '{print $4}') #Upgraded From new_full_ver=$(echo "${array[$it]}" | awk -F ',' '{print $5}') #Upraded To rollback_version=$(echo "${array[$it]}" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}') -printf '%s\0' "${ignore[@]}" | grep -iFxqz "${app_name}" && echo -e "\n$app_name\nIgnored, skipping" && exit #If application is on ignore list, skip +printf '%s\0' "${ignore[@]}" | grep -iFxqz "${app_name}" && echo -e "\n$app_name\nIgnored, skipping" && return 1 #If application is on ignore list, skip if [[ "$diff_app" == "$diff_chart" || "$update_all_apps" == "true" ]]; then #continue to update if [[ $stop_before_update == "true" ]]; then # Check to see if user is using -S or not if [[ "$status" == "STOPPED" ]]; then # if status is already stopped, skip while loop echo_array+=("\n$app_name") [[ "$verbose" == "true" ]] && echo_array+=("Updating..") cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo_array+=("Updated\n$old_full_ver\n$new_full_ver") && after_update_actions || echo_array+=("FAILED") - return + return 0 else # if status was not STOPPED, stop the app prior to updating echo_array+=("\n$app_name") [[ "$verbose" == "true" ]] && echo_array+=("Stopping prior to update..") @@ -79,7 +79,7 @@ printf '%s\0' "${ignore[@]}" | grep -iFxqz "${app_name}" && echo -e "\n$app_name fi else echo_array+=("\n$app_name\nMajor Release, update manually") - return + return 0 fi From 355ab29b0bfe4aac1565d35209ce88513593fd77 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 25 Jul 2022 22:59:13 -0600 Subject: [PATCH 0339/1229] idk --- functions/update_apps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index fff889fa..997a2adb 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -32,6 +32,7 @@ export -f commander update_apps(){ app_name=$(echo "${array[$it]}" | awk -F ',' '{print $1}') #print out first catagory, name. +printf '%s\0' "${ignore[@]}" | grep -iFxqz "${app_name}" && echo -e "\n$app_name\nIgnored, skipping" && return 0 #If application is on ignore list, skip old_app_ver=$(echo "${array[$it]}" | awk -F ',' '{print $4}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #previous/current Application MAJOR Version new_app_ver=$(echo "${array[$it]}" | awk -F ',' '{print $5}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #new Application MAJOR Version old_chart_ver=$(echo "${array[$it]}" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}' | awk -F '.' '{print $1}') # Old Chart MAJOR version @@ -43,7 +44,6 @@ diff_chart=$(diff <(echo "$old_chart_ver") <(echo "$new_chart_ver")) #caluclatin old_full_ver=$(echo "${array[$it]}" | awk -F ',' '{print $4}') #Upgraded From new_full_ver=$(echo "${array[$it]}" | awk -F ',' '{print $5}') #Upraded To rollback_version=$(echo "${array[$it]}" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}') -printf '%s\0' "${ignore[@]}" | grep -iFxqz "${app_name}" && echo -e "\n$app_name\nIgnored, skipping" && return 1 #If application is on ignore list, skip if [[ "$diff_app" == "$diff_chart" || "$update_all_apps" == "true" ]]; then #continue to update if [[ $stop_before_update == "true" ]]; then # Check to see if user is using -S or not if [[ "$status" == "STOPPED" ]]; then # if status is already stopped, skip while loop From 0517819e654ae6422f83a2cffc973d25dfef5d5e Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 25 Jul 2022 23:01:40 -0600 Subject: [PATCH 0340/1229] sadf --- functions/update_apps.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 997a2adb..db9fb9a8 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -32,7 +32,13 @@ export -f commander update_apps(){ app_name=$(echo "${array[$it]}" | awk -F ',' '{print $1}') #print out first catagory, name. -printf '%s\0' "${ignore[@]}" | grep -iFxqz "${app_name}" && echo -e "\n$app_name\nIgnored, skipping" && return 0 #If application is on ignore list, skip + +if printf '%s\0' "${ignore[@]}" | grep -iFxqz "${app_name}" ; then + echo -e "\n$app_name\nIgnored, skipping" + return 0 #If application is on ignore list, skip + +fi + old_app_ver=$(echo "${array[$it]}" | awk -F ',' '{print $4}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #previous/current Application MAJOR Version new_app_ver=$(echo "${array[$it]}" | awk -F ',' '{print $5}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #new Application MAJOR Version old_chart_ver=$(echo "${array[$it]}" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}' | awk -F '.' '{print $1}') # Old Chart MAJOR version From 545f57b8e8fe5fc1f54662b6c0c3b1af7c2578e9 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 25 Jul 2022 23:06:08 -0600 Subject: [PATCH 0341/1229] idk --- functions/update_apps.sh | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index db9fb9a8..cbf7193c 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -15,7 +15,7 @@ do if [[ "$jobs" -ge "$update_limit" ]]; then sleep 1 else - update_apps "${array[$it]}" & + { update_apps "${array[$it]}" ;} & processes+=($!) ((it++)) fi @@ -32,13 +32,7 @@ export -f commander update_apps(){ app_name=$(echo "${array[$it]}" | awk -F ',' '{print $1}') #print out first catagory, name. - -if printf '%s\0' "${ignore[@]}" | grep -iFxqz "${app_name}" ; then - echo -e "\n$app_name\nIgnored, skipping" - return 0 #If application is on ignore list, skip - -fi - +printf '%s\0' "${ignore[@]}" | grep -iFxqz "${app_name}" && echo -e "\n$app_name\nIgnored, skipping" && return 0 #If application is on ignore list, skip old_app_ver=$(echo "${array[$it]}" | awk -F ',' '{print $4}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #previous/current Application MAJOR Version new_app_ver=$(echo "${array[$it]}" | awk -F ',' '{print $5}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #new Application MAJOR Version old_chart_ver=$(echo "${array[$it]}" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}' | awk -F '.' '{print $1}') # Old Chart MAJOR version From 54ba3685c9448f43060175c1c02190bb2319aa30 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 25 Jul 2022 23:12:36 -0600 Subject: [PATCH 0342/1229] testing --- functions/update_apps.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index cbf7193c..08d84581 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -15,9 +15,10 @@ do if [[ "$jobs" -ge "$update_limit" ]]; then sleep 1 else - { update_apps "${array[$it]}" ;} & + update_apps "${array[$it]}" & processes+=($!) ((it++)) + echo "$processes" fi done From 4cb021f97979a3c36378fbff64cdac3f7de74537 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 25 Jul 2022 23:17:04 -0600 Subject: [PATCH 0343/1229] a --- functions/update_apps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 08d84581..e03aa7a3 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -33,7 +33,7 @@ export -f commander update_apps(){ app_name=$(echo "${array[$it]}" | awk -F ',' '{print $1}') #print out first catagory, name. -printf '%s\0' "${ignore[@]}" | grep -iFxqz "${app_name}" && echo -e "\n$app_name\nIgnored, skipping" && return 0 #If application is on ignore list, skip +printf '%s\0' "${ignore[@]}" | grep -iFxqz "${app_name}" && echo -e "\n$app_name\nIgnored, skipping" && disown && return 0 #If application is on ignore list, skip old_app_ver=$(echo "${array[$it]}" | awk -F ',' '{print $4}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #previous/current Application MAJOR Version new_app_ver=$(echo "${array[$it]}" | awk -F ',' '{print $5}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #new Application MAJOR Version old_chart_ver=$(echo "${array[$it]}" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}' | awk -F '.' '{print $1}') # Old Chart MAJOR version From 27b8d258cf85ec1ef6783a49018ee6368ebd7ba1 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 25 Jul 2022 23:19:18 -0600 Subject: [PATCH 0344/1229] test --- functions/update_apps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index e03aa7a3..e4fbcc71 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -33,7 +33,7 @@ export -f commander update_apps(){ app_name=$(echo "${array[$it]}" | awk -F ',' '{print $1}') #print out first catagory, name. -printf '%s\0' "${ignore[@]}" | grep -iFxqz "${app_name}" && echo -e "\n$app_name\nIgnored, skipping" && disown && return 0 #If application is on ignore list, skip +printf '%s\0' "${ignore[@]}" | grep -iFxqz "${app_name}" && echo -e "\n$app_name\nIgnored, skipping" && exit 0 #If application is on ignore list, skip old_app_ver=$(echo "${array[$it]}" | awk -F ',' '{print $4}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #previous/current Application MAJOR Version new_app_ver=$(echo "${array[$it]}" | awk -F ',' '{print $5}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #new Application MAJOR Version old_chart_ver=$(echo "${array[$it]}" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}' | awk -F '.' '{print $1}') # Old Chart MAJOR version From 51eacf44a2653c6e62dd87397549437033cfabd1 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 25 Jul 2022 23:38:29 -0600 Subject: [PATCH 0345/1229] test --- functions/update_apps.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index e4fbcc71..460e9169 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -11,14 +11,18 @@ echo "Asynchronous Updates: $update_limit" it=0 while [[ $it -lt ${#array[@]} ]] do - jobs=$(jobs -p | wc -l) - if [[ "$jobs" -ge "$update_limit" ]]; then + proc_count=${#processes[@]} + for proc in "${processes[@]}" + do + kill -0 "$proc" || ((proc_count--)) + done + #jobs=$(jobs -p | wc -l) + if [[ "$proc_count" -ge "$update_limit" ]]; then sleep 1 else update_apps "${array[$it]}" & processes+=($!) ((it++)) - echo "$processes" fi done @@ -33,7 +37,7 @@ export -f commander update_apps(){ app_name=$(echo "${array[$it]}" | awk -F ',' '{print $1}') #print out first catagory, name. -printf '%s\0' "${ignore[@]}" | grep -iFxqz "${app_name}" && echo -e "\n$app_name\nIgnored, skipping" && exit 0 #If application is on ignore list, skip +printf '%s\0' "${ignore[@]}" | grep -iFxqz "${app_name}" && echo -e "\n$app_name\nIgnored, skipping" && return 0 #If application is on ignore list, skip old_app_ver=$(echo "${array[$it]}" | awk -F ',' '{print $4}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #previous/current Application MAJOR Version new_app_ver=$(echo "${array[$it]}" | awk -F ',' '{print $5}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #new Application MAJOR Version old_chart_ver=$(echo "${array[$it]}" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}' | awk -F '.' '{print $1}') # Old Chart MAJOR version From a498bfe6cda96266a041967b67ec45f0cb0c78df Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 25 Jul 2022 23:40:32 -0600 Subject: [PATCH 0346/1229] hide output --- functions/update_apps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 460e9169..427a131b 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -14,7 +14,7 @@ do proc_count=${#processes[@]} for proc in "${processes[@]}" do - kill -0 "$proc" || ((proc_count--)) + kill -0 "$proc" &> /dev/null || ((proc_count--)) done #jobs=$(jobs -p | wc -l) if [[ "$proc_count" -ge "$update_limit" ]]; then From 5889438cbdfab70e7ee220e9d23ae231f25c0a97 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 25 Jul 2022 23:44:09 -0600 Subject: [PATCH 0347/1229] lop --- functions/update_apps.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 427a131b..94db2c24 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -12,9 +12,10 @@ it=0 while [[ $it -lt ${#array[@]} ]] do proc_count=${#processes[@]} + count=0 for proc in "${processes[@]}" do - kill -0 "$proc" &> /dev/null || ((proc_count--)) + kill -0 "$proc" &> /dev/null || { ((proc_count--)) ; unset "processes[$count]" ;} done #jobs=$(jobs -p | wc -l) if [[ "$proc_count" -ge "$update_limit" ]]; then From 2d0388d9b5d889e0a3778a18950a901c844e09bc Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 25 Jul 2022 23:44:55 -0600 Subject: [PATCH 0348/1229] best --- functions/update_apps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 94db2c24..4664de1b 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -15,7 +15,7 @@ do count=0 for proc in "${processes[@]}" do - kill -0 "$proc" &> /dev/null || { ((proc_count--)) ; unset "processes[$count]" ;} + kill -0 "$proc" &> /dev/null || { unset "processes[$count]"; ((proc_count--)); } done #jobs=$(jobs -p | wc -l) if [[ "$proc_count" -ge "$update_limit" ]]; then From 682ead72a71ca5ca68d2ad34a4f4c01cfabdb097 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 25 Jul 2022 23:53:45 -0600 Subject: [PATCH 0349/1229] ignore --- heavy_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index a452cbd8..49786818 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -66,7 +66,7 @@ do eval nextopt=${!OPTIND} # existing or starting with dash? if [[ -n $nextopt && $nextopt != -* ]] ; then - OPTIND=$((OPTIND + 1)) + OPTIND=$((OPTIND++)) ignore+=("$nextopt") else echo "Option: \"-i\" requires an argument" From 0fde7bf999dff3705ff673ad9af93266c844e964 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 00:04:39 -0600 Subject: [PATCH 0350/1229] not sure --- heavy_script.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index 49786818..5e82664f 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -66,7 +66,7 @@ do eval nextopt=${!OPTIND} # existing or starting with dash? if [[ -n $nextopt && $nextopt != -* ]] ; then - OPTIND=$((OPTIND++)) + OPTIND=$((OPTIND + 1)) ignore+=("$nextopt") else echo "Option: \"-i\" requires an argument" @@ -87,7 +87,7 @@ do eval nextopt=${!OPTIND} # existing or starting with dash? if [[ -n $nextopt && $nextopt != -* ]] ; then - OPTIND=$((OPTIND++)) + OPTIND=$((OPTIND + 1)) update_limit="$nextopt" else update_limit=1 @@ -99,7 +99,7 @@ do eval nextopt=${!OPTIND} # existing or starting with dash? if [[ -n $nextopt && $nextopt != -* ]] ; then - OPTIND=$((OPTIND++)) + OPTIND=$((OPTIND + 1)) update_limit="$nextopt" else update_limit=1 From 002ebd18f0a0b3155fbbb708c5ad1dc1be910f42 Mon Sep 17 00:00:00 2001 From: TrueCharts-Bot Date: Tue, 26 Jul 2022 00:40:08 +0000 Subject: [PATCH 0351/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.127.4 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 313a9be3..41c77701 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@fa1bc90d63a63594fc8db7ee030d357615b2e38c # tag=v32.127.0 + uses: renovatebot/github-action@afdeef2fe1e9162fce78747fdcc2046833eb8f5a # tag=v32.127.4 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 221e06317f6a1946bccc929c0ec22801589df634 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 00:23:27 -0600 Subject: [PATCH 0352/1229] sync and backup --- heavy_script.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index 5e82664f..7015f348 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -136,7 +136,12 @@ done [[ "$dns" == "true" ]] && dns && exit [[ "$restore" == "true" ]] && restore && exit [[ "$mount" == "true" ]] && mount && exit -[[ "$number_of_backups" -ge 1 ]] && backup -[[ "$sync" == "true" ]] && sync +if [[ "$number_of_backups" -ge 1 && "$sync" == "true" ]]; then # Run backup and sync at the same time + backup & + sync & + wait +fi +[[ "$number_of_backups" -ge 1 && "$sync" == "false" ]] && backup +[[ "$sync" == "true" && "$number_of_backups" -le 1 ]] && sync [[ "$update_all_apps" == "true" || "$update_apps" == "true" ]] && commander [[ "$prune" == "true" ]] && prune \ No newline at end of file From 70109420c985eafd51acdc852e84a11c493ef78a Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 00:32:37 -0600 Subject: [PATCH 0353/1229] more async --- functions/backup.sh | 16 +++++++++++----- functions/misc.sh | 8 +++++++- heavy_script.sh | 1 + 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/functions/backup.sh b/functions/backup.sh index a4684ca1..58409915 100644 --- a/functions/backup.sh +++ b/functions/backup.sh @@ -2,21 +2,27 @@ backup(){ -echo -e "\nNumber of backups was set to $number_of_backups" +echo_backup+=("\nNumber of backups was set to $number_of_backups") date=$(date '+%Y_%m_%d_%H_%M_%S') [[ "$verbose" == "true" ]] && cli -c 'app kubernetes backup_chart_releases backup_name=''"'HeavyScript_"$date"'"' -[[ -z "$verbose" ]] && echo -e "\nNew Backup Name:" && cli -c 'app kubernetes backup_chart_releases backup_name=''"'HeavyScript_"$date"'"' | tail -n 1 +[[ -z "$verbose" ]] && echo_backup+=("\nNew Backup Name:") && cli -c 'app kubernetes backup_chart_releases backup_name=''"'HeavyScript_"$date"'"' | tail -n 1 mapfile -t list_backups < <(cli -c 'app kubernetes list_backups' | grep "HeavyScript_" | sort -t '_' -Vr -k2,7 | awk -F '|' '{print $2}'| tr -d " \t\r") if [[ ${#list_backups[@]} -gt "number_of_backups" ]]; then - echo -e "\nDeleting the oldest backup(s) for exceeding limit:" + echo_backup+=("\nDeleting the oldest backup(s) for exceeding limit:") overflow=$(( ${#list_backups[@]} - "$number_of_backups" )) mapfile -t list_overflow < <(cli -c 'app kubernetes list_backups' | grep "HeavyScript_" | sort -t '_' -V -k2,7 | awk -F '|' '{print $2}'| tr -d " \t\r" | head -n "$overflow") for i in "${list_overflow[@]}" do - cli -c 'app kubernetes delete_backup backup_name=''"'"$i"'"' &> /dev/null || echo "Failed to delete $i" - echo "$i" + cli -c 'app kubernetes delete_backup backup_name=''"'"$i"'"' &> /dev/null || echo_backup+=("Failed to delete $i") + echo_backup+=("$i") done fi + +#Dump the echo_array, ensures all output is in a neat order. +for i in "${echo_backup[@]}" +do + echo -e "$i" +done } export -f backup diff --git a/functions/misc.sh b/functions/misc.sh index f854381b..d0d9a410 100644 --- a/functions/misc.sh +++ b/functions/misc.sh @@ -2,7 +2,13 @@ sync(){ -echo -e "\nSyncing all catalogs, please wait.." && cli -c 'app catalog sync_all' &> /dev/null && echo -e "Catalog sync complete" +echo_sync+=("\nSyncing all catalogs, please wait..") && cli -c 'app catalog sync_all' &> /dev/null && echo_sync+=("Catalog sync complete") + +#Dump the echo_array, ensures all output is in a neat order. +for i in "${echo_sync[@]}" +do + echo -e "$i" +done } export -f sync diff --git a/heavy_script.sh b/heavy_script.sh index 7015f348..9e810ab6 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -137,6 +137,7 @@ done [[ "$restore" == "true" ]] && restore && exit [[ "$mount" == "true" ]] && mount && exit if [[ "$number_of_backups" -ge 1 && "$sync" == "true" ]]; then # Run backup and sync at the same time + echo "Backing up and syncing catalogs at the same time, please wait for output.." backup & sync & wait From 8456f40fd2651661e994fb41db6f01c73e60d6dc Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 00:39:25 -0600 Subject: [PATCH 0354/1229] output --- functions/backup.sh | 4 ++-- heavy_script.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/functions/backup.sh b/functions/backup.sh index 58409915..03c0003b 100644 --- a/functions/backup.sh +++ b/functions/backup.sh @@ -4,8 +4,8 @@ backup(){ echo_backup+=("\nNumber of backups was set to $number_of_backups") date=$(date '+%Y_%m_%d_%H_%M_%S') -[[ "$verbose" == "true" ]] && cli -c 'app kubernetes backup_chart_releases backup_name=''"'HeavyScript_"$date"'"' -[[ -z "$verbose" ]] && echo_backup+=("\nNew Backup Name:") && cli -c 'app kubernetes backup_chart_releases backup_name=''"'HeavyScript_"$date"'"' | tail -n 1 +[[ "$verbose" == "true" ]] && cli -c 'app kubernetes backup_chart_releases backup_name=''"'HeavyScript_"$date"'"' &> /dev/null && echo_backup+=(HeavyScript_"$date") +[[ -z "$verbose" ]] && echo_backup+=("\nNew Backup Name:") && cli -c 'app kubernetes backup_chart_releases backup_name=''"'HeavyScript_"$date"'"' | tail -n 1 &> /dev/null && echo_backup+=(HeavyScript_"$date") mapfile -t list_backups < <(cli -c 'app kubernetes list_backups' | grep "HeavyScript_" | sort -t '_' -Vr -k2,7 | awk -F '|' '{print $2}'| tr -d " \t\r") if [[ ${#list_backups[@]} -gt "number_of_backups" ]]; then echo_backup+=("\nDeleting the oldest backup(s) for exceeding limit:") diff --git a/heavy_script.sh b/heavy_script.sh index 9e810ab6..ac01dbac 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -137,7 +137,7 @@ done [[ "$restore" == "true" ]] && restore && exit [[ "$mount" == "true" ]] && mount && exit if [[ "$number_of_backups" -ge 1 && "$sync" == "true" ]]; then # Run backup and sync at the same time - echo "Backing up and syncing catalogs at the same time, please wait for output.." + echo -e "Backing up and syncing catalogs at the same time, please wait for output..\n" backup & sync & wait From 88a655f9443650435b7922bd62eaa86bd72ec6f4 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 00:42:58 -0600 Subject: [PATCH 0355/1229] message --- heavy_script.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index ac01dbac..72628b77 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -142,7 +142,7 @@ if [[ "$number_of_backups" -ge 1 && "$sync" == "true" ]]; then # Run backup and sync & wait fi -[[ "$number_of_backups" -ge 1 && "$sync" == "false" ]] && backup -[[ "$sync" == "true" && "$number_of_backups" -le 1 ]] && sync +[[ "$number_of_backups" -ge 1 && "$sync" == "false" ]] && echo "Please wait for output, this could take a while.." && backup +[[ "$sync" == "true" && "$number_of_backups" -le 1 ]] && echo "Please wait for output, this could take a while.." && sync [[ "$update_all_apps" == "true" || "$update_apps" == "true" ]] && commander [[ "$prune" == "true" ]] && prune \ No newline at end of file From f80be88a71ee52459ff25903fc7b9b89edb79303 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 00:53:53 -0600 Subject: [PATCH 0356/1229] lt instead of le --- heavy_script.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index 72628b77..51c0c16a 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -143,6 +143,6 @@ if [[ "$number_of_backups" -ge 1 && "$sync" == "true" ]]; then # Run backup and wait fi [[ "$number_of_backups" -ge 1 && "$sync" == "false" ]] && echo "Please wait for output, this could take a while.." && backup -[[ "$sync" == "true" && "$number_of_backups" -le 1 ]] && echo "Please wait for output, this could take a while.." && sync +[[ "$sync" == "true" && "$number_of_backups" -lt 1 ]] && echo "Please wait for output, this could take a while.." && sync [[ "$update_all_apps" == "true" || "$update_apps" == "true" ]] && commander -[[ "$prune" == "true" ]] && prune \ No newline at end of file +[[ "$prune" == "true" ]] && prune From 3888aef71bf261d0f71ed7aa69dd134359d8cd61 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 13:08:33 -0600 Subject: [PATCH 0357/1229] menu --- functions/menu.sh | 56 +++++++++++++++++++++++++++++++++++++++++++++++ heavy_script.sh | 4 +++- 2 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 functions/menu.sh diff --git a/functions/menu.sh b/functions/menu.sh new file mode 100644 index 00000000..2dc39f69 --- /dev/null +++ b/functions/menu.sh @@ -0,0 +1,56 @@ +#!/bin/bash + +menu(){ + echo "0 Help" + echo "1 List DNS Names" + echo "2 Mount and Unmount PVC storage" + echo "3 Create a Backup" + echo "4 Restore a Backup" + echo "5 Delete a Backup" + echo "6 Update All Apps" + read -rt 600 -p "Please select an option by number: " selection + + case $selection in + 0) + help="true" + ;; + 1) + dns="true" + ;; + 2) + mount="true" + ;; + 4) + read -rt 600 -p "Please type the max number of backups to keep: " number_of_backups + re='^[0-9]+$' + number_of_backups=$number_of_backups + ! [[ $number_of_backups =~ $re ]] && echo -e "Error: -b needs to be assigned an interger\n\"""$number_of_backups""\" is not an interger" >&2 && exit + [[ "$number_of_backups" -le 0 ]] && echo "Error: Number of backups is required to be at least 1" && exit + backup "$number_of_backups" + ;; + 5) + restore="true" + ;; + 6) + deleteBackup="true" + ;; + 9) + echo "" + echo "1 Update Apps Excluding likely breaking major changes" + echo "2 Update Apps Including likely breaking major changes" + read -rt 600 -p "Please select an option by number: " updateType + if [[ "$updateType" == "1" ]]; then + update_apps="true" + elif [[ "$updateType" == "2" ]]; then + update_all_apps="true" + else + echo "INVALID ENTRY" && exit 1 + fi + ;; + *) + echo "Unknown option" && exit 1 + ;; + esac + echo "" +} +export -f menu \ No newline at end of file diff --git a/heavy_script.sh b/heavy_script.sh index 72628b77..d136c8c8 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -1,13 +1,15 @@ #!/bin/bash #If no argument is passed, kill the script. -[[ -z "$*" || "-" == "$*" || "--" == "$*" ]] && echo "This script requires an argument, use --help for help" && exit +[[ -z "$*" || "-" == "$*" || "--" == "$*" ]] && menu # shellcheck source=functions/backup.sh source functions/backup.sh # shellcheck source=functions/dns.sh source functions/dns.sh +# shellcheck source=functions/menu.sh +source functions/menu.sh # shellcheck source=functions/misc.sh source functions/misc.sh # shellcheck source=functions/mount.sh From 7a4622b3e37d727722f9fe0d590ee6cbde72b465 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 13:10:09 -0600 Subject: [PATCH 0358/1229] re-arrange --- functions/menu.sh | 2 +- heavy_script.sh | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/functions/menu.sh b/functions/menu.sh index 2dc39f69..72e3df90 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -34,7 +34,7 @@ menu(){ 6) deleteBackup="true" ;; - 9) + 7) echo "" echo "1 Update Apps Excluding likely breaking major changes" echo "2 Update Apps Including likely breaking major changes" diff --git a/heavy_script.sh b/heavy_script.sh index 1428a86e..0977b086 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -1,9 +1,5 @@ #!/bin/bash -#If no argument is passed, kill the script. -[[ -z "$*" || "-" == "$*" || "--" == "$*" ]] && menu - - # shellcheck source=functions/backup.sh source functions/backup.sh # shellcheck source=functions/dns.sh @@ -20,6 +16,10 @@ source functions/self_update.sh source functions/update_apps.sh +#If no argument is passed, kill the script. +[[ -z "$*" || "-" == "$*" || "--" == "$*" ]] && menu + + # Parse script options while getopts ":sirb:t:uUpSRv-:" opt do From 813396df2adf44a8f982985aa54de18e1c4c8bb3 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 13:11:14 -0600 Subject: [PATCH 0359/1229] number order --- functions/menu.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/functions/menu.sh b/functions/menu.sh index 72e3df90..8e127ca9 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -20,7 +20,7 @@ menu(){ 2) mount="true" ;; - 4) + 3) read -rt 600 -p "Please type the max number of backups to keep: " number_of_backups re='^[0-9]+$' number_of_backups=$number_of_backups @@ -28,13 +28,13 @@ menu(){ [[ "$number_of_backups" -le 0 ]] && echo "Error: Number of backups is required to be at least 1" && exit backup "$number_of_backups" ;; - 5) + 4) restore="true" ;; - 6) + 5) deleteBackup="true" ;; - 7) + 6) echo "" echo "1 Update Apps Excluding likely breaking major changes" echo "2 Update Apps Including likely breaking major changes" From 064fecfb33fb533fe51e10762bc36eb09113e157 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 13:12:21 -0600 Subject: [PATCH 0360/1229] text --- functions/menu.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/functions/menu.sh b/functions/menu.sh index 8e127ca9..c19d9eb1 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -26,6 +26,7 @@ menu(){ number_of_backups=$number_of_backups ! [[ $number_of_backups =~ $re ]] && echo -e "Error: -b needs to be assigned an interger\n\"""$number_of_backups""\" is not an interger" >&2 && exit [[ "$number_of_backups" -le 0 ]] && echo "Error: Number of backups is required to be at least 1" && exit + echo "Generating backup, please be patient for output.." backup "$number_of_backups" ;; 4) From 08a86ad238658599ba9dbcf3ecbbf874dc2c86c6 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 13:15:49 -0600 Subject: [PATCH 0361/1229] title --- functions/menu.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/functions/menu.sh b/functions/menu.sh index c19d9eb1..9b6cae17 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -1,6 +1,7 @@ #!/bin/bash menu(){ + title echo "0 Help" echo "1 List DNS Names" echo "2 Mount and Unmount PVC storage" From 5f31a134936cc10e8d36a49a8b33f590d3e4addc Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 13:16:15 -0600 Subject: [PATCH 0362/1229] clear --- functions/menu.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/functions/menu.sh b/functions/menu.sh index 9b6cae17..9903aa33 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -1,6 +1,7 @@ #!/bin/bash menu(){ + clear -x title echo "0 Help" echo "1 List DNS Names" From 666c1e81682ced372d2b2c064620fa91ee9674a5 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 13:29:30 -0600 Subject: [PATCH 0363/1229] maybe --- functions/menu.sh | 34 +++++++++++++++++++++++----------- functions/misc.sh | 1 - 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/functions/menu.sh b/functions/menu.sh index 9903aa33..5a9aa0a6 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -38,17 +38,29 @@ menu(){ deleteBackup="true" ;; 6) - echo "" - echo "1 Update Apps Excluding likely breaking major changes" - echo "2 Update Apps Including likely breaking major changes" - read -rt 600 -p "Please select an option by number: " updateType - if [[ "$updateType" == "1" ]]; then - update_apps="true" - elif [[ "$updateType" == "2" ]]; then - update_all_apps="true" - else - echo "INVALID ENTRY" && exit 1 - fi + script=$(readlink -f "$0") + script_path=$(dirname "$script") + script_name="heavy_script.sh" + cd "$script_path" || exit + clear -x + echo "Choose your update options" + echo + echo "-U | Update all applications, ignores versions" + echo "-u | Update all applications, does not update Major releases" + echo "-b | Back-up your ix-applications dataset, specify a number after -b" + echo "-i | Add application to ignore list, one by one, see example below." + echo "-r | Roll-back applications if they fail to update" + echo "-S | Shutdown applications prior to updating" + echo "-v | verbose output" + echo "-t | Set a custom timeout in seconds when checking if either an App or Mountpoint correctly Started, Stopped or (un)Mounted. Defaults to 500 seconds" + echo "-s | sync catalog" + echo "-p | Prune unused/old docker images" + echo + echo "Example: -u 3 -b 14 -rSvsp -i nextcloud" + + read -rt 600 -p "Please type the flags you wish, with options above: " update_selection + exec bash "$script_name" "$update_selection" + ;; *) echo "Unknown option" && exit 1 diff --git a/functions/misc.sh b/functions/misc.sh index d0d9a410..8fcdbbed 100644 --- a/functions/misc.sh +++ b/functions/misc.sh @@ -43,7 +43,6 @@ echo "-U | Update all applications, ignores versions" echo "-u | Update all applications, does not update Major releases" echo "-b | Back-up your ix-applications dataset, specify a number after -b" echo "-i | Add application to ignore list, one by one, see example below." -echo "-R | THIS OPTION WILL DEPRICATE SOON, USE \"-r\" instead. Roll-back applications if they fail to update" echo "-r | Roll-back applications if they fail to update" echo "-S | Shutdown applications prior to updating" echo "-v | verbose output" From a04d928c1ceda320ce221c006e4e81c4b53b9e24 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 13:33:59 -0600 Subject: [PATCH 0364/1229] test --- functions/menu.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/menu.sh b/functions/menu.sh index 5a9aa0a6..9b59e1ee 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -59,7 +59,7 @@ menu(){ echo "Example: -u 3 -b 14 -rSvsp -i nextcloud" read -rt 600 -p "Please type the flags you wish, with options above: " update_selection - exec bash "$script_name" "$update_selection" + exec bash "$script_name" "${update_selection[@]}" ;; *) From 15147eccc72c28d4f9e86d81c300da2818339d2d Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 13:35:16 -0600 Subject: [PATCH 0365/1229] self update beta --- functions/self_update.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/self_update.sh b/functions/self_update.sh index 340d5a5d..024630d1 100644 --- a/functions/self_update.sh +++ b/functions/self_update.sh @@ -9,7 +9,7 @@ script_name="heavy_script.sh" cd "$script_path" || exit git fetch &> /dev/null -if git diff --name-only origin/main | grep -q "$script_name" ; then +if git diff --name-only origin/beta | grep -q "$script_name" ; then echo "Found a new version of HeavyScript, updating myself..." git reset --hard -q git pull --force -q From 3c11bb4f54c170f2a7c56cadb146bbb778393669 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 13:35:52 -0600 Subject: [PATCH 0366/1229] test --- functions/menu.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/menu.sh b/functions/menu.sh index 9b59e1ee..3198e7f7 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -43,7 +43,7 @@ menu(){ script_name="heavy_script.sh" cd "$script_path" || exit clear -x - echo "Choose your update options" + echo "Choose your update options " echo echo "-U | Update all applications, ignores versions" echo "-u | Update all applications, does not update Major releases" From 1e92da6db0a920992bafea06fadc55325157cedc Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 13:36:22 -0600 Subject: [PATCH 0367/1229] test --- heavy_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index 0977b086..fef23378 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -128,7 +128,7 @@ do done -#exit if incompatable functions are called +#exit if incompatable functions are called [[ "$update_all_apps" == "true" && "$update_apps" == "true" ]] && echo -e "-U and -u cannot BOTH be called" && exit #Continue to call functions in specific order From c52502a04d820d0f7a83905fae406e53bd044c08 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 13:37:38 -0600 Subject: [PATCH 0368/1229] test --- heavy_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index fef23378..dcfcb1e0 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -144,7 +144,7 @@ if [[ "$number_of_backups" -ge 1 && "$sync" == "true" ]]; then # Run backup and sync & wait fi -[[ "$number_of_backups" -ge 1 && "$sync" == "false" ]] && echo "Please wait for output, this could take a while.." && backup +[[ "$number_of_backups" -ge 1 && -z "$sync" ]] && echo "Please wait for output, this could take a while.." && backup [[ "$sync" == "true" && "$number_of_backups" -lt 1 ]] && echo "Please wait for output, this could take a while.." && sync [[ "$update_all_apps" == "true" || "$update_apps" == "true" ]] && commander [[ "$prune" == "true" ]] && prune From e0fb20b14df9f24fe46a20bf7c0695c9bb8977e7 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 13:39:06 -0600 Subject: [PATCH 0369/1229] test --- functions/menu.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/menu.sh b/functions/menu.sh index 3198e7f7..45ce389c 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -59,7 +59,7 @@ menu(){ echo "Example: -u 3 -b 14 -rSvsp -i nextcloud" read -rt 600 -p "Please type the flags you wish, with options above: " update_selection - exec bash "$script_name" "${update_selection[@]}" + exec bash "$script_name" $update_selection ;; *) From 702325b8c152a100c19bff1145314bbdb1ba6ba3 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 13:41:02 -0600 Subject: [PATCH 0370/1229] array --- functions/menu.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/functions/menu.sh b/functions/menu.sh index 45ce389c..25b3e5af 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -59,7 +59,8 @@ menu(){ echo "Example: -u 3 -b 14 -rSvsp -i nextcloud" read -rt 600 -p "Please type the flags you wish, with options above: " update_selection - exec bash "$script_name" $update_selection + args=("$update_selection") + exec bash "$script_name" "${args[@]}" ;; *) From 48bb34fdfdc8993ee30912318ea2397359745324 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 13:49:58 -0600 Subject: [PATCH 0371/1229] test while --- functions/menu.sh | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/functions/menu.sh b/functions/menu.sh index 25b3e5af..1e178b3c 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -43,25 +43,32 @@ menu(){ script_name="heavy_script.sh" cd "$script_path" || exit clear -x + while true + do echo "Choose your update options " echo - echo "-U | Update all applications, ignores versions" - echo "-u | Update all applications, does not update Major releases" - echo "-b | Back-up your ix-applications dataset, specify a number after -b" - echo "-i | Add application to ignore list, one by one, see example below." - echo "-r | Roll-back applications if they fail to update" - echo "-S | Shutdown applications prior to updating" - echo "-v | verbose output" - echo "-t | Set a custom timeout in seconds when checking if either an App or Mountpoint correctly Started, Stopped or (un)Mounted. Defaults to 500 seconds" - echo "-s | sync catalog" - echo "-p | Prune unused/old docker images" + echo "1) -U | Update all applications, ignores versions" + echo "2) -u | Update all applications, does not update Major releases" + echo "3) -b | Back-up your ix-applications dataset, specify a number after -b" + echo "4) -i | Add application to ignore list, one by one, see example below." + echo "5) -r | Roll-back applications if they fail to update" + echo "6) -S | Shutdown applications prior to updating" + echo "7) -v | verbose output" + echo "8) -t | Set a custom timeout in seconds when checking if either an App or Mountpoint correctly Started, Stopped or (un)Mounted. Defaults to 500 seconds" + echo "9) -s | sync catalog" + echo "10) -p | Prune unused/old docker images" + echo + echo "0) Done making selections, proceed with update" echo - echo "Example: -u 3 -b 14 -rSvsp -i nextcloud" - read -rt 600 -p "Please type the flags you wish, with options above: " update_selection - args=("$update_selection") - exec bash "$script_name" "${args[@]}" + read -rt 600 -p "Please type the number associated with the flag above: " current_selection + if [[ $current_selection == 0 ]]; then + exec bash "$script_name" "${args[@]}" + else + update_selection+=("$current_selection") + fi + done ;; *) echo "Unknown option" && exit 1 From eab21168b3d8ebea5e5a50f6650ec3a99cd048c0 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 13:50:56 -0600 Subject: [PATCH 0372/1229] fix --- functions/menu.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/menu.sh b/functions/menu.sh index 1e178b3c..76276bf7 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -63,7 +63,7 @@ menu(){ read -rt 600 -p "Please type the number associated with the flag above: " current_selection if [[ $current_selection == 0 ]]; then - exec bash "$script_name" "${args[@]}" + exec bash "$script_name" "${update_selection[@]}" else update_selection+=("$current_selection") From ad20acf844a17885353d8b2ac3fdf5bc9fab79fc Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 13:52:09 -0600 Subject: [PATCH 0373/1229] test --- functions/menu.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/menu.sh b/functions/menu.sh index 76276bf7..7fef071d 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -64,7 +64,7 @@ menu(){ read -rt 600 -p "Please type the number associated with the flag above: " current_selection if [[ $current_selection == 0 ]]; then exec bash "$script_name" "${update_selection[@]}" - + exit else update_selection+=("$current_selection") fi From b37870370916efabe7a99623f3cbbb773c2cd528 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 14:04:31 -0600 Subject: [PATCH 0374/1229] test sloppy --- functions/menu.sh | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/functions/menu.sh b/functions/menu.sh index 7fef071d..469cd581 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -66,7 +66,30 @@ menu(){ exec bash "$script_name" "${update_selection[@]}" exit else - update_selection+=("$current_selection") + if [[ $current_selection == 1 ]]; then + update_selection+=("-U") + elif [[ $current_selection == 2 ]]; then + update_selection+=("-u") + elif [[ $current_selection == 3 ]]; then + read -rt 600 -p "Up to how many backups should we keep?\n Please type an integer: " up_backups + update_selection+=("-b $up_backups") + elif [[ $current_selection == 4 ]]; then + read -rt 600 -p "What is the name of the application we should ignore?: " up_ignore + update_selection+=("-i $up_ignore") + elif [[ $current_selection == 5 ]]; then + update_selection+=("-r") + elif [[ $current_selection == 6 ]]; then + update_selection+=("-S") + elif [[ $current_selection == 7 ]]; then + update_selection+=("-v") + elif [[ $current_selection == 8 ]]; then + read -rt 600 -p "What do you want your timeout to be?: " up_timeout + update_selection+=("-t $up_timeout") + elif [[ $current_selection == 9 ]]; then + update_selection+=("-s") + elif [[ $current_selection == 10 ]]; then + update_selection+=("-p") + fi fi done ;; From 9db9c1d4be88cf534357c93ba44f114b747485e6 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 14:07:04 -0600 Subject: [PATCH 0375/1229] test --- functions/menu.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/menu.sh b/functions/menu.sh index 469cd581..8b60b7c4 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -75,7 +75,7 @@ menu(){ update_selection+=("-b $up_backups") elif [[ $current_selection == 4 ]]; then read -rt 600 -p "What is the name of the application we should ignore?: " up_ignore - update_selection+=("-i $up_ignore") + update_selection+=("-i" "$up_ignore") elif [[ $current_selection == 5 ]]; then update_selection+=("-r") elif [[ $current_selection == 6 ]]; then From e3f8dc954217d8a522fcb65811df8821ce8c34ed Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 14:15:42 -0600 Subject: [PATCH 0376/1229] improved --- functions/menu.sh | 85 ++++++++++++++++++++++++++--------------------- 1 file changed, 47 insertions(+), 38 deletions(-) diff --git a/functions/menu.sh b/functions/menu.sh index 8b60b7c4..136da234 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -9,7 +9,7 @@ menu(){ echo "3 Create a Backup" echo "4 Restore a Backup" echo "5 Delete a Backup" - echo "6 Update All Apps" + echo "6 Update Applications" read -rt 600 -p "Please select an option by number: " selection case $selection in @@ -43,20 +43,35 @@ menu(){ script_name="heavy_script.sh" cd "$script_path" || exit clear -x - while true - do - echo "Choose your update options " - echo + + echo "What type of update would you like?" echo "1) -U | Update all applications, ignores versions" echo "2) -u | Update all applications, does not update Major releases" - echo "3) -b | Back-up your ix-applications dataset, specify a number after -b" - echo "4) -i | Add application to ignore list, one by one, see example below." - echo "5) -r | Roll-back applications if they fail to update" - echo "6) -S | Shutdown applications prior to updating" - echo "7) -v | verbose output" - echo "8) -t | Set a custom timeout in seconds when checking if either an App or Mountpoint correctly Started, Stopped or (un)Mounted. Defaults to 500 seconds" - echo "9) -s | sync catalog" - echo "10) -p | Prune unused/old docker images" + echo "0) Exit" + read -rt 600 -p "Please type the number associated with the flag above: " current_selection + if [[ $current_selection == 1 ]]; then + update_selection+=("-U") + elif [[ $current_selection == 2 ]]; then + update_selection+=("-u") + elif [[ $current_selection == 0 ]]; then + echo "Exiting.." + exit + else + echo "$current_selection was not an option, try again" + fi + while true + do + clear -x + echo "Choose your update options " + echo + echo "1) -b | Back-up your ix-applications dataset, specify a number after -b" + echo "2) -i | Add application to ignore list, one by one, see example below." + echo "3) -r | Roll-back applications if they fail to update" + echo "4) -S | Shutdown applications prior to updating" + echo "5) -v | verbose output" + echo "6) -t | Set a custom timeout in seconds when checking if either an App or Mountpoint correctly Started, Stopped or (un)Mounted. Defaults to 500 seconds" + echo "7) -s | sync catalog" + echo "8) -p | Prune unused/old docker images" echo echo "0) Done making selections, proceed with update" echo @@ -65,31 +80,25 @@ menu(){ if [[ $current_selection == 0 ]]; then exec bash "$script_name" "${update_selection[@]}" exit - else - if [[ $current_selection == 1 ]]; then - update_selection+=("-U") - elif [[ $current_selection == 2 ]]; then - update_selection+=("-u") - elif [[ $current_selection == 3 ]]; then - read -rt 600 -p "Up to how many backups should we keep?\n Please type an integer: " up_backups - update_selection+=("-b $up_backups") - elif [[ $current_selection == 4 ]]; then - read -rt 600 -p "What is the name of the application we should ignore?: " up_ignore - update_selection+=("-i" "$up_ignore") - elif [[ $current_selection == 5 ]]; then - update_selection+=("-r") - elif [[ $current_selection == 6 ]]; then - update_selection+=("-S") - elif [[ $current_selection == 7 ]]; then - update_selection+=("-v") - elif [[ $current_selection == 8 ]]; then - read -rt 600 -p "What do you want your timeout to be?: " up_timeout - update_selection+=("-t $up_timeout") - elif [[ $current_selection == 9 ]]; then - update_selection+=("-s") - elif [[ $current_selection == 10 ]]; then - update_selection+=("-p") - fi + elif [[ $current_selection == 3 ]]; then + read -rt 600 -p "Up to how many backups should we keep?\n Please type an integer: " up_backups + update_selection+=("-b" "$up_backups") + elif [[ $current_selection == 4 ]]; then + read -rt 600 -p "What is the name of the application we should ignore?: " up_ignore + update_selection+=("-i" "$up_ignore") + elif [[ $current_selection == 5 ]]; then + update_selection+=("-r") + elif [[ $current_selection == 6 ]]; then + update_selection+=("-S") + elif [[ $current_selection == 7 ]]; then + update_selection+=("-v") + elif [[ $current_selection == 8 ]]; then + read -rt 600 -p "What do you want your timeout to be?: " up_timeout + update_selection+=("-t" "$up_timeout") + elif [[ $current_selection == 9 ]]; then + update_selection+=("-s") + elif [[ $current_selection == 10 ]]; then + update_selection+=("-p") fi done ;; From ee366875809ef538f55a5447a65aa912aceab760 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 14:16:51 -0600 Subject: [PATCH 0377/1229] fix --- functions/menu.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/functions/menu.sh b/functions/menu.sh index 136da234..0f17f205 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -80,24 +80,24 @@ menu(){ if [[ $current_selection == 0 ]]; then exec bash "$script_name" "${update_selection[@]}" exit - elif [[ $current_selection == 3 ]]; then + elif [[ $current_selection == 1 ]]; then read -rt 600 -p "Up to how many backups should we keep?\n Please type an integer: " up_backups update_selection+=("-b" "$up_backups") - elif [[ $current_selection == 4 ]]; then + elif [[ $current_selection == 2 ]]; then read -rt 600 -p "What is the name of the application we should ignore?: " up_ignore update_selection+=("-i" "$up_ignore") - elif [[ $current_selection == 5 ]]; then + elif [[ $current_selection == 3 ]]; then update_selection+=("-r") - elif [[ $current_selection == 6 ]]; then + elif [[ $current_selection == 4 ]]; then update_selection+=("-S") - elif [[ $current_selection == 7 ]]; then + elif [[ $current_selection == 5 ]]; then update_selection+=("-v") - elif [[ $current_selection == 8 ]]; then + elif [[ $current_selection == 6 ]]; then read -rt 600 -p "What do you want your timeout to be?: " up_timeout update_selection+=("-t" "$up_timeout") - elif [[ $current_selection == 9 ]]; then + elif [[ $current_selection == 7 ]]; then update_selection+=("-s") - elif [[ $current_selection == 10 ]]; then + elif [[ $current_selection == 8 ]]; then update_selection+=("-p") fi done From c60b8d168bbbd2ffa1aa8c3b8d8b8dc5b1e66a07 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 14:26:19 -0600 Subject: [PATCH 0378/1229] async in menu --- functions/menu.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/functions/menu.sh b/functions/menu.sh index 0f17f205..a92b6660 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -50,9 +50,11 @@ menu(){ echo "0) Exit" read -rt 600 -p "Please type the number associated with the flag above: " current_selection if [[ $current_selection == 1 ]]; then - update_selection+=("-U") - elif [[ $current_selection == 2 ]]; then - update_selection+=("-u") + read -rt 600 -p "How many applications do you want updating at the same time?\n Please type an integer: " up_async + update_selection+=("-U" "$up_async") + elif [[ $current_selection == 2 ]]; then + read -rt 600 -p "How many applications do you want updating at the same time?\n Please type an integer: " up_async + update_selection+=("-u" "$up_async") elif [[ $current_selection == 0 ]]; then echo "Exiting.." exit From 36aa0cfec37e01b4784c35216abf754ae51251e1 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 14:29:59 -0600 Subject: [PATCH 0379/1229] fixes --- functions/menu.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/functions/menu.sh b/functions/menu.sh index a92b6660..1cfa8148 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -47,13 +47,16 @@ menu(){ echo "What type of update would you like?" echo "1) -U | Update all applications, ignores versions" echo "2) -u | Update all applications, does not update Major releases" + echo echo "0) Exit" read -rt 600 -p "Please type the number associated with the flag above: " current_selection if [[ $current_selection == 1 ]]; then - read -rt 600 -p "How many applications do you want updating at the same time?\n Please type an integer: " up_async + echo "How many applications do you want updating at the same time?" + read -rt 600 -p "Please type an integer greater than 0: " up_async update_selection+=("-U" "$up_async") elif [[ $current_selection == 2 ]]; then - read -rt 600 -p "How many applications do you want updating at the same time?\n Please type an integer: " up_async + echo "How many applications do you want updating at the same time?" + read -rt 600 -p "Please type an integer greater than 0: " up_async update_selection+=("-u" "$up_async") elif [[ $current_selection == 0 ]]; then echo "Exiting.." From 09acdf6ac26860ffdae0e5816a88dbbb57bca85e Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 14:30:41 -0600 Subject: [PATCH 0380/1229] exit --- functions/menu.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/functions/menu.sh b/functions/menu.sh index 1cfa8148..d8f65618 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -63,6 +63,7 @@ menu(){ exit else echo "$current_selection was not an option, try again" + exit fi while true do From 218ff297fceed85fd741d606bc3b783120207f46 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 14:31:30 -0600 Subject: [PATCH 0381/1229] title of course --- functions/menu.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/functions/menu.sh b/functions/menu.sh index d8f65618..574e1c16 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -43,7 +43,7 @@ menu(){ script_name="heavy_script.sh" cd "$script_path" || exit clear -x - + title echo "What type of update would you like?" echo "1) -U | Update all applications, ignores versions" echo "2) -u | Update all applications, does not update Major releases" @@ -68,6 +68,7 @@ menu(){ while true do clear -x + title echo "Choose your update options " echo echo "1) -b | Back-up your ix-applications dataset, specify a number after -b" From d46a128fcd061586e5b2a927acd4e72f0f369d79 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 14:32:21 -0600 Subject: [PATCH 0382/1229] newlines --- functions/menu.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/menu.sh b/functions/menu.sh index 574e1c16..a2c247bd 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -51,11 +51,11 @@ menu(){ echo "0) Exit" read -rt 600 -p "Please type the number associated with the flag above: " current_selection if [[ $current_selection == 1 ]]; then - echo "How many applications do you want updating at the same time?" + echo -e "\nHow many applications do you want updating at the same time?" read -rt 600 -p "Please type an integer greater than 0: " up_async update_selection+=("-U" "$up_async") elif [[ $current_selection == 2 ]]; then - echo "How many applications do you want updating at the same time?" + echo -e "\nHow many applications do you want updating at the same time?" read -rt 600 -p "Please type an integer greater than 0: " up_async update_selection+=("-u" "$up_async") elif [[ $current_selection == 0 ]]; then From 3f939f6b1e7229247d8c258513702eb2cc2872cf Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 14:35:25 -0600 Subject: [PATCH 0383/1229] polish --- functions/menu.sh | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/functions/menu.sh b/functions/menu.sh index a2c247bd..5695a4f6 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -3,26 +3,27 @@ menu(){ clear -x title - echo "0 Help" - echo "1 List DNS Names" - echo "2 Mount and Unmount PVC storage" - echo "3 Create a Backup" - echo "4 Restore a Backup" - echo "5 Delete a Backup" - echo "6 Update Applications" + echo "1 Help" + echo "2 List DNS Names" + echo "3 Mount and Unmount PVC storage" + echo "4 Create a Backup" + echo "5 Restore a Backup" + echo "6 Delete a Backup" + echo "7 Update HeavyScript" + echo "8 Update Applications" read -rt 600 -p "Please select an option by number: " selection case $selection in - 0) + 1) help="true" ;; - 1) + 2) dns="true" ;; - 2) + 3) mount="true" ;; - 3) + 4) read -rt 600 -p "Please type the max number of backups to keep: " number_of_backups re='^[0-9]+$' number_of_backups=$number_of_backups @@ -31,13 +32,16 @@ menu(){ echo "Generating backup, please be patient for output.." backup "$number_of_backups" ;; - 4) + 5) restore="true" ;; - 5) + 6) deleteBackup="true" ;; - 6) + 7) + self_update="true" + ;; + 8) script=$(readlink -f "$0") script_path=$(dirname "$script") script_name="heavy_script.sh" From 07058f5a0bf1520b8f68cc8d13e5bef7231199cb Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 14:36:48 -0600 Subject: [PATCH 0384/1229] exit --- functions/menu.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/functions/menu.sh b/functions/menu.sh index 5695a4f6..5910f92e 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -11,9 +11,14 @@ menu(){ echo "6 Delete a Backup" echo "7 Update HeavyScript" echo "8 Update Applications" + echo + echo "0 Exit" read -rt 600 -p "Please select an option by number: " selection case $selection in + 0) + exit + ;; 1) help="true" ;; From 064e90a44c37c3ec719fcb7fe7ea798bc90c44ac Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 14:37:46 -0600 Subject: [PATCH 0385/1229] more polishing --- functions/menu.sh | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/functions/menu.sh b/functions/menu.sh index 5910f92e..20fbc2ec 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -3,16 +3,16 @@ menu(){ clear -x title - echo "1 Help" - echo "2 List DNS Names" - echo "3 Mount and Unmount PVC storage" - echo "4 Create a Backup" - echo "5 Restore a Backup" - echo "6 Delete a Backup" - echo "7 Update HeavyScript" - echo "8 Update Applications" + echo "1) Help" + echo "2) List DNS Names" + echo "3) Mount and Unmount PVC storage" + echo "4) Create a Backup" + echo "5) Restore a Backup" + echo "6) Delete a Backup" + echo "7) Update HeavyScript" + echo "8) Update Applications" echo - echo "0 Exit" + echo "0) Exit" read -rt 600 -p "Please select an option by number: " selection case $selection in @@ -58,6 +58,7 @@ menu(){ echo "2) -u | Update all applications, does not update Major releases" echo echo "0) Exit" + echo read -rt 600 -p "Please type the number associated with the flag above: " current_selection if [[ $current_selection == 1 ]]; then echo -e "\nHow many applications do you want updating at the same time?" From 15697089988cd0de4516b73d6edeba1f8fb81bbe Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 14:43:02 -0600 Subject: [PATCH 0386/1229] ez --- functions/menu.sh | 83 ++++++++++++++++++++++++----------------------- 1 file changed, 42 insertions(+), 41 deletions(-) diff --git a/functions/menu.sh b/functions/menu.sh index 20fbc2ec..4c65a68e 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -53,7 +53,7 @@ menu(){ cd "$script_path" || exit clear -x title - echo "What type of update would you like?" + echo "--Choose your update type--" echo "1) -U | Update all applications, ignores versions" echo "2) -u | Update all applications, does not update Major releases" echo @@ -77,46 +77,47 @@ menu(){ fi while true do - clear -x - title - echo "Choose your update options " - echo - echo "1) -b | Back-up your ix-applications dataset, specify a number after -b" - echo "2) -i | Add application to ignore list, one by one, see example below." - echo "3) -r | Roll-back applications if they fail to update" - echo "4) -S | Shutdown applications prior to updating" - echo "5) -v | verbose output" - echo "6) -t | Set a custom timeout in seconds when checking if either an App or Mountpoint correctly Started, Stopped or (un)Mounted. Defaults to 500 seconds" - echo "7) -s | sync catalog" - echo "8) -p | Prune unused/old docker images" - echo - echo "0) Done making selections, proceed with update" - echo - - read -rt 600 -p "Please type the number associated with the flag above: " current_selection - if [[ $current_selection == 0 ]]; then - exec bash "$script_name" "${update_selection[@]}" - exit - elif [[ $current_selection == 1 ]]; then - read -rt 600 -p "Up to how many backups should we keep?\n Please type an integer: " up_backups - update_selection+=("-b" "$up_backups") - elif [[ $current_selection == 2 ]]; then - read -rt 600 -p "What is the name of the application we should ignore?: " up_ignore - update_selection+=("-i" "$up_ignore") - elif [[ $current_selection == 3 ]]; then - update_selection+=("-r") - elif [[ $current_selection == 4 ]]; then - update_selection+=("-S") - elif [[ $current_selection == 5 ]]; then - update_selection+=("-v") - elif [[ $current_selection == 6 ]]; then - read -rt 600 -p "What do you want your timeout to be?: " up_timeout - update_selection+=("-t" "$up_timeout") - elif [[ $current_selection == 7 ]]; then - update_selection+=("-s") - elif [[ $current_selection == 8 ]]; then - update_selection+=("-p") - fi + clear -x + title + echo "--Choose your update options--" + echo + echo "1) -b | Back-up your ix-applications dataset, specify a number after -b" + echo "2) -i | Add application to ignore list, one by one, see example below." + echo "3) -r | Roll-back applications if they fail to update" + echo "4) -S | Shutdown applications prior to updating" + echo "5) -v | verbose output" + echo "6) -t | Set a custom timeout in seconds when checking if either an App or Mountpoint correctly Started, Stopped or (un)Mounted. Defaults to 500 seconds" + echo "7) -s | sync catalog" + echo "8) -p | Prune unused/old docker images" + echo + echo "0) Done making selections, proceed with update" + echo + read -rt 600 -p "Please type the number associated with the flag above: " current_selection + if [[ $current_selection == 0 ]]; then + exec bash "$script_name" "${update_selection[@]}" + exit + elif [[ $current_selection == 1 ]]; then + echo "Up to how many backups should we keep?" + read -rt 600 -p "Please type an integer: " up_backups + update_selection+=("-b" "$up_backups") + elif [[ $current_selection == 2 ]]; then + read -rt 600 -p "What is the name of the application we should ignore?: " up_ignore + update_selection+=("-i" "$up_ignore") + elif [[ $current_selection == 3 ]]; then + update_selection+=("-r") + elif [[ $current_selection == 4 ]]; then + update_selection+=("-S") + elif [[ $current_selection == 5 ]]; then + update_selection+=("-v") + elif [[ $current_selection == 6 ]]; then + echo "What do you want your timeout to be?" + read -rt 600 -p "Please type an integer: " up_timeout + update_selection+=("-t" "$up_timeout") + elif [[ $current_selection == 7 ]]; then + update_selection+=("-s") + elif [[ $current_selection == 8 ]]; then + update_selection+=("-p") + fi done ;; *) From 340b5b7e6dd2cd9ac27f4afeb8592cddd39d7471 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 14:44:29 -0600 Subject: [PATCH 0387/1229] formatting --- functions/menu.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/functions/menu.sh b/functions/menu.sh index 4c65a68e..bc79d7b8 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -53,7 +53,8 @@ menu(){ cd "$script_path" || exit clear -x title - echo "--Choose your update type--" + echo "Choose your update type" + echo "_______________________" echo "1) -U | Update all applications, ignores versions" echo "2) -u | Update all applications, does not update Major releases" echo @@ -79,8 +80,8 @@ menu(){ do clear -x title - echo "--Choose your update options--" - echo + echo "Choose your update options" + echo "__________________________" echo "1) -b | Back-up your ix-applications dataset, specify a number after -b" echo "2) -i | Add application to ignore list, one by one, see example below." echo "3) -r | Roll-back applications if they fail to update" From 1b329c0661548a7733fdbebcb89f1519b4da7265 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 15:02:20 -0600 Subject: [PATCH 0388/1229] null --- heavy_script.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/heavy_script.sh b/heavy_script.sh index dcfcb1e0..28f111fb 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -128,6 +128,7 @@ do done + #exit if incompatable functions are called [[ "$update_all_apps" == "true" && "$update_apps" == "true" ]] && echo -e "-U and -u cannot BOTH be called" && exit From a748bb3fa5c1b1fe40ec0d603191b94538b11c09 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 15:06:30 -0600 Subject: [PATCH 0389/1229] version --- heavy_script.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/heavy_script.sh b/heavy_script.sh index 28f111fb..9708cf1f 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -1,5 +1,7 @@ #!/bin/bash +# Version 0.1 + # shellcheck source=functions/backup.sh source functions/backup.sh # shellcheck source=functions/dns.sh From 2e06b25dd62fd3f0934b5ef55ed88b3eaf1d7583 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 16:21:03 -0600 Subject: [PATCH 0390/1229] else statement --- functions/menu.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/functions/menu.sh b/functions/menu.sh index bc79d7b8..ec2e57c9 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -117,7 +117,9 @@ menu(){ elif [[ $current_selection == 7 ]]; then update_selection+=("-s") elif [[ $current_selection == 8 ]]; then - update_selection+=("-p") + update_selection+=("-p") + else + echo "$current_selection was not an option, try again" fi done ;; From c9db9cfc3e2cdcaf4b1b0d441b5bd5f753b22a33 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 16:21:41 -0600 Subject: [PATCH 0391/1229] test self --- functions/self_update.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/self_update.sh b/functions/self_update.sh index 024630d1..34319a4f 100644 --- a/functions/self_update.sh +++ b/functions/self_update.sh @@ -9,7 +9,7 @@ script_name="heavy_script.sh" cd "$script_path" || exit git fetch &> /dev/null -if git diff --name-only origin/beta | grep -q "$script_name" ; then +if git diff --name-only origin/beta ; then #| grep -q "$script_name" echo "Found a new version of HeavyScript, updating myself..." git reset --hard -q git pull --force -q From 5e6f6a7ea070f0d5b7829e59f92879d07935c269 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 16:23:41 -0600 Subject: [PATCH 0392/1229] test --- functions/self_update.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/self_update.sh b/functions/self_update.sh index 34319a4f..197e5440 100644 --- a/functions/self_update.sh +++ b/functions/self_update.sh @@ -9,7 +9,7 @@ script_name="heavy_script.sh" cd "$script_path" || exit git fetch &> /dev/null -if git diff --name-only origin/beta ; then #| grep -q "$script_name" +if git diff --name-only origin/beta | grep -eq ".sh" ; then echo "Found a new version of HeavyScript, updating myself..." git reset --hard -q git pull --force -q From f907cf746a30d4f6f3db29076d90b58917e31176 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 16:24:22 -0600 Subject: [PATCH 0393/1229] quiet? --- functions/self_update.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/self_update.sh b/functions/self_update.sh index 197e5440..c52875f5 100644 --- a/functions/self_update.sh +++ b/functions/self_update.sh @@ -9,7 +9,7 @@ script_name="heavy_script.sh" cd "$script_path" || exit git fetch &> /dev/null -if git diff --name-only origin/beta | grep -eq ".sh" ; then +if git diff --name-only origin/beta | grep -e -q ".sh" ; then echo "Found a new version of HeavyScript, updating myself..." git reset --hard -q git pull --force -q From f11e0a4fa74e61104fbfed7579f4810fabbec285 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 16:25:38 -0600 Subject: [PATCH 0394/1229] asd --- functions/self_update.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/self_update.sh b/functions/self_update.sh index c52875f5..93543752 100644 --- a/functions/self_update.sh +++ b/functions/self_update.sh @@ -9,7 +9,7 @@ script_name="heavy_script.sh" cd "$script_path" || exit git fetch &> /dev/null -if git diff --name-only origin/beta | grep -e -q ".sh" ; then +if git diff --name-only origin/beta | grep -qs ".sh" ; then echo "Found a new version of HeavyScript, updating myself..." git reset --hard -q git pull --force -q From 47aaaac2729a2aed0112cd5828c38820ce48e7da Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 16:26:07 -0600 Subject: [PATCH 0395/1229] asd --- functions/self_update.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/self_update.sh b/functions/self_update.sh index 93543752..b3678e2a 100644 --- a/functions/self_update.sh +++ b/functions/self_update.sh @@ -8,7 +8,7 @@ script_path=$(dirname "$script") script_name="heavy_script.sh" cd "$script_path" || exit git fetch &> /dev/null - +#update if git diff --name-only origin/beta | grep -qs ".sh" ; then echo "Found a new version of HeavyScript, updating myself..." git reset --hard -q From 929360806e973763266896b60a612d09023ea0b5 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 16:26:43 -0600 Subject: [PATCH 0396/1229] test --- functions/self_update.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/self_update.sh b/functions/self_update.sh index b3678e2a..93543752 100644 --- a/functions/self_update.sh +++ b/functions/self_update.sh @@ -8,7 +8,7 @@ script_path=$(dirname "$script") script_name="heavy_script.sh" cd "$script_path" || exit git fetch &> /dev/null -#update + if git diff --name-only origin/beta | grep -qs ".sh" ; then echo "Found a new version of HeavyScript, updating myself..." git reset --hard -q From 7845b76d2b0274781b73a5dbc77425be3f4d95d0 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 16:27:20 -0600 Subject: [PATCH 0397/1229] test --- heavy_script.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index 9708cf1f..4009f53c 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -1,6 +1,5 @@ #!/bin/bash -# Version 0.1 # shellcheck source=functions/backup.sh source functions/backup.sh From 9df82d6cc995ece1d0ffa1b3d0ead11099a99188 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 16:28:35 -0600 Subject: [PATCH 0398/1229] format --- functions/menu.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/functions/menu.sh b/functions/menu.sh index ec2e57c9..712d580a 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -53,8 +53,8 @@ menu(){ cd "$script_path" || exit clear -x title - echo "Choose your update type" - echo "_______________________" + echo "Choose Your Update Type" + echo "-----------------------" echo "1) -U | Update all applications, ignores versions" echo "2) -u | Update all applications, does not update Major releases" echo @@ -81,7 +81,7 @@ menu(){ clear -x title echo "Choose your update options" - echo "__________________________" + echo "--------------------------" echo "1) -b | Back-up your ix-applications dataset, specify a number after -b" echo "2) -i | Add application to ignore list, one by one, see example below." echo "3) -r | Roll-back applications if they fail to update" From 8a2fd2a976c23c8fef70164d344f0f4c502dde71 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 16:35:31 -0600 Subject: [PATCH 0399/1229] regex --- functions/menu.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/functions/menu.sh b/functions/menu.sh index 712d580a..aa024a84 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -64,11 +64,9 @@ menu(){ if [[ $current_selection == 1 ]]; then echo -e "\nHow many applications do you want updating at the same time?" read -rt 600 -p "Please type an integer greater than 0: " up_async - update_selection+=("-U" "$up_async") elif [[ $current_selection == 2 ]]; then echo -e "\nHow many applications do you want updating at the same time?" - read -rt 600 -p "Please type an integer greater than 0: " up_async - update_selection+=("-u" "$up_async") + read -rt 600 -p "Please type an integer greater than 0: " up_async elif [[ $current_selection == 0 ]]; then echo "Exiting.." exit @@ -76,6 +74,15 @@ menu(){ echo "$current_selection was not an option, try again" exit fi + if [[ $up_async == 0 ]]; then + echo "0 was not an option.. exiting" + exit + elif ! [[ $up_async =~ ^[0-9]+$ ]]; then + echo "Error: $up_async is invalid, it needs to be an integer" + exit + else + update_selection+=("-u" "$up_async") + fi while true do clear -x From c44e09e300b06cce7cc19d3e1a27ea8bcf4484ed Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 16:36:16 -0600 Subject: [PATCH 0400/1229] quotation --- functions/menu.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/menu.sh b/functions/menu.sh index aa024a84..ba34ac0d 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -78,7 +78,7 @@ menu(){ echo "0 was not an option.. exiting" exit elif ! [[ $up_async =~ ^[0-9]+$ ]]; then - echo "Error: $up_async is invalid, it needs to be an integer" + echo "Error: \"$up_async\" is invalid, it needs to be an integer" exit else update_selection+=("-u" "$up_async") From dd14c6665c179f60a4b15dc84ae36409ad324251 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 16:45:52 -0600 Subject: [PATCH 0401/1229] input validation --- functions/menu.sh | 5 +++-- heavy_script.sh | 6 ++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/functions/menu.sh b/functions/menu.sh index ba34ac0d..90ba29dc 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -30,9 +30,8 @@ menu(){ ;; 4) read -rt 600 -p "Please type the max number of backups to keep: " number_of_backups - re='^[0-9]+$' number_of_backups=$number_of_backups - ! [[ $number_of_backups =~ $re ]] && echo -e "Error: -b needs to be assigned an interger\n\"""$number_of_backups""\" is not an interger" >&2 && exit + ! [[ $number_of_backups =~ ^[0-9]+$ ]] && echo -e "Error: -b needs to be assigned an interger\n\"""$number_of_backups""\" is not an interger" >&2 && exit [[ "$number_of_backups" -le 0 ]] && echo "Error: Number of backups is required to be at least 1" && exit echo "Generating backup, please be patient for output.." backup "$number_of_backups" @@ -107,6 +106,7 @@ menu(){ elif [[ $current_selection == 1 ]]; then echo "Up to how many backups should we keep?" read -rt 600 -p "Please type an integer: " up_backups + ! [[ $up_backups =~ ^[0-9]+$ ]] && echo -e "Error: \"$up_backups\" is invalid, it needs to be an integer\nNOT adding it to the list" && sleep 5 && continue update_selection+=("-b" "$up_backups") elif [[ $current_selection == 2 ]]; then read -rt 600 -p "What is the name of the application we should ignore?: " up_ignore @@ -120,6 +120,7 @@ menu(){ elif [[ $current_selection == 6 ]]; then echo "What do you want your timeout to be?" read -rt 600 -p "Please type an integer: " up_timeout + ! [[ $up_timeout =~ ^[0-9]+$ ]] && echo -e "Error: \"$up_timeout\" is invalid, it needs to be an integer\nNOT adding it to the list" && sleep 5 && continue update_selection+=("-t" "$up_timeout") elif [[ $current_selection == 7 ]]; then update_selection+=("-s") diff --git a/heavy_script.sh b/heavy_script.sh index 4009f53c..7dff535c 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -56,9 +56,8 @@ do exit ;; b) - re='^[0-9]+$' number_of_backups=$OPTARG - ! [[ $OPTARG =~ $re ]] && echo -e "Error: -b needs to be assigned an interger\n\"""$number_of_backups""\" is not an interger" >&2 && exit + ! [[ $OPTARG =~ ^[0-9]+$ ]] && echo -e "Error: -b needs to be assigned an interger\n\"""$number_of_backups""\" is not an interger" >&2 && exit [[ "$number_of_backups" -le 0 ]] && echo "Error: Number of backups is required to be at least 1" && exit ;; r) @@ -77,9 +76,8 @@ do fi ;; t) - re='^[0-9]+$' timeout=$OPTARG - ! [[ $timeout =~ $re ]] && echo -e "Error: -t needs to be assigned an interger\n\"""$timeout""\" is not an interger" >&2 && exit + ! [[ $timeout =~ ^[0-9]+$ ]] && echo -e "Error: -t needs to be assigned an interger\n\"""$timeout""\" is not an interger" >&2 && exit ;; s) sync="true" From cdf7bf640152615c820d2b647ec8cd063d4eafe4 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 16:49:23 -0600 Subject: [PATCH 0402/1229] check for 0 backups --- functions/menu.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/functions/menu.sh b/functions/menu.sh index 90ba29dc..7821c7aa 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -107,6 +107,7 @@ menu(){ echo "Up to how many backups should we keep?" read -rt 600 -p "Please type an integer: " up_backups ! [[ $up_backups =~ ^[0-9]+$ ]] && echo -e "Error: \"$up_backups\" is invalid, it needs to be an integer\nNOT adding it to the list" && sleep 5 && continue + [[ $up_backups == 0 ]] && echo -e "Error: Number of backups cannot be 0\nNOT adding it to the list" && sleep 5 && continue update_selection+=("-b" "$up_backups") elif [[ $current_selection == 2 ]]; then read -rt 600 -p "What is the name of the application we should ignore?: " up_ignore From b286877af0d4b2eb8d7f32139d4f296882926b3d Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 16:52:32 -0600 Subject: [PATCH 0403/1229] print current selection --- functions/menu.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/functions/menu.sh b/functions/menu.sh index 7821c7aa..35ae5f4d 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -100,6 +100,11 @@ menu(){ echo "0) Done making selections, proceed with update" echo read -rt 600 -p "Please type the number associated with the flag above: " current_selection + + for i in "${current_selection[@]}" + do + echo "$i" + done if [[ $current_selection == 0 ]]; then exec bash "$script_name" "${update_selection[@]}" exit From 366fbb089821dd36e109ca544e6aabba03e02965 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 16:54:46 -0600 Subject: [PATCH 0404/1229] fix --- functions/menu.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/menu.sh b/functions/menu.sh index 35ae5f4d..304c2cd1 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -101,7 +101,7 @@ menu(){ echo read -rt 600 -p "Please type the number associated with the flag above: " current_selection - for i in "${current_selection[@]}" + for i in "${update_selection[@]}" do echo "$i" done @@ -133,7 +133,7 @@ menu(){ elif [[ $current_selection == 8 ]]; then update_selection+=("-p") else - echo "$current_selection was not an option, try again" + echo "$current_selection was not an option, try again" && sleep 5 && continue fi done ;; From 194500bbf0a3fbb637470cf6a8bfb7df9e7c376c Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 17:01:00 -0600 Subject: [PATCH 0405/1229] test --- functions/menu.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/functions/menu.sh b/functions/menu.sh index 304c2cd1..d6296e10 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -99,12 +99,15 @@ menu(){ echo echo "0) Done making selections, proceed with update" echo - read -rt 600 -p "Please type the number associated with the flag above: " current_selection - + echo "Current Choices" + echo "---------------" for i in "${update_selection[@]}" do echo "$i" done + read -rt 600 -p "Please type the number associated with the flag above: " current_selection + + if [[ $current_selection == 0 ]]; then exec bash "$script_name" "${update_selection[@]}" exit From e965e5c3cdd9cf663ddbbcfeadc3ac880a693d1a Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 17:04:39 -0600 Subject: [PATCH 0406/1229] new list array --- functions/menu.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/functions/menu.sh b/functions/menu.sh index d6296e10..ffb3790d 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -101,10 +101,11 @@ menu(){ echo echo "Current Choices" echo "---------------" - for i in "${update_selection[@]}" + for i in "${update_list[@]}" do echo "$i" done + echo read -rt 600 -p "Please type the number associated with the flag above: " current_selection @@ -116,24 +117,32 @@ menu(){ read -rt 600 -p "Please type an integer: " up_backups ! [[ $up_backups =~ ^[0-9]+$ ]] && echo -e "Error: \"$up_backups\" is invalid, it needs to be an integer\nNOT adding it to the list" && sleep 5 && continue [[ $up_backups == 0 ]] && echo -e "Error: Number of backups cannot be 0\nNOT adding it to the list" && sleep 5 && continue + update_list+=("-b $up_backups") update_selection+=("-b" "$up_backups") elif [[ $current_selection == 2 ]]; then read -rt 600 -p "What is the name of the application we should ignore?: " up_ignore + update_list+=("-b $up_ignore") update_selection+=("-i" "$up_ignore") elif [[ $current_selection == 3 ]]; then + update_list+=("-r") update_selection+=("-r") elif [[ $current_selection == 4 ]]; then + update_list+=("-S") update_selection+=("-S") elif [[ $current_selection == 5 ]]; then + update_list+=("-v") update_selection+=("-v") elif [[ $current_selection == 6 ]]; then echo "What do you want your timeout to be?" read -rt 600 -p "Please type an integer: " up_timeout ! [[ $up_timeout =~ ^[0-9]+$ ]] && echo -e "Error: \"$up_timeout\" is invalid, it needs to be an integer\nNOT adding it to the list" && sleep 5 && continue + update_list+=("-t $up_timeout") update_selection+=("-t" "$up_timeout") elif [[ $current_selection == 7 ]]; then + update_list+=("-s") update_selection+=("-s") elif [[ $current_selection == 8 ]]; then + update_list+=("-p") update_selection+=("-p") else echo "$current_selection was not an option, try again" && sleep 5 && continue From 0fb6383ce5d10b2973cc62e4a1f8dc4c3e25087d Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 17:07:01 -0600 Subject: [PATCH 0407/1229] test --- functions/menu.sh | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/functions/menu.sh b/functions/menu.sh index ffb3790d..9c25d271 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -81,6 +81,7 @@ menu(){ exit else update_selection+=("-u" "$up_async") + update_list+=("-u") fi while true do @@ -101,14 +102,10 @@ menu(){ echo echo "Current Choices" echo "---------------" - for i in "${update_list[@]}" - do - echo "$i" - done + echo "${update_list[*]}" echo read -rt 600 -p "Please type the number associated with the flag above: " current_selection - if [[ $current_selection == 0 ]]; then exec bash "$script_name" "${update_selection[@]}" exit @@ -121,7 +118,7 @@ menu(){ update_selection+=("-b" "$up_backups") elif [[ $current_selection == 2 ]]; then read -rt 600 -p "What is the name of the application we should ignore?: " up_ignore - update_list+=("-b $up_ignore") + update_list+=("-i $up_ignore") update_selection+=("-i" "$up_ignore") elif [[ $current_selection == 3 ]]; then update_list+=("-r") From 3d151ed8578f214988c1be67f3b4fafa8ca37b59 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 17:28:51 -0600 Subject: [PATCH 0408/1229] testing --- functions/menu.sh | 89 +++++++++++++++++++++++++++++------------------ 1 file changed, 56 insertions(+), 33 deletions(-) diff --git a/functions/menu.sh b/functions/menu.sh index 9c25d271..cef8c1d0 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -50,39 +50,62 @@ menu(){ script_path=$(dirname "$script") script_name="heavy_script.sh" cd "$script_path" || exit - clear -x - title - echo "Choose Your Update Type" - echo "-----------------------" - echo "1) -U | Update all applications, ignores versions" - echo "2) -u | Update all applications, does not update Major releases" - echo - echo "0) Exit" - echo - read -rt 600 -p "Please type the number associated with the flag above: " current_selection - if [[ $current_selection == 1 ]]; then - echo -e "\nHow many applications do you want updating at the same time?" - read -rt 600 -p "Please type an integer greater than 0: " up_async - elif [[ $current_selection == 2 ]]; then - echo -e "\nHow many applications do you want updating at the same time?" - read -rt 600 -p "Please type an integer greater than 0: " up_async - elif [[ $current_selection == 0 ]]; then - echo "Exiting.." - exit - else - echo "$current_selection was not an option, try again" - exit - fi - if [[ $up_async == 0 ]]; then - echo "0 was not an option.. exiting" - exit - elif ! [[ $up_async =~ ^[0-9]+$ ]]; then - echo "Error: \"$up_async\" is invalid, it needs to be an integer" - exit - else - update_selection+=("-u" "$up_async") - update_list+=("-u") - fi + while true + do + clear -x + title + echo "Choose Your Update Type" + echo "-----------------------" + echo "1) -U | Update all applications, ignores versions" + echo "2) -u | Update all applications, does not update Major releases" + echo + echo "0) Exit" + echo + read -rt 600 -p "Please type the number associated with the flag above: " current_selection + if [[ $current_selection == 1 ]]; then + echo -e "\nHow many applications do you want updating at the same time?" + read -rt 600 -p "Please type an integer greater than 0: " up_async + if [[ $up_async == 0 ]]; then + echo "Error: \"$up_async\" is less than 1" + echo "NOT adding it to the list" + sleep 5 + continue + elif ! [[ $up_async =~ ^[0-9]+$ ]]; then + echo "Error: \"$up_async\" is invalid, it needs to be an integer" + echo "NOT adding it to the list" + sleep 5 + continue + else + update_selection+=("-U" "$up_async") + update_list+=("-U") + break + fi + elif [[ $current_selection == 2 ]]; then + echo -e "\nHow many applications do you want updating at the same time?" + read -rt 600 -p "Please type an integer greater than 0: " up_async + if [[ $up_async == 0 ]]; then + echo "Error: \"$up_async\" is less than 1" + echo "NOT adding it to the list" + sleep 5 + continue + elif ! [[ $up_async =~ ^[0-9]+$ ]]; then + echo "Error: \"$up_async\" is invalid, it needs to be an integer" + echo "NOT adding it to the list" + sleep 5 + continue + else + update_selection+=("-u" "$up_async") + update_list+=("-u") + break + fi + elif [[ $current_selection == 0 ]]; then + echo "Exiting.." + exit + else + echo "$current_selection was not an option, try again" + exit + fi + done while true do clear -x From 681c0eb7c9e7364eb9a31bf1f21769cf58af8d9a Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 17:29:51 -0600 Subject: [PATCH 0409/1229] test --- functions/menu.sh | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/functions/menu.sh b/functions/menu.sh index cef8c1d0..6616091a 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -77,7 +77,6 @@ menu(){ continue else update_selection+=("-U" "$up_async") - update_list+=("-U") break fi elif [[ $current_selection == 2 ]]; then @@ -95,7 +94,6 @@ menu(){ continue else update_selection+=("-u" "$up_async") - update_list+=("-u") break fi elif [[ $current_selection == 0 ]]; then @@ -125,7 +123,7 @@ menu(){ echo echo "Current Choices" echo "---------------" - echo "${update_list[*]}" + echo "${update_selection[*]}" echo read -rt 600 -p "Please type the number associated with the flag above: " current_selection @@ -137,32 +135,32 @@ menu(){ read -rt 600 -p "Please type an integer: " up_backups ! [[ $up_backups =~ ^[0-9]+$ ]] && echo -e "Error: \"$up_backups\" is invalid, it needs to be an integer\nNOT adding it to the list" && sleep 5 && continue [[ $up_backups == 0 ]] && echo -e "Error: Number of backups cannot be 0\nNOT adding it to the list" && sleep 5 && continue - update_list+=("-b $up_backups") + update_selection+=("-b" "$up_backups") elif [[ $current_selection == 2 ]]; then read -rt 600 -p "What is the name of the application we should ignore?: " up_ignore - update_list+=("-i $up_ignore") + update_selection+=("-i" "$up_ignore") elif [[ $current_selection == 3 ]]; then - update_list+=("-r") + update_selection+=("-r") elif [[ $current_selection == 4 ]]; then - update_list+=("-S") + update_selection+=("-S") elif [[ $current_selection == 5 ]]; then - update_list+=("-v") + update_selection+=("-v") elif [[ $current_selection == 6 ]]; then echo "What do you want your timeout to be?" read -rt 600 -p "Please type an integer: " up_timeout ! [[ $up_timeout =~ ^[0-9]+$ ]] && echo -e "Error: \"$up_timeout\" is invalid, it needs to be an integer\nNOT adding it to the list" && sleep 5 && continue - update_list+=("-t $up_timeout") + update_selection+=("-t" "$up_timeout") elif [[ $current_selection == 7 ]]; then - update_list+=("-s") + update_selection+=("-s") elif [[ $current_selection == 8 ]]; then - update_list+=("-p") + update_selection+=("-p") else echo "$current_selection was not an option, try again" && sleep 5 && continue From bd5569457be112ab4a126c84d216aa32acbb1e2c Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 17:30:54 -0600 Subject: [PATCH 0410/1229] QOL --- functions/menu.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/menu.sh b/functions/menu.sh index 6616091a..188bd13e 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -123,7 +123,7 @@ menu(){ echo echo "Current Choices" echo "---------------" - echo "${update_selection[*]}" + echo "bash heavy_script.sh ${update_selection[*]}" echo read -rt 600 -p "Please type the number associated with the flag above: " current_selection From 882f4033c995977399ff7d18b57b787cc1febc5b Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 17:43:06 -0600 Subject: [PATCH 0411/1229] polish messages --- functions/backup.sh | 2 +- functions/menu.sh | 2 ++ functions/misc.sh | 2 +- heavy_script.sh | 5 ++++- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/functions/backup.sh b/functions/backup.sh index 03c0003b..a4eff30b 100644 --- a/functions/backup.sh +++ b/functions/backup.sh @@ -8,7 +8,7 @@ date=$(date '+%Y_%m_%d_%H_%M_%S') [[ -z "$verbose" ]] && echo_backup+=("\nNew Backup Name:") && cli -c 'app kubernetes backup_chart_releases backup_name=''"'HeavyScript_"$date"'"' | tail -n 1 &> /dev/null && echo_backup+=(HeavyScript_"$date") mapfile -t list_backups < <(cli -c 'app kubernetes list_backups' | grep "HeavyScript_" | sort -t '_' -Vr -k2,7 | awk -F '|' '{print $2}'| tr -d " \t\r") if [[ ${#list_backups[@]} -gt "number_of_backups" ]]; then - echo_backup+=("\nDeleting the oldest backup(s) for exceeding limit:") + echo_backup+=("\nDeleted the oldest backup(s) for exceeding limit:") overflow=$(( ${#list_backups[@]} - "$number_of_backups" )) mapfile -t list_overflow < <(cli -c 'app kubernetes list_backups' | grep "HeavyScript_" | sort -t '_' -V -k2,7 | awk -F '|' '{print $2}'| tr -d " \t\r" | head -n "$overflow") for i in "${list_overflow[@]}" diff --git a/functions/menu.sh b/functions/menu.sh index 188bd13e..acb24d7c 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -128,6 +128,8 @@ menu(){ read -rt 600 -p "Please type the number associated with the flag above: " current_selection if [[ $current_selection == 0 ]]; then + clear -x + echo "Running \"bash heavy_script.sh ${update_selection[*]}\"" exec bash "$script_name" "${update_selection[@]}" exit elif [[ $current_selection == 1 ]]; then diff --git a/functions/misc.sh b/functions/misc.sh index 8fcdbbed..e6439e9f 100644 --- a/functions/misc.sh +++ b/functions/misc.sh @@ -2,7 +2,7 @@ sync(){ -echo_sync+=("\nSyncing all catalogs, please wait..") && cli -c 'app catalog sync_all' &> /dev/null && echo_sync+=("Catalog sync complete") +cli -c 'app catalog sync_all' &> /dev/null && echo_sync+=("Catalog sync complete") #Dump the echo_array, ensures all output is in a neat order. for i in "${echo_sync[@]}" diff --git a/heavy_script.sh b/heavy_script.sh index 7dff535c..ce8742ce 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -139,7 +139,10 @@ done [[ "$restore" == "true" ]] && restore && exit [[ "$mount" == "true" ]] && mount && exit if [[ "$number_of_backups" -ge 1 && "$sync" == "true" ]]; then # Run backup and sync at the same time - echo -e "Backing up and syncing catalogs at the same time, please wait for output..\n" + echo "Running the following two tasks at the same time" + echo "------------------------------------------------" + echo -e "Backing up ix-applications dataset\nSyncing catalog(s)" + echo -e "This can take a LONG time, please wait for the output..\n" backup & sync & wait From 85eb4a17a1771c10466941f79b412e9a24cb9ecc Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 17:53:08 -0600 Subject: [PATCH 0412/1229] Titles --- functions/backup.sh | 4 +++- functions/menu.sh | 1 + functions/misc.sh | 7 ++++++- functions/update_apps.sh | 2 ++ 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/functions/backup.sh b/functions/backup.sh index a4eff30b..f2221932 100644 --- a/functions/backup.sh +++ b/functions/backup.sh @@ -2,7 +2,9 @@ backup(){ -echo_backup+=("\nNumber of backups was set to $number_of_backups") +echo_backup+=("\nBackup Output") +echo_backup+=("--------------") +echo_backup+=("Number of backups was set to $number_of_backups") date=$(date '+%Y_%m_%d_%H_%M_%S') [[ "$verbose" == "true" ]] && cli -c 'app kubernetes backup_chart_releases backup_name=''"'HeavyScript_"$date"'"' &> /dev/null && echo_backup+=(HeavyScript_"$date") [[ -z "$verbose" ]] && echo_backup+=("\nNew Backup Name:") && cli -c 'app kubernetes backup_chart_releases backup_name=''"'HeavyScript_"$date"'"' | tail -n 1 &> /dev/null && echo_backup+=(HeavyScript_"$date") diff --git a/functions/menu.sh b/functions/menu.sh index acb24d7c..440c3f29 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -130,6 +130,7 @@ menu(){ if [[ $current_selection == 0 ]]; then clear -x echo "Running \"bash heavy_script.sh ${update_selection[*]}\"" + echo exec bash "$script_name" "${update_selection[@]}" exit elif [[ $current_selection == 1 ]]; then diff --git a/functions/misc.sh b/functions/misc.sh index e6439e9f..96ca57e1 100644 --- a/functions/misc.sh +++ b/functions/misc.sh @@ -2,6 +2,8 @@ sync(){ +echo_sync+=("\nSync Output") +echo_sync+=("-----------") cli -c 'app catalog sync_all' &> /dev/null && echo_sync+=("Catalog sync complete") #Dump the echo_array, ensures all output is in a neat order. @@ -13,7 +15,10 @@ done export -f sync prune(){ -echo -e "\nPruning Docker Images" && docker image prune -af | grep "^Total" || echo "Failed to Prune Docker Images" +echo -e "\nDocker Prune Output" +echo "-------------------" +echo "Pruned Docker Images" +docker image prune -af | grep "^Total" || echo "Failed to Prune Docker Images" } export -f prune diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 4664de1b..f036f3f9 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -3,6 +3,8 @@ commander(){ mapfile -t array < <(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,container_images_update_available,status' | tr -d " \t\r" | grep -E ",true($|,)" | sort) +echo "Aplication Update Output" +echo "------------------------" [[ -z $array ]] && echo -e "\nThere are no updates available" && return 0 || echo -e "\n${#array[@]} update(s) available" [[ -z $timeout ]] && echo -e "\nDefault Timeout: 500" && timeout=500 || echo -e "\nCustom Timeout: $timeout" [[ "$timeout" -le 120 ]] && echo "Warning: Your timeout is set low and may lead to premature rollbacks or skips" From 9aa6e15f4e8b142aa41aa5238bd977ac3ee95614 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 17:58:02 -0600 Subject: [PATCH 0413/1229] formatting --- functions/menu.sh | 4 ++-- functions/update_apps.sh | 2 +- heavy_script.sh | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/functions/menu.sh b/functions/menu.sh index 440c3f29..bf7157c8 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -108,7 +108,7 @@ menu(){ do clear -x title - echo "Choose your update options" + echo "Choose Your Update Options" echo "--------------------------" echo "1) -b | Back-up your ix-applications dataset, specify a number after -b" echo "2) -i | Add application to ignore list, one by one, see example below." @@ -174,6 +174,6 @@ menu(){ echo "Unknown option" && exit 1 ;; esac - echo "" + echo } export -f menu \ No newline at end of file diff --git a/functions/update_apps.sh b/functions/update_apps.sh index f036f3f9..6ea07838 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -3,7 +3,7 @@ commander(){ mapfile -t array < <(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,container_images_update_available,status' | tr -d " \t\r" | grep -E ",true($|,)" | sort) -echo "Aplication Update Output" +echo -e "\nAplication Update Output" echo "------------------------" [[ -z $array ]] && echo -e "\nThere are no updates available" && return 0 || echo -e "\n${#array[@]} update(s) available" [[ -z $timeout ]] && echo -e "\nDefault Timeout: 500" && timeout=500 || echo -e "\nCustom Timeout: $timeout" diff --git a/heavy_script.sh b/heavy_script.sh index ce8742ce..ac4e4e48 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -147,7 +147,7 @@ if [[ "$number_of_backups" -ge 1 && "$sync" == "true" ]]; then # Run backup and sync & wait fi -[[ "$number_of_backups" -ge 1 && -z "$sync" ]] && echo "Please wait for output, this could take a while.." && backup -[[ "$sync" == "true" && "$number_of_backups" -lt 1 ]] && echo "Please wait for output, this could take a while.." && sync +[[ "$number_of_backups" -ge 1 && -z "$sync" ]] && echo "Backing up \"ix-applications\" dataset, please wait.." && backup +[[ "$sync" == "true" && "$number_of_backups" -lt 1 ]] && echo "Syncing catalogs, this takes a LONG time, please wait.." && sync [[ "$update_all_apps" == "true" || "$update_apps" == "true" ]] && commander [[ "$prune" == "true" ]] && prune From ac95a304d7722f35d67a8db890f49f58c8cca85f Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 18:00:03 -0600 Subject: [PATCH 0414/1229] more formatting --- functions/update_apps.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 6ea07838..ce642ff2 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -5,8 +5,8 @@ commander(){ mapfile -t array < <(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,container_images_update_available,status' | tr -d " \t\r" | grep -E ",true($|,)" | sort) echo -e "\nAplication Update Output" echo "------------------------" -[[ -z $array ]] && echo -e "\nThere are no updates available" && return 0 || echo -e "\n${#array[@]} update(s) available" -[[ -z $timeout ]] && echo -e "\nDefault Timeout: 500" && timeout=500 || echo -e "\nCustom Timeout: $timeout" +[[ -z $array ]] && echo "There are no updates available" && return 0 || echo "${#array[@]} update(s) available" +[[ -z $timeout ]] && echo "Default Timeout: 500" && timeout=500 || echo "Custom Timeout: $timeout" [[ "$timeout" -le 120 ]] && echo "Warning: Your timeout is set low and may lead to premature rollbacks or skips" echo "Asynchronous Updates: $update_limit" From 61a591f0230c98fb337fc645deac999a38df4ee8 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 18:16:56 -0600 Subject: [PATCH 0415/1229] while loop for menu test --- functions/menu.sh | 335 ++++++++++++++++++++------------------- functions/update_apps.sh | 1 - 2 files changed, 172 insertions(+), 164 deletions(-) diff --git a/functions/menu.sh b/functions/menu.sh index bf7157c8..2091e1d4 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -1,179 +1,188 @@ #!/bin/bash menu(){ - clear -x - title - echo "1) Help" - echo "2) List DNS Names" - echo "3) Mount and Unmount PVC storage" - echo "4) Create a Backup" - echo "5) Restore a Backup" - echo "6) Delete a Backup" - echo "7) Update HeavyScript" - echo "8) Update Applications" - echo - echo "0) Exit" - read -rt 600 -p "Please select an option by number: " selection - - case $selection in - 0) - exit - ;; - 1) - help="true" - ;; - 2) - dns="true" - ;; - 3) - mount="true" - ;; - 4) - read -rt 600 -p "Please type the max number of backups to keep: " number_of_backups - number_of_backups=$number_of_backups - ! [[ $number_of_backups =~ ^[0-9]+$ ]] && echo -e "Error: -b needs to be assigned an interger\n\"""$number_of_backups""\" is not an interger" >&2 && exit - [[ "$number_of_backups" -le 0 ]] && echo "Error: Number of backups is required to be at least 1" && exit - echo "Generating backup, please be patient for output.." - backup "$number_of_backups" - ;; - 5) - restore="true" - ;; - 6) - deleteBackup="true" - ;; - 7) - self_update="true" - ;; - 8) - script=$(readlink -f "$0") - script_path=$(dirname "$script") - script_name="heavy_script.sh" - cd "$script_path" || exit - while true - do - clear -x - title - echo "Choose Your Update Type" - echo "-----------------------" - echo "1) -U | Update all applications, ignores versions" - echo "2) -u | Update all applications, does not update Major releases" - echo - echo "0) Exit" - echo - read -rt 600 -p "Please type the number associated with the flag above: " current_selection - if [[ $current_selection == 1 ]]; then - echo -e "\nHow many applications do you want updating at the same time?" - read -rt 600 -p "Please type an integer greater than 0: " up_async - if [[ $up_async == 0 ]]; then - echo "Error: \"$up_async\" is less than 1" - echo "NOT adding it to the list" - sleep 5 - continue - elif ! [[ $up_async =~ ^[0-9]+$ ]]; then - echo "Error: \"$up_async\" is invalid, it needs to be an integer" - echo "NOT adding it to the list" - sleep 5 - continue - else - update_selection+=("-U" "$up_async") - break - fi - elif [[ $current_selection == 2 ]]; then - echo -e "\nHow many applications do you want updating at the same time?" - read -rt 600 -p "Please type an integer greater than 0: " up_async - if [[ $up_async == 0 ]]; then - echo "Error: \"$up_async\" is less than 1" - echo "NOT adding it to the list" - sleep 5 - continue - elif ! [[ $up_async =~ ^[0-9]+$ ]]; then - echo "Error: \"$up_async\" is invalid, it needs to be an integer" - echo "NOT adding it to the list" - sleep 5 - continue - else - update_selection+=("-u" "$up_async") - break - fi - elif [[ $current_selection == 0 ]]; then - echo "Exiting.." + clear -x + title + echo "1) Help" + echo "2) List DNS Names" + echo "3) Mount and Unmount PVC storage" + echo "4) Create a Backup" + echo "5) Restore a Backup" + echo "6) Delete a Backup" + echo "7) Update HeavyScript" + echo "8) Update Applications" + echo + echo "0) Exit" + read -rt 600 -p "Please select an option by number: " selection + while true + do + case $selection in + 0) exit - else - echo "$current_selection was not an option, try again" + ;; + 1) + help="true" exit - fi - done - while true - do - clear -x - title - echo "Choose Your Update Options" - echo "--------------------------" - echo "1) -b | Back-up your ix-applications dataset, specify a number after -b" - echo "2) -i | Add application to ignore list, one by one, see example below." - echo "3) -r | Roll-back applications if they fail to update" - echo "4) -S | Shutdown applications prior to updating" - echo "5) -v | verbose output" - echo "6) -t | Set a custom timeout in seconds when checking if either an App or Mountpoint correctly Started, Stopped or (un)Mounted. Defaults to 500 seconds" - echo "7) -s | sync catalog" - echo "8) -p | Prune unused/old docker images" - echo - echo "0) Done making selections, proceed with update" - echo - echo "Current Choices" - echo "---------------" - echo "bash heavy_script.sh ${update_selection[*]}" - echo - read -rt 600 -p "Please type the number associated with the flag above: " current_selection - - if [[ $current_selection == 0 ]]; then - clear -x - echo "Running \"bash heavy_script.sh ${update_selection[*]}\"" - echo - exec bash "$script_name" "${update_selection[@]}" + ;; + 2) + dns="true" exit - elif [[ $current_selection == 1 ]]; then - echo "Up to how many backups should we keep?" - read -rt 600 -p "Please type an integer: " up_backups - ! [[ $up_backups =~ ^[0-9]+$ ]] && echo -e "Error: \"$up_backups\" is invalid, it needs to be an integer\nNOT adding it to the list" && sleep 5 && continue - [[ $up_backups == 0 ]] && echo -e "Error: Number of backups cannot be 0\nNOT adding it to the list" && sleep 5 && continue + ;; + 3) + mount="true" + exit + ;; + 4) + read -rt 600 -p "Please type the max number of backups to keep: " number_of_backups + number_of_backups=$number_of_backups + ! [[ $number_of_backups =~ ^[0-9]+$ ]] && echo -e "Error: -b needs to be assigned an interger\n\"""$number_of_backups""\" is not an interger" >&2 && exit + [[ "$number_of_backups" -le 0 ]] && echo "Error: Number of backups is required to be at least 1" && exit + echo "Generating backup, please be patient for output.." + backup "$number_of_backups" + ;; + 5) + restore="true" + exit + ;; + 6) + deleteBackup="true" + exit + ;; + 7) + self_update="true" + exit + ;; + 8) + script=$(readlink -f "$0") + script_path=$(dirname "$script") + script_name="heavy_script.sh" + cd "$script_path" || exit + while true + do + clear -x + title + echo "Choose Your Update Type" + echo "-----------------------" + echo "1) -U | Update all applications, ignores versions" + echo "2) -u | Update all applications, does not update Major releases" + echo + echo "0) Exit" + echo + read -rt 600 -p "Please type the number associated with the flag above: " current_selection + if [[ $current_selection == 1 ]]; then + echo -e "\nHow many applications do you want updating at the same time?" + read -rt 600 -p "Please type an integer greater than 0: " up_async + if [[ $up_async == 0 ]]; then + echo "Error: \"$up_async\" is less than 1" + echo "NOT adding it to the list" + sleep 5 + continue + elif ! [[ $up_async =~ ^[0-9]+$ ]]; then + echo "Error: \"$up_async\" is invalid, it needs to be an integer" + echo "NOT adding it to the list" + sleep 5 + continue + else + update_selection+=("-U" "$up_async") + break + fi + elif [[ $current_selection == 2 ]]; then + echo -e "\nHow many applications do you want updating at the same time?" + read -rt 600 -p "Please type an integer greater than 0: " up_async + if [[ $up_async == 0 ]]; then + echo "Error: \"$up_async\" is less than 1" + echo "NOT adding it to the list" + sleep 5 + continue + elif ! [[ $up_async =~ ^[0-9]+$ ]]; then + echo "Error: \"$up_async\" is invalid, it needs to be an integer" + echo "NOT adding it to the list" + sleep 5 + continue + else + update_selection+=("-u" "$up_async") + break + fi + elif [[ $current_selection == 0 ]]; then + echo "Exiting.." + exit + else + echo "$current_selection was not an option, try again" + exit + fi + done + while true + do + clear -x + title + echo "Choose Your Update Options" + echo "--------------------------" + echo "1) -b | Back-up your ix-applications dataset, specify a number after -b" + echo "2) -i | Add application to ignore list, one by one, see example below." + echo "3) -r | Roll-back applications if they fail to update" + echo "4) -S | Shutdown applications prior to updating" + echo "5) -v | verbose output" + echo "6) -t | Set a custom timeout in seconds when checking if either an App or Mountpoint correctly Started, Stopped or (un)Mounted. Defaults to 500 seconds" + echo "7) -s | sync catalog" + echo "8) -p | Prune unused/old docker images" + echo + echo "0) Done making selections, proceed with update" + echo + echo "Current Choices" + echo "---------------" + echo "bash heavy_script.sh ${update_selection[*]}" + echo + read -rt 600 -p "Please type the number associated with the flag above: " current_selection - update_selection+=("-b" "$up_backups") - elif [[ $current_selection == 2 ]]; then - read -rt 600 -p "What is the name of the application we should ignore?: " up_ignore + if [[ $current_selection == 0 ]]; then + clear -x + echo "Running \"bash heavy_script.sh ${update_selection[*]}\"" + echo + exec bash "$script_name" "${update_selection[@]}" + exit + elif [[ $current_selection == 1 ]]; then + echo "Up to how many backups should we keep?" + read -rt 600 -p "Please type an integer: " up_backups + ! [[ $up_backups =~ ^[0-9]+$ ]] && echo -e "Error: \"$up_backups\" is invalid, it needs to be an integer\nNOT adding it to the list" && sleep 5 && continue + [[ $up_backups == 0 ]] && echo -e "Error: Number of backups cannot be 0\nNOT adding it to the list" && sleep 5 && continue - update_selection+=("-i" "$up_ignore") - elif [[ $current_selection == 3 ]]; then + update_selection+=("-b" "$up_backups") + elif [[ $current_selection == 2 ]]; then + read -rt 600 -p "What is the name of the application we should ignore?: " up_ignore - update_selection+=("-r") - elif [[ $current_selection == 4 ]]; then + update_selection+=("-i" "$up_ignore") + elif [[ $current_selection == 3 ]]; then - update_selection+=("-S") - elif [[ $current_selection == 5 ]]; then + update_selection+=("-r") + elif [[ $current_selection == 4 ]]; then - update_selection+=("-v") - elif [[ $current_selection == 6 ]]; then - echo "What do you want your timeout to be?" - read -rt 600 -p "Please type an integer: " up_timeout - ! [[ $up_timeout =~ ^[0-9]+$ ]] && echo -e "Error: \"$up_timeout\" is invalid, it needs to be an integer\nNOT adding it to the list" && sleep 5 && continue + update_selection+=("-S") + elif [[ $current_selection == 5 ]]; then - update_selection+=("-t" "$up_timeout") - elif [[ $current_selection == 7 ]]; then + update_selection+=("-v") + elif [[ $current_selection == 6 ]]; then + echo "What do you want your timeout to be?" + read -rt 600 -p "Please type an integer: " up_timeout + ! [[ $up_timeout =~ ^[0-9]+$ ]] && echo -e "Error: \"$up_timeout\" is invalid, it needs to be an integer\nNOT adding it to the list" && sleep 5 && continue - update_selection+=("-s") - elif [[ $current_selection == 8 ]]; then + update_selection+=("-t" "$up_timeout") + elif [[ $current_selection == 7 ]]; then - update_selection+=("-p") - else - echo "$current_selection was not an option, try again" && sleep 5 && continue - fi - done - ;; - *) - echo "Unknown option" && exit 1 - ;; - esac - echo + update_selection+=("-s") + elif [[ $current_selection == 8 ]]; then + + update_selection+=("-p") + else + echo "$current_selection was not an option, try again" && sleep 5 && continue + fi + done + exit + ;; + *) + echo "That was not an option, please try again" && sleep 5 + ;; + esac + echo + done } export -f menu \ No newline at end of file diff --git a/functions/update_apps.sh b/functions/update_apps.sh index ce642ff2..320a0351 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -19,7 +19,6 @@ do do kill -0 "$proc" &> /dev/null || { unset "processes[$count]"; ((proc_count--)); } done - #jobs=$(jobs -p | wc -l) if [[ "$proc_count" -ge "$update_limit" ]]; then sleep 1 else From 5a325d210ac8a279f7875c738de747b07f0f31e3 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 18:18:20 -0600 Subject: [PATCH 0416/1229] test --- functions/menu.sh | 2 +- functions/update_apps.sh | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/functions/menu.sh b/functions/menu.sh index 2091e1d4..6aec0511 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -179,7 +179,7 @@ menu(){ exit ;; *) - echo "That was not an option, please try again" && sleep 5 + echo "That was not an option, please try again" && sleep 5 && menu ;; esac echo diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 320a0351..d1abed7e 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -32,8 +32,6 @@ for proc in "${processes[@]}" do wait "$proc" done - - } export -f commander From 987bc9812cea18ab87626e45ec378db580cb0f91 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 18:19:01 -0600 Subject: [PATCH 0417/1229] test --- functions/menu.sh | 6 ------ 1 file changed, 6 deletions(-) diff --git a/functions/menu.sh b/functions/menu.sh index 6aec0511..be39eb69 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -22,15 +22,12 @@ menu(){ ;; 1) help="true" - exit ;; 2) dns="true" - exit ;; 3) mount="true" - exit ;; 4) read -rt 600 -p "Please type the max number of backups to keep: " number_of_backups @@ -42,15 +39,12 @@ menu(){ ;; 5) restore="true" - exit ;; 6) deleteBackup="true" - exit ;; 7) self_update="true" - exit ;; 8) script=$(readlink -f "$0") From 8b0b8393a1b75bef3c62ee90d23fe70f25a81d55 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 18:21:45 -0600 Subject: [PATCH 0418/1229] test --- functions/menu.sh | 347 +++++++++++++++++++++++----------------------- 1 file changed, 172 insertions(+), 175 deletions(-) diff --git a/functions/menu.sh b/functions/menu.sh index be39eb69..4028433e 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -1,182 +1,179 @@ #!/bin/bash menu(){ - clear -x - title - echo "1) Help" - echo "2) List DNS Names" - echo "3) Mount and Unmount PVC storage" - echo "4) Create a Backup" - echo "5) Restore a Backup" - echo "6) Delete a Backup" - echo "7) Update HeavyScript" - echo "8) Update Applications" - echo - echo "0) Exit" - read -rt 600 -p "Please select an option by number: " selection - while true - do - case $selection in - 0) + clear -x + title + echo "1) Help" + echo "2) List DNS Names" + echo "3) Mount and Unmount PVC storage" + echo "4) Create a Backup" + echo "5) Restore a Backup" + echo "6) Delete a Backup" + echo "7) Update HeavyScript" + echo "8) Update Applications" + echo + echo "0) Exit" + read -rt 600 -p "Please select an option by number: " selection + + case $selection in + 0) + exit + ;; + 1) + help="true" + ;; + 2) + dns="true" + ;; + 3) + mount="true" + ;; + 4) + read -rt 600 -p "Please type the max number of backups to keep: " number_of_backups + number_of_backups=$number_of_backups + ! [[ $number_of_backups =~ ^[0-9]+$ ]] && echo -e "Error: -b needs to be assigned an interger\n\"""$number_of_backups""\" is not an interger" >&2 && exit + [[ "$number_of_backups" -le 0 ]] && echo "Error: Number of backups is required to be at least 1" && exit + echo "Generating backup, please be patient for output.." + backup "$number_of_backups" + ;; + 5) + restore="true" + ;; + 6) + deleteBackup="true" + ;; + 7) + self_update="true" + ;; + 8) + script=$(readlink -f "$0") + script_path=$(dirname "$script") + script_name="heavy_script.sh" + cd "$script_path" || exit + while true + do + clear -x + title + echo "Choose Your Update Type" + echo "-----------------------" + echo "1) -U | Update all applications, ignores versions" + echo "2) -u | Update all applications, does not update Major releases" + echo + echo "0) Exit" + echo + read -rt 600 -p "Please type the number associated with the flag above: " current_selection + if [[ $current_selection == 1 ]]; then + echo -e "\nHow many applications do you want updating at the same time?" + read -rt 600 -p "Please type an integer greater than 0: " up_async + if [[ $up_async == 0 ]]; then + echo "Error: \"$up_async\" is less than 1" + echo "NOT adding it to the list" + sleep 5 + continue + elif ! [[ $up_async =~ ^[0-9]+$ ]]; then + echo "Error: \"$up_async\" is invalid, it needs to be an integer" + echo "NOT adding it to the list" + sleep 5 + continue + else + update_selection+=("-U" "$up_async") + break + fi + elif [[ $current_selection == 2 ]]; then + echo -e "\nHow many applications do you want updating at the same time?" + read -rt 600 -p "Please type an integer greater than 0: " up_async + if [[ $up_async == 0 ]]; then + echo "Error: \"$up_async\" is less than 1" + echo "NOT adding it to the list" + sleep 5 + continue + elif ! [[ $up_async =~ ^[0-9]+$ ]]; then + echo "Error: \"$up_async\" is invalid, it needs to be an integer" + echo "NOT adding it to the list" + sleep 5 + continue + else + update_selection+=("-u" "$up_async") + break + fi + elif [[ $current_selection == 0 ]]; then + echo "Exiting.." exit - ;; - 1) - help="true" - ;; - 2) - dns="true" - ;; - 3) - mount="true" - ;; - 4) - read -rt 600 -p "Please type the max number of backups to keep: " number_of_backups - number_of_backups=$number_of_backups - ! [[ $number_of_backups =~ ^[0-9]+$ ]] && echo -e "Error: -b needs to be assigned an interger\n\"""$number_of_backups""\" is not an interger" >&2 && exit - [[ "$number_of_backups" -le 0 ]] && echo "Error: Number of backups is required to be at least 1" && exit - echo "Generating backup, please be patient for output.." - backup "$number_of_backups" - ;; - 5) - restore="true" - ;; - 6) - deleteBackup="true" - ;; - 7) - self_update="true" - ;; - 8) - script=$(readlink -f "$0") - script_path=$(dirname "$script") - script_name="heavy_script.sh" - cd "$script_path" || exit - while true - do - clear -x - title - echo "Choose Your Update Type" - echo "-----------------------" - echo "1) -U | Update all applications, ignores versions" - echo "2) -u | Update all applications, does not update Major releases" - echo - echo "0) Exit" - echo - read -rt 600 -p "Please type the number associated with the flag above: " current_selection - if [[ $current_selection == 1 ]]; then - echo -e "\nHow many applications do you want updating at the same time?" - read -rt 600 -p "Please type an integer greater than 0: " up_async - if [[ $up_async == 0 ]]; then - echo "Error: \"$up_async\" is less than 1" - echo "NOT adding it to the list" - sleep 5 - continue - elif ! [[ $up_async =~ ^[0-9]+$ ]]; then - echo "Error: \"$up_async\" is invalid, it needs to be an integer" - echo "NOT adding it to the list" - sleep 5 - continue - else - update_selection+=("-U" "$up_async") - break - fi - elif [[ $current_selection == 2 ]]; then - echo -e "\nHow many applications do you want updating at the same time?" - read -rt 600 -p "Please type an integer greater than 0: " up_async - if [[ $up_async == 0 ]]; then - echo "Error: \"$up_async\" is less than 1" - echo "NOT adding it to the list" - sleep 5 - continue - elif ! [[ $up_async =~ ^[0-9]+$ ]]; then - echo "Error: \"$up_async\" is invalid, it needs to be an integer" - echo "NOT adding it to the list" - sleep 5 - continue - else - update_selection+=("-u" "$up_async") - break - fi - elif [[ $current_selection == 0 ]]; then - echo "Exiting.." - exit - else - echo "$current_selection was not an option, try again" - exit - fi - done - while true - do - clear -x - title - echo "Choose Your Update Options" - echo "--------------------------" - echo "1) -b | Back-up your ix-applications dataset, specify a number after -b" - echo "2) -i | Add application to ignore list, one by one, see example below." - echo "3) -r | Roll-back applications if they fail to update" - echo "4) -S | Shutdown applications prior to updating" - echo "5) -v | verbose output" - echo "6) -t | Set a custom timeout in seconds when checking if either an App or Mountpoint correctly Started, Stopped or (un)Mounted. Defaults to 500 seconds" - echo "7) -s | sync catalog" - echo "8) -p | Prune unused/old docker images" - echo - echo "0) Done making selections, proceed with update" - echo - echo "Current Choices" - echo "---------------" - echo "bash heavy_script.sh ${update_selection[*]}" - echo - read -rt 600 -p "Please type the number associated with the flag above: " current_selection - - if [[ $current_selection == 0 ]]; then - clear -x - echo "Running \"bash heavy_script.sh ${update_selection[*]}\"" - echo - exec bash "$script_name" "${update_selection[@]}" - exit - elif [[ $current_selection == 1 ]]; then - echo "Up to how many backups should we keep?" - read -rt 600 -p "Please type an integer: " up_backups - ! [[ $up_backups =~ ^[0-9]+$ ]] && echo -e "Error: \"$up_backups\" is invalid, it needs to be an integer\nNOT adding it to the list" && sleep 5 && continue - [[ $up_backups == 0 ]] && echo -e "Error: Number of backups cannot be 0\nNOT adding it to the list" && sleep 5 && continue - - update_selection+=("-b" "$up_backups") - elif [[ $current_selection == 2 ]]; then - read -rt 600 -p "What is the name of the application we should ignore?: " up_ignore - - update_selection+=("-i" "$up_ignore") - elif [[ $current_selection == 3 ]]; then - - update_selection+=("-r") - elif [[ $current_selection == 4 ]]; then - - update_selection+=("-S") - elif [[ $current_selection == 5 ]]; then - - update_selection+=("-v") - elif [[ $current_selection == 6 ]]; then - echo "What do you want your timeout to be?" - read -rt 600 -p "Please type an integer: " up_timeout - ! [[ $up_timeout =~ ^[0-9]+$ ]] && echo -e "Error: \"$up_timeout\" is invalid, it needs to be an integer\nNOT adding it to the list" && sleep 5 && continue - - update_selection+=("-t" "$up_timeout") - elif [[ $current_selection == 7 ]]; then - - update_selection+=("-s") - elif [[ $current_selection == 8 ]]; then - - update_selection+=("-p") - else - echo "$current_selection was not an option, try again" && sleep 5 && continue - fi - done + else + echo "$current_selection was not an option, try again" exit - ;; - *) - echo "That was not an option, please try again" && sleep 5 && menu - ;; - esac - echo - done + fi + done + while true + do + clear -x + title + echo "Choose Your Update Options" + echo "--------------------------" + echo "1) -b | Back-up your ix-applications dataset, specify a number after -b" + echo "2) -i | Add application to ignore list, one by one, see example below." + echo "3) -r | Roll-back applications if they fail to update" + echo "4) -S | Shutdown applications prior to updating" + echo "5) -v | verbose output" + echo "6) -t | Set a custom timeout in seconds when checking if either an App or Mountpoint correctly Started, Stopped or (un)Mounted. Defaults to 500 seconds" + echo "7) -s | sync catalog" + echo "8) -p | Prune unused/old docker images" + echo + echo "0) Done making selections, proceed with update" + echo + echo "Current Choices" + echo "---------------" + echo "bash heavy_script.sh ${update_selection[*]}" + echo + read -rt 600 -p "Please type the number associated with the flag above: " current_selection + + if [[ $current_selection == 0 ]]; then + clear -x + echo "Running \"bash heavy_script.sh ${update_selection[*]}\"" + echo + exec bash "$script_name" "${update_selection[@]}" + exit + elif [[ $current_selection == 1 ]]; then + echo "Up to how many backups should we keep?" + read -rt 600 -p "Please type an integer: " up_backups + ! [[ $up_backups =~ ^[0-9]+$ ]] && echo -e "Error: \"$up_backups\" is invalid, it needs to be an integer\nNOT adding it to the list" && sleep 5 && continue + [[ $up_backups == 0 ]] && echo -e "Error: Number of backups cannot be 0\nNOT adding it to the list" && sleep 5 && continue + + update_selection+=("-b" "$up_backups") + elif [[ $current_selection == 2 ]]; then + read -rt 600 -p "What is the name of the application we should ignore?: " up_ignore + + update_selection+=("-i" "$up_ignore") + elif [[ $current_selection == 3 ]]; then + + update_selection+=("-r") + elif [[ $current_selection == 4 ]]; then + + update_selection+=("-S") + elif [[ $current_selection == 5 ]]; then + + update_selection+=("-v") + elif [[ $current_selection == 6 ]]; then + echo "What do you want your timeout to be?" + read -rt 600 -p "Please type an integer: " up_timeout + ! [[ $up_timeout =~ ^[0-9]+$ ]] && echo -e "Error: \"$up_timeout\" is invalid, it needs to be an integer\nNOT adding it to the list" && sleep 5 && continue + + update_selection+=("-t" "$up_timeout") + elif [[ $current_selection == 7 ]]; then + + update_selection+=("-s") + elif [[ $current_selection == 8 ]]; then + + update_selection+=("-p") + else + echo "$current_selection was not an option, try again" && sleep 5 && continue + fi + done + ;; + *) + echo "That was not an option, please try agian" && menu + ;; + esac + echo } export -f menu \ No newline at end of file From 939ce2f7312b8e44f7c2fa1c2e40fd894f6980fd Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 18:22:19 -0600 Subject: [PATCH 0419/1229] test --- functions/menu.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/menu.sh b/functions/menu.sh index 4028433e..6c36be3d 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -171,7 +171,7 @@ menu(){ done ;; *) - echo "That was not an option, please try agian" && menu + echo "That was not an option, please try agian" && sleep 5 && menu ;; esac echo From 46184a772201512086221baf303a94e41de491a3 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 18:28:23 -0600 Subject: [PATCH 0420/1229] fix backups --- functions/menu.sh | 1 + heavy_script.sh | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/functions/menu.sh b/functions/menu.sh index 6c36be3d..595c0444 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -34,6 +34,7 @@ menu(){ ! [[ $number_of_backups =~ ^[0-9]+$ ]] && echo -e "Error: -b needs to be assigned an interger\n\"""$number_of_backups""\" is not an interger" >&2 && exit [[ "$number_of_backups" -le 0 ]] && echo "Error: Number of backups is required to be at least 1" && exit echo "Generating backup, please be patient for output.." + menu_backup="true" backup "$number_of_backups" ;; 5) diff --git a/heavy_script.sh b/heavy_script.sh index ac4e4e48..db3cb062 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -56,6 +56,7 @@ do exit ;; b) + backup="true" number_of_backups=$OPTARG ! [[ $OPTARG =~ ^[0-9]+$ ]] && echo -e "Error: -b needs to be assigned an interger\n\"""$number_of_backups""\" is not an interger" >&2 && exit [[ "$number_of_backups" -le 0 ]] && echo "Error: Number of backups is required to be at least 1" && exit @@ -138,7 +139,7 @@ done [[ "$dns" == "true" ]] && dns && exit [[ "$restore" == "true" ]] && restore && exit [[ "$mount" == "true" ]] && mount && exit -if [[ "$number_of_backups" -ge 1 && "$sync" == "true" ]]; then # Run backup and sync at the same time +if [[ "$backup" == "true" && "$sync" == "true" ]]; then # Run backup and sync at the same time echo "Running the following two tasks at the same time" echo "------------------------------------------------" echo -e "Backing up ix-applications dataset\nSyncing catalog(s)" @@ -147,7 +148,7 @@ if [[ "$number_of_backups" -ge 1 && "$sync" == "true" ]]; then # Run backup and sync & wait fi -[[ "$number_of_backups" -ge 1 && -z "$sync" ]] && echo "Backing up \"ix-applications\" dataset, please wait.." && backup -[[ "$sync" == "true" && "$number_of_backups" -lt 1 ]] && echo "Syncing catalogs, this takes a LONG time, please wait.." && sync +[[ "$backup" == "true" && -z "$sync" ]] && echo "Backing up \"ix-applications\" dataset, please wait.." && backup +[[ "$sync" == "true" && -z "$backup" ]] && echo "Syncing catalogs, this takes a LONG time, please wait.." && sync [[ "$update_all_apps" == "true" || "$update_apps" == "true" ]] && commander [[ "$prune" == "true" ]] && prune From 13a2a2f8b2a3b77469ad90c097d889afc25d8aa6 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 18:32:35 -0600 Subject: [PATCH 0421/1229] fix delete backup --- functions/menu.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/functions/menu.sh b/functions/menu.sh index 595c0444..6d405efb 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -1,6 +1,10 @@ #!/bin/bash menu(){ + script=$(readlink -f "$0") + script_path=$(dirname "$script") + script_name="heavy_script.sh" + cd "$script_path" || exit clear -x title echo "1) Help" @@ -42,15 +46,13 @@ menu(){ ;; 6) deleteBackup="true" + exec bash "$script_name" --restore + exit ;; 7) self_update="true" ;; 8) - script=$(readlink -f "$0") - script_path=$(dirname "$script") - script_name="heavy_script.sh" - cd "$script_path" || exit while true do clear -x From 065a809da3467273decf2205766dcdc7bf4ba119 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 18:33:58 -0600 Subject: [PATCH 0422/1229] woops lol --- functions/menu.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/menu.sh b/functions/menu.sh index 6d405efb..3466b84d 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -46,7 +46,7 @@ menu(){ ;; 6) deleteBackup="true" - exec bash "$script_name" --restore + exec bash "$script_name" --delete-backup exit ;; 7) From 27bf546869f2bba69b4ea327e46b73e934cac4ad Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 18:36:08 -0600 Subject: [PATCH 0423/1229] uhh --- functions/menu.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/functions/menu.sh b/functions/menu.sh index 3466b84d..75618d27 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -46,8 +46,6 @@ menu(){ ;; 6) deleteBackup="true" - exec bash "$script_name" --delete-backup - exit ;; 7) self_update="true" From c2002979a8613f8699c67ddf9c79a2edd9c7db99 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 18:37:34 -0600 Subject: [PATCH 0424/1229] test --- functions/menu.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/functions/menu.sh b/functions/menu.sh index 75618d27..f4fe1dc7 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -45,7 +45,8 @@ menu(){ restore="true" ;; 6) - deleteBackup="true" + exec bash "$script_name" --delete-backup + exit ;; 7) self_update="true" From 88ba5b18af49d2a6a06ea7f7163f270dd678efd4 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 18:40:07 -0600 Subject: [PATCH 0425/1229] no idea --- functions/menu.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/functions/menu.sh b/functions/menu.sh index f4fe1dc7..75618d27 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -45,8 +45,7 @@ menu(){ restore="true" ;; 6) - exec bash "$script_name" --delete-backup - exit + deleteBackup="true" ;; 7) self_update="true" From 3f73c98fbec492285e4aa1a37be587aac2e4cb4e Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 18:40:57 -0600 Subject: [PATCH 0426/1229] test --- functions/backup.sh | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/functions/backup.sh b/functions/backup.sh index f2221932..fc81dce3 100644 --- a/functions/backup.sh +++ b/functions/backup.sh @@ -34,22 +34,12 @@ deleteBackup(){ clear -x && echo "pulling all restore points.." list_backups=$(cli -c 'app kubernetes list_backups' | sort -t '_' -Vr -k2,7 | tr -d " \t\r" | awk -F '|' '{print $2}' | nl | column -t) clear -x -[[ -z "$list_backups" ]] && echo "No restore points available" && exit -title -echo -e "Choose a restore point to delete\nThese may be out of order if they are not all HeavyScript backups" -echo "$list_backups" -read -pr -t 600 "Please type a number: " selection -restore_point=$(echo "$list_backups" | grep ^"$selection " | awk '{print $2}') -if [[ -z "$selection" ]]; then #Check for valid selection. If none, kill script - echo "Your selection cannot be empty" - exit -elif [[ -z "$restore_point" ]]; then #Check for valid selection. If none, kill script - echo "Invalid Selection: $selection, was not an option" - exit -fi -echo -e "\nWARNING:\nYou CANNOT go back after deleting your restore point" -echo -e "\n\nYou have chosen:\n$restore_point\n\nWould you like to continue?" && echo -e "1 Yes\n2 No" -read -rp -t 120 "Please type a number: " yesno || { echo "Failed to make a valid selection"; exit; } +[[ -z "$list_backups" ]] && echo "No restore points available" && exit || { title; echo -e "Choose a restore point to delete\nThese may be out of order if they are not HeavyScript backups" ; } +echo "$list_backups" && read -t 600 -p "Please type a number: " selection && restore_point=$(echo "$list_backups" | grep ^"$selection " | awk '{print $2}') +[[ -z "$selection" ]] && echo "Your selection cannot be empty" && exit #Check for valid selection. If none, kill script +[[ -z "$restore_point" ]] && echo "Invalid Selection: $selection, was not an option" && exit #Check for valid selection. If none, kill script +echo -e "\nWARNING:\nYou CANNOT go back after deleting your restore point" || { echo "FAILED"; exit; } +echo -e "\n\nYou have chosen:\n$restore_point\n\nWould you like to continue?" && echo -e "1 Yes\n2 No" && read -t 120 -p "Please type a number: " yesno || { echo "FAILED"; exit; } if [[ $yesno == "1" ]]; then echo -e "\nDeleting $restore_point" && cli -c 'app kubernetes delete_backup backup_name=''"'"$restore_point"'"' &>/dev/null && echo "Sucessfully deleted" || echo "Deletion Failed" elif [[ $yesno == "2" ]]; then From e459cce2413da0fcf92c4127cf874fb0579d0594 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 18:44:55 -0600 Subject: [PATCH 0427/1229] update readme --- README.md | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index f7717f6e..bcfb7e7a 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,7 @@ | Flag | Example | Parameter | Description | |----------------- |------------------------ |----------- |--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| --self-update | --self-update | None | Updates HeavyScript prior to running it
_You no longer need to git pull_ | | --delete-backup | --delete-backup | None | Opens a menu to delete backups
_Useful if you need to delete old system backups or backups from other scripts_ | | --restore | --restore | None | Restore HeavyScript specific `ix-applications dataset` snapshot | | --mount | --mount | None | Initiates mounting feature
Choose between unmounting and mounting PVC data | @@ -36,7 +37,7 @@ ### Examples #### Typical Cron Job ``` -bash heavy_script.sh -b 14 -i portainer -i arch -i sonarr -i radarr -t 600 -rsup +bash heavy_script.sh --self-update -b 14 -i portainer -i arch -i sonarr -i radarr -t 600 -rsup ``` > `-b` is set to 14. Up to 14 snapshots of your ix-applications dataset will be saved @@ -53,6 +54,8 @@ bash heavy_script.sh -b 14 -i portainer -i arch -i sonarr -i radarr -t 600 -rsup > `-p` Prune docker images. +> `--self-update` Will update the script prior to running anything else. + #### Mounting PVC Data ``` @@ -79,7 +82,7 @@ bash /mnt/tank/scripts/heavy_script/heavy_script.sh --dns #### My personal Cron Job ``` -git -C /mnt/speed/scripts/heavy_script pull && bash /mnt/speed/scripts/heavy_script/heavy_script.sh -b 14 -rsup +bash /mnt/speed/scripts/heavy_script/heavy_script.sh --self-update -b 14 -rsup ```
@@ -111,7 +114,7 @@ cd heavy_script From here, you can just run Heavy_Script with `bash heavy_script.sh -ARGUMENTS` -> Note: `chmod +x` is NOT required. Doing this will break the `git pull` function. Just run the script with `bash heavy_script.sh` +> Note: `chmod +x` is NOT required. Doing this will break the `git pull` (or self update) function. Just run the script with `bash heavy_script.sh`
@@ -132,20 +135,13 @@ git pull ```
-### Update with your Cron Job +### Update with the scripts built-in option -Here, we will update the script prior to running it, incase there is a bugfix, or any new additions to the script - -**Cron Job Command** ``` -git -C /mnt/speed/scripts/heavy_script pull && bash /mnt/speed/scripts/heavy_script/heavy_script.sh -b 14 -rsup +bash heavyscript.sh --self-update -b 14 -supr ``` -> The important command here is the `git -C /PATH/TO/HEAVY_SCRIPT_DIRECTORY pull` +> The important argument here is the `--self-update`, you can still use all of your same arguments with this option. -> This command will allow you to preform a `git pull` on a remote directory, which will ensure your script is udated prior to running it - -> `&&` Is used to run a command AFTER the previous command completed successfully ->> So once the `git -C /PATH/TO/HEAVY_SCRIPT_DIRECTORY pull` command completes, THEN it will run the `bash /PATH/TO/HEAVY_SCRIPT_DIRECTORY/heavy_script.sh -b 14 -rsup` command

@@ -161,7 +157,7 @@ git -C /mnt/speed/scripts/heavy_script pull && bash /mnt/speed/scripts/heavy_scr | Name | Value | Reason | |------------------------ |------------------------------------------------------------------------------------------------------------------- |------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `Description` | HeavyScript git pull and Update apps | This is up to you, put whatever you think is a good description in here | -| `Command` | `git -C /PATH/TO/HEAVY_SCRIPT_DIRECTORY pull && bash /PATH/TO/HEAVY_SCRIPT_DIRECTORY/heavy_script.sh -b 14 -rsup` | This is the command you will be running on your schedule I personally use: `git -C /mnt/speed/scripts/heavy_script pull && bash /mnt/speed/scripts/heavy_script/heavy_script.sh -b 14 -rsup` | +| `Command` | `bash /PATH/TO/HEAVY_SCRIPT_DIRECTORY/heavy_script.sh --self-update -b 14 -rsup` | This is the command you will be running on your schedule I personally use: `bash /mnt/speed/scripts/heavy_script/heavy_script.sh --self-update -b 14 -rsup` | | `Run As User` | `root` | Running the script as `root` is REQUIRED. You cannot access all of the kubernetes functions without this user. | | `Schedule` | Up to you, I run mine everyday at `0400` | Again up to you | | `Hide Standard Output` | `False` or Unticked | I like to receive an email report of how the script ran, what apps updated etc. | @@ -184,4 +180,3 @@ git -C /mnt/speed/scripts/heavy_script pull && bash /mnt/speed/scripts/heavy_scr | ![image](https://user-images.githubusercontent.com/20793231/167971188-07f71d02-8da3-4e0c-b9a0-cd26e7f63613.png) | ![image](https://user-images.githubusercontent.com/20793231/167972033-dc8d4ab4-4fb2-4c8a-b7dc-b9311ae55cf8.png) | - From feb42b49e677581d1b3d68bcf47d637ea853cf22 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 18:57:22 -0600 Subject: [PATCH 0428/1229] update readme --- README.md | 45 +++++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index bcfb7e7a..627502b9 100644 --- a/README.md +++ b/README.md @@ -12,24 +12,24 @@ ## Arguments -| Flag | Example | Parameter | Description | -|----------------- |------------------------ |----------- |--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| --self-update | --self-update | None | Updates HeavyScript prior to running it
_You no longer need to git pull_ | -| --delete-backup | --delete-backup | None | Opens a menu to delete backups
_Useful if you need to delete old system backups or backups from other scripts_ | -| --restore | --restore | None | Restore HeavyScript specific `ix-applications dataset` snapshot | -| --mount | --mount | None | Initiates mounting feature
Choose between unmounting and mounting PVC data | -| --dns | --dns | None | list all of your applications DNS names and their web ports | -| -U | -U | None | Update applications, ignoring major version changes | -| -u | -u | None | Update applications, do NOT update if there was a major version change | -| -b | -b 14 | Integer | Backup `ix-appliactions` dataset
_Creates backups up to the number you've chosen_ | -| -i | -i nextcloud -i sonarr | String | Applications listed will be ignored during updating
_List one application after another as shown in the example_ | -| (-R\|-r) | -r | None | Monitors applications after they update
If the app does not become "ACTIVE" after either:
The custom Timeout, or Default Timeout,
rollback the application.
__Warning: deprecating `-R` please begin using `-r` instead__ | -| -v | -v | None | Verbose Output
_Look at the bottom of this page for an example_ | -| -S | -S | None | Shutdown the application prior to updating it | -| -t | -t 150 | Integer | Set a custom timeout to be used with either:
`-m`
_Time the script will wait for application to be "STOPPED"_
or
`-(u\|U)`
_Time the script will wait for application to be either "STOPPED" or "ACTIVE"_ | -| -s | -s | None | Sync Catalogs prior to updating | -| -p | -p | None | Prune old/unused docker images | - +| Flag | Example | Parameter | Description | +|----------------- |------------------------ |----------------- |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| NULL | NULL | NULL | If you choose not to supply an option, it will open the menu for easier access to the utilities | +| --self-update | --self-update | None | Updates HeavyScript prior to running it
_You no longer need to git pull_ | +| --delete-backup | --delete-backup | None | Opens a menu to delete backups
_Useful if you need to delete old system backups or backups from other scripts_ | +| --restore | --restore | None | Restore HeavyScript specific `ix-applications dataset` snapshot | +| --mount | --mount | None | Initiates mounting feature
Choose between unmounting and mounting PVC data | +| --dns | --dns | None | list all of your applications DNS names and their web ports | +| -U | -U
-U 5 | None or Integer | Update applications, ignoring major version changes
_Optionally, you can supply a number after the argument to update multiple applications at once_ | +| -u | -u
-u 5 | None or Integer | Update applications, do NOT update if there was a major version change
_Optionally, you can supply a number after the argument to update multiple applications at once_ | +| -b | -b 14 | Integer | Backup `ix-appliactions` dataset
_Creates backups up to the number you've chosen_ | +| -i | -i nextcloud -i sonarr | String | Applications listed will be ignored during updating
_List one application after another as shown in the example_ | +| -r | -r | None | Monitors applications after they update
If the app does not become "ACTIVE" after either:
The custom Timeout, or Default Timeout,
rollback the application. | +| -v | -v | None | Verbose Output
_Look at the bottom of this page for an example_ | +| -S | -S | None | Shutdown the application prior to updating it | +| -t | -t 150 | Integer | Set a custom timeout to be used with either:
`-m`
_Time the script will wait for application to be "STOPPED"_
or
`-(u\|U)`
_Time the script will wait for application to be either "STOPPED" or "ACTIVE"_ | +| -s | -s | None | Sync Catalogs prior to updating | +| -p | -p | None | Prune old/unused docker images |

@@ -37,7 +37,7 @@ ### Examples #### Typical Cron Job ``` -bash heavy_script.sh --self-update -b 14 -i portainer -i arch -i sonarr -i radarr -t 600 -rsup +bash heavy_script.sh --self-update -b 14 -i portainer -i arch -i sonarr -i radarr -t 600 -rsp -u 5 ``` > `-b` is set to 14. Up to 14 snapshots of your ix-applications dataset will be saved @@ -50,10 +50,11 @@ bash heavy_script.sh --self-update -b 14 -i portainer -i arch -i sonarr -i radar > `-s` will just sync the repositories, ensuring you are downloading the latest updates. -> `-u` update applications as long as the major version has absolutely no change, if it does have a change it will ask the user to update manually. - > `-p` Prune docker images. +> `-u` update applications as long as the major version has absolutely no change, if it does have a change it will ask the user to update manually. +> The `5` after the `-u` means up to 5 applications will be updating and monitored at one time + > `--self-update` Will update the script prior to running anything else. #### Mounting PVC Data @@ -82,7 +83,7 @@ bash /mnt/tank/scripts/heavy_script/heavy_script.sh --dns #### My personal Cron Job ``` -bash /mnt/speed/scripts/heavy_script/heavy_script.sh --self-update -b 14 -rsup +bash /mnt/speed/scripts/heavy_script/heavy_script.sh --self-update -b 14 -rsp -u 10 ```
From e0ba0935b837622dc316b8e5be617460959dafaa Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 18:58:17 -0600 Subject: [PATCH 0429/1229] readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 627502b9..8ab10a50 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ bash heavy_script.sh --self-update -b 14 -i portainer -i arch -i sonarr -i radar > `-p` Prune docker images. > `-u` update applications as long as the major version has absolutely no change, if it does have a change it will ask the user to update manually. -> The `5` after the `-u` means up to 5 applications will be updating and monitored at one time +>> The `5` after the `-u` means up to 5 applications will be updating and monitored at one time > `--self-update` Will update the script prior to running anything else. From 05051adf233764dcd6f28cf0a7240ee8ecefc626 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 19:04:27 -0600 Subject: [PATCH 0430/1229] cleanup --- functions/menu.sh | 40 ++++++++++++++++++++-------------------- functions/update_apps.sh | 3 +-- 2 files changed, 21 insertions(+), 22 deletions(-) diff --git a/functions/menu.sh b/functions/menu.sh index 75618d27..e965ed7b 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -1,25 +1,25 @@ #!/bin/bash menu(){ - script=$(readlink -f "$0") - script_path=$(dirname "$script") - script_name="heavy_script.sh" - cd "$script_path" || exit - clear -x - title - echo "1) Help" - echo "2) List DNS Names" - echo "3) Mount and Unmount PVC storage" - echo "4) Create a Backup" - echo "5) Restore a Backup" - echo "6) Delete a Backup" - echo "7) Update HeavyScript" - echo "8) Update Applications" - echo - echo "0) Exit" - read -rt 600 -p "Please select an option by number: " selection +script=$(readlink -f "$0") +script_path=$(dirname "$script") +script_name="heavy_script.sh" +cd "$script_path" || exit +clear -x +title +echo "1) Help" +echo "2) List DNS Names" +echo "3) Mount and Unmount PVC storage" +echo "4) Create a Backup" +echo "5) Restore a Backup" +echo "6) Delete a Backup" +echo "7) Update HeavyScript" +echo "8) Update Applications" +echo +echo "0) Exit" +read -rt 600 -p "Please select an option by number: " selection - case $selection in +case $selection in 0) exit ;; @@ -174,7 +174,7 @@ menu(){ *) echo "That was not an option, please try agian" && sleep 5 && menu ;; - esac - echo +esac +echo } export -f menu \ No newline at end of file diff --git a/functions/update_apps.sh b/functions/update_apps.sh index d1abed7e..92aeab24 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -35,6 +35,7 @@ done } export -f commander + update_apps(){ app_name=$(echo "${array[$it]}" | awk -F ',' '{print $1}') #print out first catagory, name. printf '%s\0' "${ignore[@]}" | grep -iFxqz "${app_name}" && echo -e "\n$app_name\nIgnored, skipping" && return 0 #If application is on ignore list, skip @@ -86,8 +87,6 @@ rollback_version=$(echo "${array[$it]}" | awk -F ',' '{print $4}' | awk -F '_' ' echo_array+=("\n$app_name\nMajor Release, update manually") return 0 fi - - } export -f update_apps From 0884c75ec257e04dfb3663bcf2e4bed3c2039ca0 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 19:06:57 -0600 Subject: [PATCH 0431/1229] todo --- functions/self_update.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/self_update.sh b/functions/self_update.sh index 93543752..20461d04 100644 --- a/functions/self_update.sh +++ b/functions/self_update.sh @@ -8,7 +8,7 @@ script_path=$(dirname "$script") script_name="heavy_script.sh" cd "$script_path" || exit git fetch &> /dev/null - +# TODO: change beta to main once testing is complete if git diff --name-only origin/beta | grep -qs ".sh" ; then echo "Found a new version of HeavyScript, updating myself..." git reset --hard -q From f2d30a74e501f46ffdb36a380d5369febd625739 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 20:20:16 -0600 Subject: [PATCH 0432/1229] remove uneeded --- functions/backup.sh | 2 +- functions/menu.sh | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/functions/backup.sh b/functions/backup.sh index fc81dce3..f7626653 100644 --- a/functions/backup.sh +++ b/functions/backup.sh @@ -9,7 +9,7 @@ date=$(date '+%Y_%m_%d_%H_%M_%S') [[ "$verbose" == "true" ]] && cli -c 'app kubernetes backup_chart_releases backup_name=''"'HeavyScript_"$date"'"' &> /dev/null && echo_backup+=(HeavyScript_"$date") [[ -z "$verbose" ]] && echo_backup+=("\nNew Backup Name:") && cli -c 'app kubernetes backup_chart_releases backup_name=''"'HeavyScript_"$date"'"' | tail -n 1 &> /dev/null && echo_backup+=(HeavyScript_"$date") mapfile -t list_backups < <(cli -c 'app kubernetes list_backups' | grep "HeavyScript_" | sort -t '_' -Vr -k2,7 | awk -F '|' '{print $2}'| tr -d " \t\r") -if [[ ${#list_backups[@]} -gt "number_of_backups" ]]; then +if [[ ${#list_backups[@]} -gt "$number_of_backups" ]]; then echo_backup+=("\nDeleted the oldest backup(s) for exceeding limit:") overflow=$(( ${#list_backups[@]} - "$number_of_backups" )) mapfile -t list_overflow < <(cli -c 'app kubernetes list_backups' | grep "HeavyScript_" | sort -t '_' -V -k2,7 | awk -F '|' '{print $2}'| tr -d " \t\r" | head -n "$overflow") diff --git a/functions/menu.sh b/functions/menu.sh index e965ed7b..06c138b8 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -34,12 +34,9 @@ case $selection in ;; 4) read -rt 600 -p "Please type the max number of backups to keep: " number_of_backups - number_of_backups=$number_of_backups ! [[ $number_of_backups =~ ^[0-9]+$ ]] && echo -e "Error: -b needs to be assigned an interger\n\"""$number_of_backups""\" is not an interger" >&2 && exit [[ "$number_of_backups" -le 0 ]] && echo "Error: Number of backups is required to be at least 1" && exit echo "Generating backup, please be patient for output.." - menu_backup="true" - backup "$number_of_backups" ;; 5) restore="true" From d262ad52f93628b8cb92bb50f3071cab6304dc29 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 20:21:48 -0600 Subject: [PATCH 0433/1229] test --- functions/menu.sh | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/functions/menu.sh b/functions/menu.sh index 06c138b8..e4bff97a 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -33,10 +33,7 @@ case $selection in mount="true" ;; 4) - read -rt 600 -p "Please type the max number of backups to keep: " number_of_backups - ! [[ $number_of_backups =~ ^[0-9]+$ ]] && echo -e "Error: -b needs to be assigned an interger\n\"""$number_of_backups""\" is not an interger" >&2 && exit - [[ "$number_of_backups" -le 0 ]] && echo "Error: Number of backups is required to be at least 1" && exit - echo "Generating backup, please be patient for output.." + backup="true" ;; 5) restore="true" From 890677c72f920fa75e72a8db017cda5466d51f64 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 20:23:52 -0600 Subject: [PATCH 0434/1229] test --- functions/menu.sh | 1 + heavy_script.sh | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/functions/menu.sh b/functions/menu.sh index e4bff97a..f78bbb6b 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -33,6 +33,7 @@ case $selection in mount="true" ;; 4) + read -rt 600 -p "What is the maximun number of backups you would like?: " number_of_backups backup="true" ;; 5) diff --git a/heavy_script.sh b/heavy_script.sh index db3cb062..27abd6f7 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -56,10 +56,10 @@ do exit ;; b) - backup="true" number_of_backups=$OPTARG ! [[ $OPTARG =~ ^[0-9]+$ ]] && echo -e "Error: -b needs to be assigned an interger\n\"""$number_of_backups""\" is not an interger" >&2 && exit [[ "$number_of_backups" -le 0 ]] && echo "Error: Number of backups is required to be at least 1" && exit + backup="true" ;; r) rollback="true" From 6f1fbd8bcf0957faa6345d216285b36c7478c012 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 20:31:44 -0600 Subject: [PATCH 0435/1229] update help --- functions/misc.sh | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/functions/misc.sh b/functions/misc.sh index 96ca57e1..35601d93 100644 --- a/functions/misc.sh +++ b/functions/misc.sh @@ -44,19 +44,24 @@ echo "--delete-backup | Opens a menu to delete backups on your system" echo "--dns | list all of your applications DNS names and their web ports" echo echo "Update Options" -echo "-U | Update all applications, ignores versions" -echo "-u | Update all applications, does not update Major releases" -echo "-b | Back-up your ix-applications dataset, specify a number after -b" -echo "-i | Add application to ignore list, one by one, see example below." -echo "-r | Roll-back applications if they fail to update" -echo "-S | Shutdown applications prior to updating" -echo "-v | verbose output" -echo "-t | Set a custom timeout in seconds when checking if either an App or Mountpoint correctly Started, Stopped or (un)Mounted. Defaults to 500 seconds" -echo "-s | sync catalog" -echo "-p | Prune unused/old docker images" +echo "-U | Update all applications, ignores versions" +echo "-U 5 | Same as above, but updates 5 applications at one time" +echo "-u | Update all applications, does not update Major releases" +echo "-u 5 | Same as above, but updates 5 applications at one time" +echo +echo "Additional Options" +echo "-b | Back-up your ix-applications dataset, specify a number after -b" +echo "-i | Add application to ignore list, one by one, see example below." +echo "-r | Roll-back applications if they fail to update" +echo "-S | Shutdown applications prior to updating" +echo "-v | verbose output" +echo "-t | Set a custom timeout in seconds when checking if either an App or Mountpoint correctly Started, Stopped or (un)Mounted. Defaults to 500 seconds" +echo "-s | sync catalog" +echo "-p | Prune unused/old docker images" echo echo "Examples" echo "bash heavy_script.sh -b 14 -i portainer -i arch -i sonarr -i radarr -t 600 -vrsUp" +echo "bash heavy_script.sh -b 14 -i portainer -i arch -i sonarr -i radarr -t 600 -vrsp -U 10" echo "bash /mnt/tank/scripts/heavy_script.sh -t 150 --mount" echo "bash /mnt/tank/scripts/heavy_script.sh --dns" echo "bash heavy_script.sh --restore" From 73feac7b95e8850c7b75fd93dabaf26089ccc77e Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 20:34:18 -0600 Subject: [PATCH 0436/1229] help fix --- functions/misc.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/functions/misc.sh b/functions/misc.sh index 35601d93..9b61a053 100644 --- a/functions/misc.sh +++ b/functions/misc.sh @@ -37,19 +37,28 @@ export -f title help(){ [[ $help == "true" ]] && clear -x + +echo "Access the HeavyScript Menu" +echo "---------------------------" +echo "(Just dont send any other argument)" +echo "bash heavy_script.sh" +echo echo "Basic Utilities" +echo "---------------" echo "--mount | Initiates mounting feature, choose between unmounting and mounting PVC data" echo "--restore | Opens a menu to restore a \"heavy_script\" backup that was taken on your \"ix-applications\" dataset" echo "--delete-backup | Opens a menu to delete backups on your system" echo "--dns | list all of your applications DNS names and their web ports" echo echo "Update Options" +echo "--------------" echo "-U | Update all applications, ignores versions" echo "-U 5 | Same as above, but updates 5 applications at one time" echo "-u | Update all applications, does not update Major releases" echo "-u 5 | Same as above, but updates 5 applications at one time" echo echo "Additional Options" +echo "------------------" echo "-b | Back-up your ix-applications dataset, specify a number after -b" echo "-i | Add application to ignore list, one by one, see example below." echo "-r | Roll-back applications if they fail to update" @@ -60,12 +69,14 @@ echo "-s | sync catalog" echo "-p | Prune unused/old docker images" echo echo "Examples" +echo "--------" echo "bash heavy_script.sh -b 14 -i portainer -i arch -i sonarr -i radarr -t 600 -vrsUp" echo "bash heavy_script.sh -b 14 -i portainer -i arch -i sonarr -i radarr -t 600 -vrsp -U 10" echo "bash /mnt/tank/scripts/heavy_script.sh -t 150 --mount" echo "bash /mnt/tank/scripts/heavy_script.sh --dns" echo "bash heavy_script.sh --restore" echo "bash /mnt/tank/scripts/heavy_script.sh --delete-backup" +echo "bash heavy_script.sh" echo exit } From c836ff5ce246564d249fe82452f75605b5ad5332 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 20:36:18 -0600 Subject: [PATCH 0437/1229] cleanup help --- functions/misc.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/misc.sh b/functions/misc.sh index 9b61a053..ce13f395 100644 --- a/functions/misc.sh +++ b/functions/misc.sh @@ -57,8 +57,8 @@ echo "-U 5 | Same as above, but updates 5 applications at one time" echo "-u | Update all applications, does not update Major releases" echo "-u 5 | Same as above, but updates 5 applications at one time" echo -echo "Additional Options" -echo "------------------" +echo "Additional Update Options" +echo "-------------------------" echo "-b | Back-up your ix-applications dataset, specify a number after -b" echo "-i | Add application to ignore list, one by one, see example below." echo "-r | Roll-back applications if they fail to update" From 587fefee3be6c5f63b9770dc9d7bcb5cc32f0cd3 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 20:38:18 -0600 Subject: [PATCH 0438/1229] final readme --- functions/misc.sh | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/functions/misc.sh b/functions/misc.sh index ce13f395..7956fe53 100644 --- a/functions/misc.sh +++ b/functions/misc.sh @@ -52,31 +52,31 @@ echo "--dns | list all of your applications DNS names and their web po echo echo "Update Options" echo "--------------" -echo "-U | Update all applications, ignores versions" -echo "-U 5 | Same as above, but updates 5 applications at one time" -echo "-u | Update all applications, does not update Major releases" -echo "-u 5 | Same as above, but updates 5 applications at one time" +echo "-U | Update all applications, ignores versions" +echo "-U 5 | Same as above, but updates 5 applications at one time" +echo "-u | Update all applications, does not update Major releases" +echo "-u 5 | Same as above, but updates 5 applications at one time" echo echo "Additional Update Options" echo "-------------------------" -echo "-b | Back-up your ix-applications dataset, specify a number after -b" -echo "-i | Add application to ignore list, one by one, see example below." -echo "-r | Roll-back applications if they fail to update" -echo "-S | Shutdown applications prior to updating" -echo "-v | verbose output" -echo "-t | Set a custom timeout in seconds when checking if either an App or Mountpoint correctly Started, Stopped or (un)Mounted. Defaults to 500 seconds" -echo "-s | sync catalog" -echo "-p | Prune unused/old docker images" +echo "-b 14 | Back-up your ix-applications dataset, specify a number after -b" +echo "-i | Add application to ignore list, one by one, see example below." +echo "-r | Roll-back applications if they fail to update" +echo "-S | Shutdown applications prior to updating" +echo "-v | verbose output" +echo "-t 500| Set a custom timeout in seconds when checking if either an App or Mountpoint correctly Started, Stopped or (un)Mounted. Defaults to 500 seconds" +echo "-s | sync catalog" +echo "-p | Prune unused/old docker images" echo echo "Examples" echo "--------" -echo "bash heavy_script.sh -b 14 -i portainer -i arch -i sonarr -i radarr -t 600 -vrsUp" -echo "bash heavy_script.sh -b 14 -i portainer -i arch -i sonarr -i radarr -t 600 -vrsp -U 10" +echo "bash heavy_script.sh" +echo "bash heavy_script.sh -b 14 -i portainer -i arch -i sonarr -t 600 -vrsUp" +echo "bash heavy_script.sh -b 14 -i portainer -i arch -i sonarr -t 600 -vrsp -U 10" echo "bash /mnt/tank/scripts/heavy_script.sh -t 150 --mount" echo "bash /mnt/tank/scripts/heavy_script.sh --dns" echo "bash heavy_script.sh --restore" echo "bash /mnt/tank/scripts/heavy_script.sh --delete-backup" -echo "bash heavy_script.sh" echo exit } From 84f272abde456e8137ca62e15e9bcf95de3190a6 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 22:45:12 -0600 Subject: [PATCH 0439/1229] attempt case --- functions/menu.sh | 103 ++++++++++++++++++++++++++++++++-------------- 1 file changed, 73 insertions(+), 30 deletions(-) diff --git a/functions/menu.sh b/functions/menu.sh index f78bbb6b..c13c7247 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -35,7 +35,7 @@ case $selection in 4) read -rt 600 -p "What is the maximun number of backups you would like?: " number_of_backups backup="true" - ;; + ;; 5) restore="true" ;; @@ -123,47 +123,90 @@ case $selection in echo read -rt 600 -p "Please type the number associated with the flag above: " current_selection - if [[ $current_selection == 0 ]]; then - clear -x - echo "Running \"bash heavy_script.sh ${update_selection[*]}\"" - echo - exec bash "$script_name" "${update_selection[@]}" - exit - elif [[ $current_selection == 1 ]]; then + case $current_selection in + 0) + clear -x + echo "Running \"bash heavy_script.sh ${update_selection[*]}\"" + echo + exec bash "$script_name" "${update_selection[@]}" + exit + ;; + 1) echo "Up to how many backups should we keep?" read -rt 600 -p "Please type an integer: " up_backups ! [[ $up_backups =~ ^[0-9]+$ ]] && echo -e "Error: \"$up_backups\" is invalid, it needs to be an integer\nNOT adding it to the list" && sleep 5 && continue [[ $up_backups == 0 ]] && echo -e "Error: Number of backups cannot be 0\nNOT adding it to the list" && sleep 5 && continue - update_selection+=("-b" "$up_backups") - elif [[ $current_selection == 2 ]]; then - read -rt 600 -p "What is the name of the application we should ignore?: " up_ignore + ;; + 2) + read -rt 600 -p "What is the name of the application we should ignore?: " up_ignore + update_selection+=("-i" "$up_ignore") + ;; + 3) + update_selection+=("-r") + ;; + 4) + update_selection+=("-S") + ;; + 5) + update_selection+=("-v") + ;; + 6) + echo "What do you want your timeout to be?" + read -rt 600 -p "Please type an integer: " up_timeout + ! [[ $up_timeout =~ ^[0-9]+$ ]] && echo -e "Error: \"$up_timeout\" is invalid, it needs to be an integer\nNOT adding it to the list" && sleep 5 && continue + ;; + 7) + update_selection+=("-s") + ;; + 8) + update_selection+=("-p") + ;; + *) + echo "$current_selection was not an option, try again" && sleep 5 && continue + ;; + esac + # if [[ $current_selection == 0 ]]; then + # clear -x + # echo "Running \"bash heavy_script.sh ${update_selection[*]}\"" + # echo + # exec bash "$script_name" "${update_selection[@]}" + # exit + # elif [[ $current_selection == 1 ]]; then + # echo "Up to how many backups should we keep?" + # read -rt 600 -p "Please type an integer: " up_backups + # ! [[ $up_backups =~ ^[0-9]+$ ]] && echo -e "Error: \"$up_backups\" is invalid, it needs to be an integer\nNOT adding it to the list" && sleep 5 && continue + # [[ $up_backups == 0 ]] && echo -e "Error: Number of backups cannot be 0\nNOT adding it to the list" && sleep 5 && continue - update_selection+=("-i" "$up_ignore") - elif [[ $current_selection == 3 ]]; then + # update_selection+=("-b" "$up_backups") + # elif [[ $current_selection == 2 ]]; then + # read -rt 600 -p "What is the name of the application we should ignore?: " up_ignore - update_selection+=("-r") - elif [[ $current_selection == 4 ]]; then + # update_selection+=("-i" "$up_ignore") + # elif [[ $current_selection == 3 ]]; then - update_selection+=("-S") - elif [[ $current_selection == 5 ]]; then + # update_selection+=("-r") + # elif [[ $current_selection == 4 ]]; then - update_selection+=("-v") - elif [[ $current_selection == 6 ]]; then - echo "What do you want your timeout to be?" - read -rt 600 -p "Please type an integer: " up_timeout - ! [[ $up_timeout =~ ^[0-9]+$ ]] && echo -e "Error: \"$up_timeout\" is invalid, it needs to be an integer\nNOT adding it to the list" && sleep 5 && continue + # update_selection+=("-S") + # elif [[ $current_selection == 5 ]]; then - update_selection+=("-t" "$up_timeout") - elif [[ $current_selection == 7 ]]; then + # update_selection+=("-v") + # elif [[ $current_selection == 6 ]]; then + # echo "What do you want your timeout to be?" + # read -rt 600 -p "Please type an integer: " up_timeout + # ! [[ $up_timeout =~ ^[0-9]+$ ]] && echo -e "Error: \"$up_timeout\" is invalid, it needs to be an integer\nNOT adding it to the list" && sleep 5 && continue - update_selection+=("-s") - elif [[ $current_selection == 8 ]]; then + # update_selection+=("-t" "$up_timeout") + # elif [[ $current_selection == 7 ]]; then - update_selection+=("-p") - else - echo "$current_selection was not an option, try again" && sleep 5 && continue - fi + # update_selection+=("-s") + # elif [[ $current_selection == 8 ]]; then + + # update_selection+=("-p") + # else + # echo "$current_selection was not an option, try again" && sleep 5 && continue + # fi done ;; *) From 42282b5017fd052ef63d4c302c06bbdca1d105d3 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 22:46:58 -0600 Subject: [PATCH 0440/1229] success --- functions/menu.sh | 51 +++++------------------------------------------ 1 file changed, 5 insertions(+), 46 deletions(-) diff --git a/functions/menu.sh b/functions/menu.sh index c13c7247..d011a072 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -132,11 +132,11 @@ case $selection in exit ;; 1) - echo "Up to how many backups should we keep?" - read -rt 600 -p "Please type an integer: " up_backups - ! [[ $up_backups =~ ^[0-9]+$ ]] && echo -e "Error: \"$up_backups\" is invalid, it needs to be an integer\nNOT adding it to the list" && sleep 5 && continue - [[ $up_backups == 0 ]] && echo -e "Error: Number of backups cannot be 0\nNOT adding it to the list" && sleep 5 && continue - update_selection+=("-b" "$up_backups") + echo "Up to how many backups should we keep?" + read -rt 600 -p "Please type an integer: " up_backups + ! [[ $up_backups =~ ^[0-9]+$ ]] && echo -e "Error: \"$up_backups\" is invalid, it needs to be an integer\nNOT adding it to the list" && sleep 5 && continue + [[ $up_backups == 0 ]] && echo -e "Error: Number of backups cannot be 0\nNOT adding it to the list" && sleep 5 && continue + update_selection+=("-b" "$up_backups") ;; 2) read -rt 600 -p "What is the name of the application we should ignore?: " up_ignore @@ -166,47 +166,6 @@ case $selection in echo "$current_selection was not an option, try again" && sleep 5 && continue ;; esac - # if [[ $current_selection == 0 ]]; then - # clear -x - # echo "Running \"bash heavy_script.sh ${update_selection[*]}\"" - # echo - # exec bash "$script_name" "${update_selection[@]}" - # exit - # elif [[ $current_selection == 1 ]]; then - # echo "Up to how many backups should we keep?" - # read -rt 600 -p "Please type an integer: " up_backups - # ! [[ $up_backups =~ ^[0-9]+$ ]] && echo -e "Error: \"$up_backups\" is invalid, it needs to be an integer\nNOT adding it to the list" && sleep 5 && continue - # [[ $up_backups == 0 ]] && echo -e "Error: Number of backups cannot be 0\nNOT adding it to the list" && sleep 5 && continue - - # update_selection+=("-b" "$up_backups") - # elif [[ $current_selection == 2 ]]; then - # read -rt 600 -p "What is the name of the application we should ignore?: " up_ignore - - # update_selection+=("-i" "$up_ignore") - # elif [[ $current_selection == 3 ]]; then - - # update_selection+=("-r") - # elif [[ $current_selection == 4 ]]; then - - # update_selection+=("-S") - # elif [[ $current_selection == 5 ]]; then - - # update_selection+=("-v") - # elif [[ $current_selection == 6 ]]; then - # echo "What do you want your timeout to be?" - # read -rt 600 -p "Please type an integer: " up_timeout - # ! [[ $up_timeout =~ ^[0-9]+$ ]] && echo -e "Error: \"$up_timeout\" is invalid, it needs to be an integer\nNOT adding it to the list" && sleep 5 && continue - - # update_selection+=("-t" "$up_timeout") - # elif [[ $current_selection == 7 ]]; then - - # update_selection+=("-s") - # elif [[ $current_selection == 8 ]]; then - - # update_selection+=("-p") - # else - # echo "$current_selection was not an option, try again" && sleep 5 && continue - # fi done ;; *) From 39b7928f68e9faef723d0ad1c640f35851858f14 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 22:48:46 -0600 Subject: [PATCH 0441/1229] cleaning --- functions/menu.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/menu.sh b/functions/menu.sh index d011a072..e15fbe31 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -163,13 +163,13 @@ case $selection in update_selection+=("-p") ;; *) - echo "$current_selection was not an option, try again" && sleep 5 && continue + echo "\"$OPTARG\" was not an option, try again" && sleep 5 && continue ;; esac done ;; *) - echo "That was not an option, please try agian" && sleep 5 && menu + echo "\"$OPTARG\" was not an option, please try agian" && sleep 5 && menu ;; esac echo From e83e7c8a80e0c1557276002e70cae84db79bbaf8 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 22:50:00 -0600 Subject: [PATCH 0442/1229] test --- functions/menu.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/menu.sh b/functions/menu.sh index e15fbe31..fbd46c27 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -97,7 +97,7 @@ case $selection in exit else echo "$current_selection was not an option, try again" - exit + continue fi done while true From e794d71be9318e95619230842363909ee2aebb2c Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 22:50:32 -0600 Subject: [PATCH 0443/1229] fix --- functions/menu.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/menu.sh b/functions/menu.sh index fbd46c27..a5fa27f8 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -96,7 +96,7 @@ case $selection in echo "Exiting.." exit else - echo "$current_selection was not an option, try again" + echo "$current_selection was not an option, try again" && sleep 5 continue fi done From 7f210da6b8d3564e1a6dcb3d4bc12473edc9b953 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 22:53:05 -0600 Subject: [PATCH 0444/1229] fix --- functions/menu.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/functions/menu.sh b/functions/menu.sh index a5fa27f8..f9bb003b 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -155,6 +155,7 @@ case $selection in echo "What do you want your timeout to be?" read -rt 600 -p "Please type an integer: " up_timeout ! [[ $up_timeout =~ ^[0-9]+$ ]] && echo -e "Error: \"$up_timeout\" is invalid, it needs to be an integer\nNOT adding it to the list" && sleep 5 && continue + update_selection+=("-i" "$up_timeout") ;; 7) update_selection+=("-s") From 63f1d6c477b5303b23c81b421e274932d45f7258 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 22:54:14 -0600 Subject: [PATCH 0445/1229] test --- functions/menu.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/menu.sh b/functions/menu.sh index f9bb003b..83978694 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -155,7 +155,7 @@ case $selection in echo "What do you want your timeout to be?" read -rt 600 -p "Please type an integer: " up_timeout ! [[ $up_timeout =~ ^[0-9]+$ ]] && echo -e "Error: \"$up_timeout\" is invalid, it needs to be an integer\nNOT adding it to the list" && sleep 5 && continue - update_selection+=("-i" "$up_timeout") + update_selection+=("-t" "$up_timeout") ;; 7) update_selection+=("-s") From a44b250390d6e8d965bfafb38507e99477a548ff Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 23:00:12 -0600 Subject: [PATCH 0446/1229] test skip --- functions/menu.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/functions/menu.sh b/functions/menu.sh index 83978694..8f564350 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -137,6 +137,7 @@ case $selection in ! [[ $up_backups =~ ^[0-9]+$ ]] && echo -e "Error: \"$up_backups\" is invalid, it needs to be an integer\nNOT adding it to the list" && sleep 5 && continue [[ $up_backups == 0 ]] && echo -e "Error: Number of backups cannot be 0\nNOT adding it to the list" && sleep 5 && continue update_selection+=("-b" "$up_backups") + printf '%s\0' "${update_selection[@]}" | grep -iFxqz "$OPTARG" && echo -e "$OPTARG is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it ;; 2) read -rt 600 -p "What is the name of the application we should ignore?: " up_ignore @@ -144,24 +145,30 @@ case $selection in ;; 3) update_selection+=("-r") + printf '%s\0' "${update_selection[@]}" | grep -iFxqz "$OPTARG" && echo -e "$OPTARG is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it ;; 4) update_selection+=("-S") + printf '%s\0' "${update_selection[@]}" | grep -iFxqz "$OPTARG" && echo -e "$OPTARG is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it ;; 5) update_selection+=("-v") + printf '%s\0' "${update_selection[@]}" | grep -iFxqz "$OPTARG" && echo -e "$OPTARG is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it ;; 6) echo "What do you want your timeout to be?" read -rt 600 -p "Please type an integer: " up_timeout ! [[ $up_timeout =~ ^[0-9]+$ ]] && echo -e "Error: \"$up_timeout\" is invalid, it needs to be an integer\nNOT adding it to the list" && sleep 5 && continue + printf '%s\0' "${update_selection[@]}" | grep -iFxqz "$OPTARG" && echo -e "$OPTARG is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it update_selection+=("-t" "$up_timeout") ;; 7) update_selection+=("-s") + printf '%s\0' "${update_selection[@]}" | grep -iFxqz "$OPTARG" && echo -e "$OPTARG is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it ;; 8) update_selection+=("-p") + printf '%s\0' "${update_selection[@]}" | grep -iFxqz "$OPTARG" && echo -e "$OPTARG is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it ;; *) echo "\"$OPTARG\" was not an option, try again" && sleep 5 && continue From 0c7479801ed9881dc43607178fe0ebcdf3747fbf Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 23:02:45 -0600 Subject: [PATCH 0447/1229] fix --- functions/menu.sh | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/functions/menu.sh b/functions/menu.sh index 8f564350..04a6a66b 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -132,43 +132,44 @@ case $selection in exit ;; 1) + printf '%s\0' "${update_selection[@]}" | grep -iFxqz "-b" && echo -e "$OPTARG is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it echo "Up to how many backups should we keep?" read -rt 600 -p "Please type an integer: " up_backups ! [[ $up_backups =~ ^[0-9]+$ ]] && echo -e "Error: \"$up_backups\" is invalid, it needs to be an integer\nNOT adding it to the list" && sleep 5 && continue [[ $up_backups == 0 ]] && echo -e "Error: Number of backups cannot be 0\nNOT adding it to the list" && sleep 5 && continue update_selection+=("-b" "$up_backups") - printf '%s\0' "${update_selection[@]}" | grep -iFxqz "$OPTARG" && echo -e "$OPTARG is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it ;; 2) read -rt 600 -p "What is the name of the application we should ignore?: " up_ignore update_selection+=("-i" "$up_ignore") ;; 3) + printf '%s\0' "${update_selection[@]}" | grep -iFxqz "-r" && echo -e "$OPTARG is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it update_selection+=("-r") - printf '%s\0' "${update_selection[@]}" | grep -iFxqz "$OPTARG" && echo -e "$OPTARG is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it + ;; 4) + printf '%s\0' "${update_selection[@]}" | grep -iFxqz "-S" && echo -e "$OPTARG is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it update_selection+=("-S") - printf '%s\0' "${update_selection[@]}" | grep -iFxqz "$OPTARG" && echo -e "$OPTARG is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it ;; 5) + printf '%s\0' "${update_selection[@]}" | grep -iFxqz "-v" && echo -e "$OPTARG is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it update_selection+=("-v") - printf '%s\0' "${update_selection[@]}" | grep -iFxqz "$OPTARG" && echo -e "$OPTARG is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it ;; 6) + printf '%s\0' "${update_selection[@]}" | grep -iFxqz "-t" && echo -e "$OPTARG is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it echo "What do you want your timeout to be?" read -rt 600 -p "Please type an integer: " up_timeout ! [[ $up_timeout =~ ^[0-9]+$ ]] && echo -e "Error: \"$up_timeout\" is invalid, it needs to be an integer\nNOT adding it to the list" && sleep 5 && continue - printf '%s\0' "${update_selection[@]}" | grep -iFxqz "$OPTARG" && echo -e "$OPTARG is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it update_selection+=("-t" "$up_timeout") ;; 7) + printf '%s\0' "${update_selection[@]}" | grep -iFxqz "-s" && echo -e "$OPTARG is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it update_selection+=("-s") - printf '%s\0' "${update_selection[@]}" | grep -iFxqz "$OPTARG" && echo -e "$OPTARG is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it ;; 8) + printf '%s\0' "${update_selection[@]}" | grep -iFxqz "-p" && echo -e "$OPTARG is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it update_selection+=("-p") - printf '%s\0' "${update_selection[@]}" | grep -iFxqz "$OPTARG" && echo -e "$OPTARG is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it ;; *) echo "\"$OPTARG\" was not an option, try again" && sleep 5 && continue From 2f7169ee11deb0c5221d022adb6819cf69dcf630 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 23:05:41 -0600 Subject: [PATCH 0448/1229] uhh --- functions/menu.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/functions/menu.sh b/functions/menu.sh index 04a6a66b..a6a5eee0 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -132,7 +132,7 @@ case $selection in exit ;; 1) - printf '%s\0' "${update_selection[@]}" | grep -iFxqz "-b" && echo -e "$OPTARG is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it + printf '%s\0' "${update_selection[@]}" | grep -Fxqz '-b' && echo -e "$OPTARG is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it echo "Up to how many backups should we keep?" read -rt 600 -p "Please type an integer: " up_backups ! [[ $up_backups =~ ^[0-9]+$ ]] && echo -e "Error: \"$up_backups\" is invalid, it needs to be an integer\nNOT adding it to the list" && sleep 5 && continue @@ -144,31 +144,31 @@ case $selection in update_selection+=("-i" "$up_ignore") ;; 3) - printf '%s\0' "${update_selection[@]}" | grep -iFxqz "-r" && echo -e "$OPTARG is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it + printf '%s\0' "${update_selection[@]}" | grep -Fxqz "-r" && echo -e "$OPTARG is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it update_selection+=("-r") ;; 4) - printf '%s\0' "${update_selection[@]}" | grep -iFxqz "-S" && echo -e "$OPTARG is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it + printf '%s\0' "${update_selection[@]}" | grep -Fxqz "-S" && echo -e "$OPTARG is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it update_selection+=("-S") ;; 5) - printf '%s\0' "${update_selection[@]}" | grep -iFxqz "-v" && echo -e "$OPTARG is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it + printf '%s\0' "${update_selection[@]}" | grep -Fxqz "-v" && echo -e "$OPTARG is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it update_selection+=("-v") ;; 6) - printf '%s\0' "${update_selection[@]}" | grep -iFxqz "-t" && echo -e "$OPTARG is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it + printf '%s\0' "${update_selection[@]}" | grep -Fxqz "-t" && echo -e "$OPTARG is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it echo "What do you want your timeout to be?" read -rt 600 -p "Please type an integer: " up_timeout ! [[ $up_timeout =~ ^[0-9]+$ ]] && echo -e "Error: \"$up_timeout\" is invalid, it needs to be an integer\nNOT adding it to the list" && sleep 5 && continue update_selection+=("-t" "$up_timeout") ;; 7) - printf '%s\0' "${update_selection[@]}" | grep -iFxqz "-s" && echo -e "$OPTARG is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it + printf '%s\0' "${update_selection[@]}" | grep -Fxqz "-s" && echo -e "$OPTARG is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it update_selection+=("-s") ;; 8) - printf '%s\0' "${update_selection[@]}" | grep -iFxqz "-p" && echo -e "$OPTARG is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it + printf '%s\0' "${update_selection[@]}" | grep -Fxqz "-p" && echo -e "$OPTARG is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it update_selection+=("-p") ;; *) From 4e15a6ba3eede92cc2de7eca879b6bbe6ee20e93 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 23:07:06 -0600 Subject: [PATCH 0449/1229] asd --- functions/menu.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/menu.sh b/functions/menu.sh index a6a5eee0..7d065b58 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -132,7 +132,7 @@ case $selection in exit ;; 1) - printf '%s\0' "${update_selection[@]}" | grep -Fxqz '-b' && echo -e "$OPTARG is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it + printf '%s\0' "${update_selection[@]}" | grep -Fxq '-b' && echo -e "$OPTARG is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it echo "Up to how many backups should we keep?" read -rt 600 -p "Please type an integer: " up_backups ! [[ $up_backups =~ ^[0-9]+$ ]] && echo -e "Error: \"$up_backups\" is invalid, it needs to be an integer\nNOT adding it to the list" && sleep 5 && continue From 20551b4df9b11513e806fbd370df92cf1125dda4 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 23:08:55 -0600 Subject: [PATCH 0450/1229] escape? --- functions/menu.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/menu.sh b/functions/menu.sh index 7d065b58..60cb7dce 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -132,7 +132,7 @@ case $selection in exit ;; 1) - printf '%s\0' "${update_selection[@]}" | grep -Fxq '-b' && echo -e "$OPTARG is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it + printf '%s\0' "${update_selection[@]}" | grep -Fxqz "\-b" && echo -e "$OPTARG is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it echo "Up to how many backups should we keep?" read -rt 600 -p "Please type an integer: " up_backups ! [[ $up_backups =~ ^[0-9]+$ ]] && echo -e "Error: \"$up_backups\" is invalid, it needs to be an integer\nNOT adding it to the list" && sleep 5 && continue From b0b9bce10e49a2f7587ca6f5fac2fddc037e8e4b Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 23:10:16 -0600 Subject: [PATCH 0451/1229] test --- functions/menu.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/menu.sh b/functions/menu.sh index 60cb7dce..fc74d51b 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -132,7 +132,7 @@ case $selection in exit ;; 1) - printf '%s\0' "${update_selection[@]}" | grep -Fxqz "\-b" && echo -e "$OPTARG is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it + printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-b" && echo -e "$OPTARG is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it echo "Up to how many backups should we keep?" read -rt 600 -p "Please type an integer: " up_backups ! [[ $up_backups =~ ^[0-9]+$ ]] && echo -e "Error: \"$up_backups\" is invalid, it needs to be an integer\nNOT adding it to the list" && sleep 5 && continue From edfe7542f213b87684fa6dab4f6f66e9aaf98583 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 23:12:02 -0600 Subject: [PATCH 0452/1229] woo --- functions/menu.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/functions/menu.sh b/functions/menu.sh index fc74d51b..b01f93b9 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -132,7 +132,7 @@ case $selection in exit ;; 1) - printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-b" && echo -e "$OPTARG is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it + printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-b" && echo -e "\"-b\" is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it echo "Up to how many backups should we keep?" read -rt 600 -p "Please type an integer: " up_backups ! [[ $up_backups =~ ^[0-9]+$ ]] && echo -e "Error: \"$up_backups\" is invalid, it needs to be an integer\nNOT adding it to the list" && sleep 5 && continue @@ -144,31 +144,31 @@ case $selection in update_selection+=("-i" "$up_ignore") ;; 3) - printf '%s\0' "${update_selection[@]}" | grep -Fxqz "-r" && echo -e "$OPTARG is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it + printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-r" && echo -e "\"-r\" is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it update_selection+=("-r") ;; 4) - printf '%s\0' "${update_selection[@]}" | grep -Fxqz "-S" && echo -e "$OPTARG is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it + printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-S" && echo -e "\"-S\" is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it update_selection+=("-S") ;; 5) - printf '%s\0' "${update_selection[@]}" | grep -Fxqz "-v" && echo -e "$OPTARG is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it + printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-v" && echo -e "\"-v\" is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it update_selection+=("-v") ;; 6) - printf '%s\0' "${update_selection[@]}" | grep -Fxqz "-t" && echo -e "$OPTARG is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it + printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-t" && echo -e "\"-t\" is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it echo "What do you want your timeout to be?" read -rt 600 -p "Please type an integer: " up_timeout ! [[ $up_timeout =~ ^[0-9]+$ ]] && echo -e "Error: \"$up_timeout\" is invalid, it needs to be an integer\nNOT adding it to the list" && sleep 5 && continue update_selection+=("-t" "$up_timeout") ;; 7) - printf '%s\0' "${update_selection[@]}" | grep -Fxqz "-s" && echo -e "$OPTARG is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it + printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-s" && echo -e "\"-s\" is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it update_selection+=("-s") ;; 8) - printf '%s\0' "${update_selection[@]}" | grep -Fxqz "-p" && echo -e "$OPTARG is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it + printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-p" && echo -e "\"-p\" is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it update_selection+=("-p") ;; *) From 10d6336671956813b7d8541a07fdeaa2b53777c3 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 23:21:10 -0600 Subject: [PATCH 0453/1229] test --- functions/menu.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/functions/menu.sh b/functions/menu.sh index b01f93b9..0e5310b9 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -171,6 +171,16 @@ case $selection in printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-p" && echo -e "\"-p\" is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it update_selection+=("-p") ;; + 99) + count=1 + echo "restarting" + for i in "${update_selection[@]:1}" + do + unset "update_selection[$count]" + echo "$i removed" + done + continue + ;; *) echo "\"$OPTARG\" was not an option, try again" && sleep 5 && continue ;; From 9f20f36d299f2eaef9578f7362a27defa8ef88a3 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 23:22:55 -0600 Subject: [PATCH 0454/1229] test --- functions/menu.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/functions/menu.sh b/functions/menu.sh index 0e5310b9..de2182d4 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -172,12 +172,13 @@ case $selection in update_selection+=("-p") ;; 99) - count=1 + count=2 echo "restarting" - for i in "${update_selection[@]:1}" + for i in "${update_selection[@]:2}" do unset "update_selection[$count]" echo "$i removed" + ((count++)) done continue ;; From 20ed6d7babae07399c9274a3be7c2c9e406af4ae Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 23:25:08 -0600 Subject: [PATCH 0455/1229] test --- functions/menu.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/functions/menu.sh b/functions/menu.sh index de2182d4..b4145a9d 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -115,7 +115,8 @@ case $selection in echo "7) -s | sync catalog" echo "8) -p | Prune unused/old docker images" echo - echo "0) Done making selections, proceed with update" + echo "99) Remove Update Options, Restart" + echo "00) Done making selections, proceed with update" echo echo "Current Choices" echo "---------------" @@ -124,7 +125,7 @@ case $selection in read -rt 600 -p "Please type the number associated with the flag above: " current_selection case $current_selection in - 0) + 00) clear -x echo "Running \"bash heavy_script.sh ${update_selection[*]}\"" echo @@ -180,6 +181,7 @@ case $selection in echo "$i removed" ((count++)) done + sleep 5 continue ;; *) From f97d4be4815e3b8135a6dbdb03ebe11c0be6d950 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 23:34:50 -0600 Subject: [PATCH 0456/1229] correct var --- functions/menu.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/menu.sh b/functions/menu.sh index b4145a9d..057a700f 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -185,13 +185,13 @@ case $selection in continue ;; *) - echo "\"$OPTARG\" was not an option, try again" && sleep 5 && continue + echo "\"$current_selection\" was not an option, try again" && sleep 5 && continue ;; esac done ;; *) - echo "\"$OPTARG\" was not an option, please try agian" && sleep 5 && menu + echo "\"$selection\" was not an option, please try agian" && sleep 5 && menu ;; esac echo From 767c18a62a42206e71ecb6e0f6c617425e55c33f Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 23:40:48 -0600 Subject: [PATCH 0457/1229] optional flag --- functions/menu.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/functions/menu.sh b/functions/menu.sh index 057a700f..ff127da7 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -132,7 +132,7 @@ case $selection in exec bash "$script_name" "${update_selection[@]}" exit ;; - 1) + 1 | -b) printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-b" && echo -e "\"-b\" is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it echo "Up to how many backups should we keep?" read -rt 600 -p "Please type an integer: " up_backups @@ -140,35 +140,35 @@ case $selection in [[ $up_backups == 0 ]] && echo -e "Error: Number of backups cannot be 0\nNOT adding it to the list" && sleep 5 && continue update_selection+=("-b" "$up_backups") ;; - 2) + 2 | -i) read -rt 600 -p "What is the name of the application we should ignore?: " up_ignore update_selection+=("-i" "$up_ignore") ;; - 3) + 3 | -r) printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-r" && echo -e "\"-r\" is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it update_selection+=("-r") ;; - 4) + 4 | -S) printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-S" && echo -e "\"-S\" is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it update_selection+=("-S") ;; - 5) + 5 | -v) printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-v" && echo -e "\"-v\" is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it update_selection+=("-v") ;; - 6) + 6 | -t) printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-t" && echo -e "\"-t\" is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it echo "What do you want your timeout to be?" read -rt 600 -p "Please type an integer: " up_timeout ! [[ $up_timeout =~ ^[0-9]+$ ]] && echo -e "Error: \"$up_timeout\" is invalid, it needs to be an integer\nNOT adding it to the list" && sleep 5 && continue update_selection+=("-t" "$up_timeout") ;; - 7) + 7 | -s) printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-s" && echo -e "\"-s\" is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it update_selection+=("-s") ;; - 8) + 8 | -p) printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-p" && echo -e "\"-p\" is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it update_selection+=("-p") ;; From e38c9c65d4f2007151736f655fa2d4bbc4f82603 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 23:42:30 -0600 Subject: [PATCH 0458/1229] done for the night --- functions/menu.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/functions/menu.sh b/functions/menu.sh index ff127da7..1ac5659e 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -123,7 +123,6 @@ case $selection in echo "bash heavy_script.sh ${update_selection[*]}" echo read -rt 600 -p "Please type the number associated with the flag above: " current_selection - case $current_selection in 00) clear -x From db06e5dc36fc2b8e3753e090f4dee556999aab59 Mon Sep 17 00:00:00 2001 From: TrueCharts-Bot Date: Wed, 27 Jul 2022 00:40:02 +0000 Subject: [PATCH 0459/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.131.1 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 41c77701..3a80600a 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@afdeef2fe1e9162fce78747fdcc2046833eb8f5a # tag=v32.127.4 + uses: renovatebot/github-action@2b480926ad78a8577b1ceff20e675091543d28d5 # tag=v32.131.1 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 97b65f746d776f821c767ab27d9a4cf8eb401472 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 27 Jul 2022 09:47:19 -0600 Subject: [PATCH 0460/1229] cd to script --- heavy_script.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/heavy_script.sh b/heavy_script.sh index 27abd6f7..a4552ac3 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -1,5 +1,9 @@ #!/bin/bash +# cd to script +script=$(readlink -f "$0") +script_path=$(dirname "$script") +cd "$script_path" || exit # shellcheck source=functions/backup.sh source functions/backup.sh From 27eb8b0e61199c5ec6837c34265c3f5827e1f04c Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 27 Jul 2022 10:03:34 -0600 Subject: [PATCH 0461/1229] polish format --- functions/misc.sh | 4 ++-- functions/update_apps.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/functions/misc.sh b/functions/misc.sh index 7956fe53..663e93cc 100644 --- a/functions/misc.sh +++ b/functions/misc.sh @@ -2,7 +2,7 @@ sync(){ -echo_sync+=("\nSync Output") +echo_sync+=("\n\nSync Output") echo_sync+=("-----------") cli -c 'app catalog sync_all' &> /dev/null && echo_sync+=("Catalog sync complete") @@ -15,7 +15,7 @@ done export -f sync prune(){ -echo -e "\nDocker Prune Output" +echo -e "\n\nDocker Prune Output" echo "-------------------" echo "Pruned Docker Images" docker image prune -af | grep "^Total" || echo "Failed to Prune Docker Images" diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 92aeab24..6fe1e875 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -3,7 +3,7 @@ commander(){ mapfile -t array < <(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,container_images_update_available,status' | tr -d " \t\r" | grep -E ",true($|,)" | sort) -echo -e "\nAplication Update Output" +echo -e "\n\nAplication Update Output" echo "------------------------" [[ -z $array ]] && echo "There are no updates available" && return 0 || echo "${#array[@]} update(s) available" [[ -z $timeout ]] && echo "Default Timeout: 500" && timeout=500 || echo "Custom Timeout: $timeout" From 425564e75217f6e87a93597ea014aa33df76ee92 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 27 Jul 2022 10:27:12 -0600 Subject: [PATCH 0462/1229] description --- heavy_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index a4552ac3..18a08b36 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -1,6 +1,6 @@ #!/bin/bash -# cd to script +# cd to script, this ensures the script can find the source scripts below, even when ran from a seperate directory script=$(readlink -f "$0") script_path=$(dirname "$script") cd "$script_path" || exit From dfe359e34aadd34f25c570b9ff9e835c65930a18 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 27 Jul 2022 10:31:43 -0600 Subject: [PATCH 0463/1229] silencing shellcheck --- functions/mount.sh | 2 +- functions/update_apps.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/mount.sh b/functions/mount.sh index 88d9af21..b7576ca9 100644 --- a/functions/mount.sh +++ b/functions/mount.sh @@ -39,7 +39,7 @@ if [[ $selection == "1" ]]; then exit elif [[ $selection == "2" ]]; then mapfile -t unmount_array < <(basename -a /mnt/heavyscript/* | sed "s/*//") - [[ -z $unmount_array ]] && echo "Theres nothing to unmount" && exit + [[ -z ${unmount_array[*]} ]] && echo "Theres nothing to unmount" && exit for i in "${unmount_array[@]}" do main=$(k3s kubectl get pvc -A | grep -E "\s$i\s" | awk '{print $1, $2, $4}') diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 6fe1e875..64104df1 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -5,7 +5,7 @@ commander(){ mapfile -t array < <(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,container_images_update_available,status' | tr -d " \t\r" | grep -E ",true($|,)" | sort) echo -e "\n\nAplication Update Output" echo "------------------------" -[[ -z $array ]] && echo "There are no updates available" && return 0 || echo "${#array[@]} update(s) available" +[[ -z ${array[*]} ]] && echo "There are no updates available" && return 0 || echo "${#array[@]} update(s) available" [[ -z $timeout ]] && echo "Default Timeout: 500" && timeout=500 || echo "Custom Timeout: $timeout" [[ "$timeout" -le 120 ]] && echo "Warning: Your timeout is set low and may lead to premature rollbacks or skips" echo "Asynchronous Updates: $update_limit" From d340f3164d50af24d2099e4c2c6c1d9c682795c4 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 27 Jul 2022 13:00:22 -0600 Subject: [PATCH 0464/1229] parent shell updates status --- functions/update_apps.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 92aeab24..06dabee1 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -13,6 +13,7 @@ echo "Asynchronous Updates: $update_limit" it=0 while [[ $it -lt ${#array[@]} ]] do + status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status') proc_count=${#processes[@]} count=0 for proc in "${processes[@]}" @@ -20,7 +21,7 @@ do kill -0 "$proc" &> /dev/null || { unset "processes[$count]"; ((proc_count--)); } done if [[ "$proc_count" -ge "$update_limit" ]]; then - sleep 1 + sleep 3 else update_apps "${array[$it]}" & processes+=($!) @@ -43,8 +44,7 @@ old_app_ver=$(echo "${array[$it]}" | awk -F ',' '{print $4}' | awk -F '_' '{prin new_app_ver=$(echo "${array[$it]}" | awk -F ',' '{print $5}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #new Application MAJOR Version old_chart_ver=$(echo "${array[$it]}" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}' | awk -F '.' '{print $1}') # Old Chart MAJOR version new_chart_ver=$(echo "${array[$it]}" | awk -F ',' '{print $5}' | awk -F '_' '{print $2}' | awk -F '.' '{print $1}') # New Chart MAJOR version -status=$(echo "${array[$it]}" | awk -F ',' '{print $2}') #status of the app: STOPPED / DEPLOYING / ACTIVE -startstatus=$status +startstatus=$(echo "${array[$it]}" | awk -F ',' '{print $2}') #status of the app: STOPPED / DEPLOYING / ACTIVE diff_app=$(diff <(echo "$old_app_ver") <(echo "$new_app_ver")) #caluclating difference in major app versions diff_chart=$(diff <(echo "$old_chart_ver") <(echo "$new_chart_ver")) #caluclating difference in Chart versions old_full_ver=$(echo "${array[$it]}" | awk -F ',' '{print $4}') #Upgraded From @@ -52,7 +52,7 @@ new_full_ver=$(echo "${array[$it]}" | awk -F ',' '{print $5}') #Upraded To rollback_version=$(echo "${array[$it]}" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}') if [[ "$diff_app" == "$diff_chart" || "$update_all_apps" == "true" ]]; then #continue to update if [[ $stop_before_update == "true" ]]; then # Check to see if user is using -S or not - if [[ "$status" == "STOPPED" ]]; then # if status is already stopped, skip while loop + if [[ "$startstatus" == "STOPPED" ]]; then # if status is already stopped, skip while loop echo_array+=("\n$app_name") [[ "$verbose" == "true" ]] && echo_array+=("Updating..") cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo_array+=("Updated\n$old_full_ver\n$new_full_ver") && after_update_actions || echo_array+=("FAILED") @@ -61,9 +61,9 @@ rollback_version=$(echo "${array[$it]}" | awk -F ',' '{print $4}' | awk -F '_' ' echo_array+=("\n$app_name") [[ "$verbose" == "true" ]] && echo_array+=("Stopping prior to update..") midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null && SECONDS=0 || echo_array+=("FAILED") - while [[ "$status" != "STOPPED" ]] + while [[ "$startstatus" != "STOPPED" ]] do - status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep "^$app_name," | awk -F ',' '{print $2}') + #status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep "^$app_name," | awk -F ',' '{print $2}') if [[ "$status" == "STOPPED" ]]; then echo_array+=("Stopped") [[ "$verbose" == "true" ]] && echo_array+=("Updating..") @@ -98,7 +98,7 @@ if [[ $rollback == "true" ]]; then while true do (( count++ )) - status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep "^$app_name," | awk -F ',' '{print $2}') + status=$(echo "$status" | grep "^$app_name," | awk -F ',' '{print $2}') if [[ "$status" == "ACTIVE" && "$startstatus" == "STOPPED" ]]; then [[ "$verbose" == "true" ]] && echo_array+=("Returing to STOPPED state..") midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null && echo_array+=("Stopped")|| echo_array+=("FAILED") @@ -130,7 +130,7 @@ else while true #using a constant while loop, then breaking out of the loop with break commands below. do (( count++ )) - status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep "^$app_name," | awk -F ',' '{print $2}') + status=$(echo "$status" | grep "^$app_name," | awk -F ',' '{print $2}') if [[ "$status" == "STOPPED" ]]; then [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Stopped..") && sleep 15 && continue #if reports stopped on FIRST time through loop, double check [[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports stopped on FIRST time through loop, double check From 6dc96419f464ac594bf9e48d04beb2c6ac77ccfd Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 27 Jul 2022 13:09:10 -0600 Subject: [PATCH 0465/1229] pos fix --- functions/update_apps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 90952be1..f8efb24d 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -63,7 +63,7 @@ rollback_version=$(echo "${array[$it]}" | awk -F ',' '{print $4}' | awk -F '_' ' midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null && SECONDS=0 || echo_array+=("FAILED") while [[ "$startstatus" != "STOPPED" ]] do - #status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep "^$app_name," | awk -F ',' '{print $2}') + status=$(echo "$status" | grep "^$app_name," | awk -F ',' '{print $2}') if [[ "$status" == "STOPPED" ]]; then echo_array+=("Stopped") [[ "$verbose" == "true" ]] && echo_array+=("Updating..") From 8ff5886a9990e4779a4ae89001463349c7c68221 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 27 Jul 2022 13:16:11 -0600 Subject: [PATCH 0466/1229] test --- functions/update_apps.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index f8efb24d..2522c2c1 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -11,7 +11,7 @@ echo "------------------------" echo "Asynchronous Updates: $update_limit" it=0 -while [[ $it -lt ${#array[@]} ]] +while true do status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status') proc_count=${#processes[@]} @@ -20,7 +20,9 @@ do do kill -0 "$proc" &> /dev/null || { unset "processes[$count]"; ((proc_count--)); } done - if [[ "$proc_count" -ge "$update_limit" ]]; then + if [[ $it -eq ${#array[@]} && ${#processes[@]} == 0 ]]; then + break + elif [[ "$proc_count" -ge "$update_limit" ]]; then sleep 3 else update_apps "${array[$it]}" & From 8a61eb1f8aef9ef4e71a34f69d9d5b2c6fff69bb Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 27 Jul 2022 13:27:04 -0600 Subject: [PATCH 0467/1229] export --- functions/update_apps.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 2522c2c1..548a599b 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -14,6 +14,7 @@ it=0 while true do status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status') + export status proc_count=${#processes[@]} count=0 for proc in "${processes[@]}" From e12b72a97b58cae456d7b93853f856f46206c9b9 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 27 Jul 2022 13:47:44 -0600 Subject: [PATCH 0468/1229] revert changes --- functions/update_apps.sh | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 548a599b..64104df1 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -11,20 +11,16 @@ echo "------------------------" echo "Asynchronous Updates: $update_limit" it=0 -while true +while [[ $it -lt ${#array[@]} ]] do - status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status') - export status proc_count=${#processes[@]} count=0 for proc in "${processes[@]}" do kill -0 "$proc" &> /dev/null || { unset "processes[$count]"; ((proc_count--)); } done - if [[ $it -eq ${#array[@]} && ${#processes[@]} == 0 ]]; then - break - elif [[ "$proc_count" -ge "$update_limit" ]]; then - sleep 3 + if [[ "$proc_count" -ge "$update_limit" ]]; then + sleep 1 else update_apps "${array[$it]}" & processes+=($!) @@ -47,7 +43,8 @@ old_app_ver=$(echo "${array[$it]}" | awk -F ',' '{print $4}' | awk -F '_' '{prin new_app_ver=$(echo "${array[$it]}" | awk -F ',' '{print $5}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #new Application MAJOR Version old_chart_ver=$(echo "${array[$it]}" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}' | awk -F '.' '{print $1}') # Old Chart MAJOR version new_chart_ver=$(echo "${array[$it]}" | awk -F ',' '{print $5}' | awk -F '_' '{print $2}' | awk -F '.' '{print $1}') # New Chart MAJOR version -startstatus=$(echo "${array[$it]}" | awk -F ',' '{print $2}') #status of the app: STOPPED / DEPLOYING / ACTIVE +status=$(echo "${array[$it]}" | awk -F ',' '{print $2}') #status of the app: STOPPED / DEPLOYING / ACTIVE +startstatus=$status diff_app=$(diff <(echo "$old_app_ver") <(echo "$new_app_ver")) #caluclating difference in major app versions diff_chart=$(diff <(echo "$old_chart_ver") <(echo "$new_chart_ver")) #caluclating difference in Chart versions old_full_ver=$(echo "${array[$it]}" | awk -F ',' '{print $4}') #Upgraded From @@ -55,7 +52,7 @@ new_full_ver=$(echo "${array[$it]}" | awk -F ',' '{print $5}') #Upraded To rollback_version=$(echo "${array[$it]}" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}') if [[ "$diff_app" == "$diff_chart" || "$update_all_apps" == "true" ]]; then #continue to update if [[ $stop_before_update == "true" ]]; then # Check to see if user is using -S or not - if [[ "$startstatus" == "STOPPED" ]]; then # if status is already stopped, skip while loop + if [[ "$status" == "STOPPED" ]]; then # if status is already stopped, skip while loop echo_array+=("\n$app_name") [[ "$verbose" == "true" ]] && echo_array+=("Updating..") cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo_array+=("Updated\n$old_full_ver\n$new_full_ver") && after_update_actions || echo_array+=("FAILED") @@ -64,9 +61,9 @@ rollback_version=$(echo "${array[$it]}" | awk -F ',' '{print $4}' | awk -F '_' ' echo_array+=("\n$app_name") [[ "$verbose" == "true" ]] && echo_array+=("Stopping prior to update..") midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null && SECONDS=0 || echo_array+=("FAILED") - while [[ "$startstatus" != "STOPPED" ]] + while [[ "$status" != "STOPPED" ]] do - status=$(echo "$status" | grep "^$app_name," | awk -F ',' '{print $2}') + status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep "^$app_name," | awk -F ',' '{print $2}') if [[ "$status" == "STOPPED" ]]; then echo_array+=("Stopped") [[ "$verbose" == "true" ]] && echo_array+=("Updating..") @@ -101,7 +98,7 @@ if [[ $rollback == "true" ]]; then while true do (( count++ )) - status=$(echo "$status" | grep "^$app_name," | awk -F ',' '{print $2}') + status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep "^$app_name," | awk -F ',' '{print $2}') if [[ "$status" == "ACTIVE" && "$startstatus" == "STOPPED" ]]; then [[ "$verbose" == "true" ]] && echo_array+=("Returing to STOPPED state..") midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null && echo_array+=("Stopped")|| echo_array+=("FAILED") @@ -133,7 +130,7 @@ else while true #using a constant while loop, then breaking out of the loop with break commands below. do (( count++ )) - status=$(echo "$status" | grep "^$app_name," | awk -F ',' '{print $2}') + status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep "^$app_name," | awk -F ',' '{print $2}') if [[ "$status" == "STOPPED" ]]; then [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Stopped..") && sleep 15 && continue #if reports stopped on FIRST time through loop, double check [[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports stopped on FIRST time through loop, double check From cb25487dffe11eb93e6acd71e90d6e684f7e7e80 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 27 Jul 2022 13:56:22 -0600 Subject: [PATCH 0469/1229] test file method --- functions/update_apps.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 64104df1..f609ef01 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -10,9 +10,11 @@ echo "------------------------" [[ "$timeout" -le 120 ]] && echo "Warning: Your timeout is set low and may lead to premature rollbacks or skips" echo "Asynchronous Updates: $update_limit" +touch temp.txt it=0 while [[ $it -lt ${#array[@]} ]] do + cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' > temp.txt proc_count=${#processes[@]} count=0 for proc in "${processes[@]}" @@ -20,13 +22,14 @@ do kill -0 "$proc" &> /dev/null || { unset "processes[$count]"; ((proc_count--)); } done if [[ "$proc_count" -ge "$update_limit" ]]; then - sleep 1 + sleep 3 else update_apps "${array[$it]}" & processes+=($!) ((it++)) fi done +rm temp.txt for proc in "${processes[@]}" do @@ -63,7 +66,7 @@ rollback_version=$(echo "${array[$it]}" | awk -F ',' '{print $4}' | awk -F '_' ' midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null && SECONDS=0 || echo_array+=("FAILED") while [[ "$status" != "STOPPED" ]] do - status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep "^$app_name," | awk -F ',' '{print $2}') + status=$( grep "^$app_name," temp.txt | awk -F ',' '{print $2}') if [[ "$status" == "STOPPED" ]]; then echo_array+=("Stopped") [[ "$verbose" == "true" ]] && echo_array+=("Updating..") @@ -98,7 +101,7 @@ if [[ $rollback == "true" ]]; then while true do (( count++ )) - status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep "^$app_name," | awk -F ',' '{print $2}') + status=$( grep "^$app_name," temp.txt | awk -F ',' '{print $2}') if [[ "$status" == "ACTIVE" && "$startstatus" == "STOPPED" ]]; then [[ "$verbose" == "true" ]] && echo_array+=("Returing to STOPPED state..") midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null && echo_array+=("Stopped")|| echo_array+=("FAILED") @@ -130,7 +133,7 @@ else while true #using a constant while loop, then breaking out of the loop with break commands below. do (( count++ )) - status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep "^$app_name," | awk -F ',' '{print $2}') + status=$( grep "^$app_name," temp.txt | awk -F ',' '{print $2}') if [[ "$status" == "STOPPED" ]]; then [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Stopped..") && sleep 15 && continue #if reports stopped on FIRST time through loop, double check [[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports stopped on FIRST time through loop, double check From 2fd4d0a92698f18cb9c4b93f6ee4fdca150c960e Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 27 Jul 2022 14:13:40 -0600 Subject: [PATCH 0470/1229] test --- functions/update_apps.sh | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index f609ef01..efb9d9a3 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -12,7 +12,7 @@ echo "Asynchronous Updates: $update_limit" touch temp.txt it=0 -while [[ $it -lt ${#array[@]} ]] +while true do cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' > temp.txt proc_count=${#processes[@]} @@ -23,18 +23,20 @@ do done if [[ "$proc_count" -ge "$update_limit" ]]; then sleep 3 - else + elif [[ $it -lt ${#array[@]} ]]; then update_apps "${array[$it]}" & processes+=($!) ((it++)) + else + for proc in "${processes[@]}" + do + wait "$proc" + done + break fi done rm temp.txt -for proc in "${processes[@]}" -do - wait "$proc" -done } export -f commander From eb50e56e6bf79d031666fe4cb9a5b863f5ebc0d0 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 27 Jul 2022 14:36:23 -0600 Subject: [PATCH 0471/1229] test --- functions/update_apps.sh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index efb9d9a3..94f525ec 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -27,12 +27,10 @@ do update_apps "${array[$it]}" & processes+=($!) ((it++)) - else - for proc in "${processes[@]}" - do - wait "$proc" - done + elif [[ ${#processes[@]} == 0 ]]; then break + else + sleep 3 fi done rm temp.txt From 3da75f299d1a5e9b770a2066fbdbfb38a669aa23 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 27 Jul 2022 14:40:46 -0600 Subject: [PATCH 0472/1229] test --- functions/update_apps.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 94f525ec..36f5719b 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -14,7 +14,8 @@ touch temp.txt it=0 while true do - cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' > temp.txt + while_status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status') + echo "$while_status" > temp.txt proc_count=${#processes[@]} count=0 for proc in "${processes[@]}" From ef43d3c214153e5dac21d596a57001a2f4e640c4 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 27 Jul 2022 14:50:52 -0600 Subject: [PATCH 0473/1229] test --- functions/update_apps.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 36f5719b..472ded56 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -28,10 +28,10 @@ do update_apps "${array[$it]}" & processes+=($!) ((it++)) - elif [[ ${#processes[@]} == 0 ]]; then - break - else + elif [[ ${#processes[@]} != 0 ]]; then # Wait for all processes to finish sleep 3 + else + break fi done rm temp.txt From fd21a80db09334840e54d7319cdcc68691461fea Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 27 Jul 2022 15:07:53 -0600 Subject: [PATCH 0474/1229] test --- functions/update_apps.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 472ded56..a856a945 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -21,6 +21,7 @@ do for proc in "${processes[@]}" do kill -0 "$proc" &> /dev/null || { unset "processes[$count]"; ((proc_count--)); } + ((count++)) done if [[ "$proc_count" -ge "$update_limit" ]]; then sleep 3 @@ -28,9 +29,10 @@ do update_apps "${array[$it]}" & processes+=($!) ((it++)) - elif [[ ${#processes[@]} != 0 ]]; then # Wait for all processes to finish + elif [[ $proc_count != 0 ]]; then # Wait for all processes to finish sleep 3 - else + else # All processes must be completed, break out of loop + wait "${processes[*]}" break fi done From cf2f5000ee4f19ce8d912c3f82e3232776f159ab Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 27 Jul 2022 15:23:56 -0600 Subject: [PATCH 0475/1229] test --- functions/update_apps.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index a856a945..05e62519 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -32,7 +32,9 @@ do elif [[ $proc_count != 0 ]]; then # Wait for all processes to finish sleep 3 else # All processes must be completed, break out of loop - wait "${processes[*]}" + for proc in "${processes[@]}"; do + wait "$proc" + done break fi done From 2f180d1a4b33ceed6d8aa411c75f2da7f778a699 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 27 Jul 2022 15:34:00 -0600 Subject: [PATCH 0476/1229] remove for loop --- functions/update_apps.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 05e62519..88018f7d 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -32,9 +32,10 @@ do elif [[ $proc_count != 0 ]]; then # Wait for all processes to finish sleep 3 else # All processes must be completed, break out of loop - for proc in "${processes[@]}"; do - wait "$proc" - done + # Unessesary for loop. since processes have to be completed before getting to this point, it is unlikely we would ever have to wait on processes.. Will test more. + # for proc in "${processes[@]}"; do + # wait "$proc" + # done break fi done From 3bffd42f8cc7e63b7adafe39123e06ab06f33543 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 27 Jul 2022 15:47:11 -0600 Subject: [PATCH 0477/1229] remove var --- functions/update_apps.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 88018f7d..a4dbdb72 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -52,8 +52,7 @@ old_app_ver=$(echo "${array[$it]}" | awk -F ',' '{print $4}' | awk -F '_' '{prin new_app_ver=$(echo "${array[$it]}" | awk -F ',' '{print $5}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #new Application MAJOR Version old_chart_ver=$(echo "${array[$it]}" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}' | awk -F '.' '{print $1}') # Old Chart MAJOR version new_chart_ver=$(echo "${array[$it]}" | awk -F ',' '{print $5}' | awk -F '_' '{print $2}' | awk -F '.' '{print $1}') # New Chart MAJOR version -status=$(echo "${array[$it]}" | awk -F ',' '{print $2}') #status of the app: STOPPED / DEPLOYING / ACTIVE -startstatus=$status +startstatus=$(echo "${array[$it]}" | awk -F ',' '{print $2}') #status of the app: STOPPED / DEPLOYING / ACTIVE diff_app=$(diff <(echo "$old_app_ver") <(echo "$new_app_ver")) #caluclating difference in major app versions diff_chart=$(diff <(echo "$old_chart_ver") <(echo "$new_chart_ver")) #caluclating difference in Chart versions old_full_ver=$(echo "${array[$it]}" | awk -F ',' '{print $4}') #Upgraded From @@ -61,7 +60,7 @@ new_full_ver=$(echo "${array[$it]}" | awk -F ',' '{print $5}') #Upraded To rollback_version=$(echo "${array[$it]}" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}') if [[ "$diff_app" == "$diff_chart" || "$update_all_apps" == "true" ]]; then #continue to update if [[ $stop_before_update == "true" ]]; then # Check to see if user is using -S or not - if [[ "$status" == "STOPPED" ]]; then # if status is already stopped, skip while loop + if [[ "$startstatus" == "STOPPED" ]]; then # if status is already stopped, skip while loop echo_array+=("\n$app_name") [[ "$verbose" == "true" ]] && echo_array+=("Updating..") cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo_array+=("Updated\n$old_full_ver\n$new_full_ver") && after_update_actions || echo_array+=("FAILED") From 12218c4976925c0bf246fffdd518f96fd3fff18e Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 27 Jul 2022 16:35:16 -0600 Subject: [PATCH 0478/1229] remove touch --- functions/update_apps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index a4dbdb72..d2f00837 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -10,7 +10,7 @@ echo "------------------------" [[ "$timeout" -le 120 ]] && echo "Warning: Your timeout is set low and may lead to premature rollbacks or skips" echo "Asynchronous Updates: $update_limit" -touch temp.txt + it=0 while true do From f52ef399d47782167ca5c909310ec7d3d96c5748 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 27 Jul 2022 16:40:44 -0600 Subject: [PATCH 0479/1229] better format --- functions/update_apps.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index d2f00837..30c197ea 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -5,10 +5,10 @@ commander(){ mapfile -t array < <(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,container_images_update_available,status' | tr -d " \t\r" | grep -E ",true($|,)" | sort) echo -e "\n\nAplication Update Output" echo "------------------------" -[[ -z ${array[*]} ]] && echo "There are no updates available" && return 0 || echo "${#array[@]} update(s) available" +[[ -z ${array[*]} ]] && echo "There are no updates available" && return 0 || echo "Update(s) Available: ${#array[@]}" +echo "Asynchronous Updates: $update_limit" [[ -z $timeout ]] && echo "Default Timeout: 500" && timeout=500 || echo "Custom Timeout: $timeout" [[ "$timeout" -le 120 ]] && echo "Warning: Your timeout is set low and may lead to premature rollbacks or skips" -echo "Asynchronous Updates: $update_limit" it=0 From e365429ee48e8e47672e822f8fa55b22ed40a020 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 27 Jul 2022 16:51:23 -0600 Subject: [PATCH 0480/1229] better mount message --- functions/mount.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/mount.sh b/functions/mount.sh index b7576ca9..880ffce4 100644 --- a/functions/mount.sh +++ b/functions/mount.sh @@ -29,7 +29,7 @@ if [[ $selection == "1" ]]; then volume_name=$(echo "$pvc" | awk '{print $4}') mapfile -t full_path < <(zfs list | grep "$volume_name" | awk '{print $1}') if [[ "${#full_path[@]}" -gt 1 ]]; then #if there is another app with the same name on another pool, use the current pools application, since the other instance is probably old, or unused, or a backup. - echo "$app is a name used on more than one pool.. attempting to use your current kubernetes apps pool" + echo "$app is using the same volume identifier on more than one pool.. attempting to use your current kubernetes apps pool" pool=$(cli -c 'app kubernetes config' | grep -E "dataset\s\|" | awk -F '|' '{print $3}' | awk -F '/' '{print $1}' | tr -d " \t\n\r") full_path=$(zfs list | grep "$volume_name" | grep "$pool" | awk '{print $1}') fi From 6c9bd67e42f1e8578b6fd29a86bcccf82cb4132d Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 27 Jul 2022 16:56:29 -0600 Subject: [PATCH 0481/1229] rm cd from selfupdate --- functions/self_update.sh | 4 ---- heavy_script.sh | 2 ++ 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/functions/self_update.sh b/functions/self_update.sh index 20461d04..cd56e705 100644 --- a/functions/self_update.sh +++ b/functions/self_update.sh @@ -3,10 +3,6 @@ args=("$@") self_update() { -script=$(readlink -f "$0") -script_path=$(dirname "$script") -script_name="heavy_script.sh" -cd "$script_path" || exit git fetch &> /dev/null # TODO: change beta to main once testing is complete if git diff --name-only origin/beta | grep -qs ".sh" ; then diff --git a/heavy_script.sh b/heavy_script.sh index 18a08b36..4b99e646 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -3,8 +3,10 @@ # cd to script, this ensures the script can find the source scripts below, even when ran from a seperate directory script=$(readlink -f "$0") script_path=$(dirname "$script") +script_name="heavy_script.sh" cd "$script_path" || exit + # shellcheck source=functions/backup.sh source functions/backup.sh # shellcheck source=functions/dns.sh From 5ac2b76c32769abd77a2023172742087b365f92e Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 27 Jul 2022 16:57:24 -0600 Subject: [PATCH 0482/1229] test change --- functions/self_update.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/functions/self_update.sh b/functions/self_update.sh index cd56e705..fac45a1e 100644 --- a/functions/self_update.sh +++ b/functions/self_update.sh @@ -1,7 +1,6 @@ #!/bin/bash args=("$@") - self_update() { git fetch &> /dev/null # TODO: change beta to main once testing is complete From 6902e15c9cfa599839ff0f014b6b20d39de6c62f Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 27 Jul 2022 17:03:03 -0600 Subject: [PATCH 0483/1229] better message --- heavy_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index 4b99e646..024aec0c 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -4,7 +4,7 @@ script=$(readlink -f "$0") script_path=$(dirname "$script") script_name="heavy_script.sh" -cd "$script_path" || exit +cd "$script_path" || { echo "Error: Failed to change to script directory" ; exit ; } # shellcheck source=functions/backup.sh From d88762ea57019e8f2cb46f9871072310b80efc4a Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 27 Jul 2022 20:05:28 -0600 Subject: [PATCH 0484/1229] cleanup --- functions/update_apps.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 30c197ea..eb517a92 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -32,10 +32,6 @@ do elif [[ $proc_count != 0 ]]; then # Wait for all processes to finish sleep 3 else # All processes must be completed, break out of loop - # Unessesary for loop. since processes have to be completed before getting to this point, it is unlikely we would ever have to wait on processes.. Will test more. - # for proc in "${processes[@]}"; do - # wait "$proc" - # done break fi done From ca8d3f5b4e66de2cf1114a49e591896823bdb4fc Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 28 Jul 2022 13:31:48 -0600 Subject: [PATCH 0485/1229] fancy titles --- functions/backup.sh | 3 +-- functions/misc.sh | 6 ++---- functions/update_apps.sh | 3 +-- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/functions/backup.sh b/functions/backup.sh index f7626653..56656b9d 100644 --- a/functions/backup.sh +++ b/functions/backup.sh @@ -2,8 +2,7 @@ backup(){ -echo_backup+=("\nBackup Output") -echo_backup+=("--------------") +echo_backup+=("\n🄱 🄰 🄲 🄺 🅄 🄿 🅂") echo_backup+=("Number of backups was set to $number_of_backups") date=$(date '+%Y_%m_%d_%H_%M_%S') [[ "$verbose" == "true" ]] && cli -c 'app kubernetes backup_chart_releases backup_name=''"'HeavyScript_"$date"'"' &> /dev/null && echo_backup+=(HeavyScript_"$date") diff --git a/functions/misc.sh b/functions/misc.sh index 663e93cc..baa1583b 100644 --- a/functions/misc.sh +++ b/functions/misc.sh @@ -2,8 +2,7 @@ sync(){ -echo_sync+=("\n\nSync Output") -echo_sync+=("-----------") +echo_sync+=("\n\n🅂 🅈 🄽 🄲") cli -c 'app catalog sync_all' &> /dev/null && echo_sync+=("Catalog sync complete") #Dump the echo_array, ensures all output is in a neat order. @@ -15,8 +14,7 @@ done export -f sync prune(){ -echo -e "\n\nDocker Prune Output" -echo "-------------------" +echo -e "\n\n🄳 🄾 🄲 🄺 🄴 🅁 🄿 🅁 🅄 🄽 🄴" echo "Pruned Docker Images" docker image prune -af | grep "^Total" || echo "Failed to Prune Docker Images" } diff --git a/functions/update_apps.sh b/functions/update_apps.sh index eb517a92..460877eb 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -3,8 +3,7 @@ commander(){ mapfile -t array < <(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,container_images_update_available,status' | tr -d " \t\r" | grep -E ",true($|,)" | sort) -echo -e "\n\nAplication Update Output" -echo "------------------------" +echo -e "\n\n🅄 🄿 🄳 🄰 🅃 🄴 🅂" [[ -z ${array[*]} ]] && echo "There are no updates available" && return 0 || echo "Update(s) Available: ${#array[@]}" echo "Asynchronous Updates: $update_limit" [[ -z $timeout ]] && echo "Default Timeout: 500" && timeout=500 || echo "Custom Timeout: $timeout" From 88e047e56acd8b693c44477060e5ef4aef02b248 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 28 Jul 2022 13:50:34 -0600 Subject: [PATCH 0486/1229] format --- functions/misc.sh | 2 +- heavy_script.sh | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/functions/misc.sh b/functions/misc.sh index baa1583b..880de232 100644 --- a/functions/misc.sh +++ b/functions/misc.sh @@ -14,7 +14,7 @@ done export -f sync prune(){ -echo -e "\n\n🄳 🄾 🄲 🄺 🄴 🅁 🄿 🅁 🅄 🄽 🄴" +echo -e "\n\n🄿 🅁 🅄 🄽 🄴" echo "Pruned Docker Images" docker image prune -af | grep "^Total" || echo "Failed to Prune Docker Images" } diff --git a/heavy_script.sh b/heavy_script.sh index 024aec0c..758296be 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -146,8 +146,7 @@ done [[ "$restore" == "true" ]] && restore && exit [[ "$mount" == "true" ]] && mount && exit if [[ "$backup" == "true" && "$sync" == "true" ]]; then # Run backup and sync at the same time - echo "Running the following two tasks at the same time" - echo "------------------------------------------------" + echo "🅁 🅄 🄽 🄽 🄸 🄽 🄶 🅃 🄰 🅂 🄺 🅂 :" echo -e "Backing up ix-applications dataset\nSyncing catalog(s)" echo -e "This can take a LONG time, please wait for the output..\n" backup & From b0c7cb88509229318b632b9b0fd8fda27d5f74ca Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 28 Jul 2022 13:55:35 -0600 Subject: [PATCH 0487/1229] More Titles --- functions/self_update.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/functions/self_update.sh b/functions/self_update.sh index fac45a1e..690d2516 100644 --- a/functions/self_update.sh +++ b/functions/self_update.sh @@ -3,6 +3,7 @@ args=("$@") self_update() { git fetch &> /dev/null +echo "🅂 🄴 🄻 🄵 🅄 🄿 🄳 🄰 🅃 🄴 :" # TODO: change beta to main once testing is complete if git diff --name-only origin/beta | grep -qs ".sh" ; then echo "Found a new version of HeavyScript, updating myself..." From 69258f9af5c159ba85a307216e1bf6f7ead7b233 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 28 Jul 2022 13:59:50 -0600 Subject: [PATCH 0488/1229] format --- heavy_script.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index 758296be..5d539c1d 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -146,9 +146,9 @@ done [[ "$restore" == "true" ]] && restore && exit [[ "$mount" == "true" ]] && mount && exit if [[ "$backup" == "true" && "$sync" == "true" ]]; then # Run backup and sync at the same time - echo "🅁 🅄 🄽 🄽 🄸 🄽 🄶 🅃 🄰 🅂 🄺 🅂 :" - echo -e "Backing up ix-applications dataset\nSyncing catalog(s)" - echo -e "This can take a LONG time, please wait for the output..\n" + echo "🅃 🄰 🅂 🄺 🅂 :" + echo -e "-Backing up ix-applications dataset\n-Syncing catalog(s)" + echo -e "This can take a LONG time, please wait for both output..\n" backup & sync & wait From 0f9469cc3a317a82c177ab42a20442ffcbe85d4e Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 28 Jul 2022 14:02:57 -0600 Subject: [PATCH 0489/1229] self update fix --- functions/self_update.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/self_update.sh b/functions/self_update.sh index 690d2516..5b404492 100644 --- a/functions/self_update.sh +++ b/functions/self_update.sh @@ -9,16 +9,16 @@ if git diff --name-only origin/beta | grep -qs ".sh" ; then echo "Found a new version of HeavyScript, updating myself..." git reset --hard -q git pull --force -q - echo -e "Running the new version...\n" count=0 for i in "${args[@]}" do [[ "$i" == "--self-update" ]] && unset "args[$count]" && break ((count++)) done + [[ -z ${args[*]} ]] && exit + echo -e "Running the new version...\n" sleep 5 exec bash "$script_name" "${args[@]}" - # Now exit this old instance exit else From c9c77c1d6cb4d4ae41bca9ac2c4cb26b1404e6b9 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 28 Jul 2022 14:05:21 -0600 Subject: [PATCH 0490/1229] change just for test --- functions/self_update.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/self_update.sh b/functions/self_update.sh index 5b404492..82342d33 100644 --- a/functions/self_update.sh +++ b/functions/self_update.sh @@ -4,7 +4,7 @@ args=("$@") self_update() { git fetch &> /dev/null echo "🅂 🄴 🄻 🄵 🅄 🄿 🄳 🄰 🅃 🄴 :" -# TODO: change beta to main once testing is complete +# TODO: change beta to main once testing is complete if git diff --name-only origin/beta | grep -qs ".sh" ; then echo "Found a new version of HeavyScript, updating myself..." git reset --hard -q From 2adbf8d1f71701b0c9491e265fb8a6c29e1db09e Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 28 Jul 2022 14:06:10 -0600 Subject: [PATCH 0491/1229] explanation --- functions/self_update.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/self_update.sh b/functions/self_update.sh index 82342d33..871276b7 100644 --- a/functions/self_update.sh +++ b/functions/self_update.sh @@ -15,7 +15,7 @@ if git diff --name-only origin/beta | grep -qs ".sh" ; then [[ "$i" == "--self-update" ]] && unset "args[$count]" && break ((count++)) done - [[ -z ${args[*]} ]] && exit + [[ -z ${args[*]} ]] && echo "No more arguments, exiting.." && exit echo -e "Running the new version...\n" sleep 5 exec bash "$script_name" "${args[@]}" From 21baeaf4d8d773dd032274bb717c1ea3c963f549 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 28 Jul 2022 14:06:40 -0600 Subject: [PATCH 0492/1229] testing self update again --- functions/self_update.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/self_update.sh b/functions/self_update.sh index 871276b7..c5851484 100644 --- a/functions/self_update.sh +++ b/functions/self_update.sh @@ -4,7 +4,7 @@ args=("$@") self_update() { git fetch &> /dev/null echo "🅂 🄴 🄻 🄵 🅄 🄿 🄳 🄰 🅃 🄴 :" -# TODO: change beta to main once testing is complete +# TODO: change beta to main once testing is complete if git diff --name-only origin/beta | grep -qs ".sh" ; then echo "Found a new version of HeavyScript, updating myself..." git reset --hard -q From 3bd0543fc587540f6fb6bf75d85c66968abd92ca Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 28 Jul 2022 14:07:38 -0600 Subject: [PATCH 0493/1229] again --- functions/self_update.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/self_update.sh b/functions/self_update.sh index c5851484..871276b7 100644 --- a/functions/self_update.sh +++ b/functions/self_update.sh @@ -4,7 +4,7 @@ args=("$@") self_update() { git fetch &> /dev/null echo "🅂 🄴 🄻 🄵 🅄 🄿 🄳 🄰 🅃 🄴 :" -# TODO: change beta to main once testing is complete +# TODO: change beta to main once testing is complete if git diff --name-only origin/beta | grep -qs ".sh" ; then echo "Found a new version of HeavyScript, updating myself..." git reset --hard -q From e5a28282a0469950cba728b030e9b7839c6b167a Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 28 Jul 2022 14:10:16 -0600 Subject: [PATCH 0494/1229] formatting --- functions/self_update.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/self_update.sh b/functions/self_update.sh index 871276b7..96d017d9 100644 --- a/functions/self_update.sh +++ b/functions/self_update.sh @@ -15,7 +15,7 @@ if git diff --name-only origin/beta | grep -qs ".sh" ; then [[ "$i" == "--self-update" ]] && unset "args[$count]" && break ((count++)) done - [[ -z ${args[*]} ]] && echo "No more arguments, exiting.." && exit + [[ -z ${args[*]} ]] && echo -e "No more arguments, exiting..\n" && exit echo -e "Running the new version...\n" sleep 5 exec bash "$script_name" "${args[@]}" From 9e2bd269a6c0d75e9bd3f2f7b9b55dbd25188d2d Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 28 Jul 2022 14:13:57 -0600 Subject: [PATCH 0495/1229] final --- functions/self_update.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/self_update.sh b/functions/self_update.sh index 96d017d9..3f2445c3 100644 --- a/functions/self_update.sh +++ b/functions/self_update.sh @@ -3,7 +3,7 @@ args=("$@") self_update() { git fetch &> /dev/null -echo "🅂 🄴 🄻 🄵 🅄 🄿 🄳 🄰 🅃 🄴 :" +echo "🅂 🄴 🄻 🄵 - 🅄 🄿 🄳 🄰 🅃 🄴 :" # TODO: change beta to main once testing is complete if git diff --name-only origin/beta | grep -qs ".sh" ; then echo "Found a new version of HeavyScript, updating myself..." From b8e649badf3979b076b00173302ed8ab348d0ae9 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 28 Jul 2022 14:21:21 -0600 Subject: [PATCH 0496/1229] remove colon --- functions/self_update.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/self_update.sh b/functions/self_update.sh index 3f2445c3..b4b88664 100644 --- a/functions/self_update.sh +++ b/functions/self_update.sh @@ -3,7 +3,7 @@ args=("$@") self_update() { git fetch &> /dev/null -echo "🅂 🄴 🄻 🄵 - 🅄 🄿 🄳 🄰 🅃 🄴 :" +echo "🅂 🄴 🄻 🄵 - 🅄 🄿 🄳 🄰 🅃 🄴" # TODO: change beta to main once testing is complete if git diff --name-only origin/beta | grep -qs ".sh" ; then echo "Found a new version of HeavyScript, updating myself..." From 8da7373f33ced2fb61bc49c9622805d95eeff9e4 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 28 Jul 2022 16:01:29 -0600 Subject: [PATCH 0497/1229] heavysetup readme --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 8ab10a50..af609280 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,9 @@ # heavy_script +## Website + +[HeavySetup - Further In-Depth Explanation](https://heavysetup.info/scripts/heavyscript/about/) + ## Table of contents: * [Arguments](#arguments) * [Examples](#examples) From e2dfead10a046008a64daa6f39f13efa5f272ba8 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 28 Jul 2022 16:04:41 -0600 Subject: [PATCH 0498/1229] selfupdate to menu update --- functions/menu.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/functions/menu.sh b/functions/menu.sh index 1ac5659e..9fcafab9 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -114,6 +114,7 @@ case $selection in echo "6) -t | Set a custom timeout in seconds when checking if either an App or Mountpoint correctly Started, Stopped or (un)Mounted. Defaults to 500 seconds" echo "7) -s | sync catalog" echo "8) -p | Prune unused/old docker images" + echo "9) --self-update | Updates HeavyScript prior to running any other commands" echo echo "99) Remove Update Options, Restart" echo "00) Done making selections, proceed with update" @@ -171,6 +172,10 @@ case $selection in printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-p" && echo -e "\"-p\" is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it update_selection+=("-p") ;; + 9 | --self-update ) + printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "--self-update" && echo -e "\"--self-update\" is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it + update_selection+=("--self-update") + ;; 99) count=2 echo "restarting" From 8e654d5942c629357e8d1829636d974958c44f23 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 28 Jul 2022 16:10:33 -0600 Subject: [PATCH 0499/1229] test ignore regex validation --- functions/menu.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/functions/menu.sh b/functions/menu.sh index 9fcafab9..2d4195a0 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -123,7 +123,7 @@ case $selection in echo "---------------" echo "bash heavy_script.sh ${update_selection[*]}" echo - read -rt 600 -p "Please type the number associated with the flag above: " current_selection + read -rt 600 -p "Type the Number OR Flag: " current_selection case $current_selection in 00) clear -x @@ -142,6 +142,7 @@ case $selection in ;; 2 | -i) read -rt 600 -p "What is the name of the application we should ignore?: " up_ignore + ! [[ $up_ignore =~ ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ ]] && echo -e "Error: \"$up_ignore\" is invalid, that is not the name youre using for your application" && sleep 5 && continue update_selection+=("-i" "$up_ignore") ;; 3 | -r) From 1fa9e3f9084123497b3be9d9505c2d9cb6688762 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 28 Jul 2022 16:48:27 -0600 Subject: [PATCH 0500/1229] regex changes for ignore --- functions/menu.sh | 2 +- heavy_script.sh | 12 ++++-------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/functions/menu.sh b/functions/menu.sh index 2d4195a0..95008b4a 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -142,7 +142,7 @@ case $selection in ;; 2 | -i) read -rt 600 -p "What is the name of the application we should ignore?: " up_ignore - ! [[ $up_ignore =~ ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ ]] && echo -e "Error: \"$up_ignore\" is invalid, that is not the name youre using for your application" && sleep 5 && continue + ! [[ $up_ignore =~ ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ ]] && echo -e "Error: \"$up_ignore\" is invalid, that is not the name youre using for your application" && sleep 5 && continue update_selection+=("-i" "$up_ignore") ;; 3 | -r) diff --git a/heavy_script.sh b/heavy_script.sh index 5d539c1d..61caec9a 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -71,15 +71,11 @@ do rollback="true" ;; i) - # Check next positional parameter - eval nextopt=${!OPTIND} - # existing or starting with dash? - if [[ -n $nextopt && $nextopt != -* ]] ; then - OPTIND=$((OPTIND + 1)) - ignore+=("$nextopt") - else - echo "Option: \"-i\" requires an argument" + if ! [[ $OPTARG =~ ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ ]]; then # Using case insensitive version of the regex used by Truenas Scale + echo -e "Error: \"$OPTARG\" is invalid, that is not the name youre using for your application" exit + else + ignore+=("$OPTARG") fi ;; t) From 276f2126870e9c0cdc51986d7c933fad57bf9a74 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 28 Jul 2022 17:00:45 -0600 Subject: [PATCH 0501/1229] remove hyphen in title --- functions/self_update.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/self_update.sh b/functions/self_update.sh index b4b88664..586cadc9 100644 --- a/functions/self_update.sh +++ b/functions/self_update.sh @@ -3,7 +3,7 @@ args=("$@") self_update() { git fetch &> /dev/null -echo "🅂 🄴 🄻 🄵 - 🅄 🄿 🄳 🄰 🅃 🄴" +echo "🅂 🄴 🄻 🄵 🅄 🄿 🄳 🄰 🅃 🄴" # TODO: change beta to main once testing is complete if git diff --name-only origin/beta | grep -qs ".sh" ; then echo "Found a new version of HeavyScript, updating myself..." From 34c4e5f9cb50bb6b201cdba913237c4325f92c53 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 28 Jul 2022 17:31:38 -0600 Subject: [PATCH 0502/1229] change ignore error message --- functions/menu.sh | 2 +- heavy_script.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/menu.sh b/functions/menu.sh index 95008b4a..27e702a6 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -142,7 +142,7 @@ case $selection in ;; 2 | -i) read -rt 600 -p "What is the name of the application we should ignore?: " up_ignore - ! [[ $up_ignore =~ ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ ]] && echo -e "Error: \"$up_ignore\" is invalid, that is not the name youre using for your application" && sleep 5 && continue + ! [[ $up_ignore =~ ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ ]] && echo -e "Error: \"$up_ignore\" is not a possible option for an application name" && sleep 5 && continue update_selection+=("-i" "$up_ignore") ;; 3 | -r) diff --git a/heavy_script.sh b/heavy_script.sh index 61caec9a..f0e3015c 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -72,7 +72,7 @@ do ;; i) if ! [[ $OPTARG =~ ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ ]]; then # Using case insensitive version of the regex used by Truenas Scale - echo -e "Error: \"$OPTARG\" is invalid, that is not the name youre using for your application" + echo -e "Error: \"$OPTARG\" is not a possible option for an application name" exit else ignore+=("$OPTARG") From 6e5a0480d9e80c82aad4537ada02cb90944d2168 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 28 Jul 2022 22:23:10 -0600 Subject: [PATCH 0503/1229] test new mount --- functions/mount.sh | 245 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 191 insertions(+), 54 deletions(-) diff --git a/functions/mount.sh b/functions/mount.sh index 880ffce4..c0785e64 100644 --- a/functions/mount.sh +++ b/functions/mount.sh @@ -1,63 +1,200 @@ #!/bin/bash +# mount(){ +# clear -x +# title +# echo -e "1 Mount\n2 Unmount All" && read -t 600 -p "Please type a number: " selection +# [[ -z "$selection" ]] && echo "Your selection cannot be empty" && exit #Check for valid selection. If none, kill script +# if [[ $selection == "1" ]]; then +# list=$(k3s kubectl get pvc -A | sort -u | awk '{print NR-1, "\t" $1 "\t" $2 "\t" $4}' | column -t | sed "s/^0/ /") +# echo "$list" && read -t 120 -p "Please type a number: " selection +# [[ -z "$selection" ]] && echo "Your selection cannot be empty" && exit #Check for valid selection. If none, kill script +# app=$(echo -e "$list" | grep ^"$selection " | awk '{print $2}' | cut -c 4- ) +# [[ -z "$app" ]] && echo "Invalid Selection: $selection, was not an option" && exit #Check for valid selection. If none, kill script +# pvc=$(echo -e "$list" | grep ^"$selection ") +# status=$(cli -m csv -c 'app chart_release query name,status' | grep -E "^$app\b" | awk -F ',' '{print $2}'| tr -d " \t\n\r") +# if [[ "$status" != "STOPPED" ]]; then +# [[ -z $timeout ]] && echo -e "\nDefault Timeout: 500" && timeout=500 || echo -e "\nCustom Timeout: $timeout" +# SECONDS=0 && echo -e "\nScaling down $app" && midclt call chart.release.scale "$app" '{"replica_count": 0}' &> /dev/null +# else +# echo -e "\n$app is already stopped" +# fi +# while [[ "$SECONDS" -le "$timeout" && "$status" != "STOPPED" ]] +# do +# status=$(cli -m csv -c 'app chart_release query name,status' | grep -E "^$app\b" | awk -F ',' '{print $2}'| tr -d " \t\n\r") +# echo -e "Waiting $((timeout-SECONDS)) more seconds for $app to be STOPPED" && sleep 5 +# done +# data_name=$(echo "$pvc" | awk '{print $3}') +# mount=$(echo "$pvc" | awk '{print $4}') +# volume_name=$(echo "$pvc" | awk '{print $4}') +# mapfile -t full_path < <(zfs list | grep "$volume_name" | awk '{print $1}') +# if [[ "${#full_path[@]}" -gt 1 ]]; then #if there is another app with the same name on another pool, use the current pools application, since the other instance is probably old, or unused, or a backup. +# echo "$app is using the same volume identifier on more than one pool.. attempting to use your current kubernetes apps pool" +# pool=$(cli -c 'app kubernetes config' | grep -E "dataset\s\|" | awk -F '|' '{print $3}' | awk -F '/' '{print $1}' | tr -d " \t\n\r") +# full_path=$(zfs list | grep "$volume_name" | grep "$pool" | awk '{print $1}') +# fi +# echo -e "\nMounting\n$full_path\nTo\n/mnt/heavyscript/$data_name" +# zfs set mountpoint=/heavyscript/"$data_name" "$full_path" || echo "Failed to mount $app" +# echo -e "Mounted\n\nUnmount with:\nzfs set mountpoint=legacy $full_path && rmdir /mnt/heavyscript/$data_name\n\nOr use the Unmount All option\n" +# exit +# elif [[ $selection == "2" ]]; then +# mapfile -t unmount_array < <(basename -a /mnt/heavyscript/* | sed "s/*//") +# [[ -z ${unmount_array[*]} ]] && echo "Theres nothing to unmount" && exit +# for i in "${unmount_array[@]}" +# do +# main=$(k3s kubectl get pvc -A | grep -E "\s$i\s" | awk '{print $1, $2, $4}') +# app=$(echo "$main" | awk '{print $1}' | cut -c 4-) +# pvc=$(echo "$main" | awk '{print $3}') +# mapfile -t path < <(find /mnt/*/ix-applications/releases/"$app"/volumes/ -maxdepth 0 | cut -c 6-) +# if [[ "${#path[@]}" -gt 1 ]]; then #if there is another app with the same name on another pool, use the current pools application, since the other instance is probably old, or unused, or a backup. +# echo "$i is a name used on more than one pool.. attempting to use your current kubernetes apps pool" +# pool=$(cli -c 'app kubernetes config' | grep -E "dataset\s\|" | awk -F '|' '{print $3}' | awk -F '/' '{print $1}' | tr -d " \t\n\r") +# full_path=$(find /mnt/"$pool"/ix-applications/releases/"$app"/volumes/ -maxdepth 0 | cut -c 6-) +# zfs set mountpoint=legacy "$full_path""$pvc" && echo "$i unmounted" && rmdir /mnt/heavyscript/"$i" || echo "failed to unmount $i" +# else +# zfs set mountpoint=legacy "$path""$pvc" && echo "$i unmounted" && rmdir /mnt/heavyscript/"$i" || echo "failed to unmount $i" +# fi +# done +# rmdir /mnt/heavyscript +# else +# echo "Invalid selection, \"$selection\" was not an option" +# fi +# } +# export -f mount + + + + mount(){ clear -x title -echo -e "1 Mount\n2 Unmount All" && read -t 600 -p "Please type a number: " selection -[[ -z "$selection" ]] && echo "Your selection cannot be empty" && exit #Check for valid selection. If none, kill script -if [[ $selection == "1" ]]; then - list=$(k3s kubectl get pvc -A | sort -u | awk '{print NR-1, "\t" $1 "\t" $2 "\t" $4}' | column -t | sed "s/^0/ /") - echo "$list" && read -t 120 -p "Please type a number: " selection - [[ -z "$selection" ]] && echo "Your selection cannot be empty" && exit #Check for valid selection. If none, kill script - app=$(echo -e "$list" | grep ^"$selection " | awk '{print $2}' | cut -c 4- ) - [[ -z "$app" ]] && echo "Invalid Selection: $selection, was not an option" && exit #Check for valid selection. If none, kill script - pvc=$(echo -e "$list" | grep ^"$selection ") - status=$(cli -m csv -c 'app chart_release query name,status' | grep -E "^$app\b" | awk -F ',' '{print $2}'| tr -d " \t\n\r") - if [[ "$status" != "STOPPED" ]]; then - [[ -z $timeout ]] && echo -e "\nDefault Timeout: 500" && timeout=500 || echo -e "\nCustom Timeout: $timeout" - SECONDS=0 && echo -e "\nScaling down $app" && midclt call chart.release.scale "$app" '{"replica_count": 0}' &> /dev/null - else - echo -e "\n$app is already stopped" - fi - while [[ "$SECONDS" -le "$timeout" && "$status" != "STOPPED" ]] - do +echo "1 Mount" +echo "2 Unmount All" +echo +echo "0 Exit" +read -rt 120 -p "Unmount All Please type a number: " selection + +case $selection in + 0) + echo "Exitting.." + exit + ;; + 1) + list=$(k3s kubectl get pvc -A | sort -u | awk '{print NR-1, "\t" $1 "\t" $2 "\t" $4}' | column -t | sed "s/^0/ /") + echo "$list" + read -rt 120 -p "Please type a number: " selection + app=$(echo -e "$list" | grep ^"$selection " | awk '{print $2}' | cut -c 4- ) + [[ -z "$app" ]] && echo "Invalid Selection: $selection, was not an option" && exit #Check for valid selection. If none, kill script + pvc=$(echo -e "$list" | grep ^"$selection ") status=$(cli -m csv -c 'app chart_release query name,status' | grep -E "^$app\b" | awk -F ',' '{print $2}'| tr -d " \t\n\r") - echo -e "Waiting $((timeout-SECONDS)) more seconds for $app to be STOPPED" && sleep 5 - done - data_name=$(echo "$pvc" | awk '{print $3}') - mount=$(echo "$pvc" | awk '{print $4}') - volume_name=$(echo "$pvc" | awk '{print $4}') - mapfile -t full_path < <(zfs list | grep "$volume_name" | awk '{print $1}') - if [[ "${#full_path[@]}" -gt 1 ]]; then #if there is another app with the same name on another pool, use the current pools application, since the other instance is probably old, or unused, or a backup. - echo "$app is using the same volume identifier on more than one pool.. attempting to use your current kubernetes apps pool" - pool=$(cli -c 'app kubernetes config' | grep -E "dataset\s\|" | awk -F '|' '{print $3}' | awk -F '/' '{print $1}' | tr -d " \t\n\r") - full_path=$(zfs list | grep "$volume_name" | grep "$pool" | awk '{print $1}') - fi - echo -e "\nMounting\n$full_path\nTo\n/mnt/heavyscript/$data_name" - zfs set mountpoint=/heavyscript/"$data_name" "$full_path" || echo "Failed to mount $app" - echo -e "Mounted\n\nUnmount with:\nzfs set mountpoint=legacy $full_path && rmdir /mnt/heavyscript/$data_name\n\nOr use the Unmount All option\n" - exit -elif [[ $selection == "2" ]]; then - mapfile -t unmount_array < <(basename -a /mnt/heavyscript/* | sed "s/*//") - [[ -z ${unmount_array[*]} ]] && echo "Theres nothing to unmount" && exit - for i in "${unmount_array[@]}" - do - main=$(k3s kubectl get pvc -A | grep -E "\s$i\s" | awk '{print $1, $2, $4}') - app=$(echo "$main" | awk '{print $1}' | cut -c 4-) - pvc=$(echo "$main" | awk '{print $3}') - mapfile -t path < <(find /mnt/*/ix-applications/releases/"$app"/volumes/ -maxdepth 0 | cut -c 6-) - if [[ "${#path[@]}" -gt 1 ]]; then #if there is another app with the same name on another pool, use the current pools application, since the other instance is probably old, or unused, or a backup. - echo "$i is a name used on more than one pool.. attempting to use your current kubernetes apps pool" - pool=$(cli -c 'app kubernetes config' | grep -E "dataset\s\|" | awk -F '|' '{print $3}' | awk -F '/' '{print $1}' | tr -d " \t\n\r") - full_path=$(find /mnt/"$pool"/ix-applications/releases/"$app"/volumes/ -maxdepth 0 | cut -c 6-) - zfs set mountpoint=legacy "$full_path""$pvc" && echo "$i unmounted" && rmdir /mnt/heavyscript/"$i" || echo "failed to unmount $i" + if [[ "$status" != "STOPPED" ]]; then + [[ -z $timeout ]] && echo -e "\nDefault Timeout: 500" && timeout=500 || echo -e "\nCustom Timeout: $timeout" + SECONDS=0 && echo -e "\nScaling down $app" && midclt call chart.release.scale "$app" '{"replica_count": 0}' &> /dev/null else - zfs set mountpoint=legacy "$path""$pvc" && echo "$i unmounted" && rmdir /mnt/heavyscript/"$i" || echo "failed to unmount $i" + echo -e "\n$app is already stopped" fi - done - rmdir /mnt/heavyscript -else - echo "Invalid selection, \"$selection\" was not an option" -fi + while [[ "$SECONDS" -le "$timeout" && "$status" != "STOPPED" ]] + do + status=$(cli -m csv -c 'app chart_release query name,status' | grep -E "^$app\b" | awk -F ',' '{print $2}'| tr -d " \t\n\r") + echo -e "Waiting $((timeout-SECONDS)) more seconds for $app to be STOPPED" && sleep 5 + done + data_name=$(echo "$pvc" | awk '{print $3}') + mount=$(echo "$pvc" | awk '{print $4}') + volume_name=$(echo "$pvc" | awk '{print $4}') + mapfile -t full_path < <(zfs list | grep "$volume_name" | awk '{print $1}') + if [[ "${#full_path[@]}" -gt 1 ]]; then #if there is another app with the same name on another pool, use the current pools application, since the other instance is probably old, or unused, or a backup. + echo "$app is using the same volume identifier on more than one pool.. attempting to use your current kubernetes apps pool" + pool=$(cli -c 'app kubernetes config' | grep -E "dataset\s\|" | awk -F '|' '{print $3}' | awk -F '/' '{print $1}' | tr -d " \t\n\r") + full_path=$(zfs list | grep "$volume_name" | grep "$pool" | awk '{print $1}') + fi + echo -e "\nMounting\n$full_path\nTo\n/mnt/heavyscript/$data_name" + zfs set mountpoint=/heavyscript/"$data_name" "$full_path" || echo "Failed to mount $app" + echo -e "Mounted\n\nUnmount with:\nzfs set mountpoint=legacy $full_path && rmdir /mnt/heavyscript/$data_name\n\nOr use the Unmount All option\n" + exit + ;; + 2) + mapfile -t unmount_array < <(basename -a /mnt/heavyscript/* | sed "s/*//") + [[ -z ${unmount_array[*]} ]] && echo "Theres nothing to unmount" && exit + for i in "${unmount_array[@]}" + do + main=$(k3s kubectl get pvc -A | grep -E "\s$i\s" | awk '{print $1, $2, $4}') + app=$(echo "$main" | awk '{print $1}' | cut -c 4-) + pvc=$(echo "$main" | awk '{print $3}') + mapfile -t path < <(find /mnt/*/ix-applications/releases/"$app"/volumes/ -maxdepth 0 | cut -c 6-) + if [[ "${#path[@]}" -gt 1 ]]; then #if there is another app with the same name on another pool, use the current pools application, since the other instance is probably old, or unused, or a backup. + echo "$i is a name used on more than one pool.. attempting to use your current kubernetes apps pool" + pool=$(cli -c 'app kubernetes config' | grep -E "dataset\s\|" | awk -F '|' '{print $3}' | awk -F '/' '{print $1}' | tr -d " \t\n\r") + full_path=$(find /mnt/"$pool"/ix-applications/releases/"$app"/volumes/ -maxdepth 0 | cut -c 6-) + zfs set mountpoint=legacy "$full_path""$pvc" && echo "$i unmounted" && rmdir /mnt/heavyscript/"$i" || echo "failed to unmount $i" + else + zfs set mountpoint=legacy "$path""$pvc" && echo "$i unmounted" && rmdir /mnt/heavyscript/"$i" || echo "failed to unmount $i" + fi + done + rmdir /mnt/heavyscript + ;; + *) + echo "Invalid selection, \"$selection\" was not an option" + ;; +esac } -export -f mount \ No newline at end of file +export -f mount + + + +# [[ -z "$selection" ]] && echo "Your selection cannot be empty" && exit #Check for valid selection. If none, kill script +# if [[ $selection == "1" ]]; then + # list=$(k3s kubectl get pvc -A | sort -u | awk '{print NR-1, "\t" $1 "\t" $2 "\t" $4}' | column -t | sed "s/^0/ /") + # echo "$list" && read -t 120 -p "Please type a number: " selection + # [[ -z "$selection" ]] && echo "Your selection cannot be empty" && exit #Check for valid selection. If none, kill script + # app=$(echo -e "$list" | grep ^"$selection " | awk '{print $2}' | cut -c 4- ) + # [[ -z "$app" ]] && echo "Invalid Selection: $selection, was not an option" && exit #Check for valid selection. If none, kill script + # pvc=$(echo -e "$list" | grep ^"$selection ") + # status=$(cli -m csv -c 'app chart_release query name,status' | grep -E "^$app\b" | awk -F ',' '{print $2}'| tr -d " \t\n\r") + # if [[ "$status" != "STOPPED" ]]; then + # [[ -z $timeout ]] && echo -e "\nDefault Timeout: 500" && timeout=500 || echo -e "\nCustom Timeout: $timeout" + # SECONDS=0 && echo -e "\nScaling down $app" && midclt call chart.release.scale "$app" '{"replica_count": 0}' &> /dev/null + # else + # echo -e "\n$app is already stopped" + # fi + # while [[ "$SECONDS" -le "$timeout" && "$status" != "STOPPED" ]] + # do + # status=$(cli -m csv -c 'app chart_release query name,status' | grep -E "^$app\b" | awk -F ',' '{print $2}'| tr -d " \t\n\r") + # echo -e "Waiting $((timeout-SECONDS)) more seconds for $app to be STOPPED" && sleep 5 + # done + # data_name=$(echo "$pvc" | awk '{print $3}') + # mount=$(echo "$pvc" | awk '{print $4}') + # volume_name=$(echo "$pvc" | awk '{print $4}') + # mapfile -t full_path < <(zfs list | grep "$volume_name" | awk '{print $1}') + # if [[ "${#full_path[@]}" -gt 1 ]]; then #if there is another app with the same name on another pool, use the current pools application, since the other instance is probably old, or unused, or a backup. + # echo "$app is using the same volume identifier on more than one pool.. attempting to use your current kubernetes apps pool" + # pool=$(cli -c 'app kubernetes config' | grep -E "dataset\s\|" | awk -F '|' '{print $3}' | awk -F '/' '{print $1}' | tr -d " \t\n\r") + # full_path=$(zfs list | grep "$volume_name" | grep "$pool" | awk '{print $1}') + # fi + # echo -e "\nMounting\n$full_path\nTo\n/mnt/heavyscript/$data_name" + # zfs set mountpoint=/heavyscript/"$data_name" "$full_path" || echo "Failed to mount $app" + # echo -e "Mounted\n\nUnmount with:\nzfs set mountpoint=legacy $full_path && rmdir /mnt/heavyscript/$data_name\n\nOr use the Unmount All option\n" + # exit +# elif [[ $selection == "2" ]]; then +# # mapfile -t unmount_array < <(basename -a /mnt/heavyscript/* | sed "s/*//") + # [[ -z ${unmount_array[*]} ]] && echo "Theres nothing to unmount" && exit + # for i in "${unmount_array[@]}" + # do + # main=$(k3s kubectl get pvc -A | grep -E "\s$i\s" | awk '{print $1, $2, $4}') + # app=$(echo "$main" | awk '{print $1}' | cut -c 4-) + # pvc=$(echo "$main" | awk '{print $3}') + # mapfile -t path < <(find /mnt/*/ix-applications/releases/"$app"/volumes/ -maxdepth 0 | cut -c 6-) + # if [[ "${#path[@]}" -gt 1 ]]; then #if there is another app with the same name on another pool, use the current pools application, since the other instance is probably old, or unused, or a backup. + # echo "$i is a name used on more than one pool.. attempting to use your current kubernetes apps pool" + # pool=$(cli -c 'app kubernetes config' | grep -E "dataset\s\|" | awk -F '|' '{print $3}' | awk -F '/' '{print $1}' | tr -d " \t\n\r") + # full_path=$(find /mnt/"$pool"/ix-applications/releases/"$app"/volumes/ -maxdepth 0 | cut -c 6-) + # zfs set mountpoint=legacy "$full_path""$pvc" && echo "$i unmounted" && rmdir /mnt/heavyscript/"$i" || echo "failed to unmount $i" + # else + # zfs set mountpoint=legacy "$path""$pvc" && echo "$i unmounted" && rmdir /mnt/heavyscript/"$i" || echo "failed to unmount $i" + # fi + # done + # rmdir /mnt/heavyscript +# else +# echo "Invalid selection, \"$selection\" was not an option" +# fi +# } +# export -f mount \ No newline at end of file From 436599e7a93784e8cf7a90a16d95f71d5a9b10e4 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 28 Jul 2022 22:36:14 -0600 Subject: [PATCH 0504/1229] test new while loop for mount --- functions/mount.sh | 79 +++++++++++++++++++++++++++++----------------- 1 file changed, 50 insertions(+), 29 deletions(-) diff --git a/functions/mount.sh b/functions/mount.sh index c0785e64..ece5861d 100644 --- a/functions/mount.sh +++ b/functions/mount.sh @@ -76,41 +76,62 @@ read -rt 120 -p "Unmount All Please type a number: " selection case $selection in 0) - echo "Exitting.." + echo "Exiting.." exit ;; 1) - list=$(k3s kubectl get pvc -A | sort -u | awk '{print NR-1, "\t" $1 "\t" $2 "\t" $4}' | column -t | sed "s/^0/ /") - echo "$list" - read -rt 120 -p "Please type a number: " selection - app=$(echo -e "$list" | grep ^"$selection " | awk '{print $2}' | cut -c 4- ) - [[ -z "$app" ]] && echo "Invalid Selection: $selection, was not an option" && exit #Check for valid selection. If none, kill script - pvc=$(echo -e "$list" | grep ^"$selection ") - status=$(cli -m csv -c 'app chart_release query name,status' | grep -E "^$app\b" | awk -F ',' '{print $2}'| tr -d " \t\n\r") - if [[ "$status" != "STOPPED" ]]; then - [[ -z $timeout ]] && echo -e "\nDefault Timeout: 500" && timeout=500 || echo -e "\nCustom Timeout: $timeout" - SECONDS=0 && echo -e "\nScaling down $app" && midclt call chart.release.scale "$app" '{"replica_count": 0}' &> /dev/null - else - echo -e "\n$app is already stopped" - fi - while [[ "$SECONDS" -le "$timeout" && "$status" != "STOPPED" ]] + while true do + list=$(k3s kubectl get pvc -A | sort -u | awk '{print NR-1, "\t" $1 "\t" $2 "\t" $4}' | column -t | sed "s/^0/ /") + echo "$list" + read -rt 120 -p "Please type a number: " selection + app=$(echo -e "$list" | grep ^"$selection " | awk '{print $2}' | cut -c 4- ) + [[ -z "$app" ]] && echo "Invalid Selection: $selection, was not an option" && exit #Check for valid selection. If none, kill script + pvc=$(echo -e "$list" | grep ^"$selection ") status=$(cli -m csv -c 'app chart_release query name,status' | grep -E "^$app\b" | awk -F ',' '{print $2}'| tr -d " \t\n\r") - echo -e "Waiting $((timeout-SECONDS)) more seconds for $app to be STOPPED" && sleep 5 + if [[ "$status" != "STOPPED" ]]; then + [[ -z $timeout ]] && echo -e "\nDefault Timeout: 500" && timeout=500 || echo -e "\nCustom Timeout: $timeout" + SECONDS=0 && echo -e "\nScaling down $app" && midclt call chart.release.scale "$app" '{"replica_count": 0}' &> /dev/null + else + echo -e "\n$app is already stopped" + fi + while [[ "$SECONDS" -le "$timeout" && "$status" != "STOPPED" ]] + do + status=$(cli -m csv -c 'app chart_release query name,status' | grep -E "^$app\b" | awk -F ',' '{print $2}'| tr -d " \t\n\r") + echo -e "Waiting $((timeout-SECONDS)) more seconds for $app to be STOPPED" && sleep 5 + done + data_name=$(echo "$pvc" | awk '{print $3}') + mount=$(echo "$pvc" | awk '{print $4}') + volume_name=$(echo "$pvc" | awk '{print $4}') + mapfile -t full_path < <(zfs list | grep "$volume_name" | awk '{print $1}') + if [[ "${#full_path[@]}" -gt 1 ]]; then #if there is another app with the same name on another pool, use the current pools application, since the other instance is probably old, or unused, or a backup. + echo "$app is using the same volume identifier on more than one pool.. attempting to use your current kubernetes apps pool" + pool=$(cli -c 'app kubernetes config' | grep -E "dataset\s\|" | awk -F '|' '{print $3}' | awk -F '/' '{print $1}' | tr -d " \t\n\r") + full_path=$(zfs list | grep "$volume_name" | grep "$pool" | awk '{print $1}') + fi + echo -e "\nMounting\n$full_path\nTo\n/mnt/heavyscript/$data_name" + zfs set mountpoint=/heavyscript/"$data_name" "$full_path" || echo "Failed to mount $app" + echo -e "Mounted\n\nUnmount with:\nzfs set mountpoint=legacy $full_path && rmdir /mnt/heavyscript/$data_name\n\nOr use the Unmount All option\n" + while [[ $yesno != 0 ]] + do + echo "Would you like to mount anything else?" + echo "1 Yes" + echo "2 No" + read -rt 120 -p "Unmount All Please type a number: " yesno + case $yesno in + 1) + continue + ;; + 2) + exit + ;; + *) + echo "Invalid selection \"$yesno\" was not an option" sleep 3 + continue + ;; + esac + done done - data_name=$(echo "$pvc" | awk '{print $3}') - mount=$(echo "$pvc" | awk '{print $4}') - volume_name=$(echo "$pvc" | awk '{print $4}') - mapfile -t full_path < <(zfs list | grep "$volume_name" | awk '{print $1}') - if [[ "${#full_path[@]}" -gt 1 ]]; then #if there is another app with the same name on another pool, use the current pools application, since the other instance is probably old, or unused, or a backup. - echo "$app is using the same volume identifier on more than one pool.. attempting to use your current kubernetes apps pool" - pool=$(cli -c 'app kubernetes config' | grep -E "dataset\s\|" | awk -F '|' '{print $3}' | awk -F '/' '{print $1}' | tr -d " \t\n\r") - full_path=$(zfs list | grep "$volume_name" | grep "$pool" | awk '{print $1}') - fi - echo -e "\nMounting\n$full_path\nTo\n/mnt/heavyscript/$data_name" - zfs set mountpoint=/heavyscript/"$data_name" "$full_path" || echo "Failed to mount $app" - echo -e "Mounted\n\nUnmount with:\nzfs set mountpoint=legacy $full_path && rmdir /mnt/heavyscript/$data_name\n\nOr use the Unmount All option\n" - exit ;; 2) mapfile -t unmount_array < <(basename -a /mnt/heavyscript/* | sed "s/*//") From 348fa7b3025c54df4eb01ef836fbfc2a7c724573 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 28 Jul 2022 22:40:40 -0600 Subject: [PATCH 0505/1229] test --- functions/mount.sh | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/functions/mount.sh b/functions/mount.sh index ece5861d..8a8f60c0 100644 --- a/functions/mount.sh +++ b/functions/mount.sh @@ -112,24 +112,24 @@ case $selection in echo -e "\nMounting\n$full_path\nTo\n/mnt/heavyscript/$data_name" zfs set mountpoint=/heavyscript/"$data_name" "$full_path" || echo "Failed to mount $app" echo -e "Mounted\n\nUnmount with:\nzfs set mountpoint=legacy $full_path && rmdir /mnt/heavyscript/$data_name\n\nOr use the Unmount All option\n" - while [[ $yesno != 0 ]] + while true do - echo "Would you like to mount anything else?" - echo "1 Yes" - echo "2 No" - read -rt 120 -p "Unmount All Please type a number: " yesno - case $yesno in - 1) - continue - ;; - 2) - exit - ;; - *) - echo "Invalid selection \"$yesno\" was not an option" sleep 3 - continue - ;; - esac + echo "Would you like to mount anything else?" + echo "1 Yes" + echo "2 No" + read -rt 120 -p "Please type a number: " yesno + case $yesno in + 1) + break + ;; + 2) + exit + ;; + *) + echo "Invalid selection \"$yesno\" was not an option" sleep 3 + continue + ;; + esac done done ;; From 96cc369f32665f8822ae1b44a03bfd937bca6d3b Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 28 Jul 2022 22:44:28 -0600 Subject: [PATCH 0506/1229] test --- functions/mount.sh | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/functions/mount.sh b/functions/mount.sh index 8a8f60c0..6d757f56 100644 --- a/functions/mount.sh +++ b/functions/mount.sh @@ -68,10 +68,10 @@ mount(){ clear -x title -echo "1 Mount" -echo "2 Unmount All" +echo "1) Mount" +echo "2) Unmount All" echo -echo "0 Exit" +echo "0) Exit" read -rt 120 -p "Unmount All Please type a number: " selection case $selection in @@ -114,9 +114,9 @@ case $selection in echo -e "Mounted\n\nUnmount with:\nzfs set mountpoint=legacy $full_path && rmdir /mnt/heavyscript/$data_name\n\nOr use the Unmount All option\n" while true do - echo "Would you like to mount anything else?" - echo "1 Yes" - echo "2 No" + echo -e "\nWould you like to mount anything else?" + echo "1) Yes" + echo "2) No" read -rt 120 -p "Please type a number: " yesno case $yesno in 1) @@ -126,7 +126,8 @@ case $selection in exit ;; *) - echo "Invalid selection \"$yesno\" was not an option" sleep 3 + echo "Invalid selection \"$yesno\" was not an option" + sleep 2 continue ;; esac From a96092c37037076105a373ef1903273c8cee6c36 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 28 Jul 2022 22:48:22 -0600 Subject: [PATCH 0507/1229] test --- functions/mount.sh | 181 +++++++++++++++++++++++---------------------- 1 file changed, 93 insertions(+), 88 deletions(-) diff --git a/functions/mount.sh b/functions/mount.sh index 6d757f56..d2c4a7f9 100644 --- a/functions/mount.sh +++ b/functions/mount.sh @@ -66,98 +66,103 @@ mount(){ -clear -x -title -echo "1) Mount" -echo "2) Unmount All" -echo -echo "0) Exit" -read -rt 120 -p "Unmount All Please type a number: " selection +while true +do + clear -x + title + echo "1) Mount" + echo "2) Unmount All" + echo + echo "0) Exit" + read -rt 120 -p "Unmount All Please type a number: " selection -case $selection in - 0) - echo "Exiting.." - exit - ;; - 1) - while true - do - list=$(k3s kubectl get pvc -A | sort -u | awk '{print NR-1, "\t" $1 "\t" $2 "\t" $4}' | column -t | sed "s/^0/ /") - echo "$list" - read -rt 120 -p "Please type a number: " selection - app=$(echo -e "$list" | grep ^"$selection " | awk '{print $2}' | cut -c 4- ) - [[ -z "$app" ]] && echo "Invalid Selection: $selection, was not an option" && exit #Check for valid selection. If none, kill script - pvc=$(echo -e "$list" | grep ^"$selection ") - status=$(cli -m csv -c 'app chart_release query name,status' | grep -E "^$app\b" | awk -F ',' '{print $2}'| tr -d " \t\n\r") - if [[ "$status" != "STOPPED" ]]; then - [[ -z $timeout ]] && echo -e "\nDefault Timeout: 500" && timeout=500 || echo -e "\nCustom Timeout: $timeout" - SECONDS=0 && echo -e "\nScaling down $app" && midclt call chart.release.scale "$app" '{"replica_count": 0}' &> /dev/null - else - echo -e "\n$app is already stopped" - fi - while [[ "$SECONDS" -le "$timeout" && "$status" != "STOPPED" ]] - do - status=$(cli -m csv -c 'app chart_release query name,status' | grep -E "^$app\b" | awk -F ',' '{print $2}'| tr -d " \t\n\r") - echo -e "Waiting $((timeout-SECONDS)) more seconds for $app to be STOPPED" && sleep 5 - done - data_name=$(echo "$pvc" | awk '{print $3}') - mount=$(echo "$pvc" | awk '{print $4}') - volume_name=$(echo "$pvc" | awk '{print $4}') - mapfile -t full_path < <(zfs list | grep "$volume_name" | awk '{print $1}') - if [[ "${#full_path[@]}" -gt 1 ]]; then #if there is another app with the same name on another pool, use the current pools application, since the other instance is probably old, or unused, or a backup. - echo "$app is using the same volume identifier on more than one pool.. attempting to use your current kubernetes apps pool" - pool=$(cli -c 'app kubernetes config' | grep -E "dataset\s\|" | awk -F '|' '{print $3}' | awk -F '/' '{print $1}' | tr -d " \t\n\r") - full_path=$(zfs list | grep "$volume_name" | grep "$pool" | awk '{print $1}') - fi - echo -e "\nMounting\n$full_path\nTo\n/mnt/heavyscript/$data_name" - zfs set mountpoint=/heavyscript/"$data_name" "$full_path" || echo "Failed to mount $app" - echo -e "Mounted\n\nUnmount with:\nzfs set mountpoint=legacy $full_path && rmdir /mnt/heavyscript/$data_name\n\nOr use the Unmount All option\n" + case $selection in + 0) + echo "Exiting.." + exit + ;; + 1) while true do - echo -e "\nWould you like to mount anything else?" - echo "1) Yes" - echo "2) No" - read -rt 120 -p "Please type a number: " yesno - case $yesno in - 1) - break - ;; - 2) - exit - ;; - *) - echo "Invalid selection \"$yesno\" was not an option" - sleep 2 - continue - ;; - esac + list=$(k3s kubectl get pvc -A | sort -u | awk '{print NR-1, "\t" $1 "\t" $2 "\t" $4}' | column -t | sed "s/^0/ /") + echo "$list" + read -rt 120 -p "Please type a number: " selection + app=$(echo -e "$list" | grep ^"$selection " | awk '{print $2}' | cut -c 4- ) + [[ -z "$app" ]] && echo "Invalid Selection: $selection, was not an option" && exit #Check for valid selection. If none, kill script + pvc=$(echo -e "$list" | grep ^"$selection ") + status=$(cli -m csv -c 'app chart_release query name,status' | grep -E "^$app\b" | awk -F ',' '{print $2}'| tr -d " \t\n\r") + if [[ "$status" != "STOPPED" ]]; then + [[ -z $timeout ]] && echo -e "\nDefault Timeout: 500" && timeout=500 || echo -e "\nCustom Timeout: $timeout" + SECONDS=0 && echo -e "\nScaling down $app" && midclt call chart.release.scale "$app" '{"replica_count": 0}' &> /dev/null + else + echo -e "\n$app is already stopped" + fi + while [[ "$SECONDS" -le "$timeout" && "$status" != "STOPPED" ]] + do + status=$(cli -m csv -c 'app chart_release query name,status' | grep -E "^$app\b" | awk -F ',' '{print $2}'| tr -d " \t\n\r") + echo -e "Waiting $((timeout-SECONDS)) more seconds for $app to be STOPPED" && sleep 5 + done + data_name=$(echo "$pvc" | awk '{print $3}') + mount=$(echo "$pvc" | awk '{print $4}') + volume_name=$(echo "$pvc" | awk '{print $4}') + mapfile -t full_path < <(zfs list | grep "$volume_name" | awk '{print $1}') + if [[ "${#full_path[@]}" -gt 1 ]]; then #if there is another app with the same name on another pool, use the current pools application, since the other instance is probably old, or unused, or a backup. + echo "$app is using the same volume identifier on more than one pool.. attempting to use your current kubernetes apps pool" + pool=$(cli -c 'app kubernetes config' | grep -E "dataset\s\|" | awk -F '|' '{print $3}' | awk -F '/' '{print $1}' | tr -d " \t\n\r") + full_path=$(zfs list | grep "$volume_name" | grep "$pool" | awk '{print $1}') + fi + echo -e "\nMounting\n$full_path\nTo\n/mnt/heavyscript/$data_name" + zfs set mountpoint=/heavyscript/"$data_name" "$full_path" || echo "Failed to mount $app" + echo -e "Mounted\n\nUnmount with:\nzfs set mountpoint=legacy $full_path && rmdir /mnt/heavyscript/$data_name\n\nOr use the Unmount All option\n" + while true + do + echo -e "\nWould you like to mount anything else?" + echo "1) Yes" + echo "2) No" + read -rt 120 -p "Please type a number: " yesno + case $yesno in + 1) + break + ;; + 2) + exit + ;; + *) + echo "Invalid selection \"$yesno\" was not an option" + sleep 2 + continue + ;; + esac + done done - done - ;; - 2) - mapfile -t unmount_array < <(basename -a /mnt/heavyscript/* | sed "s/*//") - [[ -z ${unmount_array[*]} ]] && echo "Theres nothing to unmount" && exit - for i in "${unmount_array[@]}" - do - main=$(k3s kubectl get pvc -A | grep -E "\s$i\s" | awk '{print $1, $2, $4}') - app=$(echo "$main" | awk '{print $1}' | cut -c 4-) - pvc=$(echo "$main" | awk '{print $3}') - mapfile -t path < <(find /mnt/*/ix-applications/releases/"$app"/volumes/ -maxdepth 0 | cut -c 6-) - if [[ "${#path[@]}" -gt 1 ]]; then #if there is another app with the same name on another pool, use the current pools application, since the other instance is probably old, or unused, or a backup. - echo "$i is a name used on more than one pool.. attempting to use your current kubernetes apps pool" - pool=$(cli -c 'app kubernetes config' | grep -E "dataset\s\|" | awk -F '|' '{print $3}' | awk -F '/' '{print $1}' | tr -d " \t\n\r") - full_path=$(find /mnt/"$pool"/ix-applications/releases/"$app"/volumes/ -maxdepth 0 | cut -c 6-) - zfs set mountpoint=legacy "$full_path""$pvc" && echo "$i unmounted" && rmdir /mnt/heavyscript/"$i" || echo "failed to unmount $i" - else - zfs set mountpoint=legacy "$path""$pvc" && echo "$i unmounted" && rmdir /mnt/heavyscript/"$i" || echo "failed to unmount $i" - fi - done - rmdir /mnt/heavyscript - ;; - *) - echo "Invalid selection, \"$selection\" was not an option" - ;; -esac + ;; + 2) + mapfile -t unmount_array < <(basename -a /mnt/heavyscript/* | sed "s/*//") + [[ -z ${unmount_array[*]} ]] && echo "Theres nothing to unmount" && exit + for i in "${unmount_array[@]}" + do + main=$(k3s kubectl get pvc -A | grep -E "\s$i\s" | awk '{print $1, $2, $4}') + app=$(echo "$main" | awk '{print $1}' | cut -c 4-) + pvc=$(echo "$main" | awk '{print $3}') + mapfile -t path < <(find /mnt/*/ix-applications/releases/"$app"/volumes/ -maxdepth 0 | cut -c 6-) + if [[ "${#path[@]}" -gt 1 ]]; then #if there is another app with the same name on another pool, use the current pools application, since the other instance is probably old, or unused, or a backup. + echo "$i is a name used on more than one pool.. attempting to use your current kubernetes apps pool" + pool=$(cli -c 'app kubernetes config' | grep -E "dataset\s\|" | awk -F '|' '{print $3}' | awk -F '/' '{print $1}' | tr -d " \t\n\r") + full_path=$(find /mnt/"$pool"/ix-applications/releases/"$app"/volumes/ -maxdepth 0 | cut -c 6-) + zfs set mountpoint=legacy "$full_path""$pvc" && echo "$i unmounted" && rmdir /mnt/heavyscript/"$i" || echo "failed to unmount $i" + else + zfs set mountpoint=legacy "$path""$pvc" && echo "$i unmounted" && rmdir /mnt/heavyscript/"$i" || echo "failed to unmount $i" + fi + done + rmdir /mnt/heavyscript + ;; + *) + echo "Invalid selection, \"$selection\" was not an option" + sleep 2 + continue + ;; + esac +done } export -f mount From 5b51ba45b600e32c12e2989731745e83319e7441 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 28 Jul 2022 22:52:54 -0600 Subject: [PATCH 0508/1229] remove exits from mount --- functions/mount.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/mount.sh b/functions/mount.sh index d2c4a7f9..9214da3e 100644 --- a/functions/mount.sh +++ b/functions/mount.sh @@ -88,7 +88,7 @@ do echo "$list" read -rt 120 -p "Please type a number: " selection app=$(echo -e "$list" | grep ^"$selection " | awk '{print $2}' | cut -c 4- ) - [[ -z "$app" ]] && echo "Invalid Selection: $selection, was not an option" && exit #Check for valid selection. If none, kill script + [[ -z "$app" ]] && echo "Invalid Selection: $selection, was not an option" && sleep 5 && continue #Check for valid selection. If none, kill script pvc=$(echo -e "$list" | grep ^"$selection ") status=$(cli -m csv -c 'app chart_release query name,status' | grep -E "^$app\b" | awk -F ',' '{print $2}'| tr -d " \t\n\r") if [[ "$status" != "STOPPED" ]]; then @@ -138,7 +138,7 @@ do ;; 2) mapfile -t unmount_array < <(basename -a /mnt/heavyscript/* | sed "s/*//") - [[ -z ${unmount_array[*]} ]] && echo "Theres nothing to unmount" && exit + [[ -z ${unmount_array[*]} ]] && echo "Theres nothing to unmount" && sleep 3 && continue for i in "${unmount_array[@]}" do main=$(k3s kubectl get pvc -A | grep -E "\s$i\s" | awk '{print $1, $2, $4}') From 5858610851a0e600c20ab8c8e10d0b0c6920a73f Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 28 Jul 2022 23:11:09 -0600 Subject: [PATCH 0509/1229] delete while loop --- functions/backup.sh | 57 ++++++++++++++++---- functions/mount.sh | 127 +------------------------------------------- 2 files changed, 47 insertions(+), 137 deletions(-) diff --git a/functions/backup.sh b/functions/backup.sh index 56656b9d..c28a2e7b 100644 --- a/functions/backup.sh +++ b/functions/backup.sh @@ -33,19 +33,54 @@ deleteBackup(){ clear -x && echo "pulling all restore points.." list_backups=$(cli -c 'app kubernetes list_backups' | sort -t '_' -Vr -k2,7 | tr -d " \t\r" | awk -F '|' '{print $2}' | nl | column -t) clear -x -[[ -z "$list_backups" ]] && echo "No restore points available" && exit || { title; echo -e "Choose a restore point to delete\nThese may be out of order if they are not HeavyScript backups" ; } -echo "$list_backups" && read -t 600 -p "Please type a number: " selection && restore_point=$(echo "$list_backups" | grep ^"$selection " | awk '{print $2}') -[[ -z "$selection" ]] && echo "Your selection cannot be empty" && exit #Check for valid selection. If none, kill script -[[ -z "$restore_point" ]] && echo "Invalid Selection: $selection, was not an option" && exit #Check for valid selection. If none, kill script -echo -e "\nWARNING:\nYou CANNOT go back after deleting your restore point" || { echo "FAILED"; exit; } -echo -e "\n\nYou have chosen:\n$restore_point\n\nWould you like to continue?" && echo -e "1 Yes\n2 No" && read -t 120 -p "Please type a number: " yesno || { echo "FAILED"; exit; } -if [[ $yesno == "1" ]]; then - echo -e "\nDeleting $restore_point" && cli -c 'app kubernetes delete_backup backup_name=''"'"$restore_point"'"' &>/dev/null && echo "Sucessfully deleted" || echo "Deletion Failed" -elif [[ $yesno == "2" ]]; then - echo "You've chosen NO, killing script." +if [[ -z "$list_backups" ]]; then + echo "No restore points available" + exit else - echo "Invalid Selection" + title + echo -e "Choose a restore point to delete\nThese may be out of order if they are not HeavyScript backups" fi +echo "$list_backups" +read -rt 120 -p "Please type a number: " selection +restore_point=$(echo "$list_backups" | grep ^"$selection " | awk '{print $2}') +#Check for valid selection. If none, kill script +if [[ -z "$selection" ]]; then + echo "Your selection cannot be empty" + exit +elif [[ -z "$restore_point" ]]; then + echo "Invalid Selection: $selection, was not an option" + exit +fi +while true +do + echo -e "\nWARNING:\nYou CANNOT go back after deleting your restore point" + echo -e "\n\nYou have chosen:\n$restore_point\n\nWould you like to continue?" + echo -e "Yes\n0 exit" + read -rt 120 -p "Type \"yes\" to continue, or exit with \"0\": " yesno + case $yesno in + [Yy][Ee][Ss]) + echo -e "\nDeleting $restore_point" + cli -c 'app kubernetes delete_backup backup_name=''"'"$restore_point"'"' &>/dev/null || { echo "Failed to delete backup.."; exit; } + echo "Sucessfully deleted" + break + ;; + 0|[Ee][Xx][Ii][Tt]) + echo "Exiting" + exit + ;; + *) + echo "Invalid Selection" + ;; + esac +done +# while true +# do +# echo "Delete more?" +# echo + + +# done + } export -f deleteBackup diff --git a/functions/mount.sh b/functions/mount.sh index 9214da3e..aabc3989 100644 --- a/functions/mount.sh +++ b/functions/mount.sh @@ -1,70 +1,5 @@ #!/bin/bash -# mount(){ -# clear -x -# title -# echo -e "1 Mount\n2 Unmount All" && read -t 600 -p "Please type a number: " selection -# [[ -z "$selection" ]] && echo "Your selection cannot be empty" && exit #Check for valid selection. If none, kill script -# if [[ $selection == "1" ]]; then -# list=$(k3s kubectl get pvc -A | sort -u | awk '{print NR-1, "\t" $1 "\t" $2 "\t" $4}' | column -t | sed "s/^0/ /") -# echo "$list" && read -t 120 -p "Please type a number: " selection -# [[ -z "$selection" ]] && echo "Your selection cannot be empty" && exit #Check for valid selection. If none, kill script -# app=$(echo -e "$list" | grep ^"$selection " | awk '{print $2}' | cut -c 4- ) -# [[ -z "$app" ]] && echo "Invalid Selection: $selection, was not an option" && exit #Check for valid selection. If none, kill script -# pvc=$(echo -e "$list" | grep ^"$selection ") -# status=$(cli -m csv -c 'app chart_release query name,status' | grep -E "^$app\b" | awk -F ',' '{print $2}'| tr -d " \t\n\r") -# if [[ "$status" != "STOPPED" ]]; then -# [[ -z $timeout ]] && echo -e "\nDefault Timeout: 500" && timeout=500 || echo -e "\nCustom Timeout: $timeout" -# SECONDS=0 && echo -e "\nScaling down $app" && midclt call chart.release.scale "$app" '{"replica_count": 0}' &> /dev/null -# else -# echo -e "\n$app is already stopped" -# fi -# while [[ "$SECONDS" -le "$timeout" && "$status" != "STOPPED" ]] -# do -# status=$(cli -m csv -c 'app chart_release query name,status' | grep -E "^$app\b" | awk -F ',' '{print $2}'| tr -d " \t\n\r") -# echo -e "Waiting $((timeout-SECONDS)) more seconds for $app to be STOPPED" && sleep 5 -# done -# data_name=$(echo "$pvc" | awk '{print $3}') -# mount=$(echo "$pvc" | awk '{print $4}') -# volume_name=$(echo "$pvc" | awk '{print $4}') -# mapfile -t full_path < <(zfs list | grep "$volume_name" | awk '{print $1}') -# if [[ "${#full_path[@]}" -gt 1 ]]; then #if there is another app with the same name on another pool, use the current pools application, since the other instance is probably old, or unused, or a backup. -# echo "$app is using the same volume identifier on more than one pool.. attempting to use your current kubernetes apps pool" -# pool=$(cli -c 'app kubernetes config' | grep -E "dataset\s\|" | awk -F '|' '{print $3}' | awk -F '/' '{print $1}' | tr -d " \t\n\r") -# full_path=$(zfs list | grep "$volume_name" | grep "$pool" | awk '{print $1}') -# fi -# echo -e "\nMounting\n$full_path\nTo\n/mnt/heavyscript/$data_name" -# zfs set mountpoint=/heavyscript/"$data_name" "$full_path" || echo "Failed to mount $app" -# echo -e "Mounted\n\nUnmount with:\nzfs set mountpoint=legacy $full_path && rmdir /mnt/heavyscript/$data_name\n\nOr use the Unmount All option\n" -# exit -# elif [[ $selection == "2" ]]; then -# mapfile -t unmount_array < <(basename -a /mnt/heavyscript/* | sed "s/*//") -# [[ -z ${unmount_array[*]} ]] && echo "Theres nothing to unmount" && exit -# for i in "${unmount_array[@]}" -# do -# main=$(k3s kubectl get pvc -A | grep -E "\s$i\s" | awk '{print $1, $2, $4}') -# app=$(echo "$main" | awk '{print $1}' | cut -c 4-) -# pvc=$(echo "$main" | awk '{print $3}') -# mapfile -t path < <(find /mnt/*/ix-applications/releases/"$app"/volumes/ -maxdepth 0 | cut -c 6-) -# if [[ "${#path[@]}" -gt 1 ]]; then #if there is another app with the same name on another pool, use the current pools application, since the other instance is probably old, or unused, or a backup. -# echo "$i is a name used on more than one pool.. attempting to use your current kubernetes apps pool" -# pool=$(cli -c 'app kubernetes config' | grep -E "dataset\s\|" | awk -F '|' '{print $3}' | awk -F '/' '{print $1}' | tr -d " \t\n\r") -# full_path=$(find /mnt/"$pool"/ix-applications/releases/"$app"/volumes/ -maxdepth 0 | cut -c 6-) -# zfs set mountpoint=legacy "$full_path""$pvc" && echo "$i unmounted" && rmdir /mnt/heavyscript/"$i" || echo "failed to unmount $i" -# else -# zfs set mountpoint=legacy "$path""$pvc" && echo "$i unmounted" && rmdir /mnt/heavyscript/"$i" || echo "failed to unmount $i" -# fi -# done -# rmdir /mnt/heavyscript -# else -# echo "Invalid selection, \"$selection\" was not an option" -# fi -# } -# export -f mount - - - - mount(){ while true do @@ -164,64 +99,4 @@ do esac done } -export -f mount - - - -# [[ -z "$selection" ]] && echo "Your selection cannot be empty" && exit #Check for valid selection. If none, kill script -# if [[ $selection == "1" ]]; then - # list=$(k3s kubectl get pvc -A | sort -u | awk '{print NR-1, "\t" $1 "\t" $2 "\t" $4}' | column -t | sed "s/^0/ /") - # echo "$list" && read -t 120 -p "Please type a number: " selection - # [[ -z "$selection" ]] && echo "Your selection cannot be empty" && exit #Check for valid selection. If none, kill script - # app=$(echo -e "$list" | grep ^"$selection " | awk '{print $2}' | cut -c 4- ) - # [[ -z "$app" ]] && echo "Invalid Selection: $selection, was not an option" && exit #Check for valid selection. If none, kill script - # pvc=$(echo -e "$list" | grep ^"$selection ") - # status=$(cli -m csv -c 'app chart_release query name,status' | grep -E "^$app\b" | awk -F ',' '{print $2}'| tr -d " \t\n\r") - # if [[ "$status" != "STOPPED" ]]; then - # [[ -z $timeout ]] && echo -e "\nDefault Timeout: 500" && timeout=500 || echo -e "\nCustom Timeout: $timeout" - # SECONDS=0 && echo -e "\nScaling down $app" && midclt call chart.release.scale "$app" '{"replica_count": 0}' &> /dev/null - # else - # echo -e "\n$app is already stopped" - # fi - # while [[ "$SECONDS" -le "$timeout" && "$status" != "STOPPED" ]] - # do - # status=$(cli -m csv -c 'app chart_release query name,status' | grep -E "^$app\b" | awk -F ',' '{print $2}'| tr -d " \t\n\r") - # echo -e "Waiting $((timeout-SECONDS)) more seconds for $app to be STOPPED" && sleep 5 - # done - # data_name=$(echo "$pvc" | awk '{print $3}') - # mount=$(echo "$pvc" | awk '{print $4}') - # volume_name=$(echo "$pvc" | awk '{print $4}') - # mapfile -t full_path < <(zfs list | grep "$volume_name" | awk '{print $1}') - # if [[ "${#full_path[@]}" -gt 1 ]]; then #if there is another app with the same name on another pool, use the current pools application, since the other instance is probably old, or unused, or a backup. - # echo "$app is using the same volume identifier on more than one pool.. attempting to use your current kubernetes apps pool" - # pool=$(cli -c 'app kubernetes config' | grep -E "dataset\s\|" | awk -F '|' '{print $3}' | awk -F '/' '{print $1}' | tr -d " \t\n\r") - # full_path=$(zfs list | grep "$volume_name" | grep "$pool" | awk '{print $1}') - # fi - # echo -e "\nMounting\n$full_path\nTo\n/mnt/heavyscript/$data_name" - # zfs set mountpoint=/heavyscript/"$data_name" "$full_path" || echo "Failed to mount $app" - # echo -e "Mounted\n\nUnmount with:\nzfs set mountpoint=legacy $full_path && rmdir /mnt/heavyscript/$data_name\n\nOr use the Unmount All option\n" - # exit -# elif [[ $selection == "2" ]]; then -# # mapfile -t unmount_array < <(basename -a /mnt/heavyscript/* | sed "s/*//") - # [[ -z ${unmount_array[*]} ]] && echo "Theres nothing to unmount" && exit - # for i in "${unmount_array[@]}" - # do - # main=$(k3s kubectl get pvc -A | grep -E "\s$i\s" | awk '{print $1, $2, $4}') - # app=$(echo "$main" | awk '{print $1}' | cut -c 4-) - # pvc=$(echo "$main" | awk '{print $3}') - # mapfile -t path < <(find /mnt/*/ix-applications/releases/"$app"/volumes/ -maxdepth 0 | cut -c 6-) - # if [[ "${#path[@]}" -gt 1 ]]; then #if there is another app with the same name on another pool, use the current pools application, since the other instance is probably old, or unused, or a backup. - # echo "$i is a name used on more than one pool.. attempting to use your current kubernetes apps pool" - # pool=$(cli -c 'app kubernetes config' | grep -E "dataset\s\|" | awk -F '|' '{print $3}' | awk -F '/' '{print $1}' | tr -d " \t\n\r") - # full_path=$(find /mnt/"$pool"/ix-applications/releases/"$app"/volumes/ -maxdepth 0 | cut -c 6-) - # zfs set mountpoint=legacy "$full_path""$pvc" && echo "$i unmounted" && rmdir /mnt/heavyscript/"$i" || echo "failed to unmount $i" - # else - # zfs set mountpoint=legacy "$path""$pvc" && echo "$i unmounted" && rmdir /mnt/heavyscript/"$i" || echo "failed to unmount $i" - # fi - # done - # rmdir /mnt/heavyscript -# else -# echo "Invalid selection, \"$selection\" was not an option" -# fi -# } -# export -f mount \ No newline at end of file +export -f mount \ No newline at end of file From 26815e9783dbc9e16257cc6ad24d13f27813c2af Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 28 Jul 2022 23:22:06 -0600 Subject: [PATCH 0510/1229] test loop --- functions/backup.sh | 113 +++++++++++++++++++++++++------------------- 1 file changed, 65 insertions(+), 48 deletions(-) diff --git a/functions/backup.sh b/functions/backup.sh index c28a2e7b..b8946e4a 100644 --- a/functions/backup.sh +++ b/functions/backup.sh @@ -30,57 +30,74 @@ export -f backup deleteBackup(){ -clear -x && echo "pulling all restore points.." -list_backups=$(cli -c 'app kubernetes list_backups' | sort -t '_' -Vr -k2,7 | tr -d " \t\r" | awk -F '|' '{print $2}' | nl | column -t) -clear -x -if [[ -z "$list_backups" ]]; then - echo "No restore points available" - exit -else - title - echo -e "Choose a restore point to delete\nThese may be out of order if they are not HeavyScript backups" -fi -echo "$list_backups" -read -rt 120 -p "Please type a number: " selection -restore_point=$(echo "$list_backups" | grep ^"$selection " | awk '{print $2}') -#Check for valid selection. If none, kill script -if [[ -z "$selection" ]]; then - echo "Your selection cannot be empty" - exit -elif [[ -z "$restore_point" ]]; then - echo "Invalid Selection: $selection, was not an option" - exit -fi while true do - echo -e "\nWARNING:\nYou CANNOT go back after deleting your restore point" - echo -e "\n\nYou have chosen:\n$restore_point\n\nWould you like to continue?" - echo -e "Yes\n0 exit" - read -rt 120 -p "Type \"yes\" to continue, or exit with \"0\": " yesno - case $yesno in - [Yy][Ee][Ss]) - echo -e "\nDeleting $restore_point" - cli -c 'app kubernetes delete_backup backup_name=''"'"$restore_point"'"' &>/dev/null || { echo "Failed to delete backup.."; exit; } - echo "Sucessfully deleted" - break - ;; - 0|[Ee][Xx][Ii][Tt]) - echo "Exiting" - exit - ;; - *) - echo "Invalid Selection" - ;; - esac + clear -x && echo "pulling all restore points.." + list_backups=$(cli -c 'app kubernetes list_backups' | sort -t '_' -Vr -k2,7 | tr -d " \t\r" | awk -F '|' '{print $2}' | nl | column -t) + clear -x + if [[ -z "$list_backups" ]]; then + echo "No restore points available" + exit + else + title + echo -e "Choose a restore point to delete\nThese may be out of order if they are not HeavyScript backups" + fi + echo "$list_backups" + read -rt 120 -p "Please type a number: " selection + restore_point=$(echo "$list_backups" | grep ^"$selection " | awk '{print $2}') + #Check for valid selection. If none, kill script + if [[ -z "$selection" ]]; then + echo "Your selection cannot be empty" + continue + elif [[ -z "$restore_point" ]]; then + echo "Invalid Selection: $selection, was not an option" + continue + fi + while true + do + echo -e "\nWARNING:\nYou CANNOT go back after deleting your restore point" + echo -e "\n\nYou have chosen:\n$restore_point\n\nWould you like to continue?" + echo -e "Yes\n0 exit\n" + read -rt 120 -p "Type \"yes\" to continue, or exit with \"0\": " yesno + case $yesno in + [Yy][Ee][Ss]) + echo -e "\nDeleting $restore_point" + cli -c 'app kubernetes delete_backup backup_name=''"'"$restore_point"'"' &>/dev/null || { echo "Failed to delete backup.."; exit; } + echo "Sucessfully deleted" + break + ;; + 0|[Ee][Xx][Ii][Tt]) + echo "Exiting" + exit + ;; + *) + echo "Invalid Selection" + ;; + esac + done + while true + do + echo "Delete more?" + echo "1 Yes" + echo "2 No" + read -rt 120 -p "Please type a number: " yesno + case $yesno in + 1) + break + ;; + 2) + exit + ;; + *) + echo "$yesno was not an option, try again" + sleep 2 + continue + ;; + + esac + + done done -# while true -# do -# echo "Delete more?" -# echo - - -# done - } export -f deleteBackup From 7c9cf2366448decc28d414086b43146db009a7c5 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 28 Jul 2022 23:32:01 -0600 Subject: [PATCH 0511/1229] test nl --- functions/backup.sh | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/functions/backup.sh b/functions/backup.sh index b8946e4a..f2e37b6f 100644 --- a/functions/backup.sh +++ b/functions/backup.sh @@ -33,7 +33,7 @@ deleteBackup(){ while true do clear -x && echo "pulling all restore points.." - list_backups=$(cli -c 'app kubernetes list_backups' | sort -t '_' -Vr -k2,7 | tr -d " \t\r" | awk -F '|' '{print $2}' | nl | column -t) + list_backups=$(cli -c 'app kubernetes list_backups' | sort -t '_' -Vr -k2,7 | tr -d " \t\r" | awk -F '|' '{print $2}' | nl -s \) | column -t) clear -x if [[ -z "$list_backups" ]]; then echo "No restore points available" @@ -48,38 +48,43 @@ do #Check for valid selection. If none, kill script if [[ -z "$selection" ]]; then echo "Your selection cannot be empty" + sleep 3 continue elif [[ -z "$restore_point" ]]; then echo "Invalid Selection: $selection, was not an option" + sleep 3 continue fi while true do + clear -x echo -e "\nWARNING:\nYou CANNOT go back after deleting your restore point" echo -e "\n\nYou have chosen:\n$restore_point\n\nWould you like to continue?" - echo -e "Yes\n0 exit\n" - read -rt 120 -p "Type \"yes\" to continue, or exit with \"0\": " yesno + echo -e "1) Yes\n2) Exit\n" + read -rt 120 -p "Please type a number: " yesno case $yesno in - [Yy][Ee][Ss]) + 1) echo -e "\nDeleting $restore_point" cli -c 'app kubernetes delete_backup backup_name=''"'"$restore_point"'"' &>/dev/null || { echo "Failed to delete backup.."; exit; } echo "Sucessfully deleted" break ;; - 0|[Ee][Xx][Ii][Tt]) + 2) echo "Exiting" exit ;; *) - echo "Invalid Selection" + echo "That was not an option, try again" + sleep 3 + continue ;; esac done while true do echo "Delete more?" - echo "1 Yes" - echo "2 No" + echo "1) Yes" + echo "2) No" read -rt 120 -p "Please type a number: " yesno case $yesno in 1) From 7ad86534f0356758a55e9cdc7a9eded55d298dce Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 28 Jul 2022 23:32:45 -0600 Subject: [PATCH 0512/1229] test --- functions/backup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/backup.sh b/functions/backup.sh index f2e37b6f..7fa5f08f 100644 --- a/functions/backup.sh +++ b/functions/backup.sh @@ -33,7 +33,7 @@ deleteBackup(){ while true do clear -x && echo "pulling all restore points.." - list_backups=$(cli -c 'app kubernetes list_backups' | sort -t '_' -Vr -k2,7 | tr -d " \t\r" | awk -F '|' '{print $2}' | nl -s \) | column -t) + list_backups=$(cli -c 'app kubernetes list_backups' | sort -t '_' -Vr -k2,7 | tr -d " \t\r" | awk -F '|' '{print $2}' | nl -s ") " | column -t) clear -x if [[ -z "$list_backups" ]]; then echo "No restore points available" From 048efbd4ba08b6a50d3aae680824606930a1e237 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 28 Jul 2022 23:33:44 -0600 Subject: [PATCH 0513/1229] fix regex --- functions/backup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/backup.sh b/functions/backup.sh index 7fa5f08f..80ab8ec2 100644 --- a/functions/backup.sh +++ b/functions/backup.sh @@ -44,7 +44,7 @@ do fi echo "$list_backups" read -rt 120 -p "Please type a number: " selection - restore_point=$(echo "$list_backups" | grep ^"$selection " | awk '{print $2}') + restore_point=$(echo "$list_backups" | grep ^"$selection)" | awk '{print $2}') #Check for valid selection. If none, kill script if [[ -z "$selection" ]]; then echo "Your selection cannot be empty" From 4b3847c6fc391d46f54e536ef44d81c6cc72296a Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 28 Jul 2022 23:46:08 -0600 Subject: [PATCH 0514/1229] restore improvement --- functions/backup.sh | 66 ++++++++++++++++++++++++++++++++++----------- 1 file changed, 50 insertions(+), 16 deletions(-) diff --git a/functions/backup.sh b/functions/backup.sh index 80ab8ec2..ffc90786 100644 --- a/functions/backup.sh +++ b/functions/backup.sh @@ -108,21 +108,55 @@ export -f deleteBackup restore(){ -clear -x && echo "pulling restore points.." -list_backups=$(cli -c 'app kubernetes list_backups' | grep "HeavyScript_" | sort -t '_' -Vr -k2,7 | tr -d " \t\r" | awk -F '|' '{print $2}' | nl | column -t) -clear -x -[[ -z "$list_backups" ]] && echo "No HeavyScript restore points available" && exit || { title; echo "Choose a restore point" ; } -echo "$list_backups" && read -t 600 -p "Please type a number: " selection && restore_point=$(echo "$list_backups" | grep ^"$selection " | awk '{print $2}') -[[ -z "$selection" ]] && echo "Your selection cannot be empty" && exit #Check for valid selection. If none, kill script -[[ -z "$restore_point" ]] && echo "Invalid Selection: $selection, was not an option" && exit #Check for valid selection. If none, kill script -echo -e "\nWARNING:\nThis is NOT guranteed to work\nThis is ONLY supposed to be used as a LAST RESORT\nConsider rolling back your applications instead if possible" || { echo "FAILED"; exit; } -echo -e "\n\nYou have chosen:\n$restore_point\n\nWould you like to continue?" && echo -e "1 Yes\n2 No" && read -t 120 -p "Please type a number: " yesno || { echo "FAILED"; exit; } -if [[ $yesno == "1" ]]; then - echo -e "\nStarting Backup, this will take a LONG time." && cli -c 'app kubernetes restore_backup backup_name=''"'"$restore_point"'"' || echo "Restore FAILED" -elif [[ $yesno == "2" ]]; then - echo "You've chosen NO, killing script. Good luck." -else - echo "Invalid Selection" -fi +while true +do + clear -x && echo "pulling restore points.." + list_backups=$(cli -c 'app kubernetes list_backups' | grep "HeavyScript_" | sort -t '_' -Vr -k2,7 | tr -d " \t\r" | awk -F '|' '{print $2}' | nl -s ") " | column -t) + clear -x + if [[ -z "$list_backups" ]]; then + echo "No HeavyScript restore points available" + exit + else + title + echo "Choose a restore point" + fi + echo "$list_backups" + read -rt 120 -p "Please type a number: " selection + restore_point=$(echo "$list_backups" | grep ^"$selection)" | awk '{print $2}') + #Check for valid selection. If none, kill script + if [[ -z "$selection" ]]; then + echo "Your selection cannot be empty" + sleep 3 + continue + elif [[ -z "$restore_point" ]]; then + echo "Invalid Selection: $selection, was not an option" + sleep 3 + continue + fi + while true + do + clear -x + echo -e "\nWARNING:\nThis is NOT guranteed to work\nThis is ONLY supposed to be used as a LAST RESORT\nConsider rolling back your applications instead if possible" + echo -e "\n\nYou have chosen:\n$restore_point\n\nWould you like to continue?" + echo -e "1) Yes\n2) Exit\n" + read -rt 120 -p "Please type a number: " yesno + case $yesno in + 1) + echo -e "\nStarting Backup, this will take a LONG time." + cli -c 'app kubernetes restore_backup backup_name=''"'"$restore_point"'"' || { echo "Failed to delete backup.."; exit; } + exit + ;; + 2) + echo "Exiting" + exit + ;; + *) + echo "That was not an option, try again" + sleep 3 + continue + ;; + esac + done +done } export -f restore \ No newline at end of file From 79f957f8ac26f296eb19ae69c6343f552736fc0a Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 28 Jul 2022 23:49:53 -0600 Subject: [PATCH 0515/1229] exit option --- functions/backup.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/functions/backup.sh b/functions/backup.sh index ffc90786..9199a560 100644 --- a/functions/backup.sh +++ b/functions/backup.sh @@ -121,7 +121,10 @@ do echo "Choose a restore point" fi echo "$list_backups" + echo + echo "0) Exit" read -rt 120 -p "Please type a number: " selection + [[ $selection == 0 ]] && echo "Exiting.." && exit restore_point=$(echo "$list_backups" | grep ^"$selection)" | awk '{print $2}') #Check for valid selection. If none, kill script if [[ -z "$selection" ]]; then From 719e1088af8a22a1596e6537809f417bea5ddebf Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 28 Jul 2022 23:51:33 -0600 Subject: [PATCH 0516/1229] exit option for deletebackup --- functions/backup.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/functions/backup.sh b/functions/backup.sh index 9199a560..adc3fece 100644 --- a/functions/backup.sh +++ b/functions/backup.sh @@ -43,7 +43,10 @@ do echo -e "Choose a restore point to delete\nThese may be out of order if they are not HeavyScript backups" fi echo "$list_backups" + echo + echo "0) Exit" read -rt 120 -p "Please type a number: " selection + [[ $selection == 0 ]] && echo "Exiting.." && exit restore_point=$(echo "$list_backups" | grep ^"$selection)" | awk '{print $2}') #Check for valid selection. If none, kill script if [[ -z "$selection" ]]; then From 4841c568fa0ad305c6c0bb398967291776f4dda0 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 29 Jul 2022 00:08:30 -0600 Subject: [PATCH 0517/1229] better message --- functions/backup.sh | 4 ++-- functions/mount.sh | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/functions/backup.sh b/functions/backup.sh index adc3fece..1345eae2 100644 --- a/functions/backup.sh +++ b/functions/backup.sh @@ -40,7 +40,7 @@ do exit else title - echo -e "Choose a restore point to delete\nThese may be out of order if they are not HeavyScript backups" + echo -e "Choose a Restore Point to Delete\nThese may be out of order if they are not HeavyScript backups" fi echo "$list_backups" echo @@ -121,7 +121,7 @@ do exit else title - echo "Choose a restore point" + echo "Choose a Restore Point" fi echo "$list_backups" echo diff --git a/functions/mount.sh b/functions/mount.sh index aabc3989..8a096579 100644 --- a/functions/mount.sh +++ b/functions/mount.sh @@ -90,6 +90,7 @@ do fi done rmdir /mnt/heavyscript + sleep 2 ;; *) echo "Invalid selection, \"$selection\" was not an option" From 83d3ed66eca2ff733e72beb81de4e351fcdb6b36 Mon Sep 17 00:00:00 2001 From: TrueCharts-Bot Date: Fri, 29 Jul 2022 00:38:10 +0000 Subject: [PATCH 0518/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.133.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 3a80600a..23e9b61f 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@2b480926ad78a8577b1ceff20e675091543d28d5 # tag=v32.131.1 + uses: renovatebot/github-action@882edd774bd5bbda64c981b0c1dc011c61ece5d8 # tag=v32.133.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 571e00a2f4f76da51cff664d26c7969886ddd308 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 29 Jul 2022 00:25:20 -0600 Subject: [PATCH 0519/1229] delete-backup avoid extra calls --- functions/backup.sh | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/functions/backup.sh b/functions/backup.sh index 1345eae2..916291ff 100644 --- a/functions/backup.sh +++ b/functions/backup.sh @@ -42,22 +42,27 @@ do title echo -e "Choose a Restore Point to Delete\nThese may be out of order if they are not HeavyScript backups" fi - echo "$list_backups" - echo - echo "0) Exit" - read -rt 120 -p "Please type a number: " selection - [[ $selection == 0 ]] && echo "Exiting.." && exit - restore_point=$(echo "$list_backups" | grep ^"$selection)" | awk '{print $2}') - #Check for valid selection. If none, kill script - if [[ -z "$selection" ]]; then - echo "Your selection cannot be empty" - sleep 3 - continue - elif [[ -z "$restore_point" ]]; then - echo "Invalid Selection: $selection, was not an option" - sleep 3 - continue - fi + while true + do + echo "$list_backups" + echo + echo "0) Exit" + read -rt 120 -p "Please type a number: " selection + restore_point=$(echo "$list_backups" | grep ^"$selection)" | awk '{print $2}') + if [[ $selection == 0 ]]; then + echo "Exiting.." + exit + elif [[ -z "$selection" ]]; then + echo "Your selection cannot be empty" + sleep 3 + continue + elif [[ -z "$restore_point" ]]; then + echo "Invalid Selection: $selection, was not an option" + sleep 3 + continue + fi + break + done while true do clear -x From 291ad68542dc1db84e16a8773eff9332307e6770 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 29 Jul 2022 00:26:47 -0600 Subject: [PATCH 0520/1229] fix --- functions/backup.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/functions/backup.sh b/functions/backup.sh index 916291ff..2dd2c960 100644 --- a/functions/backup.sh +++ b/functions/backup.sh @@ -34,16 +34,15 @@ while true do clear -x && echo "pulling all restore points.." list_backups=$(cli -c 'app kubernetes list_backups' | sort -t '_' -Vr -k2,7 | tr -d " \t\r" | awk -F '|' '{print $2}' | nl -s ") " | column -t) - clear -x if [[ -z "$list_backups" ]]; then echo "No restore points available" exit - else - title - echo -e "Choose a Restore Point to Delete\nThese may be out of order if they are not HeavyScript backups" fi while true do + clear -x + title + echo -e "Choose a Restore Point to Delete\nThese may be out of order if they are not HeavyScript backups" echo "$list_backups" echo echo "0) Exit" From 73f060cea334d8325c7c744a5a909dbc9ff62024 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 29 Jul 2022 00:34:55 -0600 Subject: [PATCH 0521/1229] restore update --- functions/backup.sh | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/functions/backup.sh b/functions/backup.sh index 2dd2c960..b875e08c 100644 --- a/functions/backup.sh +++ b/functions/backup.sh @@ -119,30 +119,33 @@ while true do clear -x && echo "pulling restore points.." list_backups=$(cli -c 'app kubernetes list_backups' | grep "HeavyScript_" | sort -t '_' -Vr -k2,7 | tr -d " \t\r" | awk -F '|' '{print $2}' | nl -s ") " | column -t) - clear -x if [[ -z "$list_backups" ]]; then echo "No HeavyScript restore points available" exit - else + fi + while true + do + clear -x title echo "Choose a Restore Point" - fi - echo "$list_backups" - echo - echo "0) Exit" - read -rt 120 -p "Please type a number: " selection - [[ $selection == 0 ]] && echo "Exiting.." && exit - restore_point=$(echo "$list_backups" | grep ^"$selection)" | awk '{print $2}') - #Check for valid selection. If none, kill script - if [[ -z "$selection" ]]; then - echo "Your selection cannot be empty" - sleep 3 - continue - elif [[ -z "$restore_point" ]]; then - echo "Invalid Selection: $selection, was not an option" - sleep 3 - continue - fi + echo "$list_backups" + echo + echo "0) Exit" + read -rt 120 -p "Please type a number: " selection + restore_point=$(echo "$list_backups" | grep ^"$selection)" | awk '{print $2}') + if [[ $selection == 0 ]]; then + echo "Exiting.." + exit + elif [[ -z "$selection" ]]; then + echo "Your selection cannot be empty" + sleep 3 + continue + elif [[ -z "$restore_point" ]]; then + echo "Invalid Selection: $selection, was not an option" + sleep 3 + continue + fi + done while true do clear -x From 06c80dd5ebc1dc5619b4fa720adf33b06664b16a Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 29 Jul 2022 00:35:54 -0600 Subject: [PATCH 0522/1229] break --- functions/backup.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/functions/backup.sh b/functions/backup.sh index b875e08c..9561b5d6 100644 --- a/functions/backup.sh +++ b/functions/backup.sh @@ -145,6 +145,7 @@ do sleep 3 continue fi + break done while true do From 21c46258f62b523e35f3ea5e925961ed0678c156 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 29 Jul 2022 00:45:22 -0600 Subject: [PATCH 0523/1229] break on bottom line --- functions/update_apps.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 460877eb..be33626f 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -117,11 +117,13 @@ if [[ $rollback == "true" ]]; then elif [[ "$status" == "STOPPED" ]]; then [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Stopped..") && sleep 15 && continue #if reports stopped on FIRST time through loop, double check [[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports stopped on FIRST time through loop, double check - echo_array+=("Stopped") && break #if reports stopped any time after the first loop, assume its extermal services. + echo_array+=("Stopped") + break #if reports stopped any time after the first loop, assume its extermal services. elif [[ "$status" == "ACTIVE" ]]; then [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Active..") && sleep 15 && continue #if reports active on FIRST time through loop, double check [[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports active on FIRST time through loop, double check - echo_array+=("Active") && break #if reports active any time after the first loop, assume actually active. + echo_array+=("Active") + break #if reports active any time after the first loop, assume actually active. else [[ "$verbose" == "true" ]] && echo_array+=("Waiting $((timeout-SECONDS)) more seconds for $app_name to be ACTIVE") sleep 15 @@ -137,7 +139,7 @@ else if [[ "$status" == "STOPPED" ]]; then [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Stopped..") && sleep 15 && continue #if reports stopped on FIRST time through loop, double check [[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports stopped on FIRST time through loop, double check - echo_array+=("Stopped") && break #assume actually stopped anytime AFTER the first loop + echo_array+=("Stopped") #assume actually stopped anytime AFTER the first loop break elif [[ "$status" == "ACTIVE" ]]; then [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Active..") && sleep 15 && continue #if reports active on FIRST time through loop, double check From 542ac5ee0b6582f7d89aad286c5d73ffe5e46a9e Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 29 Jul 2022 00:47:38 -0600 Subject: [PATCH 0524/1229] remove unused help --- heavy_script.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index f0e3015c..adb5022c 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -52,14 +52,14 @@ do deleteBackup="true" ;; *) - echo -e "Invalid Option \"--$OPTARG\"\n" && help - exit + echo -e "Invalid Option \"--$OPTARG\"\n" + help ;; esac ;; :) - echo -e "Option: \"-$OPTARG\" requires an argument\n" && help - exit + echo -e "Option: \"-$OPTARG\" requires an argument\n" + help ;; b) number_of_backups=$OPTARG @@ -119,12 +119,12 @@ do verbose="true" ;; \?) - echo -e "Invalid Option \"-$OPTARG\"\n" && help - exit + echo -e "Invalid Option \"-$OPTARG\"\n" + help ;; *) - echo -e "Invalid Option \"-$OPTARG\"\n" && help - exit + echo -e "Invalid Option \"-$OPTARG\"\n" + help ;; esac done From 3107bc97cd351ba5aa3f58b93c04dde5d5d85fd7 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 29 Jul 2022 00:50:33 -0600 Subject: [PATCH 0525/1229] change lines --- functions/mount.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/functions/mount.sh b/functions/mount.sh index 8a096579..ec2d7938 100644 --- a/functions/mount.sh +++ b/functions/mount.sh @@ -84,9 +84,11 @@ do echo "$i is a name used on more than one pool.. attempting to use your current kubernetes apps pool" pool=$(cli -c 'app kubernetes config' | grep -E "dataset\s\|" | awk -F '|' '{print $3}' | awk -F '/' '{print $1}' | tr -d " \t\n\r") full_path=$(find /mnt/"$pool"/ix-applications/releases/"$app"/volumes/ -maxdepth 0 | cut -c 6-) - zfs set mountpoint=legacy "$full_path""$pvc" && echo "$i unmounted" && rmdir /mnt/heavyscript/"$i" || echo "failed to unmount $i" + zfs set mountpoint=legacy "$full_path""$pvc" + echo "$i unmounted" && rmdir /mnt/heavyscript/"$i" || echo "failed to unmount $i" else - zfs set mountpoint=legacy "$path""$pvc" && echo "$i unmounted" && rmdir /mnt/heavyscript/"$i" || echo "failed to unmount $i" + zfs set mountpoint=legacy "$path""$pvc" + echo "$i unmounted" && rmdir /mnt/heavyscript/"$i" || echo "failed to unmount $i" fi done rmdir /mnt/heavyscript From b1c62e68922664fe64f66a14752427816c246374 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 29 Jul 2022 00:52:26 -0600 Subject: [PATCH 0526/1229] mount clear after continue --- functions/mount.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/functions/mount.sh b/functions/mount.sh index ec2d7938..210f9699 100644 --- a/functions/mount.sh +++ b/functions/mount.sh @@ -57,6 +57,7 @@ do read -rt 120 -p "Please type a number: " yesno case $yesno in 1) + clear -x break ;; 2) From 42558612463d4c463f470e205492a050d6cbd3c3 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 29 Jul 2022 00:53:11 -0600 Subject: [PATCH 0527/1229] add title again --- functions/mount.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/functions/mount.sh b/functions/mount.sh index 210f9699..da01352d 100644 --- a/functions/mount.sh +++ b/functions/mount.sh @@ -58,6 +58,7 @@ do case $yesno in 1) clear -x + title break ;; 2) From f1f495544ba59218b7802b890e81dcc214e4bb5c Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 29 Jul 2022 00:56:12 -0600 Subject: [PATCH 0528/1229] better output after invalid --- functions/mount.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/mount.sh b/functions/mount.sh index da01352d..993e4d51 100644 --- a/functions/mount.sh +++ b/functions/mount.sh @@ -23,7 +23,7 @@ do echo "$list" read -rt 120 -p "Please type a number: " selection app=$(echo -e "$list" | grep ^"$selection " | awk '{print $2}' | cut -c 4- ) - [[ -z "$app" ]] && echo "Invalid Selection: $selection, was not an option" && sleep 5 && continue #Check for valid selection. If none, kill script + [[ -z "$app" ]] && echo "Invalid Selection: $selection, was not an option" && sleep 3 && clear -x && title && echo "$list" continue #Check for valid selection. If none, contiue pvc=$(echo -e "$list" | grep ^"$selection ") status=$(cli -m csv -c 'app chart_release query name,status' | grep -E "^$app\b" | awk -F ',' '{print $2}'| tr -d " \t\n\r") if [[ "$status" != "STOPPED" ]]; then From fd26ef349a38e7c6b9b597789bdd36197d5b35b5 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 29 Jul 2022 00:56:55 -0600 Subject: [PATCH 0529/1229] whoops --- functions/mount.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/mount.sh b/functions/mount.sh index 993e4d51..c52ee704 100644 --- a/functions/mount.sh +++ b/functions/mount.sh @@ -23,7 +23,7 @@ do echo "$list" read -rt 120 -p "Please type a number: " selection app=$(echo -e "$list" | grep ^"$selection " | awk '{print $2}' | cut -c 4- ) - [[ -z "$app" ]] && echo "Invalid Selection: $selection, was not an option" && sleep 3 && clear -x && title && echo "$list" continue #Check for valid selection. If none, contiue + [[ -z "$app" ]] && echo "Invalid Selection: $selection, was not an option" && sleep 3 && clear -x && title && echo "$list" && continue #Check for valid selection. If none, contiue pvc=$(echo -e "$list" | grep ^"$selection ") status=$(cli -m csv -c 'app chart_release query name,status' | grep -E "^$app\b" | awk -F ',' '{print $2}'| tr -d " \t\n\r") if [[ "$status" != "STOPPED" ]]; then From a211dc9a8ae7d72e68c66f0e334e60afed15913f Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 29 Jul 2022 00:58:49 -0600 Subject: [PATCH 0530/1229] tired --- functions/mount.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/functions/mount.sh b/functions/mount.sh index c52ee704..d88253cd 100644 --- a/functions/mount.sh +++ b/functions/mount.sh @@ -20,10 +20,12 @@ do while true do list=$(k3s kubectl get pvc -A | sort -u | awk '{print NR-1, "\t" $1 "\t" $2 "\t" $4}' | column -t | sed "s/^0/ /") + clear -x + title echo "$list" read -rt 120 -p "Please type a number: " selection app=$(echo -e "$list" | grep ^"$selection " | awk '{print $2}' | cut -c 4- ) - [[ -z "$app" ]] && echo "Invalid Selection: $selection, was not an option" && sleep 3 && clear -x && title && echo "$list" && continue #Check for valid selection. If none, contiue + [[ -z "$app" ]] && echo "Invalid Selection: $selection, was not an option" && sleep 3 && continue #Check for valid selection. If none, contiue pvc=$(echo -e "$list" | grep ^"$selection ") status=$(cli -m csv -c 'app chart_release query name,status' | grep -E "^$app\b" | awk -F ',' '{print $2}'| tr -d " \t\n\r") if [[ "$status" != "STOPPED" ]]; then From 22589499ada538ad9272c9826fb335a47cae072d Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 29 Jul 2022 01:02:13 -0600 Subject: [PATCH 0531/1229] avoid calling more than once --- functions/mount.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/functions/mount.sh b/functions/mount.sh index d88253cd..8082d0f8 100644 --- a/functions/mount.sh +++ b/functions/mount.sh @@ -10,7 +10,7 @@ do echo echo "0) Exit" read -rt 120 -p "Unmount All Please type a number: " selection - + list=$(k3s kubectl get pvc -A | sort -u | awk '{print NR-1, "\t" $1 "\t" $2 "\t" $4}' | column -t | sed "s/^0/ /") case $selection in 0) echo "Exiting.." @@ -19,7 +19,6 @@ do 1) while true do - list=$(k3s kubectl get pvc -A | sort -u | awk '{print NR-1, "\t" $1 "\t" $2 "\t" $4}' | column -t | sed "s/^0/ /") clear -x title echo "$list" From 717306e01f39d075d1fc925c54d723aac8bbe452 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 29 Jul 2022 01:03:01 -0600 Subject: [PATCH 0532/1229] only list with option 1 --- functions/mount.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/mount.sh b/functions/mount.sh index 8082d0f8..422a10e3 100644 --- a/functions/mount.sh +++ b/functions/mount.sh @@ -10,13 +10,13 @@ do echo echo "0) Exit" read -rt 120 -p "Unmount All Please type a number: " selection - list=$(k3s kubectl get pvc -A | sort -u | awk '{print NR-1, "\t" $1 "\t" $2 "\t" $4}' | column -t | sed "s/^0/ /") case $selection in 0) echo "Exiting.." exit ;; 1) + list=$(k3s kubectl get pvc -A | sort -u | awk '{print NR-1, "\t" $1 "\t" $2 "\t" $4}' | column -t | sed "s/^0/ /") while true do clear -x From 4f303e3489a40dbdcf1315cd367366e1c0af2302 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 29 Jul 2022 01:22:59 -0600 Subject: [PATCH 0533/1229] while loop for async check --- functions/menu.sh | 72 ++++++++++++++++++++++++++--------------------- 1 file changed, 40 insertions(+), 32 deletions(-) diff --git a/functions/menu.sh b/functions/menu.sh index 27e702a6..710a144a 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -59,39 +59,47 @@ case $selection in echo read -rt 600 -p "Please type the number associated with the flag above: " current_selection if [[ $current_selection == 1 ]]; then - echo -e "\nHow many applications do you want updating at the same time?" - read -rt 600 -p "Please type an integer greater than 0: " up_async - if [[ $up_async == 0 ]]; then - echo "Error: \"$up_async\" is less than 1" - echo "NOT adding it to the list" - sleep 5 - continue - elif ! [[ $up_async =~ ^[0-9]+$ ]]; then - echo "Error: \"$up_async\" is invalid, it needs to be an integer" - echo "NOT adding it to the list" - sleep 5 - continue - else - update_selection+=("-U" "$up_async") - break - fi + while true + do + echo -e "\nHow many applications do you want updating at the same time?" + read -rt 600 -p "Please type an integer greater than 0: " up_async + if [[ $up_async == 0 ]]; then + echo "Error: \"$up_async\" is less than 1" + echo "NOT adding it to the list" + sleep 5 + continue + elif ! [[ $up_async =~ ^[0-9]+$ ]]; then + echo "Error: \"$up_async\" is invalid, it needs to be an integer" + echo "NOT adding it to the list" + sleep 5 + continue + else + update_selection+=("-U" "$up_async") + break + fi + done + break elif [[ $current_selection == 2 ]]; then - echo -e "\nHow many applications do you want updating at the same time?" - read -rt 600 -p "Please type an integer greater than 0: " up_async - if [[ $up_async == 0 ]]; then - echo "Error: \"$up_async\" is less than 1" - echo "NOT adding it to the list" - sleep 5 - continue - elif ! [[ $up_async =~ ^[0-9]+$ ]]; then - echo "Error: \"$up_async\" is invalid, it needs to be an integer" - echo "NOT adding it to the list" - sleep 5 - continue - else - update_selection+=("-u" "$up_async") - break - fi + while true + do + echo -e "\nHow many applications do you want updating at the same time?" + read -rt 600 -p "Please type an integer greater than 0: " up_async + if [[ $up_async == 0 ]]; then + echo "Error: \"$up_async\" is less than 1" + echo "NOT adding it to the list" + sleep 5 + continue + elif ! [[ $up_async =~ ^[0-9]+$ ]]; then + echo "Error: \"$up_async\" is invalid, it needs to be an integer" + echo "NOT adding it to the list" + sleep 5 + continue + else + update_selection+=("-u" "$up_async") + break + fi + done + break elif [[ $current_selection == 0 ]]; then echo "Exiting.." exit From c7c3be0d95a7a5ad3368d0d6ed0105add3e44313 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 29 Jul 2022 01:26:47 -0600 Subject: [PATCH 0534/1229] exit for updates menu --- functions/menu.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/functions/menu.sh b/functions/menu.sh index 710a144a..8330cc33 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -127,12 +127,18 @@ case $selection in echo "99) Remove Update Options, Restart" echo "00) Done making selections, proceed with update" echo + echo "0) Exit" + echo echo "Current Choices" echo "---------------" echo "bash heavy_script.sh ${update_selection[*]}" echo read -rt 600 -p "Type the Number OR Flag: " current_selection case $current_selection in + 0) + echo "Exiting.." + exit + ;; 00) clear -x echo "Running \"bash heavy_script.sh ${update_selection[*]}\"" From 3baffef323f522cc511d994a2f5a42372050ce5b Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 29 Jul 2022 01:30:27 -0600 Subject: [PATCH 0535/1229] exit menu mount --- functions/mount.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/functions/mount.sh b/functions/mount.sh index 422a10e3..c15158b3 100644 --- a/functions/mount.sh +++ b/functions/mount.sh @@ -22,7 +22,10 @@ do clear -x title echo "$list" + echo + echo "0 Exit" read -rt 120 -p "Please type a number: " selection + [[ $selection == 0 ]] && echo "Exiting.." && exit app=$(echo -e "$list" | grep ^"$selection " | awk '{print $2}' | cut -c 4- ) [[ -z "$app" ]] && echo "Invalid Selection: $selection, was not an option" && sleep 3 && continue #Check for valid selection. If none, contiue pvc=$(echo -e "$list" | grep ^"$selection ") From d70bb33dd3dadbba040402ab4cad42e23892e526 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 29 Jul 2022 01:51:37 -0600 Subject: [PATCH 0536/1229] test --- functions/mount.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/functions/mount.sh b/functions/mount.sh index c15158b3..cd700a67 100644 --- a/functions/mount.sh +++ b/functions/mount.sh @@ -16,7 +16,11 @@ do exit ;; 1) - list=$(k3s kubectl get pvc -A | sort -u | awk '{print NR-1, "\t" $1 "\t" $2 "\t" $4}' | column -t | sed "s/^0/ /") + call=$(k3s kubectl get pvc -A | sort -u | awk '{print $1 "\t" $2 "\t" $4}' | column -t | sed "s/^0/ /") + mount_list=$(echo "$call" | sed 1d | nl -s ") ") + mount_title=$(echo "$call" | head -n 1) + list=$(echo -e "$mount_title \n $mount_title") + while true do clear -x From e39912f0b1bee19658a0d484224cf11de7bb5935 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 29 Jul 2022 01:52:27 -0600 Subject: [PATCH 0537/1229] test --- functions/mount.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/mount.sh b/functions/mount.sh index cd700a67..d0c28ce1 100644 --- a/functions/mount.sh +++ b/functions/mount.sh @@ -19,7 +19,7 @@ do call=$(k3s kubectl get pvc -A | sort -u | awk '{print $1 "\t" $2 "\t" $4}' | column -t | sed "s/^0/ /") mount_list=$(echo "$call" | sed 1d | nl -s ") ") mount_title=$(echo "$call" | head -n 1) - list=$(echo -e "$mount_title \n $mount_title") + list=$(echo -e "$mount_title\n$mount_list") while true do From dba0e738e6ec96d7f6f44299c71104b322f13ec4 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 29 Jul 2022 01:53:05 -0600 Subject: [PATCH 0538/1229] test --- functions/mount.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/mount.sh b/functions/mount.sh index d0c28ce1..0778a522 100644 --- a/functions/mount.sh +++ b/functions/mount.sh @@ -16,10 +16,10 @@ do exit ;; 1) - call=$(k3s kubectl get pvc -A | sort -u | awk '{print $1 "\t" $2 "\t" $4}' | column -t | sed "s/^0/ /") + call=$(k3s kubectl get pvc -A | sort -u | awk '{print $1 "\t" $2 "\t" $4}' | sed "s/^0/ /") mount_list=$(echo "$call" | sed 1d | nl -s ") ") mount_title=$(echo "$call" | head -n 1) - list=$(echo -e "$mount_title\n$mount_list") + list=$(echo -e "$mount_title\n$mount_list" | column -t) while true do From 978fdd7866b32f78d305fad2c8365c892818e1df Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 29 Jul 2022 01:53:49 -0600 Subject: [PATCH 0539/1229] test --- functions/mount.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/mount.sh b/functions/mount.sh index 0778a522..b155071e 100644 --- a/functions/mount.sh +++ b/functions/mount.sh @@ -19,7 +19,7 @@ do call=$(k3s kubectl get pvc -A | sort -u | awk '{print $1 "\t" $2 "\t" $4}' | sed "s/^0/ /") mount_list=$(echo "$call" | sed 1d | nl -s ") ") mount_title=$(echo "$call" | head -n 1) - list=$(echo -e "$mount_title\n$mount_list" | column -t) + list=$(echo -e "# $mount_title\n$mount_list" | column -t) while true do From 4e24d1577e5256ad9e84bedbe5ef3e246bdb78a8 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 29 Jul 2022 01:55:09 -0600 Subject: [PATCH 0540/1229] test --- functions/mount.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/mount.sh b/functions/mount.sh index b155071e..82909364 100644 --- a/functions/mount.sh +++ b/functions/mount.sh @@ -19,7 +19,7 @@ do call=$(k3s kubectl get pvc -A | sort -u | awk '{print $1 "\t" $2 "\t" $4}' | sed "s/^0/ /") mount_list=$(echo "$call" | sed 1d | nl -s ") ") mount_title=$(echo "$call" | head -n 1) - list=$(echo -e "# $mount_title\n$mount_list" | column -t) + list=$(echo -e "# $mount_title\n$mount_list\n\n0) Exit" | column -t) while true do From 67a6436944e4f0eb6362c6728cd2f673fabf1819 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 29 Jul 2022 01:56:58 -0600 Subject: [PATCH 0541/1229] mount number brackets --- functions/mount.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/functions/mount.sh b/functions/mount.sh index 82909364..52a32359 100644 --- a/functions/mount.sh +++ b/functions/mount.sh @@ -19,7 +19,7 @@ do call=$(k3s kubectl get pvc -A | sort -u | awk '{print $1 "\t" $2 "\t" $4}' | sed "s/^0/ /") mount_list=$(echo "$call" | sed 1d | nl -s ") ") mount_title=$(echo "$call" | head -n 1) - list=$(echo -e "# $mount_title\n$mount_list\n\n0) Exit" | column -t) + list=$(echo -e "# $mount_title\n$mount_list" | column -t) while true do @@ -27,12 +27,12 @@ do title echo "$list" echo - echo "0 Exit" + echo "0) Exit" read -rt 120 -p "Please type a number: " selection [[ $selection == 0 ]] && echo "Exiting.." && exit - app=$(echo -e "$list" | grep ^"$selection " | awk '{print $2}' | cut -c 4- ) + app=$(echo -e "$list" | grep ^"$selection)" | awk '{print $2}' | cut -c 4- ) [[ -z "$app" ]] && echo "Invalid Selection: $selection, was not an option" && sleep 3 && continue #Check for valid selection. If none, contiue - pvc=$(echo -e "$list" | grep ^"$selection ") + pvc=$(echo -e "$list" | grep ^"$selection)") status=$(cli -m csv -c 'app chart_release query name,status' | grep -E "^$app\b" | awk -F ',' '{print $2}'| tr -d " \t\n\r") if [[ "$status" != "STOPPED" ]]; then [[ -z $timeout ]] && echo -e "\nDefault Timeout: 500" && timeout=500 || echo -e "\nCustom Timeout: $timeout" From df19c4f553971e6fd7e1540598d354994bdcfedd Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 29 Jul 2022 01:58:44 -0600 Subject: [PATCH 0542/1229] mounting complete --- functions/mount.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/functions/mount.sh b/functions/mount.sh index 52a32359..e574fcac 100644 --- a/functions/mount.sh +++ b/functions/mount.sh @@ -20,7 +20,6 @@ do mount_list=$(echo "$call" | sed 1d | nl -s ") ") mount_title=$(echo "$call" | head -n 1) list=$(echo -e "# $mount_title\n$mount_list" | column -t) - while true do clear -x From dd598adf6071743f58189c30e9365f4eee6c3ef6 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 29 Jul 2022 19:15:50 +0000 Subject: [PATCH 0543/1229] change self-update from beta to main --- functions/self_update.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/functions/self_update.sh b/functions/self_update.sh index 586cadc9..5c2178d0 100644 --- a/functions/self_update.sh +++ b/functions/self_update.sh @@ -4,8 +4,7 @@ args=("$@") self_update() { git fetch &> /dev/null echo "🅂 🄴 🄻 🄵 🅄 🄿 🄳 🄰 🅃 🄴" -# TODO: change beta to main once testing is complete -if git diff --name-only origin/beta | grep -qs ".sh" ; then +if git diff --name-only origin/main | grep -qs ".sh" ; then echo "Found a new version of HeavyScript, updating myself..." git reset --hard -q git pull --force -q @@ -25,4 +24,4 @@ else echo -e "HeavyScript is already the latest version\n" fi } -export -f self_update \ No newline at end of file +export -f self_update From 43075b8533864eaebc2bc74b3ea482d227b28edf Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 29 Jul 2022 20:19:59 +0000 Subject: [PATCH 0544/1229] remove spaces --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index eae9ad0b..3dd5d4d3 100644 --- a/README.md +++ b/README.md @@ -42,9 +42,7 @@ ### Examples #### Typical Cron Job ``` - bash heavy_script.sh --self-update -b 14 -i portainer -i arch -i sonarr -i radarr -t 600 -rsp -u 5 - ``` > `-b` is set to 14. Up to 14 snapshots of your ix-applications dataset will be saved From 14942a92e09f56d721ecc4ed0c786f68b0a279e7 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 29 Jul 2022 20:20:58 +0000 Subject: [PATCH 0545/1229] remove double --self-update --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 3dd5d4d3..45cea470 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,6 @@ bash heavy_script.sh --self-update -b 14 -i portainer -i arch -i sonarr -i radar > `--self-update` Will update the script prior to running anything else. -> `--self-update` Will update the script prior to running anything else. #### Mounting PVC Data From 482cc99837761a80c0d02f9ac9f8ffba3f435d96 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 29 Jul 2022 20:33:30 +0000 Subject: [PATCH 0546/1229] return : in ignore --- heavy_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heavy_script.sh b/heavy_script.sh index 6de0e9de..db7068c2 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -32,7 +32,7 @@ source functions/update_apps.sh # Parse script options -while getopts ":sirb:t:uUpSRv-:" opt +while getopts ":si:rb:t:uUpSRv-:" opt do case $opt in -) From 1ce6422f2361353fd428212bcbbe75c8f34961ed Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 29 Jul 2022 16:13:01 -0600 Subject: [PATCH 0547/1229] change invalid input to sleep 3 --- functions/backup.sh | 2 +- functions/menu.sh | 40 ++++++++++++++++++++-------------------- functions/mount.sh | 6 +++--- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/functions/backup.sh b/functions/backup.sh index 9561b5d6..9f2de90f 100644 --- a/functions/backup.sh +++ b/functions/backup.sh @@ -60,7 +60,7 @@ do sleep 3 continue fi - break + break # Break out of the loop if all of the If statement checks above are untrue done while true do diff --git a/functions/menu.sh b/functions/menu.sh index 8330cc33..b9d0bcc5 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -66,12 +66,12 @@ case $selection in if [[ $up_async == 0 ]]; then echo "Error: \"$up_async\" is less than 1" echo "NOT adding it to the list" - sleep 5 + sleep 3 continue elif ! [[ $up_async =~ ^[0-9]+$ ]]; then echo "Error: \"$up_async\" is invalid, it needs to be an integer" echo "NOT adding it to the list" - sleep 5 + sleep 3 continue else update_selection+=("-U" "$up_async") @@ -87,12 +87,12 @@ case $selection in if [[ $up_async == 0 ]]; then echo "Error: \"$up_async\" is less than 1" echo "NOT adding it to the list" - sleep 5 + sleep 3 continue elif ! [[ $up_async =~ ^[0-9]+$ ]]; then echo "Error: \"$up_async\" is invalid, it needs to be an integer" echo "NOT adding it to the list" - sleep 5 + sleep 3 continue else update_selection+=("-u" "$up_async") @@ -104,7 +104,7 @@ case $selection in echo "Exiting.." exit else - echo "$current_selection was not an option, try again" && sleep 5 + echo "$current_selection was not an option, try again" && sleep 3 continue fi done @@ -147,48 +147,48 @@ case $selection in exit ;; 1 | -b) - printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-b" && echo -e "\"-b\" is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it + printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-b" && echo -e "\"-b\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it echo "Up to how many backups should we keep?" read -rt 600 -p "Please type an integer: " up_backups - ! [[ $up_backups =~ ^[0-9]+$ ]] && echo -e "Error: \"$up_backups\" is invalid, it needs to be an integer\nNOT adding it to the list" && sleep 5 && continue - [[ $up_backups == 0 ]] && echo -e "Error: Number of backups cannot be 0\nNOT adding it to the list" && sleep 5 && continue + ! [[ $up_backups =~ ^[0-9]+$ ]] && echo -e "Error: \"$up_backups\" is invalid, it needs to be an integer\nNOT adding it to the list" && sleep 3 && continue + [[ $up_backups == 0 ]] && echo -e "Error: Number of backups cannot be 0\nNOT adding it to the list" && sleep 3 && continue update_selection+=("-b" "$up_backups") ;; 2 | -i) read -rt 600 -p "What is the name of the application we should ignore?: " up_ignore - ! [[ $up_ignore =~ ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ ]] && echo -e "Error: \"$up_ignore\" is not a possible option for an application name" && sleep 5 && continue + ! [[ $up_ignore =~ ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ ]] && echo -e "Error: \"$up_ignore\" is not a possible option for an application name" && sleep 3 && continue update_selection+=("-i" "$up_ignore") ;; 3 | -r) - printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-r" && echo -e "\"-r\" is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it + printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-r" && echo -e "\"-r\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it update_selection+=("-r") ;; 4 | -S) - printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-S" && echo -e "\"-S\" is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it + printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-S" && echo -e "\"-S\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it update_selection+=("-S") ;; 5 | -v) - printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-v" && echo -e "\"-v\" is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it + printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-v" && echo -e "\"-v\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it update_selection+=("-v") ;; 6 | -t) - printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-t" && echo -e "\"-t\" is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it + printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-t" && echo -e "\"-t\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it echo "What do you want your timeout to be?" read -rt 600 -p "Please type an integer: " up_timeout - ! [[ $up_timeout =~ ^[0-9]+$ ]] && echo -e "Error: \"$up_timeout\" is invalid, it needs to be an integer\nNOT adding it to the list" && sleep 5 && continue + ! [[ $up_timeout =~ ^[0-9]+$ ]] && echo -e "Error: \"$up_timeout\" is invalid, it needs to be an integer\nNOT adding it to the list" && sleep 3 && continue update_selection+=("-t" "$up_timeout") ;; 7 | -s) - printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-s" && echo -e "\"-s\" is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it + printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-s" && echo -e "\"-s\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it update_selection+=("-s") ;; 8 | -p) - printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-p" && echo -e "\"-p\" is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it + printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-p" && echo -e "\"-p\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it update_selection+=("-p") ;; 9 | --self-update ) - printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "--self-update" && echo -e "\"--self-update\" is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it + printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "--self-update" && echo -e "\"--self-update\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it update_selection+=("--self-update") ;; 99) @@ -200,17 +200,17 @@ case $selection in echo "$i removed" ((count++)) done - sleep 5 + sleep 3 continue ;; *) - echo "\"$current_selection\" was not an option, try again" && sleep 5 && continue + echo "\"$current_selection\" was not an option, try again" && sleep 3 && continue ;; esac done ;; *) - echo "\"$selection\" was not an option, please try agian" && sleep 5 && menu + echo "\"$selection\" was not an option, please try agian" && sleep 3 && menu ;; esac echo diff --git a/functions/mount.sh b/functions/mount.sh index e574fcac..db369b4c 100644 --- a/functions/mount.sh +++ b/functions/mount.sh @@ -73,7 +73,7 @@ do ;; *) echo "Invalid selection \"$yesno\" was not an option" - sleep 2 + sleep 3 continue ;; esac @@ -101,11 +101,11 @@ do fi done rmdir /mnt/heavyscript - sleep 2 + sleep 3 ;; *) echo "Invalid selection, \"$selection\" was not an option" - sleep 2 + sleep 3 continue ;; esac From c20898c396a53a5983c95c18881a223a85c96639 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 29 Jul 2022 16:18:44 -0600 Subject: [PATCH 0548/1229] Change backups to 10 README --- README.md | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 45cea470..7199c34e 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ | --dns | --dns | None | list all of your applications DNS names and their web ports | | -U | -U
-U 5 | None or Integer | Update applications, ignoring major version changes
_Optionally, you can supply a number after the argument to update multiple applications at once_ | | -u | -u
-u 5 | None or Integer | Update applications, do NOT update if there was a major version change
_Optionally, you can supply a number after the argument to update multiple applications at once_ | -| -b | -b 14 | Integer | Backup `ix-appliactions` dataset
_Creates backups up to the number you've chosen_ | +| -b | -b 10 | Integer | Backup `ix-appliactions` dataset
_Creates backups up to the number you've chosen_ | | -i | -i nextcloud -i sonarr | String | Applications listed will be ignored during updating
_List one application after another as shown in the example_ | | -r | -r | None | Monitors applications after they update
If the app does not become "ACTIVE" after either:
The custom Timeout, or Default Timeout,
rollback the application. | | -v | -v | None | Verbose Output
_Look at the bottom of this page for an example_ | @@ -42,10 +42,10 @@ ### Examples #### Typical Cron Job ``` -bash heavy_script.sh --self-update -b 14 -i portainer -i arch -i sonarr -i radarr -t 600 -rsp -u 5 +bash heavy_script.sh --self-update -b 10 -i portainer -i arch -i sonarr -i radarr -t 600 -rsp -u 5 ``` -> `-b` is set to 14. Up to 14 snapshots of your ix-applications dataset will be saved +> `-b` is set to 10. Up to 10 snapshots of your ix-applications dataset will be saved > `-i` is set to ignore portainer, arch, sonarr, and radarr. These applications will be ignored when it comes to updates. @@ -88,10 +88,9 @@ bash /mnt/tank/scripts/heavy_script/heavy_script.sh --dns ``` #### My personal Cron Job + ``` - -bash /mnt/speed/scripts/heavy_script/heavy_script.sh --self-update -b 14 -rsp -u 10 - +bash /mnt/speed/scripts/heavy_script/heavy_script.sh --self-update -b 10 -rsp -u 10 ```
@@ -147,7 +146,7 @@ git pull ### Update with the scripts built-in option ``` -bash heavyscript.sh --self-update -b 14 -supr +bash heavyscript.sh --self-update -b 10 -supr ``` > The important argument here is the `--self-update`, you can still use all of your same arguments with this option. @@ -166,7 +165,7 @@ bash heavyscript.sh --self-update -b 14 -supr | Name | Value | Reason | |------------------------ |------------------------------------------------------------------------------------------------------------------- |------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `Description` | HeavyScript git pull and Update apps | This is up to you, put whatever you think is a good description in here | -| `Command` | `bash /PATH/TO/HEAVY_SCRIPT_DIRECTORY/heavy_script.sh --self-update -b 14 -rsup` | This is the command you will be running on your schedule I personally use: `bash /mnt/speed/scripts/heavy_script/heavy_script.sh --self-update -b 14 -rsup` | +| `Command` | `bash /PATH/TO/HEAVY_SCRIPT_DIRECTORY/heavy_script.sh --self-update -b 10 -rsup` | This is the command you will be running on your schedule I personally use: `bash /mnt/speed/scripts/heavy_script/heavy_script.sh --self-update -b 10 -rsup` | | `Run As User` | `root` | Running the script as `root` is REQUIRED. You cannot access all of the kubernetes functions without this user. | | `Schedule` | Up to you, I run mine everyday at `0400` | Again up to you | | `Hide Standard Output` | `False` or Unticked | I like to receive an email report of how the script ran, what apps updated etc. | From 3860c16148baced95d4019e044648a94d2e5b59e Mon Sep 17 00:00:00 2001 From: TrueCharts-Bot Date: Sat, 30 Jul 2022 00:32:39 +0000 Subject: [PATCH 0549/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.134.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 23e9b61f..a6104468 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@882edd774bd5bbda64c981b0c1dc011c61ece5d8 # tag=v32.133.0 + uses: renovatebot/github-action@811ced1628f54adbd50df235fec78b5299b887ca # tag=v32.134.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From d99e377134397a9bffecf56b49cae4e98691a9ea Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sat, 30 Jul 2022 15:58:54 -0600 Subject: [PATCH 0550/1229] Remove redundant cd --- functions/menu.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/functions/menu.sh b/functions/menu.sh index b9d0bcc5..3a671fc1 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -1,10 +1,6 @@ #!/bin/bash menu(){ -script=$(readlink -f "$0") -script_path=$(dirname "$script") -script_name="heavy_script.sh" -cd "$script_path" || exit clear -x title echo "1) Help" From ebb472dae789b5455e85aff53a62c9ba3ca4b084 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sat, 30 Jul 2022 16:12:45 -0600 Subject: [PATCH 0551/1229] timeout 120 instead of 600 --- functions/menu.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/functions/menu.sh b/functions/menu.sh index 3a671fc1..365dd773 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -13,7 +13,7 @@ echo "7) Update HeavyScript" echo "8) Update Applications" echo echo "0) Exit" -read -rt 600 -p "Please select an option by number: " selection +read -rt 120 -p "Please select an option by number: " selection case $selection in 0) @@ -29,7 +29,7 @@ case $selection in mount="true" ;; 4) - read -rt 600 -p "What is the maximun number of backups you would like?: " number_of_backups + read -rt 120 -p "What is the maximun number of backups you would like?: " number_of_backups backup="true" ;; 5) @@ -53,12 +53,12 @@ case $selection in echo echo "0) Exit" echo - read -rt 600 -p "Please type the number associated with the flag above: " current_selection + read -rt 120 -p "Please type the number associated with the flag above: " current_selection if [[ $current_selection == 1 ]]; then while true do echo -e "\nHow many applications do you want updating at the same time?" - read -rt 600 -p "Please type an integer greater than 0: " up_async + read -rt 120 -p "Please type an integer greater than 0: " up_async if [[ $up_async == 0 ]]; then echo "Error: \"$up_async\" is less than 1" echo "NOT adding it to the list" @@ -79,7 +79,7 @@ case $selection in while true do echo -e "\nHow many applications do you want updating at the same time?" - read -rt 600 -p "Please type an integer greater than 0: " up_async + read -rt 120 -p "Please type an integer greater than 0: " up_async if [[ $up_async == 0 ]]; then echo "Error: \"$up_async\" is less than 1" echo "NOT adding it to the list" @@ -129,7 +129,7 @@ case $selection in echo "---------------" echo "bash heavy_script.sh ${update_selection[*]}" echo - read -rt 600 -p "Type the Number OR Flag: " current_selection + read -rt 120 -p "Type the Number OR Flag: " current_selection case $current_selection in 0) echo "Exiting.." @@ -145,13 +145,13 @@ case $selection in 1 | -b) printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-b" && echo -e "\"-b\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it echo "Up to how many backups should we keep?" - read -rt 600 -p "Please type an integer: " up_backups + read -rt 120 -p "Please type an integer: " up_backups ! [[ $up_backups =~ ^[0-9]+$ ]] && echo -e "Error: \"$up_backups\" is invalid, it needs to be an integer\nNOT adding it to the list" && sleep 3 && continue [[ $up_backups == 0 ]] && echo -e "Error: Number of backups cannot be 0\nNOT adding it to the list" && sleep 3 && continue update_selection+=("-b" "$up_backups") ;; 2 | -i) - read -rt 600 -p "What is the name of the application we should ignore?: " up_ignore + read -rt 120 -p "What is the name of the application we should ignore?: " up_ignore ! [[ $up_ignore =~ ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ ]] && echo -e "Error: \"$up_ignore\" is not a possible option for an application name" && sleep 3 && continue update_selection+=("-i" "$up_ignore") ;; @@ -171,7 +171,7 @@ case $selection in 6 | -t) printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-t" && echo -e "\"-t\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it echo "What do you want your timeout to be?" - read -rt 600 -p "Please type an integer: " up_timeout + read -rt 120 -p "Please type an integer: " up_timeout ! [[ $up_timeout =~ ^[0-9]+$ ]] && echo -e "Error: \"$up_timeout\" is invalid, it needs to be an integer\nNOT adding it to the list" && sleep 3 && continue update_selection+=("-t" "$up_timeout") ;; From 0e60f84c22f7058d396b9a70bddaadbdb7f79957 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sat, 30 Jul 2022 16:43:42 -0600 Subject: [PATCH 0552/1229] change user input --- functions/backup.sh | 30 ++++++------ functions/menu.sh | 117 +++++++++++++++++++++++--------------------- functions/mount.sh | 14 +++--- 3 files changed, 83 insertions(+), 78 deletions(-) diff --git a/functions/backup.sh b/functions/backup.sh index 9f2de90f..9cfac408 100644 --- a/functions/backup.sh +++ b/functions/backup.sh @@ -46,7 +46,7 @@ do echo "$list_backups" echo echo "0) Exit" - read -rt 120 -p "Please type a number: " selection + read -rt 240 -p "Please type a number: " selection || { echo -e "\nFailed to make a selection in time" ; exit; } restore_point=$(echo "$list_backups" | grep ^"$selection)" | awk '{print $2}') if [[ $selection == 0 ]]; then echo "Exiting.." @@ -67,16 +67,16 @@ do clear -x echo -e "\nWARNING:\nYou CANNOT go back after deleting your restore point" echo -e "\n\nYou have chosen:\n$restore_point\n\nWould you like to continue?" - echo -e "1) Yes\n2) Exit\n" - read -rt 120 -p "Please type a number: " yesno + echo -e "Y) Yes\nN) No\n" + read -rt 120 -p "Please type a number: " yesno || { echo -e "\nFailed to make a selection in time" ; exit; } case $yesno in - 1) + [Yy]) echo -e "\nDeleting $restore_point" cli -c 'app kubernetes delete_backup backup_name=''"'"$restore_point"'"' &>/dev/null || { echo "Failed to delete backup.."; exit; } echo "Sucessfully deleted" break ;; - 2) + [Nn]) echo "Exiting" exit ;; @@ -90,14 +90,14 @@ do while true do echo "Delete more?" - echo "1) Yes" - echo "2) No" - read -rt 120 -p "Please type a number: " yesno + echo "Y) Yes" + echo "N) No" + read -rt 120 -p "Please type a number: " yesno || { echo -e "\nFailed to make a selection in time" ; exit; } case $yesno in - 1) + [Yy]) break ;; - 2) + [Nn]) exit ;; *) @@ -131,7 +131,7 @@ do echo "$list_backups" echo echo "0) Exit" - read -rt 120 -p "Please type a number: " selection + read -rt 240 -p "Please type a number: " selection || { echo -e "\nFailed to make a selection in time" ; exit; } restore_point=$(echo "$list_backups" | grep ^"$selection)" | awk '{print $2}') if [[ $selection == 0 ]]; then echo "Exiting.." @@ -152,15 +152,15 @@ do clear -x echo -e "\nWARNING:\nThis is NOT guranteed to work\nThis is ONLY supposed to be used as a LAST RESORT\nConsider rolling back your applications instead if possible" echo -e "\n\nYou have chosen:\n$restore_point\n\nWould you like to continue?" - echo -e "1) Yes\n2) Exit\n" - read -rt 120 -p "Please type a number: " yesno + echo -e "Y) Yes\nN) No\n" + read -rt 120 -p "Please type a number: " yesno || { echo -e "\nFailed to make a selection in time" ; exit; } case $yesno in - 1) + [Yy]) echo -e "\nStarting Backup, this will take a LONG time." cli -c 'app kubernetes restore_backup backup_name=''"'"$restore_point"'"' || { echo "Failed to delete backup.."; exit; } exit ;; - 2) + [Nn]) echo "Exiting" exit ;; diff --git a/functions/menu.sh b/functions/menu.sh index 365dd773..ec3a860b 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -29,7 +29,7 @@ case $selection in mount="true" ;; 4) - read -rt 120 -p "What is the maximun number of backups you would like?: " number_of_backups + read -rt 120 -p "What is the maximun number of backups you would like?: " number_of_backups || echo "Failed to make a selection" backup="true" ;; 5) @@ -53,56 +53,61 @@ case $selection in echo echo "0) Exit" echo - read -rt 120 -p "Please type the number associated with the flag above: " current_selection - if [[ $current_selection == 1 ]]; then - while true - do - echo -e "\nHow many applications do you want updating at the same time?" - read -rt 120 -p "Please type an integer greater than 0: " up_async - if [[ $up_async == 0 ]]; then - echo "Error: \"$up_async\" is less than 1" - echo "NOT adding it to the list" - sleep 3 - continue - elif ! [[ $up_async =~ ^[0-9]+$ ]]; then - echo "Error: \"$up_async\" is invalid, it needs to be an integer" - echo "NOT adding it to the list" - sleep 3 - continue - else - update_selection+=("-U" "$up_async") - break - fi - done - break - elif [[ $current_selection == 2 ]]; then - while true - do - echo -e "\nHow many applications do you want updating at the same time?" - read -rt 120 -p "Please type an integer greater than 0: " up_async - if [[ $up_async == 0 ]]; then - echo "Error: \"$up_async\" is less than 1" - echo "NOT adding it to the list" - sleep 3 - continue - elif ! [[ $up_async =~ ^[0-9]+$ ]]; then - echo "Error: \"$up_async\" is invalid, it needs to be an integer" - echo "NOT adding it to the list" - sleep 3 - continue - else - update_selection+=("-u" "$up_async") - break - fi - done - break - elif [[ $current_selection == 0 ]]; then - echo "Exiting.." - exit - else - echo "$current_selection was not an option, try again" && sleep 3 - continue - fi + read -rt 120 -p "Type the Number or Flag: " current_selection || { echo -e "\nFailed to make a selection in time" ; exit; } + case $current_selection in + 0 | [Ee][Xx][Ii][Tt]) + echo "Exiting.." + exit + ;; + 1 | -U) + while true + do + echo -e "\nHow many applications do you want updating at the same time?" + read -rt 120 -p "Please type an integer greater than 0: " up_async || { echo -e "\nFailed to make a selection in time" ; exit; } + if [[ $up_async == 0 ]]; then + echo "Error: \"$up_async\" is less than 1" + echo "NOT adding it to the list" + sleep 3 + continue + elif ! [[ $up_async =~ ^[0-9]+$ ]]; then + echo "Error: \"$up_async\" is invalid, it needs to be an integer" + echo "NOT adding it to the list" + sleep 3 + continue + else + update_selection+=("-U" "$up_async") + break + fi + done + break + ;; + 2 | -u) + while true + do + echo -e "\nHow many applications do you want updating at the same time?" + read -rt 120 -p "Please type an integer greater than 0: " up_async || { echo -e "\nFailed to make a selection in time" ; exit; } + if [[ $up_async == 0 ]]; then + echo "Error: \"$up_async\" is less than 1" + echo "NOT adding it to the list" + sleep 3 + continue + elif ! [[ $up_async =~ ^[0-9]+$ ]]; then + echo "Error: \"$up_async\" is invalid, it needs to be an integer" + echo "NOT adding it to the list" + sleep 3 + continue + else + update_selection+=("-u" "$up_async") + break + fi + done + break + ;; + *) + echo "$current_selection was not an option, try again" && sleep 3 + continue + ;; + esac done while true do @@ -129,9 +134,9 @@ case $selection in echo "---------------" echo "bash heavy_script.sh ${update_selection[*]}" echo - read -rt 120 -p "Type the Number OR Flag: " current_selection + read -rt 600 -p "Type the Number or Flag: " current_selection || { echo -e "\nFailed to make a selection in time" ; exit; } case $current_selection in - 0) + 0 | [Ee][Xx][Ii][Tt]) echo "Exiting.." exit ;; @@ -145,13 +150,13 @@ case $selection in 1 | -b) printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-b" && echo -e "\"-b\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it echo "Up to how many backups should we keep?" - read -rt 120 -p "Please type an integer: " up_backups + read -rt 120 -p "Please type an integer: " up_backups || { echo -e "\nFailed to make a selection in time" ; exit; } ! [[ $up_backups =~ ^[0-9]+$ ]] && echo -e "Error: \"$up_backups\" is invalid, it needs to be an integer\nNOT adding it to the list" && sleep 3 && continue [[ $up_backups == 0 ]] && echo -e "Error: Number of backups cannot be 0\nNOT adding it to the list" && sleep 3 && continue update_selection+=("-b" "$up_backups") ;; 2 | -i) - read -rt 120 -p "What is the name of the application we should ignore?: " up_ignore + read -rt 120 -p "What is the name of the application we should ignore?: " up_ignore || { echo -e "\nFailed to make a selection in time" ; exit; } ! [[ $up_ignore =~ ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ ]] && echo -e "Error: \"$up_ignore\" is not a possible option for an application name" && sleep 3 && continue update_selection+=("-i" "$up_ignore") ;; @@ -171,7 +176,7 @@ case $selection in 6 | -t) printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-t" && echo -e "\"-t\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it echo "What do you want your timeout to be?" - read -rt 120 -p "Please type an integer: " up_timeout + read -rt 120 -p "Please type an integer: " up_timeout || { echo -e "\nFailed to make a selection in time" ; exit; } ! [[ $up_timeout =~ ^[0-9]+$ ]] && echo -e "Error: \"$up_timeout\" is invalid, it needs to be an integer\nNOT adding it to the list" && sleep 3 && continue update_selection+=("-t" "$up_timeout") ;; diff --git a/functions/mount.sh b/functions/mount.sh index db369b4c..dfb0ac22 100644 --- a/functions/mount.sh +++ b/functions/mount.sh @@ -9,7 +9,7 @@ do echo "2) Unmount All" echo echo "0) Exit" - read -rt 120 -p "Unmount All Please type a number: " selection + read -rt 120 -p "Unmount All Please type a number: " selection || { echo -e "\nFailed to make a selection in time" ; exit; } case $selection in 0) echo "Exiting.." @@ -27,7 +27,7 @@ do echo "$list" echo echo "0) Exit" - read -rt 120 -p "Please type a number: " selection + read -rt 120 -p "Please type a number: " selection || { echo -e "\nFailed to make a selection in time" ; exit; } [[ $selection == 0 ]] && echo "Exiting.." && exit app=$(echo -e "$list" | grep ^"$selection)" | awk '{print $2}' | cut -c 4- ) [[ -z "$app" ]] && echo "Invalid Selection: $selection, was not an option" && sleep 3 && continue #Check for valid selection. If none, contiue @@ -59,16 +59,16 @@ do while true do echo -e "\nWould you like to mount anything else?" - echo "1) Yes" - echo "2) No" - read -rt 120 -p "Please type a number: " yesno + echo "Y) Yes" + echo "N) No" + read -rt 120 -p "Please type a number: " yesno || { echo -e "\nFailed to make a selection in time" ; exit; } case $yesno in - 1) + [Yy]) clear -x title break ;; - 2) + [Nn]) exit ;; *) From 79a0531da63d71c1d30a5c59be25711e4ad2da04 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sat, 30 Jul 2022 16:57:52 -0600 Subject: [PATCH 0553/1229] yes no revamp --- functions/backup.sh | 27 +++++++++++---------------- functions/mount.sh | 10 ++++------ 2 files changed, 15 insertions(+), 22 deletions(-) diff --git a/functions/backup.sh b/functions/backup.sh index 9cfac408..07a6fb23 100644 --- a/functions/backup.sh +++ b/functions/backup.sh @@ -66,17 +66,16 @@ do do clear -x echo -e "\nWARNING:\nYou CANNOT go back after deleting your restore point" - echo -e "\n\nYou have chosen:\n$restore_point\n\nWould you like to continue?" - echo -e "Y) Yes\nN) No\n" - read -rt 120 -p "Please type a number: " yesno || { echo -e "\nFailed to make a selection in time" ; exit; } + echo -e "\n\nYou have chosen:\n$restore_point\n\n" + read -rt 120 -p "Would you like to proceed with deletion? (y/N) " yesno || { echo -e "\nFailed to make a selection in time" ; exit; } case $yesno in - [Yy]) + [Yy] | [Yy][Ee][Ss]) echo -e "\nDeleting $restore_point" cli -c 'app kubernetes delete_backup backup_name=''"'"$restore_point"'"' &>/dev/null || { echo "Failed to delete backup.."; exit; } echo "Sucessfully deleted" break ;; - [Nn]) + [Nn] | [Nn][Oo]) echo "Exiting" exit ;; @@ -89,15 +88,12 @@ do done while true do - echo "Delete more?" - echo "Y) Yes" - echo "N) No" - read -rt 120 -p "Please type a number: " yesno || { echo -e "\nFailed to make a selection in time" ; exit; } + read -rt 120 -p "Delete more backups? (y/N)" yesno || { echo -e "\nFailed to make a selection in time" ; exit; } case $yesno in - [Yy]) + [Yy] | [Yy][Ee][Ss]) break ;; - [Nn]) + [Nn] | [Nn][Oo]) exit ;; *) @@ -151,16 +147,15 @@ do do clear -x echo -e "\nWARNING:\nThis is NOT guranteed to work\nThis is ONLY supposed to be used as a LAST RESORT\nConsider rolling back your applications instead if possible" - echo -e "\n\nYou have chosen:\n$restore_point\n\nWould you like to continue?" - echo -e "Y) Yes\nN) No\n" - read -rt 120 -p "Please type a number: " yesno || { echo -e "\nFailed to make a selection in time" ; exit; } + echo -e "\n\nYou have chosen:\n$restore_point\n\n" + read -rt 120 -p "Would you like to proceed with restore? (y/N) " yesno || { echo -e "\nFailed to make a selection in time" ; exit; } case $yesno in - [Yy]) + [Yy] | [Yy][Ee][Ss]) echo -e "\nStarting Backup, this will take a LONG time." cli -c 'app kubernetes restore_backup backup_name=''"'"$restore_point"'"' || { echo "Failed to delete backup.."; exit; } exit ;; - [Nn]) + [Nn] | [Nn][Oo]) echo "Exiting" exit ;; diff --git a/functions/mount.sh b/functions/mount.sh index dfb0ac22..b866d489 100644 --- a/functions/mount.sh +++ b/functions/mount.sh @@ -58,17 +58,15 @@ do echo -e "Mounted\n\nUnmount with:\nzfs set mountpoint=legacy $full_path && rmdir /mnt/heavyscript/$data_name\n\nOr use the Unmount All option\n" while true do - echo -e "\nWould you like to mount anything else?" - echo "Y) Yes" - echo "N) No" - read -rt 120 -p "Please type a number: " yesno || { echo -e "\nFailed to make a selection in time" ; exit; } + echo + read -rt 120 -p "Would you like to mount anything else? (y/N) " yesno || { echo -e "\nFailed to make a selection in time" ; exit; } case $yesno in - [Yy]) + [Yy] | [Yy][Ee][Ss]) clear -x title break ;; - [Nn]) + [Nn] | [Nn][Oo]) exit ;; *) From 18a231e9712504467ff35369f1685f9036e8c375 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sat, 30 Jul 2022 17:07:28 -0600 Subject: [PATCH 0554/1229] colon and spaces --- functions/backup.sh | 6 +++--- functions/mount.sh | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/functions/backup.sh b/functions/backup.sh index 07a6fb23..58fa1904 100644 --- a/functions/backup.sh +++ b/functions/backup.sh @@ -67,7 +67,7 @@ do clear -x echo -e "\nWARNING:\nYou CANNOT go back after deleting your restore point" echo -e "\n\nYou have chosen:\n$restore_point\n\n" - read -rt 120 -p "Would you like to proceed with deletion? (y/N) " yesno || { echo -e "\nFailed to make a selection in time" ; exit; } + read -rt 120 -p "Would you like to proceed with deletion? (y/N): " yesno || { echo -e "\nFailed to make a selection in time" ; exit; } case $yesno in [Yy] | [Yy][Ee][Ss]) echo -e "\nDeleting $restore_point" @@ -88,7 +88,7 @@ do done while true do - read -rt 120 -p "Delete more backups? (y/N)" yesno || { echo -e "\nFailed to make a selection in time" ; exit; } + read -rt 120 -p "Delete more backups? (y/N): " yesno || { echo -e "\nFailed to make a selection in time" ; exit; } case $yesno in [Yy] | [Yy][Ee][Ss]) break @@ -148,7 +148,7 @@ do clear -x echo -e "\nWARNING:\nThis is NOT guranteed to work\nThis is ONLY supposed to be used as a LAST RESORT\nConsider rolling back your applications instead if possible" echo -e "\n\nYou have chosen:\n$restore_point\n\n" - read -rt 120 -p "Would you like to proceed with restore? (y/N) " yesno || { echo -e "\nFailed to make a selection in time" ; exit; } + read -rt 120 -p "Would you like to proceed with restore? (y/N): " yesno || { echo -e "\nFailed to make a selection in time" ; exit; } case $yesno in [Yy] | [Yy][Ee][Ss]) echo -e "\nStarting Backup, this will take a LONG time." diff --git a/functions/mount.sh b/functions/mount.sh index b866d489..ba2a1955 100644 --- a/functions/mount.sh +++ b/functions/mount.sh @@ -59,7 +59,7 @@ do while true do echo - read -rt 120 -p "Would you like to mount anything else? (y/N) " yesno || { echo -e "\nFailed to make a selection in time" ; exit; } + read -rt 120 -p "Would you like to mount anything else? (y/N): " yesno || { echo -e "\nFailed to make a selection in time" ; exit; } case $yesno in [Yy] | [Yy][Ee][Ss]) clear -x From e9c27d7800fb5d15772c917d7576740085923cdd Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sat, 30 Jul 2022 17:08:57 -0600 Subject: [PATCH 0555/1229] spelling mistake in mount --- functions/mount.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/mount.sh b/functions/mount.sh index ba2a1955..26198633 100644 --- a/functions/mount.sh +++ b/functions/mount.sh @@ -9,7 +9,7 @@ do echo "2) Unmount All" echo echo "0) Exit" - read -rt 120 -p "Unmount All Please type a number: " selection || { echo -e "\nFailed to make a selection in time" ; exit; } + read -rt 120 -p "Please type a number: " selection || { echo -e "\nFailed to make a selection in time" ; exit; } case $selection in 0) echo "Exiting.." From 2be7b0c5a66887dc293cfe2a8166ee44b5384ed2 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sat, 30 Jul 2022 17:10:59 -0600 Subject: [PATCH 0556/1229] self-update title newline --- functions/self_update.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/functions/self_update.sh b/functions/self_update.sh index 5c2178d0..2e99e7bc 100644 --- a/functions/self_update.sh +++ b/functions/self_update.sh @@ -3,7 +3,8 @@ args=("$@") self_update() { git fetch &> /dev/null -echo "🅂 🄴 🄻 🄵 🅄 🄿 🄳 🄰 🅃 🄴" +echo "🅂 🄴 🄻 🄵" +echo "🅄 🄿 🄳 🄰 🅃 🄴" if git diff --name-only origin/main | grep -qs ".sh" ; then echo "Found a new version of HeavyScript, updating myself..." git reset --hard -q From 263ffa377efd52a593b0cda799293e80bf3cd114 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sat, 30 Jul 2022 17:18:27 -0600 Subject: [PATCH 0557/1229] dns numbers --- functions/dns.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/dns.sh b/functions/dns.sh index c4316139..986f3d3e 100644 --- a/functions/dns.sh +++ b/functions/dns.sh @@ -22,6 +22,6 @@ do ixName=$(echo "$i" | awk '{print $1}') port=$(echo "$all_ports" | grep -E "\s$appName\s" | awk '{print $6}' | grep -Eo "^[[:digit:]]+{1}") echo -e "$appName.$ixName.svc.cluster.local $port" -done | uniq | nl -b t | sed 's/\s\s\s$/- -------- ----/' | column -t -R 1 -N "#,DNS_Name,Port" -L +done | uniq | nl -s ") " -b t | sed 's/\s\s\s$/- -------- ----/' | column -t -R 1 -N "#,DNS_Name,Port" -L } export -f dns \ No newline at end of file From c6e89cf356fa6bd91c9837a30feaad44a26c12af Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sat, 30 Jul 2022 17:19:41 -0600 Subject: [PATCH 0558/1229] revert --- functions/dns.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/dns.sh b/functions/dns.sh index 986f3d3e..c4316139 100644 --- a/functions/dns.sh +++ b/functions/dns.sh @@ -22,6 +22,6 @@ do ixName=$(echo "$i" | awk '{print $1}') port=$(echo "$all_ports" | grep -E "\s$appName\s" | awk '{print $6}' | grep -Eo "^[[:digit:]]+{1}") echo -e "$appName.$ixName.svc.cluster.local $port" -done | uniq | nl -s ") " -b t | sed 's/\s\s\s$/- -------- ----/' | column -t -R 1 -N "#,DNS_Name,Port" -L +done | uniq | nl -b t | sed 's/\s\s\s$/- -------- ----/' | column -t -R 1 -N "#,DNS_Name,Port" -L } export -f dns \ No newline at end of file From e6bcaf42bb4d9276ddc018f604d3449c9efd3ac0 Mon Sep 17 00:00:00 2001 From: TrueCharts-Bot Date: Sun, 31 Jul 2022 00:36:43 +0000 Subject: [PATCH 0559/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.135.1 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index a6104468..4830211b 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@811ced1628f54adbd50df235fec78b5299b887ca # tag=v32.134.0 + uses: renovatebot/github-action@f489d66310a2026c6e780a14840973f662f7a138 # tag=v32.135.1 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 41e2b9f9ffa759cfb59676fd88cd66d7da86bdea Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 31 Jul 2022 12:56:50 -0600 Subject: [PATCH 0560/1229] new spacing --- functions/backup.sh | 4 +++- functions/misc.sh | 4 +++- functions/self_update.sh | 6 +++--- heavy_script.sh | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/functions/backup.sh b/functions/backup.sh index 58fa1904..1226c9d3 100644 --- a/functions/backup.sh +++ b/functions/backup.sh @@ -2,7 +2,7 @@ backup(){ -echo_backup+=("\n🄱 🄰 🄲 🄺 🅄 🄿 🅂") +echo_backup+=("🄱 🄰 🄲 🄺 🅄 🄿 🅂") echo_backup+=("Number of backups was set to $number_of_backups") date=$(date '+%Y_%m_%d_%H_%M_%S') [[ "$verbose" == "true" ]] && cli -c 'app kubernetes backup_chart_releases backup_name=''"'HeavyScript_"$date"'"' &> /dev/null && echo_backup+=(HeavyScript_"$date") @@ -24,6 +24,8 @@ for i in "${echo_backup[@]}" do echo -e "$i" done +echo +echo } export -f backup diff --git a/functions/misc.sh b/functions/misc.sh index 880de232..54eaefa1 100644 --- a/functions/misc.sh +++ b/functions/misc.sh @@ -2,7 +2,7 @@ sync(){ -echo_sync+=("\n\n🅂 🅈 🄽 🄲") +echo_sync+=("🅂 🅈 🄽 🄲") cli -c 'app catalog sync_all' &> /dev/null && echo_sync+=("Catalog sync complete") #Dump the echo_array, ensures all output is in a neat order. @@ -10,6 +10,8 @@ for i in "${echo_sync[@]}" do echo -e "$i" done +echo +echo } export -f sync diff --git a/functions/self_update.sh b/functions/self_update.sh index 2e99e7bc..98a3e19e 100644 --- a/functions/self_update.sh +++ b/functions/self_update.sh @@ -15,14 +15,14 @@ if git diff --name-only origin/main | grep -qs ".sh" ; then [[ "$i" == "--self-update" ]] && unset "args[$count]" && break ((count++)) done - [[ -z ${args[*]} ]] && echo -e "No more arguments, exiting..\n" && exit - echo -e "Running the new version...\n" + [[ -z ${args[*]} ]] && echo -e "No more arguments, exiting..\n\n" && exit + echo -e "Running the new version...\n\n" sleep 5 exec bash "$script_name" "${args[@]}" # Now exit this old instance exit else - echo -e "HeavyScript is already the latest version\n" + echo -e "HeavyScript is already the latest version\n\n" fi } export -f self_update diff --git a/heavy_script.sh b/heavy_script.sh index db7068c2..c5e387c4 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -148,7 +148,7 @@ done if [[ "$backup" == "true" && "$sync" == "true" ]]; then # Run backup and sync at the same time echo "🅃 🄰 🅂 🄺 🅂 :" echo -e "-Backing up ix-applications dataset\n-Syncing catalog(s)" - echo -e "This can take a LONG time, please wait for both output..\n" + echo -e "This can take a LONG time, please wait for both output..\n\n" backup & sync & wait From 58ab28ef0fd5c2d0a79f3045d88609de049177b7 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 31 Jul 2022 13:03:45 -0600 Subject: [PATCH 0561/1229] remove spaces --- functions/update_apps.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index be33626f..a8a19287 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -3,7 +3,7 @@ commander(){ mapfile -t array < <(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,container_images_update_available,status' | tr -d " \t\r" | grep -E ",true($|,)" | sort) -echo -e "\n\n🅄 🄿 🄳 🄰 🅃 🄴 🅂" +echo -e "🅄 🄿 🄳 🄰 🅃 🄴 🅂" [[ -z ${array[*]} ]] && echo "There are no updates available" && return 0 || echo "Update(s) Available: ${#array[@]}" echo "Asynchronous Updates: $update_limit" [[ -z $timeout ]] && echo "Default Timeout: 500" && timeout=500 || echo "Custom Timeout: $timeout" @@ -35,7 +35,8 @@ do fi done rm temp.txt - +echo +echo } export -f commander @@ -164,7 +165,5 @@ for i in "${echo_array[@]}" do echo -e "$i" done - - } export -f after_update_actions \ No newline at end of file From 07d4b2c791ee6d3d8e15cd6e1058525caee82d4f Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 31 Jul 2022 13:06:00 -0600 Subject: [PATCH 0562/1229] remove newlines in prune --- functions/misc.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/misc.sh b/functions/misc.sh index 54eaefa1..f4018c5b 100644 --- a/functions/misc.sh +++ b/functions/misc.sh @@ -16,7 +16,7 @@ echo export -f sync prune(){ -echo -e "\n\n🄿 🅁 🅄 🄽 🄴" +echo -e "🄿 🅁 🅄 🄽 🄴" echo "Pruned Docker Images" docker image prune -af | grep "^Total" || echo "Failed to Prune Docker Images" } From c38915c775bc2e25db2b5a9158640d1fcae197af Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 31 Jul 2022 13:08:34 -0600 Subject: [PATCH 0563/1229] newlines before return --- functions/update_apps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index a8a19287..a99cec60 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -4,7 +4,7 @@ commander(){ mapfile -t array < <(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,container_images_update_available,status' | tr -d " \t\r" | grep -E ",true($|,)" | sort) echo -e "🅄 🄿 🄳 🄰 🅃 🄴 🅂" -[[ -z ${array[*]} ]] && echo "There are no updates available" && return 0 || echo "Update(s) Available: ${#array[@]}" +[[ -z ${array[*]} ]] && echo "There are no updates available" && echo -e "\n\n" && return 0 || echo "Update(s) Available: ${#array[@]}" echo "Asynchronous Updates: $update_limit" [[ -z $timeout ]] && echo "Default Timeout: 500" && timeout=500 || echo "Custom Timeout: $timeout" [[ "$timeout" -le 120 ]] && echo "Warning: Your timeout is set low and may lead to premature rollbacks or skips" From 74d4b423fa852fa9e148a376f7d289526923cc95 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 31 Jul 2022 13:16:40 -0600 Subject: [PATCH 0564/1229] remove extra newline --- functions/update_apps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index a99cec60..ec738a6b 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -4,7 +4,7 @@ commander(){ mapfile -t array < <(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,container_images_update_available,status' | tr -d " \t\r" | grep -E ",true($|,)" | sort) echo -e "🅄 🄿 🄳 🄰 🅃 🄴 🅂" -[[ -z ${array[*]} ]] && echo "There are no updates available" && echo -e "\n\n" && return 0 || echo "Update(s) Available: ${#array[@]}" +[[ -z ${array[*]} ]] && echo "There are no updates available" && echo -e "\n" && return 0 || echo "Update(s) Available: ${#array[@]}" echo "Asynchronous Updates: $update_limit" [[ -z $timeout ]] && echo "Default Timeout: 500" && timeout=500 || echo "Custom Timeout: $timeout" [[ "$timeout" -le 120 ]] && echo "Warning: Your timeout is set low and may lead to premature rollbacks or skips" From 9cbcdb69704e3a247aabcfc5ce34c8dd51b4ca5a Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 31 Jul 2022 13:25:00 -0600 Subject: [PATCH 0565/1229] sync and backup titles --- heavy_script.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index c5e387c4..6523ee96 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -152,9 +152,15 @@ if [[ "$backup" == "true" && "$sync" == "true" ]]; then # Run backup and sync at backup & sync & wait +elif [[ "$backup" == "true" && -z "$sync" ]]; then # If only backup is true, run it + echo "🅃 🄰 🅂 🄺 :" + echo -e "-Backing up \"ix-applications\" dataset, please wait..\n\n" + backup +elif [[ "$sync" == "true" && -z "$backup" ]]; then # If only sync is true, run it + echo "🅃 🄰 🅂 🄺 :" + echo -e "Syncing catalogs, this takes a LONG time, please wait..\n\n" + sync fi -[[ "$backup" == "true" && -z "$sync" ]] && echo "Backing up \"ix-applications\" dataset, please wait.." && backup -[[ "$sync" == "true" && -z "$backup" ]] && echo "Syncing catalogs, this takes a LONG time, please wait.." && sync [[ "$update_all_apps" == "true" || "$update_apps" == "true" ]] && commander [[ "$prune" == "true" ]] && prune From f23355ceb9afdc6c13f057ce3042ff2c5cb6d57e Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 31 Jul 2022 13:30:37 -0600 Subject: [PATCH 0566/1229] little more formatting on output --- heavy_script.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index 6523ee96..efecf333 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -147,18 +147,18 @@ done [[ "$mount" == "true" ]] && mount && exit if [[ "$backup" == "true" && "$sync" == "true" ]]; then # Run backup and sync at the same time echo "🅃 🄰 🅂 🄺 🅂 :" - echo -e "-Backing up ix-applications dataset\n-Syncing catalog(s)" - echo -e "This can take a LONG time, please wait for both output..\n\n" + echo -e "-Backing up ix-applications Dataset\n-Syncing catalog(s)" + echo -e "This can take a LONG time, Please Wait For Both Output..\n\n" backup & sync & wait elif [[ "$backup" == "true" && -z "$sync" ]]; then # If only backup is true, run it echo "🅃 🄰 🅂 🄺 :" - echo -e "-Backing up \"ix-applications\" dataset, please wait..\n\n" + echo -e "-Backing up \"ix-applications\" Dataset\nPlease Wait..\n\n" backup elif [[ "$sync" == "true" && -z "$backup" ]]; then # If only sync is true, run it echo "🅃 🄰 🅂 🄺 :" - echo -e "Syncing catalogs, this takes a LONG time, please wait..\n\n" + echo -e "Syncing Catalog(s)\nThis Takes a LONG Time, Please Wait..\n\n" sync fi [[ "$update_all_apps" == "true" || "$update_apps" == "true" ]] && commander From 56094507f9b2510afccc70fdd6ff2da5b5d70a33 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 31 Jul 2022 19:01:16 -0600 Subject: [PATCH 0567/1229] change order in menu --- functions/menu.sh | 46 ++++++++++++++++++++++++---------------------- functions/misc.sh | 22 +++++++++++++--------- 2 files changed, 37 insertions(+), 31 deletions(-) diff --git a/functions/menu.sh b/functions/menu.sh index ec3a860b..8800dd6c 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -113,14 +113,17 @@ case $selection in do clear -x title - echo "Choose Your Update Options" - echo "--------------------------" - echo "1) -b | Back-up your ix-applications dataset, specify a number after -b" + echo "Update Options" + echo "--------------" + echo "1) -r | Roll-back applications if they fail to update" echo "2) -i | Add application to ignore list, one by one, see example below." - echo "3) -r | Roll-back applications if they fail to update" - echo "4) -S | Shutdown applications prior to updating" - echo "5) -v | verbose output" - echo "6) -t | Set a custom timeout in seconds when checking if either an App or Mountpoint correctly Started, Stopped or (un)Mounted. Defaults to 500 seconds" + echo "3) -S | Shutdown applications prior to updating" + echo "4) -v | verbose output" + echo "5) -t | Set a custom timeout in seconds when checking if either an App or Mountpoint correctly Started, Stopped or (un)Mounted. Defaults to 500 seconds" + echo + echo "Additional Options" + echo "------------------" + echo "6) -b | Back-up your ix-applications dataset, specify a number after -b" echo "7) -s | sync catalog" echo "8) -p | Prune unused/old docker images" echo "9) --self-update | Updates HeavyScript prior to running any other commands" @@ -147,39 +150,38 @@ case $selection in exec bash "$script_name" "${update_selection[@]}" exit ;; - 1 | -b) - printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-b" && echo -e "\"-b\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it - echo "Up to how many backups should we keep?" - read -rt 120 -p "Please type an integer: " up_backups || { echo -e "\nFailed to make a selection in time" ; exit; } - ! [[ $up_backups =~ ^[0-9]+$ ]] && echo -e "Error: \"$up_backups\" is invalid, it needs to be an integer\nNOT adding it to the list" && sleep 3 && continue - [[ $up_backups == 0 ]] && echo -e "Error: Number of backups cannot be 0\nNOT adding it to the list" && sleep 3 && continue - update_selection+=("-b" "$up_backups") + 1 | -r) + printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-r" && echo -e "\"-r\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it + update_selection+=("-r") ;; 2 | -i) read -rt 120 -p "What is the name of the application we should ignore?: " up_ignore || { echo -e "\nFailed to make a selection in time" ; exit; } ! [[ $up_ignore =~ ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ ]] && echo -e "Error: \"$up_ignore\" is not a possible option for an application name" && sleep 3 && continue update_selection+=("-i" "$up_ignore") ;; - 3 | -r) - printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-r" && echo -e "\"-r\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it - update_selection+=("-r") - - ;; - 4 | -S) + 3 | -S) printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-S" && echo -e "\"-S\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it update_selection+=("-S") ;; - 5 | -v) + 4 | -v) printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-v" && echo -e "\"-v\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it update_selection+=("-v") ;; - 6 | -t) + 5 | -t) printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-t" && echo -e "\"-t\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it echo "What do you want your timeout to be?" read -rt 120 -p "Please type an integer: " up_timeout || { echo -e "\nFailed to make a selection in time" ; exit; } ! [[ $up_timeout =~ ^[0-9]+$ ]] && echo -e "Error: \"$up_timeout\" is invalid, it needs to be an integer\nNOT adding it to the list" && sleep 3 && continue update_selection+=("-t" "$up_timeout") ;; + 6 | -b) + printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-b" && echo -e "\"-b\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it + echo "Up to how many backups should we keep?" + read -rt 120 -p "Please type an integer: " up_backups || { echo -e "\nFailed to make a selection in time" ; exit; } + ! [[ $up_backups =~ ^[0-9]+$ ]] && echo -e "Error: \"$up_backups\" is invalid, it needs to be an integer\nNOT adding it to the list" && sleep 3 && continue + [[ $up_backups == 0 ]] && echo -e "Error: Number of backups cannot be 0\nNOT adding it to the list" && sleep 3 && continue + update_selection+=("-b" "$up_backups") + ;; 7 | -s) printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-s" && echo -e "\"-s\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it update_selection+=("-s") diff --git a/functions/misc.sh b/functions/misc.sh index f4018c5b..44ec0bec 100644 --- a/functions/misc.sh +++ b/functions/misc.sh @@ -43,36 +43,40 @@ echo "---------------------------" echo "(Just dont send any other argument)" echo "bash heavy_script.sh" echo -echo "Basic Utilities" -echo "---------------" +echo "Utilities" +echo "---------" echo "--mount | Initiates mounting feature, choose between unmounting and mounting PVC data" echo "--restore | Opens a menu to restore a \"heavy_script\" backup that was taken on your \"ix-applications\" dataset" echo "--delete-backup | Opens a menu to delete backups on your system" echo "--dns | list all of your applications DNS names and their web ports" echo -echo "Update Options" +echo "Update Types" echo "--------------" echo "-U | Update all applications, ignores versions" echo "-U 5 | Same as above, but updates 5 applications at one time" echo "-u | Update all applications, does not update Major releases" echo "-u 5 | Same as above, but updates 5 applications at one time" echo -echo "Additional Update Options" -echo "-------------------------" -echo "-b 14 | Back-up your ix-applications dataset, specify a number after -b" -echo "-i | Add application to ignore list, one by one, see example below." +echo "Update Options" +echo "--------------" echo "-r | Roll-back applications if they fail to update" +echo "-i | Add application to ignore list, one by one, see example below." echo "-S | Shutdown applications prior to updating" echo "-v | verbose output" echo "-t 500| Set a custom timeout in seconds when checking if either an App or Mountpoint correctly Started, Stopped or (un)Mounted. Defaults to 500 seconds" +echo +echo "Additional Options" +echo "------------------" +echo "-b 14 | Back-up your ix-applications dataset, specify a number after -b" echo "-s | sync catalog" echo "-p | Prune unused/old docker images" +echo "--self-update | Updates HeavyScript prior to running any other commands" echo echo "Examples" echo "--------" echo "bash heavy_script.sh" -echo "bash heavy_script.sh -b 14 -i portainer -i arch -i sonarr -t 600 -vrsUp" -echo "bash heavy_script.sh -b 14 -i portainer -i arch -i sonarr -t 600 -vrsp -U 10" +echo "bash heavy_script.sh -b 14 -i portainer -i arch -i sonarr -t 600 -vrsUp --self-update" +echo "bash heavy_script.sh -b 14 -i portainer -i arch -i sonarr -t 600 -vrsp -U 10 --self-update" echo "bash /mnt/tank/scripts/heavy_script.sh -t 150 --mount" echo "bash /mnt/tank/scripts/heavy_script.sh --dns" echo "bash heavy_script.sh --restore" From 65f0175deb7e36f8dda932bfcd1222db0d436d68 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 31 Jul 2022 19:05:06 -0600 Subject: [PATCH 0568/1229] update help, formatting --- functions/misc.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/functions/misc.sh b/functions/misc.sh index 44ec0bec..050055d8 100644 --- a/functions/misc.sh +++ b/functions/misc.sh @@ -40,7 +40,6 @@ help(){ echo "Access the HeavyScript Menu" echo "---------------------------" -echo "(Just dont send any other argument)" echo "bash heavy_script.sh" echo echo "Utilities" @@ -51,7 +50,7 @@ echo "--delete-backup | Opens a menu to delete backups on your system" echo "--dns | list all of your applications DNS names and their web ports" echo echo "Update Types" -echo "--------------" +echo "------------" echo "-U | Update all applications, ignores versions" echo "-U 5 | Same as above, but updates 5 applications at one time" echo "-u | Update all applications, does not update Major releases" From 8d789fe09a7984291318f4ee467d1ccc3bd38473 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 31 Jul 2022 23:14:00 -0600 Subject: [PATCH 0569/1229] Remove warning newline --- functions/backup.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/backup.sh b/functions/backup.sh index 1226c9d3..581b3bc1 100644 --- a/functions/backup.sh +++ b/functions/backup.sh @@ -148,7 +148,7 @@ do while true do clear -x - echo -e "\nWARNING:\nThis is NOT guranteed to work\nThis is ONLY supposed to be used as a LAST RESORT\nConsider rolling back your applications instead if possible" + echo -e "WARNING:\nThis is NOT guranteed to work\nThis is ONLY supposed to be used as a LAST RESORT\nConsider rolling back your applications instead if possible" echo -e "\n\nYou have chosen:\n$restore_point\n\n" read -rt 120 -p "Would you like to proceed with restore? (y/N): " yesno || { echo -e "\nFailed to make a selection in time" ; exit; } case $yesno in @@ -170,4 +170,4 @@ do done done } -export -f restore \ No newline at end of file +export -f restore From 8d782e880b7b4034b518225782a63bc75b447ab7 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 31 Jul 2022 23:21:38 -0600 Subject: [PATCH 0570/1229] remove newline before warning --- functions/backup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/backup.sh b/functions/backup.sh index 581b3bc1..642b58f5 100644 --- a/functions/backup.sh +++ b/functions/backup.sh @@ -67,7 +67,7 @@ do while true do clear -x - echo -e "\nWARNING:\nYou CANNOT go back after deleting your restore point" + echo -e "WARNING:\nYou CANNOT go back after deleting your restore point" echo -e "\n\nYou have chosen:\n$restore_point\n\n" read -rt 120 -p "Would you like to proceed with deletion? (y/N): " yesno || { echo -e "\nFailed to make a selection in time" ; exit; } case $yesno in From 11a9935c099b384cd9835b36f019c4058e29e2ce Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 1 Aug 2022 14:16:54 -0600 Subject: [PATCH 0571/1229] Ignore description in menu --- functions/menu.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/menu.sh b/functions/menu.sh index 8800dd6c..22e4ac76 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -116,7 +116,7 @@ case $selection in echo "Update Options" echo "--------------" echo "1) -r | Roll-back applications if they fail to update" - echo "2) -i | Add application to ignore list, one by one, see example below." + echo "2) -i | Add application to ignore list" echo "3) -S | Shutdown applications prior to updating" echo "4) -v | verbose output" echo "5) -t | Set a custom timeout in seconds when checking if either an App or Mountpoint correctly Started, Stopped or (un)Mounted. Defaults to 500 seconds" @@ -218,4 +218,4 @@ case $selection in esac echo } -export -f menu \ No newline at end of file +export -f menu From 5007ab574f49a1be9d6a0cfb2895d44f0af5d3aa Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 1 Aug 2022 15:47:08 -0600 Subject: [PATCH 0572/1229] remove whitespaces --- functions/update_apps.sh | 64 ++++++++++++++++++++-------------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index ec738a6b..9989a64e 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -54,43 +54,43 @@ diff_chart=$(diff <(echo "$old_chart_ver") <(echo "$new_chart_ver")) #caluclatin old_full_ver=$(echo "${array[$it]}" | awk -F ',' '{print $4}') #Upgraded From new_full_ver=$(echo "${array[$it]}" | awk -F ',' '{print $5}') #Upraded To rollback_version=$(echo "${array[$it]}" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}') - if [[ "$diff_app" == "$diff_chart" || "$update_all_apps" == "true" ]]; then #continue to update - if [[ $stop_before_update == "true" ]]; then # Check to see if user is using -S or not - if [[ "$startstatus" == "STOPPED" ]]; then # if status is already stopped, skip while loop - echo_array+=("\n$app_name") - [[ "$verbose" == "true" ]] && echo_array+=("Updating..") - cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo_array+=("Updated\n$old_full_ver\n$new_full_ver") && after_update_actions || echo_array+=("FAILED") - return 0 - else # if status was not STOPPED, stop the app prior to updating - echo_array+=("\n$app_name") - [[ "$verbose" == "true" ]] && echo_array+=("Stopping prior to update..") - midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null && SECONDS=0 || echo_array+=("FAILED") - while [[ "$status" != "STOPPED" ]] - do - status=$( grep "^$app_name," temp.txt | awk -F ',' '{print $2}') - if [[ "$status" == "STOPPED" ]]; then - echo_array+=("Stopped") - [[ "$verbose" == "true" ]] && echo_array+=("Updating..") - cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo_array+=("Updated\n$old_full_ver\n$new_full_ver") && after_update_actions || echo_array+=("Failed to update") - break - elif [[ "$SECONDS" -ge "$timeout" ]]; then - echo_array+=("Error: Run Time($SECONDS) has exceeded Timeout($timeout)") - break - elif [[ "$status" != "STOPPED" ]]; then - [[ "$verbose" == "true" ]] && echo_array+=("Waiting $((timeout-SECONDS)) more seconds for $app_name to be STOPPED") - sleep 10 - fi - done - fi - else #user must not be using -S, just update +if [[ "$diff_app" == "$diff_chart" || "$update_all_apps" == "true" ]]; then #continue to update + if [[ $stop_before_update == "true" ]]; then # Check to see if user is using -S or not + if [[ "$startstatus" == "STOPPED" ]]; then # if status is already stopped, skip while loop echo_array+=("\n$app_name") [[ "$verbose" == "true" ]] && echo_array+=("Updating..") cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo_array+=("Updated\n$old_full_ver\n$new_full_ver") && after_update_actions || echo_array+=("FAILED") + return 0 + else # if status was not STOPPED, stop the app prior to updating + echo_array+=("\n$app_name") + [[ "$verbose" == "true" ]] && echo_array+=("Stopping prior to update..") + midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null && SECONDS=0 || echo_array+=("FAILED") + while [[ "$status" != "STOPPED" ]] + do + status=$( grep "^$app_name," temp.txt | awk -F ',' '{print $2}') + if [[ "$status" == "STOPPED" ]]; then + echo_array+=("Stopped") + [[ "$verbose" == "true" ]] && echo_array+=("Updating..") + cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo_array+=("Updated\n$old_full_ver\n$new_full_ver") && after_update_actions || echo_array+=("Failed to update") + break + elif [[ "$SECONDS" -ge "$timeout" ]]; then + echo_array+=("Error: Run Time($SECONDS) has exceeded Timeout($timeout)") + break + elif [[ "$status" != "STOPPED" ]]; then + [[ "$verbose" == "true" ]] && echo_array+=("Waiting $((timeout-SECONDS)) more seconds for $app_name to be STOPPED") + sleep 10 + fi + done fi - else - echo_array+=("\n$app_name\nMajor Release, update manually") - return 0 + else #user must not be using -S, just update + echo_array+=("\n$app_name") + [[ "$verbose" == "true" ]] && echo_array+=("Updating..") + cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo_array+=("Updated\n$old_full_ver\n$new_full_ver") && after_update_actions || echo_array+=("FAILED") fi +else + echo_array+=("\n$app_name\nMajor Release, update manually") + return 0 +fi } export -f update_apps From 1d4be7191c617163c6e2481b4657ee4c10abb077 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 4 Aug 2022 14:14:32 -0600 Subject: [PATCH 0573/1229] test ignore file for failed rollbacks --- functions/update_apps.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 9989a64e..05b44752 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -54,6 +54,14 @@ diff_chart=$(diff <(echo "$old_chart_ver") <(echo "$new_chart_ver")) #caluclatin old_full_ver=$(echo "${array[$it]}" | awk -F ',' '{print $4}') #Upgraded From new_full_ver=$(echo "${array[$it]}" | awk -F ',' '{print $5}') #Upraded To rollback_version=$(echo "${array[$it]}" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}') +if grep -qs "^$app_name," failed.txt ; then + if diff <(grep "^$app_name," | awk -F ',' '{print $2}') <(echo "$new_full_ver") ; then + sed -i /"$app_name","$new_full_ver"/d failed.txt + else + echo "Skipping already failed version $new_full_ver" + return 0 + fi +fi if [[ "$diff_app" == "$diff_chart" || "$update_all_apps" == "true" ]]; then #continue to update if [[ $stop_before_update == "true" ]]; then # Check to see if user is using -S or not if [[ "$startstatus" == "STOPPED" ]]; then # if status is already stopped, skip while loop @@ -111,6 +119,7 @@ if [[ $rollback == "true" ]]; then echo_array+=("Error: Run Time($SECONDS) for $app_name has exceeded Timeout($timeout)\nIf this is a slow starting application, set a higher timeout with -t\nIf this applicaion is always DEPLOYING, you can disable all probes under the Healthcheck Probes Liveness section in the edit configuration\nReverting update..") midclt call chart.release.rollback "$app_name" "{\"item_version\": \"$rollback_version\"}" &> /dev/null [[ "$startstatus" == "STOPPED" ]] && failed="true" && after_update_actions && unset failed #run back after_update_actions function if the app was stopped prior to update + echo "$app_name,$new_full_ver" >> failed.txt break elif [[ "$SECONDS" -ge "$timeout" && "$status" == "DEPLOYING" && "$failed" == "true" ]]; then echo_array+=("Error: Run Time($SECONDS) for $app_name has exceeded Timeout($timeout)\nThe application failed to be ACTIVE even after a rollback,\nManual intervention is required\nAbandoning") From 738a773975df5dc06d9b699391fd38c8e7624c73 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 4 Aug 2022 14:19:48 -0600 Subject: [PATCH 0574/1229] diff supress and appname --- functions/update_apps.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 05b44752..8784cba1 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -55,9 +55,10 @@ old_full_ver=$(echo "${array[$it]}" | awk -F ',' '{print $4}') #Upgraded From new_full_ver=$(echo "${array[$it]}" | awk -F ',' '{print $5}') #Upraded To rollback_version=$(echo "${array[$it]}" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}') if grep -qs "^$app_name," failed.txt ; then - if diff <(grep "^$app_name," | awk -F ',' '{print $2}') <(echo "$new_full_ver") ; then + if diff <(grep "^$app_name," | awk -F ',' '{print $2}') <(echo "$new_full_ver") &> /dev/null ; then sed -i /"$app_name","$new_full_ver"/d failed.txt else + echo "$app_name" echo "Skipping already failed version $new_full_ver" return 0 fi From 286c215281529e4295d15a0025fb2b81cbcce215 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 4 Aug 2022 14:20:40 -0600 Subject: [PATCH 0575/1229] newline for appname --- functions/update_apps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 8784cba1..6100d688 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -58,7 +58,7 @@ if grep -qs "^$app_name," failed.txt ; then if diff <(grep "^$app_name," | awk -F ',' '{print $2}') <(echo "$new_full_ver") &> /dev/null ; then sed -i /"$app_name","$new_full_ver"/d failed.txt else - echo "$app_name" + echo -e "\n$app_name" echo "Skipping already failed version $new_full_ver" return 0 fi From 9ad8673e8bfb3703c4af6491fde1e8f3b97a59bb Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 4 Aug 2022 14:36:39 -0600 Subject: [PATCH 0576/1229] test string --- functions/update_apps.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 6100d688..95a57cc8 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -55,8 +55,9 @@ old_full_ver=$(echo "${array[$it]}" | awk -F ',' '{print $4}') #Upgraded From new_full_ver=$(echo "${array[$it]}" | awk -F ',' '{print $5}') #Upraded To rollback_version=$(echo "${array[$it]}" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}') if grep -qs "^$app_name," failed.txt ; then - if diff <(grep "^$app_name," | awk -F ',' '{print $2}') <(echo "$new_full_ver") &> /dev/null ; then - sed -i /"$app_name","$new_full_ver"/d failed.txt + failed_ver=$(grep "^$app_name," | awk -F ',' '{print $2}') + if diff <(echo "$failed_ver") <(echo "$new_full_ver") &> /dev/null ; then + sed -inE /"$app_name",.*/d failed.txt else echo -e "\n$app_name" echo "Skipping already failed version $new_full_ver" From 0a2f3147a967900353f102b5abe666f1f2b247eb Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 4 Aug 2022 14:38:43 -0600 Subject: [PATCH 0577/1229] forgot filename --- functions/update_apps.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 95a57cc8..9369e095 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -55,8 +55,7 @@ old_full_ver=$(echo "${array[$it]}" | awk -F ',' '{print $4}') #Upgraded From new_full_ver=$(echo "${array[$it]}" | awk -F ',' '{print $5}') #Upraded To rollback_version=$(echo "${array[$it]}" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}') if grep -qs "^$app_name," failed.txt ; then - failed_ver=$(grep "^$app_name," | awk -F ',' '{print $2}') - if diff <(echo "$failed_ver") <(echo "$new_full_ver") &> /dev/null ; then + if diff <(grep "^$app_name," failed.txt | awk -F ',' '{print $2}') <(echo "$new_full_ver") &> /dev/null ; then sed -inE /"$app_name",.*/d failed.txt else echo -e "\n$app_name" From 8b1916c36f11bb68c62e48ef6c12ab22d86af598 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 4 Aug 2022 14:40:55 -0600 Subject: [PATCH 0578/1229] uh --- functions/update_apps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 9369e095..e96c3135 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -56,7 +56,7 @@ new_full_ver=$(echo "${array[$it]}" | awk -F ',' '{print $5}') #Upraded To rollback_version=$(echo "${array[$it]}" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}') if grep -qs "^$app_name," failed.txt ; then if diff <(grep "^$app_name," failed.txt | awk -F ',' '{print $2}') <(echo "$new_full_ver") &> /dev/null ; then - sed -inE /"$app_name",.*/d failed.txt + sed -i /"$app_name",/d failed.txt else echo -e "\n$app_name" echo "Skipping already failed version $new_full_ver" From 7ba7b1fd9d20b0d243307df918909b9c896789e7 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 4 Aug 2022 14:46:00 -0600 Subject: [PATCH 0579/1229] test string compare instead of diff --- functions/update_apps.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index e96c3135..18f17b9e 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -55,12 +55,13 @@ old_full_ver=$(echo "${array[$it]}" | awk -F ',' '{print $4}') #Upgraded From new_full_ver=$(echo "${array[$it]}" | awk -F ',' '{print $5}') #Upraded To rollback_version=$(echo "${array[$it]}" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}') if grep -qs "^$app_name," failed.txt ; then - if diff <(grep "^$app_name," failed.txt | awk -F ',' '{print $2}') <(echo "$new_full_ver") &> /dev/null ; then - sed -i /"$app_name",/d failed.txt - else + failed_ver=$(grep "^$app_name," failed.txt | awk -F ',' '{print $2}') + if [[ "$failed_ver" == "$new_full_ver" ]] ; then echo -e "\n$app_name" echo "Skipping already failed version $new_full_ver" return 0 + else + sed -i /"$app_name",/d failed.txt fi fi if [[ "$diff_app" == "$diff_chart" || "$update_all_apps" == "true" ]]; then #continue to update From c3a4915de22dca72204b4bf6d31d877412f1ac39 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 4 Aug 2022 16:08:45 -0600 Subject: [PATCH 0580/1229] better skip message --- functions/update_apps.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 18f17b9e..b511c850 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -58,10 +58,10 @@ if grep -qs "^$app_name," failed.txt ; then failed_ver=$(grep "^$app_name," failed.txt | awk -F ',' '{print $2}') if [[ "$failed_ver" == "$new_full_ver" ]] ; then echo -e "\n$app_name" - echo "Skipping already failed version $new_full_ver" + echo -e "Skipping previously failed version:\n$new_full_ver" return 0 else - sed -i /"$app_name",/d failed.txt + sed -i /"$app_name",/d failed.txt fi fi if [[ "$diff_app" == "$diff_chart" || "$update_all_apps" == "true" ]]; then #continue to update From 42af8744b4fed00436c2e81a92c43bb1819d302d Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 4 Aug 2022 16:48:55 -0600 Subject: [PATCH 0581/1229] change after_update_actions --- functions/update_apps.sh | 55 +++++++++++++--------------------------- 1 file changed, 18 insertions(+), 37 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index b511c850..e7b97d33 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -108,7 +108,7 @@ export -f update_apps after_update_actions(){ SECONDS=0 count=0 -if [[ $rollback == "true" ]]; then +if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then while true do (( count++ )) @@ -117,15 +117,22 @@ if [[ $rollback == "true" ]]; then [[ "$verbose" == "true" ]] && echo_array+=("Returing to STOPPED state..") midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null && echo_array+=("Stopped")|| echo_array+=("FAILED") break - elif [[ "$SECONDS" -ge "$timeout" && "$status" == "DEPLOYING" && "$failed" != "true" ]]; then - echo_array+=("Error: Run Time($SECONDS) for $app_name has exceeded Timeout($timeout)\nIf this is a slow starting application, set a higher timeout with -t\nIf this applicaion is always DEPLOYING, you can disable all probes under the Healthcheck Probes Liveness section in the edit configuration\nReverting update..") - midclt call chart.release.rollback "$app_name" "{\"item_version\": \"$rollback_version\"}" &> /dev/null - [[ "$startstatus" == "STOPPED" ]] && failed="true" && after_update_actions && unset failed #run back after_update_actions function if the app was stopped prior to update - echo "$app_name,$new_full_ver" >> failed.txt - break - elif [[ "$SECONDS" -ge "$timeout" && "$status" == "DEPLOYING" && "$failed" == "true" ]]; then - echo_array+=("Error: Run Time($SECONDS) for $app_name has exceeded Timeout($timeout)\nThe application failed to be ACTIVE even after a rollback,\nManual intervention is required\nAbandoning") - break + elif [[ "$SECONDS" -ge "$timeout" && "$status" == "DEPLOYING" ]]; then + if [[ $rollback == "true" ]]; then + if [[ "$failed" != "true" ]]; then + echo_array+=("Error: Run Time($SECONDS) for $app_name has exceeded Timeout($timeout)\nIf this is a slow starting application, set a higher timeout with -t\nIf this applicaion is always DEPLOYING, you can disable all probes under the Healthcheck Probes Liveness section in the edit configuration\nReverting update..") + midclt call chart.release.rollback "$app_name" "{\"item_version\": \"$rollback_version\"}" &> /dev/null + [[ "$startstatus" == "STOPPED" ]] && failed="true" && after_update_actions && unset failed #run back after_update_actions function if the app was stopped prior to update + echo "$app_name,$new_full_ver" >> failed.txt + break + elif [[ "$failed" == "true" ]]; then + echo_array+=("Error: Run Time($SECONDS) for $app_name has exceeded Timeout($timeout)\nThe application failed to be ACTIVE even after a rollback,\nManual intervention is required\nAbandoning") + break + fi + else + echo_array+=("Error: Run Time($SECONDS) has exceeded Timeout($timeout)") + break + fi elif [[ "$status" == "STOPPED" ]]; then [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Stopped..") && sleep 15 && continue #if reports stopped on FIRST time through loop, double check [[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports stopped on FIRST time through loop, double check @@ -142,35 +149,9 @@ if [[ $rollback == "true" ]]; then continue fi done -else - if [[ "$startstatus" == "STOPPED" ]]; then - while true #using a constant while loop, then breaking out of the loop with break commands below. - do - (( count++ )) - status=$( grep "^$app_name," temp.txt | awk -F ',' '{print $2}') - if [[ "$status" == "STOPPED" ]]; then - [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Stopped..") && sleep 15 && continue #if reports stopped on FIRST time through loop, double check - [[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports stopped on FIRST time through loop, double check - echo_array+=("Stopped") #assume actually stopped anytime AFTER the first loop - break - elif [[ "$status" == "ACTIVE" ]]; then - [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Active..") && sleep 15 && continue #if reports active on FIRST time through loop, double check - [[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports active on FIRST time through loop, double check - [[ "$verbose" == "true" ]] && echo_array+=("Returing to STOPPED state..") - midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null && echo_array+=("Stopped")|| echo_array+=("FAILED") - break - elif [[ "$SECONDS" -ge "$timeout" ]]; then - echo_array+=("Error: Run Time($SECONDS) has exceeded Timeout($timeout)") - break - else - [[ "$verbose" == "true" ]] && echo_array+=("Waiting $((timeout-SECONDS)) more seconds for $app_name to be ACTIVE") - sleep 10 - continue - fi - done - fi fi + #Dump the echo_array, ensures all output is in a neat order. for i in "${echo_array[@]}" do From 2ba8a6c084a07b753dd927689b721c41da7b4b45 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 4 Aug 2022 16:51:10 -0600 Subject: [PATCH 0582/1229] after update action call after update --- functions/update_apps.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index e7b97d33..503e7afc 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -69,7 +69,7 @@ if [[ "$diff_app" == "$diff_chart" || "$update_all_apps" == "true" ]]; then #con if [[ "$startstatus" == "STOPPED" ]]; then # if status is already stopped, skip while loop echo_array+=("\n$app_name") [[ "$verbose" == "true" ]] && echo_array+=("Updating..") - cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo_array+=("Updated\n$old_full_ver\n$new_full_ver") && after_update_actions || echo_array+=("FAILED") + cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo_array+=("Updated\n$old_full_ver\n$new_full_ver") || echo_array+=("FAILED") return 0 else # if status was not STOPPED, stop the app prior to updating echo_array+=("\n$app_name") @@ -81,7 +81,7 @@ if [[ "$diff_app" == "$diff_chart" || "$update_all_apps" == "true" ]]; then #con if [[ "$status" == "STOPPED" ]]; then echo_array+=("Stopped") [[ "$verbose" == "true" ]] && echo_array+=("Updating..") - cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo_array+=("Updated\n$old_full_ver\n$new_full_ver") && after_update_actions || echo_array+=("Failed to update") + cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo_array+=("Updated\n$old_full_ver\n$new_full_ver") || echo_array+=("Failed to update") break elif [[ "$SECONDS" -ge "$timeout" ]]; then echo_array+=("Error: Run Time($SECONDS) has exceeded Timeout($timeout)") @@ -95,12 +95,13 @@ if [[ "$diff_app" == "$diff_chart" || "$update_all_apps" == "true" ]]; then #con else #user must not be using -S, just update echo_array+=("\n$app_name") [[ "$verbose" == "true" ]] && echo_array+=("Updating..") - cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo_array+=("Updated\n$old_full_ver\n$new_full_ver") && after_update_actions || echo_array+=("FAILED") + cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo_array+=("Updated\n$old_full_ver\n$new_full_ver") || echo_array+=("FAILED") fi else echo_array+=("\n$app_name\nMajor Release, update manually") return 0 fi +after_update_actions } export -f update_apps From 0a6926c0d6567c6a9b05cdb023f4146e0bc0319a Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 4 Aug 2022 17:19:44 -0600 Subject: [PATCH 0583/1229] nested active check --- functions/update_apps.sh | 55 +++++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 23 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 503e7afc..ec211d87 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -114,36 +114,45 @@ if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then do (( count++ )) status=$( grep "^$app_name," temp.txt | awk -F ',' '{print $2}') - if [[ "$status" == "ACTIVE" && "$startstatus" == "STOPPED" ]]; then - [[ "$verbose" == "true" ]] && echo_array+=("Returing to STOPPED state..") - midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null && echo_array+=("Stopped")|| echo_array+=("FAILED") - break - elif [[ "$SECONDS" -ge "$timeout" && "$status" == "DEPLOYING" ]]; then - if [[ $rollback == "true" ]]; then - if [[ "$failed" != "true" ]]; then - echo_array+=("Error: Run Time($SECONDS) for $app_name has exceeded Timeout($timeout)\nIf this is a slow starting application, set a higher timeout with -t\nIf this applicaion is always DEPLOYING, you can disable all probes under the Healthcheck Probes Liveness section in the edit configuration\nReverting update..") - midclt call chart.release.rollback "$app_name" "{\"item_version\": \"$rollback_version\"}" &> /dev/null - [[ "$startstatus" == "STOPPED" ]] && failed="true" && after_update_actions && unset failed #run back after_update_actions function if the app was stopped prior to update - echo "$app_name,$new_full_ver" >> failed.txt - break - elif [[ "$failed" == "true" ]]; then - echo_array+=("Error: Run Time($SECONDS) for $app_name has exceeded Timeout($timeout)\nThe application failed to be ACTIVE even after a rollback,\nManual intervention is required\nAbandoning") - break - fi - else - echo_array+=("Error: Run Time($SECONDS) has exceeded Timeout($timeout)") + if [[ "$status" == "ACTIVE" ]]; then + if [[ "$startstatus" == "STOPPED" ]]; then + [[ "$verbose" == "true" ]] && echo_array+=("Returing to STOPPED state..") + midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null && echo_array+=("Stopped")|| echo_array+=("FAILED") break + else + [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Active..") && sleep 15 && continue #if reports active on FIRST time through loop, double check + [[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports active on FIRST time through loop, double check + echo_array+=("Active") + break #if reports active any time after the first loop, assume actually active. fi elif [[ "$status" == "STOPPED" ]]; then [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Stopped..") && sleep 15 && continue #if reports stopped on FIRST time through loop, double check [[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports stopped on FIRST time through loop, double check echo_array+=("Stopped") break #if reports stopped any time after the first loop, assume its extermal services. - elif [[ "$status" == "ACTIVE" ]]; then - [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Active..") && sleep 15 && continue #if reports active on FIRST time through loop, double check - [[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports active on FIRST time through loop, double check - echo_array+=("Active") - break #if reports active any time after the first loop, assume actually active. + elif [[ "$SECONDS" -ge "$timeout" && "$status" == "DEPLOYING" ]]; then + if [[ $rollback == "true" ]]; then + if [[ "$failed" != "true" ]]; then + echo_array+=("Error: Run Time($SECONDS) for $app_name has exceeded Timeout($timeout)") + echo_array+=("If this is a slow starting application, set a higher timeout with -t") + echo_array+=("If this applicaion is always DEPLOYING, you can disable all probes under the Healthcheck Probes Liveness section in the edit configuration") + echo_array+=("Reverting update..") + midclt call chart.release.rollback "$app_name" "{\"item_version\": \"$rollback_version\"}" &> /dev/null + [[ "$startstatus" == "STOPPED" ]] && failed="true" && after_update_actions && unset failed #run back after_update_actions function if the app was stopped prior to update + echo "$app_name,$new_full_ver" >> failed.txt + break + else + echo_array+=("Error: Run Time($SECONDS) for $app_name has exceeded Timeout($timeout)") + echo_array+=("The application failed to be ACTIVE even after a rollback") + echo_array+=("Manual intervention is required\nAbandoning") + break + fi + else + echo_array+=("Error: Run Time($SECONDS) for $app_name has exceeded Timeout($timeout)") + echo_array+=("If this is a slow starting application, set a higher timeout with -t") + echo_array+=("If this applicaion is always DEPLOYING, you can disable all probes under the Healthcheck Probes Liveness section in the edit configuration") + break + fi else [[ "$verbose" == "true" ]] && echo_array+=("Waiting $((timeout-SECONDS)) more seconds for $app_name to be ACTIVE") sleep 15 From 1ad4690a2a9c875236d5d44ab07b1fd49323595b Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 4 Aug 2022 17:31:21 -0600 Subject: [PATCH 0584/1229] changed some error messages --- functions/update_apps.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index ec211d87..421576e4 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -74,7 +74,8 @@ if [[ "$diff_app" == "$diff_chart" || "$update_all_apps" == "true" ]]; then #con else # if status was not STOPPED, stop the app prior to updating echo_array+=("\n$app_name") [[ "$verbose" == "true" ]] && echo_array+=("Stopping prior to update..") - midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null && SECONDS=0 || echo_array+=("FAILED") + midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null || echo_array+=("Error: Failed to stop $app_name") + SECONDS=0 while [[ "$status" != "STOPPED" ]] do status=$( grep "^$app_name," temp.txt | awk -F ',' '{print $2}') @@ -117,7 +118,8 @@ if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then if [[ "$status" == "ACTIVE" ]]; then if [[ "$startstatus" == "STOPPED" ]]; then [[ "$verbose" == "true" ]] && echo_array+=("Returing to STOPPED state..") - midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null && echo_array+=("Stopped")|| echo_array+=("FAILED") + midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null || { echo_array+=("Error: Failed to stop $app_name") ; break ; } + echo_array+=("Stopped") break else [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Active..") && sleep 15 && continue #if reports active on FIRST time through loop, double check @@ -130,15 +132,15 @@ if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then [[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports stopped on FIRST time through loop, double check echo_array+=("Stopped") break #if reports stopped any time after the first loop, assume its extermal services. - elif [[ "$SECONDS" -ge "$timeout" && "$status" == "DEPLOYING" ]]; then + elif [[ "$SECONDS" -ge "$timeout" && "$status" == "DEPLOYING" ]]; then if [[ $rollback == "true" ]]; then if [[ "$failed" != "true" ]]; then echo_array+=("Error: Run Time($SECONDS) for $app_name has exceeded Timeout($timeout)") echo_array+=("If this is a slow starting application, set a higher timeout with -t") echo_array+=("If this applicaion is always DEPLOYING, you can disable all probes under the Healthcheck Probes Liveness section in the edit configuration") echo_array+=("Reverting update..") - midclt call chart.release.rollback "$app_name" "{\"item_version\": \"$rollback_version\"}" &> /dev/null - [[ "$startstatus" == "STOPPED" ]] && failed="true" && after_update_actions && unset failed #run back after_update_actions function if the app was stopped prior to update + midclt call chart.release.rollback "$app_name" "{\"item_version\": \"$rollback_version\"}" &> /dev/null || { echo_array+=("Error: Failed to rollback $app_name") ; break ; } + [[ "$startstatus" == "STOPPED" ]] && failed="true" && after_update_actions #run back after_update_actions function if the app was stopped prior to update echo "$app_name,$new_full_ver" >> failed.txt break else From 3eae25deded291726587a74f68f0a3292f11461f Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 4 Aug 2022 18:23:15 -0600 Subject: [PATCH 0585/1229] test more aggressive loop --- functions/update_apps.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 421576e4..ab30afd2 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -25,9 +25,12 @@ do if [[ "$proc_count" -ge "$update_limit" ]]; then sleep 3 elif [[ $it -lt ${#array[@]} ]]; then - update_apps "${array[$it]}" & - processes+=($!) - ((it++)) + until [[ ${#processes[@]} -ge "$update_limit" || ${#processes[@]} -ge ${#array[@]} ]] + do + update_apps "${array[$it]}" & + processes+=($!) + ((it++)) + done elif [[ $proc_count != 0 ]]; then # Wait for all processes to finish sleep 3 else # All processes must be completed, break out of loop From c83354d1a57e742a034fd3e428a6994e9fff98d9 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 4 Aug 2022 18:54:15 -0600 Subject: [PATCH 0586/1229] update async --- functions/update_apps.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index ab30afd2..5df910ab 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -25,10 +25,11 @@ do if [[ "$proc_count" -ge "$update_limit" ]]; then sleep 3 elif [[ $it -lt ${#array[@]} ]]; then - until [[ ${#processes[@]} -ge "$update_limit" || ${#processes[@]} -ge ${#array[@]} ]] + until [[ "$proc_count" -ge "$update_limit" || $it -ge ${#array[@]} ]] do update_apps "${array[$it]}" & processes+=($!) + ((proc_count++)) ((it++)) done elif [[ $proc_count != 0 ]]; then # Wait for all processes to finish From cad29364a5095f62eb38c9af12607ffa705154d6 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 4 Aug 2022 19:07:33 -0600 Subject: [PATCH 0587/1229] sleep to avoid call timeout --- functions/update_apps.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 5df910ab..793dc826 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -32,6 +32,7 @@ do ((proc_count++)) ((it++)) done + sleep 3 elif [[ $proc_count != 0 ]]; then # Wait for all processes to finish sleep 3 else # All processes must be completed, break out of loop From 17914fada84ab01c12505ef87e930cc5fe63c0fe Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 4 Aug 2022 19:10:02 -0600 Subject: [PATCH 0588/1229] if gt than 1 sleep --- functions/update_apps.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 793dc826..2cfb6526 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -25,14 +25,16 @@ do if [[ "$proc_count" -ge "$update_limit" ]]; then sleep 3 elif [[ $it -lt ${#array[@]} ]]; then + new_updates=0 until [[ "$proc_count" -ge "$update_limit" || $it -ge ${#array[@]} ]] do update_apps "${array[$it]}" & processes+=($!) ((proc_count++)) ((it++)) + ((new_updates++)) done - sleep 3 + [[ $new_updates -gt 1 ]] && sleep 3 elif [[ $proc_count != 0 ]]; then # Wait for all processes to finish sleep 3 else # All processes must be completed, break out of loop From 561b84797a9f9c7a4b891c2726a078f46a69028f Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 4 Aug 2022 19:28:52 -0600 Subject: [PATCH 0589/1229] greater sleep for updates --- functions/update_apps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 2cfb6526..7bf55310 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -34,7 +34,7 @@ do ((it++)) ((new_updates++)) done - [[ $new_updates -gt 1 ]] && sleep 3 + [[ $new_updates -gt 1 ]] && sleep 6 elif [[ $proc_count != 0 ]]; then # Wait for all processes to finish sleep 3 else # All processes must be completed, break out of loop From 33a77e0687087788f689f72bcae0543a1cee0597 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 4 Aug 2022 19:32:14 -0600 Subject: [PATCH 0590/1229] assigning array # to string is off? --- functions/update_apps.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 7bf55310..96ff50ed 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -9,13 +9,12 @@ echo "Asynchronous Updates: $update_limit" [[ -z $timeout ]] && echo "Default Timeout: 500" && timeout=500 || echo "Custom Timeout: $timeout" [[ "$timeout" -le 120 ]] && echo "Warning: Your timeout is set low and may lead to premature rollbacks or skips" - +proc_count=0 it=0 while true do while_status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status') echo "$while_status" > temp.txt - proc_count=${#processes[@]} count=0 for proc in "${processes[@]}" do From 033db8d4a56e53f05b09599566ecfb37a51fd46d Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 4 Aug 2022 19:52:08 -0600 Subject: [PATCH 0591/1229] return array append --- functions/update_apps.sh | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 96ff50ed..42d8a3c8 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -11,10 +11,12 @@ echo "Asynchronous Updates: $update_limit" proc_count=0 it=0 +ttl=0 while true do while_status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status') echo "$while_status" > temp.txt + proc_count=${#processes[@]} count=0 for proc in "${processes[@]}" do @@ -25,15 +27,21 @@ do sleep 3 elif [[ $it -lt ${#array[@]} ]]; then new_updates=0 - until [[ "$proc_count" -ge "$update_limit" || $it -ge ${#array[@]} ]] + until [[ "$proc_count" -eq "$update_limit" || $it -eq ${#array[@]} ]] do update_apps "${array[$it]}" & processes+=($!) - ((proc_count++)) ((it++)) ((new_updates++)) done - [[ $new_updates -gt 1 ]] && sleep 6 + ((ttl++)) + if [[ $ttl -eq 1 ]]; then + sleep 15 + elif [[ $new_updates -gt 1 ]]; then + sleep 6 + else + sleep 3 + fi elif [[ $proc_count != 0 ]]; then # Wait for all processes to finish sleep 3 else # All processes must be completed, break out of loop From 4faf03d1a00b7e1349750db60385d802b7d74920 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 4 Aug 2022 19:58:19 -0600 Subject: [PATCH 0592/1229] ge instead of eq --- functions/update_apps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 42d8a3c8..6c56b332 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -27,7 +27,7 @@ do sleep 3 elif [[ $it -lt ${#array[@]} ]]; then new_updates=0 - until [[ "$proc_count" -eq "$update_limit" || $it -eq ${#array[@]} ]] + until [[ "$proc_count" -ge "$update_limit" || $it -ge ${#array[@]} ]] do update_apps "${array[$it]}" & processes+=($!) From 0fefd885e07d31d65687617f96c3030cd8c61a0d Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 4 Aug 2022 20:02:36 -0600 Subject: [PATCH 0593/1229] wow --- functions/update_apps.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 6c56b332..2e1394d5 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -33,6 +33,7 @@ do processes+=($!) ((it++)) ((new_updates++)) + ((proc_count++)) done ((ttl++)) if [[ $ttl -eq 1 ]]; then From 1d9ca34227057b36abd575c4a0e25ba825c67171 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 4 Aug 2022 20:08:57 -0600 Subject: [PATCH 0594/1229] raise sleep globally --- functions/update_apps.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 2e1394d5..c9773bbb 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -38,13 +38,13 @@ do ((ttl++)) if [[ $ttl -eq 1 ]]; then sleep 15 - elif [[ $new_updates -gt 1 ]]; then - sleep 6 + # elif [[ $new_updates -gt 1 ]]; then + # sleep 15 else - sleep 3 + sleep 10 fi elif [[ $proc_count != 0 ]]; then # Wait for all processes to finish - sleep 3 + sleep 10 else # All processes must be completed, break out of loop break fi @@ -104,7 +104,7 @@ if [[ "$diff_app" == "$diff_chart" || "$update_all_apps" == "true" ]]; then #con break elif [[ "$status" != "STOPPED" ]]; then [[ "$verbose" == "true" ]] && echo_array+=("Waiting $((timeout-SECONDS)) more seconds for $app_name to be STOPPED") - sleep 10 + sleep 15 fi done fi From 65d32d2155bcf70532310d4385448557bb46fe7d Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 4 Aug 2022 20:13:44 -0600 Subject: [PATCH 0595/1229] forgot a sleep timer --- functions/update_apps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index c9773bbb..bb778075 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -24,7 +24,7 @@ do ((count++)) done if [[ "$proc_count" -ge "$update_limit" ]]; then - sleep 3 + sleep 10 elif [[ $it -lt ${#array[@]} ]]; then new_updates=0 until [[ "$proc_count" -ge "$update_limit" || $it -ge ${#array[@]} ]] From 3cb21aa86ad7158fe50e73d85052fdfbfc473165 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 4 Aug 2022 20:14:06 -0600 Subject: [PATCH 0596/1229] +5 to first sleep --- functions/update_apps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index bb778075..50288dde 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -37,7 +37,7 @@ do done ((ttl++)) if [[ $ttl -eq 1 ]]; then - sleep 15 + sleep 20 # elif [[ $new_updates -gt 1 ]]; then # sleep 15 else From fc022a13c5dd8f182175be4869c04eedb9552331 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 4 Aug 2022 20:26:17 -0600 Subject: [PATCH 0597/1229] remove commentedout --- functions/update_apps.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 50288dde..2dfd897c 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -38,8 +38,6 @@ do ((ttl++)) if [[ $ttl -eq 1 ]]; then sleep 20 - # elif [[ $new_updates -gt 1 ]]; then - # sleep 15 else sleep 10 fi From d448916d5bf1fc6df27ce1fec2b523024e443535 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 4 Aug 2022 20:27:44 -0600 Subject: [PATCH 0598/1229] reasigns to 0, un-needed --- functions/update_apps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 2dfd897c..504a76f7 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -9,7 +9,7 @@ echo "Asynchronous Updates: $update_limit" [[ -z $timeout ]] && echo "Default Timeout: 500" && timeout=500 || echo "Custom Timeout: $timeout" [[ "$timeout" -le 120 ]] && echo "Warning: Your timeout is set low and may lead to premature rollbacks or skips" -proc_count=0 + it=0 ttl=0 while true From e496fc4c14f081149d542e94e10b67b9703c669d Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 4 Aug 2022 20:29:06 -0600 Subject: [PATCH 0599/1229] removed variable --- functions/update_apps.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 504a76f7..afaf1bd6 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -26,13 +26,11 @@ do if [[ "$proc_count" -ge "$update_limit" ]]; then sleep 10 elif [[ $it -lt ${#array[@]} ]]; then - new_updates=0 until [[ "$proc_count" -ge "$update_limit" || $it -ge ${#array[@]} ]] do update_apps "${array[$it]}" & processes+=($!) ((it++)) - ((new_updates++)) ((proc_count++)) done ((ttl++)) From 8a5237960992032a15271383e77fd02fda1f5817 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 4 Aug 2022 20:29:57 -0600 Subject: [PATCH 0600/1229] test sleep time in until update --- functions/update_apps.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index afaf1bd6..f6e57e48 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -29,6 +29,7 @@ do until [[ "$proc_count" -ge "$update_limit" || $it -ge ${#array[@]} ]] do update_apps "${array[$it]}" & + sleep 0.5 processes+=($!) ((it++)) ((proc_count++)) From a3d75393b2f511a9791dbf469d5bd5d61be4bf15 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 4 Aug 2022 20:30:33 -0600 Subject: [PATCH 0601/1229] raise sleep to 1 --- functions/update_apps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index f6e57e48..cb41a046 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -29,7 +29,7 @@ do until [[ "$proc_count" -ge "$update_limit" || $it -ge ${#array[@]} ]] do update_apps "${array[$it]}" & - sleep 0.5 + sleep 1 processes+=($!) ((it++)) ((proc_count++)) From e5e309ecaf72ffbec8ff9dafb25119713740a3cf Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 4 Aug 2022 20:37:08 -0600 Subject: [PATCH 0602/1229] try 2 for sleep --- functions/update_apps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index cb41a046..ceedeaed 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -29,7 +29,7 @@ do until [[ "$proc_count" -ge "$update_limit" || $it -ge ${#array[@]} ]] do update_apps "${array[$it]}" & - sleep 1 + sleep 2 processes+=($!) ((it++)) ((proc_count++)) From 2d39df3601d483adf42145e6736563806ba4378b Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 4 Aug 2022 21:05:01 -0600 Subject: [PATCH 0603/1229] racing original --- functions/update_apps.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index ceedeaed..f7ca7045 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -24,12 +24,12 @@ do ((count++)) done if [[ "$proc_count" -ge "$update_limit" ]]; then - sleep 10 + sleep 6 elif [[ $it -lt ${#array[@]} ]]; then until [[ "$proc_count" -ge "$update_limit" || $it -ge ${#array[@]} ]] do update_apps "${array[$it]}" & - sleep 2 + sleep 1 processes+=($!) ((it++)) ((proc_count++)) @@ -38,10 +38,10 @@ do if [[ $ttl -eq 1 ]]; then sleep 20 else - sleep 10 + sleep 6 fi elif [[ $proc_count != 0 ]]; then # Wait for all processes to finish - sleep 10 + sleep 6 else # All processes must be completed, break out of loop break fi From fdcf899d56e75dd89ad19aa229fded4d0042ae64 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 4 Aug 2022 21:16:17 -0600 Subject: [PATCH 0604/1229] test sleep after updates instead --- functions/update_apps.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index f7ca7045..85d04f47 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -29,17 +29,17 @@ do until [[ "$proc_count" -ge "$update_limit" || $it -ge ${#array[@]} ]] do update_apps "${array[$it]}" & - sleep 1 + sleep 4 processes+=($!) ((it++)) ((proc_count++)) done ((ttl++)) - if [[ $ttl -eq 1 ]]; then - sleep 20 - else - sleep 6 - fi + # if [[ $ttl -eq 1 ]]; then + # sleep 20 + # else + # sleep 6 + # fi elif [[ $proc_count != 0 ]]; then # Wait for all processes to finish sleep 6 else # All processes must be completed, break out of loop From 0323ba526e6fa6f56e7820162263aef197a2bb15 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 4 Aug 2022 21:23:50 -0600 Subject: [PATCH 0605/1229] test sleep 3/4 --- functions/update_apps.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 85d04f47..ffde4255 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -9,7 +9,7 @@ echo "Asynchronous Updates: $update_limit" [[ -z $timeout ]] && echo "Default Timeout: 500" && timeout=500 || echo "Custom Timeout: $timeout" [[ "$timeout" -le 120 ]] && echo "Warning: Your timeout is set low and may lead to premature rollbacks or skips" - +# previous 20% 2 min 9 seconds it=0 ttl=0 while true @@ -29,7 +29,7 @@ do until [[ "$proc_count" -ge "$update_limit" || $it -ge ${#array[@]} ]] do update_apps "${array[$it]}" & - sleep 4 + sleep 3 processes+=($!) ((it++)) ((proc_count++)) From 59bd4c18bd751b0c147de26661a558a4a0cdd8f7 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 4 Aug 2022 21:32:23 -0600 Subject: [PATCH 0606/1229] new race test --- functions/update_apps.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index ffde4255..e7273a25 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -29,17 +29,17 @@ do until [[ "$proc_count" -ge "$update_limit" || $it -ge ${#array[@]} ]] do update_apps "${array[$it]}" & - sleep 3 + sleep 1 processes+=($!) ((it++)) ((proc_count++)) done ((ttl++)) - # if [[ $ttl -eq 1 ]]; then - # sleep 20 - # else - # sleep 6 - # fi + if [[ $ttl -eq 1 ]]; then + sleep 20 + else + sleep 6 + fi elif [[ $proc_count != 0 ]]; then # Wait for all processes to finish sleep 6 else # All processes must be completed, break out of loop From 382f6d2f6adcf0a74ac6e02c71183f008096d843 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 4 Aug 2022 21:39:54 -0600 Subject: [PATCH 0607/1229] revert to fastest --- functions/update_apps.sh | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index e7273a25..91390eb0 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -29,17 +29,12 @@ do until [[ "$proc_count" -ge "$update_limit" || $it -ge ${#array[@]} ]] do update_apps "${array[$it]}" & - sleep 1 + sleep 4 processes+=($!) ((it++)) ((proc_count++)) done ((ttl++)) - if [[ $ttl -eq 1 ]]; then - sleep 20 - else - sleep 6 - fi elif [[ $proc_count != 0 ]]; then # Wait for all processes to finish sleep 6 else # All processes must be completed, break out of loop From c52e1e86f930c1ba6f0bddc39904f880580668b4 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 4 Aug 2022 21:46:37 -0600 Subject: [PATCH 0608/1229] test --- functions/update_apps.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 91390eb0..470c342a 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -29,12 +29,16 @@ do until [[ "$proc_count" -ge "$update_limit" || $it -ge ${#array[@]} ]] do update_apps "${array[$it]}" & - sleep 4 processes+=($!) ((it++)) ((proc_count++)) done ((ttl++)) + if [[ $ttl -eq 1 ]]; then + sleep 15 + else + sleep 6 + fi elif [[ $proc_count != 0 ]]; then # Wait for all processes to finish sleep 6 else # All processes must be completed, break out of loop From b1d7471eee7f046eeed6c0d562a5286ee76c1d32 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 4 Aug 2022 21:56:26 -0600 Subject: [PATCH 0609/1229] test_rearrange --- functions/update_apps.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 470c342a..1dd6508d 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -9,6 +9,26 @@ echo "Asynchronous Updates: $update_limit" [[ -z $timeout ]] && echo "Default Timeout: 500" && timeout=500 || echo "Custom Timeout: $timeout" [[ "$timeout" -le 120 ]] && echo "Warning: Your timeout is set low and may lead to premature rollbacks or skips" +#rearange array +for i in ${array[$@]} +do + if printf '%s\0' "${ignore[@]}" | grep -iFxqz "$i" ; then + new_array+=("$i") + elif grep -qs "^$i," failed.txt ; then + new_array+=("$i") + fi +done + +for i in ${array[$@]} +do + printf '%s\0' "${new_array[@]}" | grep -iFxqz "$i" || new_array+=("$i") +done + +for i in ${new_array[$@]} +do + echo "$i" +done + # previous 20% 2 min 9 seconds it=0 ttl=0 From 116492cb92401a4ba883b995751366c78adcb7b4 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 4 Aug 2022 22:00:18 -0600 Subject: [PATCH 0610/1229] test --- functions/update_apps.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 1dd6508d..d32bf7da 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -12,7 +12,8 @@ echo "Asynchronous Updates: $update_limit" #rearange array for i in ${array[$@]} do - if printf '%s\0' "${ignore[@]}" | grep -iFxqz "$i" ; then + in=$(awk -F ',' '{print $1}') + if printf '%s\0' "${ignore[@]}" | grep -iFxqz "$in" ; then new_array+=("$i") elif grep -qs "^$i," failed.txt ; then new_array+=("$i") @@ -21,7 +22,8 @@ done for i in ${array[$@]} do - printf '%s\0' "${new_array[@]}" | grep -iFxqz "$i" || new_array+=("$i") + in=$(awk -F ',' '{print $1}') + printf '%s\0' "${new_array[@]}" | grep -iFxqz "$in" || new_array+=("$i") done for i in ${new_array[$@]} From 17fa578eb4f5931362f02472f353930e4bac7480 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 4 Aug 2022 22:03:25 -0600 Subject: [PATCH 0611/1229] test --- functions/update_apps.sh | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index d32bf7da..470c342a 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -9,28 +9,6 @@ echo "Asynchronous Updates: $update_limit" [[ -z $timeout ]] && echo "Default Timeout: 500" && timeout=500 || echo "Custom Timeout: $timeout" [[ "$timeout" -le 120 ]] && echo "Warning: Your timeout is set low and may lead to premature rollbacks or skips" -#rearange array -for i in ${array[$@]} -do - in=$(awk -F ',' '{print $1}') - if printf '%s\0' "${ignore[@]}" | grep -iFxqz "$in" ; then - new_array+=("$i") - elif grep -qs "^$i," failed.txt ; then - new_array+=("$i") - fi -done - -for i in ${array[$@]} -do - in=$(awk -F ',' '{print $1}') - printf '%s\0' "${new_array[@]}" | grep -iFxqz "$in" || new_array+=("$i") -done - -for i in ${new_array[$@]} -do - echo "$i" -done - # previous 20% 2 min 9 seconds it=0 ttl=0 From f50c016c621aac0ab6f778264b43de106e8328aa Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Mon, 8 Aug 2022 22:43:02 +0200 Subject: [PATCH 0612/1229] Update renovate-config.js --- .github/renovate-config.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/renovate-config.js b/.github/renovate-config.js index 94f7dec2..da91bb42 100644 --- a/.github/renovate-config.js +++ b/.github/renovate-config.js @@ -1,7 +1,7 @@ module.exports = { dryRun: false, - username: 'truecharts-bot', - gitAuthor: 'truecharts-bot ', + username: 'truecharts-admin', + gitAuthor: 'truecharts-admin ', onboarding: false, platform: 'github', repositories: [ From bc09c6ed458056ae0e2ac256cb2c24e68080fc44 Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Mon, 8 Aug 2022 22:44:54 +0200 Subject: [PATCH 0613/1229] Update renovate.json5 --- .github/renovate.json5 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/renovate.json5 b/.github/renovate.json5 index 788702b7..de107f43 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -11,7 +11,7 @@ "prConcurrentLimit": 100, "pinDigests": true, "automerge": true, - "gitAuthor": "TrueCharts-Bot ", + "gitAuthor": "TrueCharts-Admin ", "packageRules": [ // Setup datasources for github actions { From edb437b7181c833a56b98b0198e007b0e92ec0b5 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 8 Aug 2022 18:56:56 -0600 Subject: [PATCH 0614/1229] add branch variable --- functions/self_update.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/functions/self_update.sh b/functions/self_update.sh index 98a3e19e..b7b3e884 100644 --- a/functions/self_update.sh +++ b/functions/self_update.sh @@ -2,10 +2,11 @@ args=("$@") self_update() { +branch="ignore-file" git fetch &> /dev/null echo "🅂 🄴 🄻 🄵" echo "🅄 🄿 🄳 🄰 🅃 🄴" -if git diff --name-only origin/main | grep -qs ".sh" ; then +if git diff --name-only origin/$branch | grep -qs ".sh" ; then echo "Found a new version of HeavyScript, updating myself..." git reset --hard -q git pull --force -q From 6bafce8181f488252b67690a8bce2cdebdda7a7b Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 8 Aug 2022 20:12:09 -0600 Subject: [PATCH 0615/1229] cmd to container initial --- functions/menu.sh | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/functions/menu.sh b/functions/menu.sh index 22e4ac76..6d9063c9 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -11,6 +11,7 @@ echo "5) Restore a Backup" echo "6) Delete a Backup" echo "7) Update HeavyScript" echo "8) Update Applications" +echo "9) Command to Container" echo echo "0) Exit" read -rt 120 -p "Please select an option by number: " selection @@ -212,6 +213,40 @@ case $selection in esac done ;; + + 9) + title + clear -x + app_name=$(k3s kubectl get pods -A | awk '{print $1}' | sort -u | grep -v "system" | sed '1d' | sed 's/^[^-]*-//' | nl -s ") " | column -t) + echo "$app_name" + echo + echo "0) Exit" + [[ $selection == 0 ]] && echo "Exiting.." && exit + read -rt 120 -p "Please type a number: " selection || { echo -e "\nFailed to make a selection in time" ; exit; } + app_name=$(echo -e "$app_name" | grep ^"$selection)" | awk '{print $2}') + search=$(k3s crictl ps -a -s running) + mapfile -t pod_id < <(echo "$search" | grep "$app_name" | awk '{print $9}') + + containers=$( + for pod in "${pod_id[@]}" + do + echo "$search" | grep "$pod" | awk '{print $7}' + done | nl -s ") " | column -t) + clear -x + title + echo "$containers" + echo + echo "0) Exit" + read -rt 120 -p "Choose a container by number: " selection || { echo -e "\nFailed to make a selection in time" ; exit; } + [[ $selection == 0 ]] && echo "Exiting.." && exit + + container=$(echo "$containers" | grep ^"$selection)" | awk '{print $2}') + container_id=$(echo "$search" | grep "$container" | awk '{print $1}') + + read -rt 120 -p "What command would you like to submit to $app_name on $container?: " command || { echo -e "\nFailed to make a selection in time" ; exit; } + k3s crictl exec "$container_id" $command + container=$(echo -e "$app_name" | grep ^"$selection)" | awk '{print $2}') + ;; *) echo "\"$selection\" was not an option, please try agian" && sleep 3 && menu ;; From 887e69cb36caac435935acfb81adf0657adbea0e Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 8 Aug 2022 20:28:36 -0600 Subject: [PATCH 0616/1229] while loops to cmd to cnter --- functions/menu.sh | 63 ++++++++++++++++++++++++++++++++++------------- 1 file changed, 46 insertions(+), 17 deletions(-) diff --git a/functions/menu.sh b/functions/menu.sh index 6d9063c9..b4cd224b 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -215,14 +215,26 @@ case $selection in ;; 9) - title - clear -x app_name=$(k3s kubectl get pods -A | awk '{print $1}' | sort -u | grep -v "system" | sed '1d' | sed 's/^[^-]*-//' | nl -s ") " | column -t) - echo "$app_name" - echo - echo "0) Exit" - [[ $selection == 0 ]] && echo "Exiting.." && exit - read -rt 120 -p "Please type a number: " selection || { echo -e "\nFailed to make a selection in time" ; exit; } + while true + do + clear -x + title + echo "$app_name" + echo + echo "0) Exit" + read -rt 120 -p "Please type a number: " selection || { echo -e "\nFailed to make a selection in time" ; exit; } + if [[ $selection == 0 ]]; then + echo "Exitting.." + exit + elif ! echo -e "$app_name" | grep -qs ^"$selection)" ; then + echo "Error: \"$selection\" was not an option.. Try again" + sleep 3 + continue + else + break + fi + done app_name=$(echo -e "$app_name" | grep ^"$selection)" | awk '{print $2}') search=$(k3s crictl ps -a -s running) mapfile -t pod_id < <(echo "$search" | grep "$app_name" | awk '{print $9}') @@ -232,18 +244,35 @@ case $selection in do echo "$search" | grep "$pod" | awk '{print $7}' done | nl -s ") " | column -t) - clear -x - title - echo "$containers" - echo - echo "0) Exit" - read -rt 120 -p "Choose a container by number: " selection || { echo -e "\nFailed to make a selection in time" ; exit; } - [[ $selection == 0 ]] && echo "Exiting.." && exit - + while true + do + clear -x + title + echo "$containers" + echo + echo "0) Exit" + read -rt 120 -p "Choose a container by number: " selection || { echo -e "\nFailed to make a selection in time" ; exit; } + if [[ $selection == 0 ]]; then + echo "Exitting.." + exit + elif ! echo -e "$containers" | grep -qs ^"$selection)" ; then + echo "Error: \"$selection\" was not an option.. Try again" + sleep 3 + continue + else + break + fi + done container=$(echo "$containers" | grep ^"$selection)" | awk '{print $2}') container_id=$(echo "$search" | grep "$container" | awk '{print $1}') - - read -rt 120 -p "What command would you like to submit to $app_name on $container?: " command || { echo -e "\nFailed to make a selection in time" ; exit; } + clear -x + title + echo "App Name: $app_name" + echo "Container $container" + echo + echo "0) Exit" + read -rt 120 -p "What command would you like to run?: " command || { echo -e "\nFailed to make a selection in time" ; exit; } + [[ $command == 0 ]] && echo "Exitting.." && exit k3s crictl exec "$container_id" $command container=$(echo -e "$app_name" | grep ^"$selection)" | awk '{print $2}') ;; From 6a1c216da3c49e78a64c42859d70398f5a74dbd4 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 8 Aug 2022 20:29:58 -0600 Subject: [PATCH 0617/1229] Spelling --- functions/menu.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/functions/menu.sh b/functions/menu.sh index b4cd224b..a59df8c9 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -225,7 +225,7 @@ case $selection in echo "0) Exit" read -rt 120 -p "Please type a number: " selection || { echo -e "\nFailed to make a selection in time" ; exit; } if [[ $selection == 0 ]]; then - echo "Exitting.." + echo "Exiting.." exit elif ! echo -e "$app_name" | grep -qs ^"$selection)" ; then echo "Error: \"$selection\" was not an option.. Try again" @@ -253,7 +253,7 @@ case $selection in echo "0) Exit" read -rt 120 -p "Choose a container by number: " selection || { echo -e "\nFailed to make a selection in time" ; exit; } if [[ $selection == 0 ]]; then - echo "Exitting.." + echo "Exiting.." exit elif ! echo -e "$containers" | grep -qs ^"$selection)" ; then echo "Error: \"$selection\" was not an option.. Try again" @@ -272,7 +272,7 @@ case $selection in echo echo "0) Exit" read -rt 120 -p "What command would you like to run?: " command || { echo -e "\nFailed to make a selection in time" ; exit; } - [[ $command == 0 ]] && echo "Exitting.." && exit + [[ $command == 0 ]] && echo "Exiting.." && exit k3s crictl exec "$container_id" $command container=$(echo -e "$app_name" | grep ^"$selection)" | awk '{print $2}') ;; From b6a796eb5bed41126ca1b2c78356e70d47fe40f4 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 8 Aug 2022 20:36:53 -0600 Subject: [PATCH 0618/1229] grep appname --- functions/menu.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/menu.sh b/functions/menu.sh index a59df8c9..e05353bc 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -237,7 +237,7 @@ case $selection in done app_name=$(echo -e "$app_name" | grep ^"$selection)" | awk '{print $2}') search=$(k3s crictl ps -a -s running) - mapfile -t pod_id < <(echo "$search" | grep "$app_name" | awk '{print $9}') + mapfile -t pod_id < <(echo "$search" | grep " $app_name " | awk '{print $9}') containers=$( for pod in "${pod_id[@]}" From b845b650c5068098db3fc8f31e66cba7ce1900ed Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 8 Aug 2022 20:41:53 -0600 Subject: [PATCH 0619/1229] search regex --- functions/menu.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/menu.sh b/functions/menu.sh index e05353bc..ddf13880 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -237,7 +237,7 @@ case $selection in done app_name=$(echo -e "$app_name" | grep ^"$selection)" | awk '{print $2}') search=$(k3s crictl ps -a -s running) - mapfile -t pod_id < <(echo "$search" | grep " $app_name " | awk '{print $9}') + mapfile -t pod_id < <(echo "$search" | grep -E " $app_name(-)?" | awk '{print $9}') containers=$( for pod in "${pod_id[@]}" From a1ab1ffb8b89fff34507502f8d5bf94aebed3068 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 8 Aug 2022 20:43:07 -0600 Subject: [PATCH 0620/1229] space or hyphen --- functions/menu.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/menu.sh b/functions/menu.sh index ddf13880..88df690d 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -237,7 +237,7 @@ case $selection in done app_name=$(echo -e "$app_name" | grep ^"$selection)" | awk '{print $2}') search=$(k3s crictl ps -a -s running) - mapfile -t pod_id < <(echo "$search" | grep -E " $app_name(-)?" | awk '{print $9}') + mapfile -t pod_id < <(echo "$search" | grep -E " $app_name( |-)?" | awk '{print $9}') containers=$( for pod in "${pod_id[@]}" From c10ea958f30a9f93af138d1371f1207a08649210 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 8 Aug 2022 20:46:06 -0600 Subject: [PATCH 0621/1229] test new regex --- functions/menu.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/menu.sh b/functions/menu.sh index 88df690d..704f9a46 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -237,7 +237,7 @@ case $selection in done app_name=$(echo -e "$app_name" | grep ^"$selection)" | awk '{print $2}') search=$(k3s crictl ps -a -s running) - mapfile -t pod_id < <(echo "$search" | grep -E " $app_name( |-)?" | awk '{print $9}') + mapfile -t pod_id < <(echo "$search" | grep -E " $app_name( *|-?)" | awk '{print $9}') containers=$( for pod in "${pod_id[@]}" From 65eaf1682d89020cea5a71cbe3666275d47bd3ac Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 8 Aug 2022 20:52:35 -0600 Subject: [PATCH 0622/1229] test regex --- functions/menu.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/menu.sh b/functions/menu.sh index 704f9a46..14ad312a 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -237,7 +237,7 @@ case $selection in done app_name=$(echo -e "$app_name" | grep ^"$selection)" | awk '{print $2}') search=$(k3s crictl ps -a -s running) - mapfile -t pod_id < <(echo "$search" | grep -E " $app_name( *|-?)" | awk '{print $9}') + mapfile -t pod_id < <(echo "$search" | grep -E " $app_name(-|[[:alnum:]])*[[:space:]]" | awk '{print $9}') containers=$( for pod in "${pod_id[@]}" From df34a87089917a1e8e2c271275d2fbb5816ef25a Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 8 Aug 2022 20:53:29 -0600 Subject: [PATCH 0623/1229] test --- functions/menu.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/menu.sh b/functions/menu.sh index 14ad312a..a79fa21a 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -237,7 +237,7 @@ case $selection in done app_name=$(echo -e "$app_name" | grep ^"$selection)" | awk '{print $2}') search=$(k3s crictl ps -a -s running) - mapfile -t pod_id < <(echo "$search" | grep -E " $app_name(-|[[:alnum:]])*[[:space:]]" | awk '{print $9}') + mapfile -t pod_id < <(echo "$search" | grep -E " $app_name(-)?[[:alnum:]]*[[:space:]]" | awk '{print $9}') containers=$( for pod in "${pod_id[@]}" From 76f54786ba114099cc2a957d17b3343768fc5046 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 8 Aug 2022 20:56:52 -0600 Subject: [PATCH 0624/1229] test again --- functions/menu.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/menu.sh b/functions/menu.sh index a79fa21a..d0f595df 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -237,7 +237,7 @@ case $selection in done app_name=$(echo -e "$app_name" | grep ^"$selection)" | awk '{print $2}') search=$(k3s crictl ps -a -s running) - mapfile -t pod_id < <(echo "$search" | grep -E " $app_name(-)?[[:alnum:]]*[[:space:]]" | awk '{print $9}') + mapfile -t pod_id < <(echo "$search" | grep -E " $app_name( |-[[:alnum:]]*[[:space:]])" | awk '{print $9}') containers=$( for pod in "${pod_id[@]}" From bb453ec320ed8f9a7a6260281482f794dd212c56 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 8 Aug 2022 21:00:04 -0600 Subject: [PATCH 0625/1229] final regex edit for now --- functions/menu.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/menu.sh b/functions/menu.sh index d0f595df..a0f16986 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -237,7 +237,7 @@ case $selection in done app_name=$(echo -e "$app_name" | grep ^"$selection)" | awk '{print $2}') search=$(k3s crictl ps -a -s running) - mapfile -t pod_id < <(echo "$search" | grep -E " $app_name( |-[[:alnum:]]*[[:space:]])" | awk '{print $9}') + mapfile -t pod_id < <(echo "$search" | grep -E " $app_name([[:space:]]|-([-[:alnum:]])*[[:space:]])" | awk '{print $9}') containers=$( for pod in "${pod_id[@]}" From 99ad0cd1fe2e3aab717b40c4f894dead860ba3bd Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 8 Aug 2022 21:51:56 -0600 Subject: [PATCH 0626/1229] test --- functions/menu.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/menu.sh b/functions/menu.sh index a0f16986..53ec177c 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -264,7 +264,7 @@ case $selection in fi done container=$(echo "$containers" | grep ^"$selection)" | awk '{print $2}') - container_id=$(echo "$search" | grep "$container" | awk '{print $1}') + container_id=$(echo "$search" | grep -E "[[:space:]]${container}[[:space:]]" | awk '{print $1}') clear -x title echo "App Name: $app_name" From 08e98759783c5d3d3cff356330c203179c924595 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 8 Aug 2022 21:58:54 -0600 Subject: [PATCH 0627/1229] exit message on no pods --- functions/menu.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/menu.sh b/functions/menu.sh index 53ec177c..0ae95ff3 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -238,7 +238,7 @@ case $selection in app_name=$(echo -e "$app_name" | grep ^"$selection)" | awk '{print $2}') search=$(k3s crictl ps -a -s running) mapfile -t pod_id < <(echo "$search" | grep -E " $app_name([[:space:]]|-([-[:alnum:]])*[[:space:]])" | awk '{print $9}') - + [[ "${#pod_id[@]}" == 0 ]] && echo "Are you sure the application in running?" && exit containers=$( for pod in "${pod_id[@]}" do From 835528a8c15fb6504d3830a98dbbf5f6ac8e5ad2 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 8 Aug 2022 21:59:58 -0600 Subject: [PATCH 0628/1229] better message --- functions/menu.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/menu.sh b/functions/menu.sh index 0ae95ff3..077fd917 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -238,7 +238,7 @@ case $selection in app_name=$(echo -e "$app_name" | grep ^"$selection)" | awk '{print $2}') search=$(k3s crictl ps -a -s running) mapfile -t pod_id < <(echo "$search" | grep -E " $app_name([[:space:]]|-([-[:alnum:]])*[[:space:]])" | awk '{print $9}') - [[ "${#pod_id[@]}" == 0 ]] && echo "Are you sure the application in running?" && exit + [[ "${#pod_id[@]}" == 0 ]] && echo -e "No containers available\nAre you sure the application in running?" && exit containers=$( for pod in "${pod_id[@]}" do From bd2e381bb8c5da6c330e873cf152dd2f40e41d78 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 8 Aug 2022 22:17:15 -0600 Subject: [PATCH 0629/1229] test new call --- functions/cmd_to_container.sh | 66 +++++++++ functions/menu.sh | 248 ++-------------------------------- functions/script_create.sh | 174 ++++++++++++++++++++++++ heavy_script.sh | 11 +- 4 files changed, 256 insertions(+), 243 deletions(-) create mode 100644 functions/cmd_to_container.sh create mode 100644 functions/script_create.sh diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh new file mode 100644 index 00000000..00d2a0b4 --- /dev/null +++ b/functions/cmd_to_container.sh @@ -0,0 +1,66 @@ +#!/bin/bash + + +cmd_to_container(){ + app_name=$(k3s kubectl get pods -A | awk '{print $1}' | sort -u | grep -v "system" | sed '1d' | sed 's/^[^-]*-//' | nl -s ") " | column -t) + while true + do + clear -x + title + echo "$app_name" + echo + echo "0) Exit" + read -rt 120 -p "Please type a number: " selection || { echo -e "\nFailed to make a selection in time" ; exit; } + if [[ $selection == 0 ]]; then + echo "Exiting.." + exit + elif ! echo -e "$app_name" | grep -qs ^"$selection)" ; then + echo "Error: \"$selection\" was not an option.. Try again" + sleep 3 + continue + else + break + fi + done + app_name=$(echo -e "$app_name" | grep ^"$selection)" | awk '{print $2}') + search=$(k3s crictl ps -a -s running) + mapfile -t pod_id < <(echo "$search" | grep -E " $app_name([[:space:]]|-([-[:alnum:]])*[[:space:]])" | awk '{print $9}') + [[ "${#pod_id[@]}" == 0 ]] && echo -e "No containers available\nAre you sure the application in running?" && exit + containers=$( + for pod in "${pod_id[@]}" + do + echo "$search" | grep "$pod" | awk '{print $7}' + done | nl -s ") " | column -t) + while true + do + clear -x + title + echo "$containers" + echo + echo "0) Exit" + read -rt 120 -p "Choose a container by number: " selection || { echo -e "\nFailed to make a selection in time" ; exit; } + if [[ $selection == 0 ]]; then + echo "Exiting.." + exit + elif ! echo -e "$containers" | grep -qs ^"$selection)" ; then + echo "Error: \"$selection\" was not an option.. Try again" + sleep 3 + continue + else + break + fi + done + container=$(echo "$containers" | grep ^"$selection)" | awk '{print $2}') + container_id=$(echo "$search" | grep -E "[[:space:]]${container}[[:space:]]" | awk '{print $1}') + clear -x + title + echo "App Name: $app_name" + echo "Container: $container" + echo + echo "0) Exit" + read -rt 120 -p "What command would you like to run?: " command || { echo -e "\nFailed to make a selection in time" ; exit; } + [[ $command == 0 ]] && echo "Exiting.." && exit + k3s crictl exec "$container_id" $command + container=$(echo -e "$app_name" | grep ^"$selection)" | awk '{print $2}') +} +export -f cmd_to_container \ No newline at end of file diff --git a/functions/menu.sh b/functions/menu.sh index 077fd917..9ac93713 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -21,260 +21,38 @@ case $selection in exit ;; 1) - help="true" + help + exit ;; 2) - dns="true" + dns + exit ;; 3) - mount="true" + mount + exit ;; 4) read -rt 120 -p "What is the maximun number of backups you would like?: " number_of_backups || echo "Failed to make a selection" backup="true" ;; 5) - restore="true" + restore + exit ;; 6) - deleteBackup="true" + deleteBackup + exit ;; 7) - self_update="true" + self_update ;; 8) - while true - do - clear -x - title - echo "Choose Your Update Type" - echo "-----------------------" - echo "1) -U | Update all applications, ignores versions" - echo "2) -u | Update all applications, does not update Major releases" - echo - echo "0) Exit" - echo - read -rt 120 -p "Type the Number or Flag: " current_selection || { echo -e "\nFailed to make a selection in time" ; exit; } - case $current_selection in - 0 | [Ee][Xx][Ii][Tt]) - echo "Exiting.." - exit - ;; - 1 | -U) - while true - do - echo -e "\nHow many applications do you want updating at the same time?" - read -rt 120 -p "Please type an integer greater than 0: " up_async || { echo -e "\nFailed to make a selection in time" ; exit; } - if [[ $up_async == 0 ]]; then - echo "Error: \"$up_async\" is less than 1" - echo "NOT adding it to the list" - sleep 3 - continue - elif ! [[ $up_async =~ ^[0-9]+$ ]]; then - echo "Error: \"$up_async\" is invalid, it needs to be an integer" - echo "NOT adding it to the list" - sleep 3 - continue - else - update_selection+=("-U" "$up_async") - break - fi - done - break - ;; - 2 | -u) - while true - do - echo -e "\nHow many applications do you want updating at the same time?" - read -rt 120 -p "Please type an integer greater than 0: " up_async || { echo -e "\nFailed to make a selection in time" ; exit; } - if [[ $up_async == 0 ]]; then - echo "Error: \"$up_async\" is less than 1" - echo "NOT adding it to the list" - sleep 3 - continue - elif ! [[ $up_async =~ ^[0-9]+$ ]]; then - echo "Error: \"$up_async\" is invalid, it needs to be an integer" - echo "NOT adding it to the list" - sleep 3 - continue - else - update_selection+=("-u" "$up_async") - break - fi - done - break - ;; - *) - echo "$current_selection was not an option, try again" && sleep 3 - continue - ;; - esac - done - while true - do - clear -x - title - echo "Update Options" - echo "--------------" - echo "1) -r | Roll-back applications if they fail to update" - echo "2) -i | Add application to ignore list" - echo "3) -S | Shutdown applications prior to updating" - echo "4) -v | verbose output" - echo "5) -t | Set a custom timeout in seconds when checking if either an App or Mountpoint correctly Started, Stopped or (un)Mounted. Defaults to 500 seconds" - echo - echo "Additional Options" - echo "------------------" - echo "6) -b | Back-up your ix-applications dataset, specify a number after -b" - echo "7) -s | sync catalog" - echo "8) -p | Prune unused/old docker images" - echo "9) --self-update | Updates HeavyScript prior to running any other commands" - echo - echo "99) Remove Update Options, Restart" - echo "00) Done making selections, proceed with update" - echo - echo "0) Exit" - echo - echo "Current Choices" - echo "---------------" - echo "bash heavy_script.sh ${update_selection[*]}" - echo - read -rt 600 -p "Type the Number or Flag: " current_selection || { echo -e "\nFailed to make a selection in time" ; exit; } - case $current_selection in - 0 | [Ee][Xx][Ii][Tt]) - echo "Exiting.." - exit - ;; - 00) - clear -x - echo "Running \"bash heavy_script.sh ${update_selection[*]}\"" - echo - exec bash "$script_name" "${update_selection[@]}" - exit - ;; - 1 | -r) - printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-r" && echo -e "\"-r\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it - update_selection+=("-r") - ;; - 2 | -i) - read -rt 120 -p "What is the name of the application we should ignore?: " up_ignore || { echo -e "\nFailed to make a selection in time" ; exit; } - ! [[ $up_ignore =~ ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ ]] && echo -e "Error: \"$up_ignore\" is not a possible option for an application name" && sleep 3 && continue - update_selection+=("-i" "$up_ignore") - ;; - 3 | -S) - printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-S" && echo -e "\"-S\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it - update_selection+=("-S") - ;; - 4 | -v) - printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-v" && echo -e "\"-v\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it - update_selection+=("-v") - ;; - 5 | -t) - printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-t" && echo -e "\"-t\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it - echo "What do you want your timeout to be?" - read -rt 120 -p "Please type an integer: " up_timeout || { echo -e "\nFailed to make a selection in time" ; exit; } - ! [[ $up_timeout =~ ^[0-9]+$ ]] && echo -e "Error: \"$up_timeout\" is invalid, it needs to be an integer\nNOT adding it to the list" && sleep 3 && continue - update_selection+=("-t" "$up_timeout") - ;; - 6 | -b) - printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-b" && echo -e "\"-b\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it - echo "Up to how many backups should we keep?" - read -rt 120 -p "Please type an integer: " up_backups || { echo -e "\nFailed to make a selection in time" ; exit; } - ! [[ $up_backups =~ ^[0-9]+$ ]] && echo -e "Error: \"$up_backups\" is invalid, it needs to be an integer\nNOT adding it to the list" && sleep 3 && continue - [[ $up_backups == 0 ]] && echo -e "Error: Number of backups cannot be 0\nNOT adding it to the list" && sleep 3 && continue - update_selection+=("-b" "$up_backups") - ;; - 7 | -s) - printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-s" && echo -e "\"-s\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it - update_selection+=("-s") - ;; - 8 | -p) - printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-p" && echo -e "\"-p\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it - update_selection+=("-p") - ;; - 9 | --self-update ) - printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "--self-update" && echo -e "\"--self-update\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it - update_selection+=("--self-update") - ;; - 99) - count=2 - echo "restarting" - for i in "${update_selection[@]:2}" - do - unset "update_selection[$count]" - echo "$i removed" - ((count++)) - done - sleep 3 - continue - ;; - *) - echo "\"$current_selection\" was not an option, try again" && sleep 3 && continue - ;; - esac - done + script_create ;; 9) - app_name=$(k3s kubectl get pods -A | awk '{print $1}' | sort -u | grep -v "system" | sed '1d' | sed 's/^[^-]*-//' | nl -s ") " | column -t) - while true - do - clear -x - title - echo "$app_name" - echo - echo "0) Exit" - read -rt 120 -p "Please type a number: " selection || { echo -e "\nFailed to make a selection in time" ; exit; } - if [[ $selection == 0 ]]; then - echo "Exiting.." - exit - elif ! echo -e "$app_name" | grep -qs ^"$selection)" ; then - echo "Error: \"$selection\" was not an option.. Try again" - sleep 3 - continue - else - break - fi - done - app_name=$(echo -e "$app_name" | grep ^"$selection)" | awk '{print $2}') - search=$(k3s crictl ps -a -s running) - mapfile -t pod_id < <(echo "$search" | grep -E " $app_name([[:space:]]|-([-[:alnum:]])*[[:space:]])" | awk '{print $9}') - [[ "${#pod_id[@]}" == 0 ]] && echo -e "No containers available\nAre you sure the application in running?" && exit - containers=$( - for pod in "${pod_id[@]}" - do - echo "$search" | grep "$pod" | awk '{print $7}' - done | nl -s ") " | column -t) - while true - do - clear -x - title - echo "$containers" - echo - echo "0) Exit" - read -rt 120 -p "Choose a container by number: " selection || { echo -e "\nFailed to make a selection in time" ; exit; } - if [[ $selection == 0 ]]; then - echo "Exiting.." - exit - elif ! echo -e "$containers" | grep -qs ^"$selection)" ; then - echo "Error: \"$selection\" was not an option.. Try again" - sleep 3 - continue - else - break - fi - done - container=$(echo "$containers" | grep ^"$selection)" | awk '{print $2}') - container_id=$(echo "$search" | grep -E "[[:space:]]${container}[[:space:]]" | awk '{print $1}') - clear -x - title - echo "App Name: $app_name" - echo "Container $container" - echo - echo "0) Exit" - read -rt 120 -p "What command would you like to run?: " command || { echo -e "\nFailed to make a selection in time" ; exit; } - [[ $command == 0 ]] && echo "Exiting.." && exit - k3s crictl exec "$container_id" $command - container=$(echo -e "$app_name" | grep ^"$selection)" | awk '{print $2}') + cmd_to_container ;; *) echo "\"$selection\" was not an option, please try agian" && sleep 3 && menu diff --git a/functions/script_create.sh b/functions/script_create.sh new file mode 100644 index 00000000..78b4d287 --- /dev/null +++ b/functions/script_create.sh @@ -0,0 +1,174 @@ +#!/bin/bash + +script_create(){ + while true + do + clear -x + title + echo "Choose Your Update Type" + echo "-----------------------" + echo "1) -U | Update all applications, ignores versions" + echo "2) -u | Update all applications, does not update Major releases" + echo + echo "0) Exit" + echo + read -rt 120 -p "Type the Number or Flag: " current_selection || { echo -e "\nFailed to make a selection in time" ; exit; } + case $current_selection in + 0 | [Ee][Xx][Ii][Tt]) + echo "Exiting.." + exit + ;; + 1 | -U) + while true + do + echo -e "\nHow many applications do you want updating at the same time?" + read -rt 120 -p "Please type an integer greater than 0: " up_async || { echo -e "\nFailed to make a selection in time" ; exit; } + if [[ $up_async == 0 ]]; then + echo "Error: \"$up_async\" is less than 1" + echo "NOT adding it to the list" + sleep 3 + continue + elif ! [[ $up_async =~ ^[0-9]+$ ]]; then + echo "Error: \"$up_async\" is invalid, it needs to be an integer" + echo "NOT adding it to the list" + sleep 3 + continue + else + update_selection+=("-U" "$up_async") + break + fi + done + break + ;; + 2 | -u) + while true + do + echo -e "\nHow many applications do you want updating at the same time?" + read -rt 120 -p "Please type an integer greater than 0: " up_async || { echo -e "\nFailed to make a selection in time" ; exit; } + if [[ $up_async == 0 ]]; then + echo "Error: \"$up_async\" is less than 1" + echo "NOT adding it to the list" + sleep 3 + continue + elif ! [[ $up_async =~ ^[0-9]+$ ]]; then + echo "Error: \"$up_async\" is invalid, it needs to be an integer" + echo "NOT adding it to the list" + sleep 3 + continue + else + update_selection+=("-u" "$up_async") + break + fi + done + break + ;; + *) + echo "$current_selection was not an option, try again" && sleep 3 + continue + ;; + esac + done + while true + do + clear -x + title + echo "Update Options" + echo "--------------" + echo "1) -r | Roll-back applications if they fail to update" + echo "2) -i | Add application to ignore list" + echo "3) -S | Shutdown applications prior to updating" + echo "4) -v | verbose output" + echo "5) -t | Set a custom timeout in seconds when checking if either an App or Mountpoint correctly Started, Stopped or (un)Mounted. Defaults to 500 seconds" + echo + echo "Additional Options" + echo "------------------" + echo "6) -b | Back-up your ix-applications dataset, specify a number after -b" + echo "7) -s | sync catalog" + echo "8) -p | Prune unused/old docker images" + echo "9) --self-update | Updates HeavyScript prior to running any other commands" + echo + echo "99) Remove Update Options, Restart" + echo "00) Done making selections, proceed with update" + echo + echo "0) Exit" + echo + echo "Current Choices" + echo "---------------" + echo "bash heavy_script.sh ${update_selection[*]}" + echo + read -rt 600 -p "Type the Number or Flag: " current_selection || { echo -e "\nFailed to make a selection in time" ; exit; } + case $current_selection in + 0 | [Ee][Xx][Ii][Tt]) + echo "Exiting.." + exit + ;; + 00) + clear -x + echo "Running \"bash heavy_script.sh ${update_selection[*]}\"" + echo + exec bash "$script_name" "${update_selection[@]}" + exit + ;; + 1 | -r) + printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-r" && echo -e "\"-r\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it + update_selection+=("-r") + ;; + 2 | -i) + read -rt 120 -p "What is the name of the application we should ignore?: " up_ignore || { echo -e "\nFailed to make a selection in time" ; exit; } + ! [[ $up_ignore =~ ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ ]] && echo -e "Error: \"$up_ignore\" is not a possible option for an application name" && sleep 3 && continue + update_selection+=("-i" "$up_ignore") + ;; + 3 | -S) + printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-S" && echo -e "\"-S\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it + update_selection+=("-S") + ;; + 4 | -v) + printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-v" && echo -e "\"-v\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it + update_selection+=("-v") + ;; + 5 | -t) + printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-t" && echo -e "\"-t\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it + echo "What do you want your timeout to be?" + read -rt 120 -p "Please type an integer: " up_timeout || { echo -e "\nFailed to make a selection in time" ; exit; } + ! [[ $up_timeout =~ ^[0-9]+$ ]] && echo -e "Error: \"$up_timeout\" is invalid, it needs to be an integer\nNOT adding it to the list" && sleep 3 && continue + update_selection+=("-t" "$up_timeout") + ;; + 6 | -b) + printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-b" && echo -e "\"-b\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it + echo "Up to how many backups should we keep?" + read -rt 120 -p "Please type an integer: " up_backups || { echo -e "\nFailed to make a selection in time" ; exit; } + ! [[ $up_backups =~ ^[0-9]+$ ]] && echo -e "Error: \"$up_backups\" is invalid, it needs to be an integer\nNOT adding it to the list" && sleep 3 && continue + [[ $up_backups == 0 ]] && echo -e "Error: Number of backups cannot be 0\nNOT adding it to the list" && sleep 3 && continue + update_selection+=("-b" "$up_backups") + ;; + 7 | -s) + printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-s" && echo -e "\"-s\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it + update_selection+=("-s") + ;; + 8 | -p) + printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-p" && echo -e "\"-p\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it + update_selection+=("-p") + ;; + 9 | --self-update ) + printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "--self-update" && echo -e "\"--self-update\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it + update_selection+=("--self-update") + ;; + 99) + count=2 + echo "restarting" + for i in "${update_selection[@]:2}" + do + unset "update_selection[$count]" + echo "$i removed" + ((count++)) + done + sleep 3 + continue + ;; + *) + echo "\"$current_selection\" was not an option, try again" && sleep 3 && continue + ;; + esac + done +} +export -f script_create \ No newline at end of file diff --git a/heavy_script.sh b/heavy_script.sh index efecf333..3b970e9f 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -8,20 +8,15 @@ script_name="heavy_script.sh" cd "$script_path" || { echo "Error: Failed to change to script directory" ; exit ; } -# shellcheck source=functions/backup.sh source functions/backup.sh -# shellcheck source=functions/dns.sh source functions/dns.sh -# shellcheck source=functions/menu.sh source functions/menu.sh -# shellcheck source=functions/misc.sh source functions/misc.sh -# shellcheck source=functions/mount.sh source functions/mount.sh -# shellcheck source=functions/self_update.sh source functions/self_update.sh -# shellcheck source=functions/update_apps.sh source functions/update_apps.sh +source functions/cmd_to_container.sh +source functions/script_create.sh @@ -139,8 +134,8 @@ done [[ "$update_all_apps" == "true" && "$update_apps" == "true" ]] && echo -e "-U and -u cannot BOTH be called" && exit #Continue to call functions in specific order -[[ "$help" == "true" ]] && help [[ "$self_update" == "true" ]] && self_update +[[ "$help" == "true" ]] && help [[ "$deleteBackup" == "true" ]] && deleteBackup && exit [[ "$dns" == "true" ]] && dns && exit [[ "$restore" == "true" ]] && restore && exit From f3e66e9327e4686fe40ce49c4ce6c8905dcdd116 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 8 Aug 2022 22:18:37 -0600 Subject: [PATCH 0630/1229] remove exits --- functions/menu.sh | 5 ----- 1 file changed, 5 deletions(-) diff --git a/functions/menu.sh b/functions/menu.sh index 9ac93713..79993400 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -22,15 +22,12 @@ case $selection in ;; 1) help - exit ;; 2) dns - exit ;; 3) mount - exit ;; 4) read -rt 120 -p "What is the maximun number of backups you would like?: " number_of_backups || echo "Failed to make a selection" @@ -38,11 +35,9 @@ case $selection in ;; 5) restore - exit ;; 6) deleteBackup - exit ;; 7) self_update From 721dadf09ed59cc5a901e831698aac1c18a0e11b Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 8 Aug 2022 22:28:09 -0600 Subject: [PATCH 0631/1229] remove indents, test sleep timer async --- functions/cmd_to_container.sh | 120 ++++++------ functions/script_create.sh | 334 +++++++++++++++++----------------- functions/update_apps.sh | 13 +- 3 files changed, 234 insertions(+), 233 deletions(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index 00d2a0b4..8b51cf76 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -2,65 +2,65 @@ cmd_to_container(){ - app_name=$(k3s kubectl get pods -A | awk '{print $1}' | sort -u | grep -v "system" | sed '1d' | sed 's/^[^-]*-//' | nl -s ") " | column -t) - while true - do - clear -x - title - echo "$app_name" - echo - echo "0) Exit" - read -rt 120 -p "Please type a number: " selection || { echo -e "\nFailed to make a selection in time" ; exit; } - if [[ $selection == 0 ]]; then - echo "Exiting.." - exit - elif ! echo -e "$app_name" | grep -qs ^"$selection)" ; then - echo "Error: \"$selection\" was not an option.. Try again" - sleep 3 - continue - else - break - fi - done - app_name=$(echo -e "$app_name" | grep ^"$selection)" | awk '{print $2}') - search=$(k3s crictl ps -a -s running) - mapfile -t pod_id < <(echo "$search" | grep -E " $app_name([[:space:]]|-([-[:alnum:]])*[[:space:]])" | awk '{print $9}') - [[ "${#pod_id[@]}" == 0 ]] && echo -e "No containers available\nAre you sure the application in running?" && exit - containers=$( - for pod in "${pod_id[@]}" - do - echo "$search" | grep "$pod" | awk '{print $7}' - done | nl -s ") " | column -t) - while true - do - clear -x - title - echo "$containers" - echo - echo "0) Exit" - read -rt 120 -p "Choose a container by number: " selection || { echo -e "\nFailed to make a selection in time" ; exit; } - if [[ $selection == 0 ]]; then - echo "Exiting.." - exit - elif ! echo -e "$containers" | grep -qs ^"$selection)" ; then - echo "Error: \"$selection\" was not an option.. Try again" - sleep 3 - continue - else - break - fi - done - container=$(echo "$containers" | grep ^"$selection)" | awk '{print $2}') - container_id=$(echo "$search" | grep -E "[[:space:]]${container}[[:space:]]" | awk '{print $1}') - clear -x - title - echo "App Name: $app_name" - echo "Container: $container" - echo - echo "0) Exit" - read -rt 120 -p "What command would you like to run?: " command || { echo -e "\nFailed to make a selection in time" ; exit; } - [[ $command == 0 ]] && echo "Exiting.." && exit - k3s crictl exec "$container_id" $command - container=$(echo -e "$app_name" | grep ^"$selection)" | awk '{print $2}') +app_name=$(k3s kubectl get pods -A | awk '{print $1}' | sort -u | grep -v "system" | sed '1d' | sed 's/^[^-]*-//' | nl -s ") " | column -t) +while true +do + clear -x + title + echo "$app_name" + echo + echo "0) Exit" + read -rt 120 -p "Please type a number: " selection || { echo -e "\nFailed to make a selection in time" ; exit; } + if [[ $selection == 0 ]]; then + echo "Exiting.." + exit + elif ! echo -e "$app_name" | grep -qs ^"$selection)" ; then + echo "Error: \"$selection\" was not an option.. Try again" + sleep 3 + continue + else + break + fi +done +app_name=$(echo -e "$app_name" | grep ^"$selection)" | awk '{print $2}') +search=$(k3s crictl ps -a -s running) +mapfile -t pod_id < <(echo "$search" | grep -E " $app_name([[:space:]]|-([-[:alnum:]])*[[:space:]])" | awk '{print $9}') +[[ "${#pod_id[@]}" == 0 ]] && echo -e "No containers available\nAre you sure the application in running?" && exit +containers=$( +for pod in "${pod_id[@]}" +do + echo "$search" | grep "$pod" | awk '{print $7}' +done | nl -s ") " | column -t) +while true +do + clear -x + title + echo "$containers" + echo + echo "0) Exit" + read -rt 120 -p "Choose a container by number: " selection || { echo -e "\nFailed to make a selection in time" ; exit; } + if [[ $selection == 0 ]]; then + echo "Exiting.." + exit + elif ! echo -e "$containers" | grep -qs ^"$selection)" ; then + echo "Error: \"$selection\" was not an option.. Try again" + sleep 3 + continue + else + break + fi +done +container=$(echo "$containers" | grep ^"$selection)" | awk '{print $2}') +container_id=$(echo "$search" | grep -E "[[:space:]]${container}[[:space:]]" | awk '{print $1}') +clear -x +title +echo "App Name: $app_name" +echo "Container: $container" +echo +echo "0) Exit" +read -rt 120 -p "What command would you like to run?: " command || { echo -e "\nFailed to make a selection in time" ; exit; } +[[ $command == 0 ]] && echo "Exiting.." && exit +k3s crictl exec "$container_id" $command +container=$(echo -e "$app_name" | grep ^"$selection)" | awk '{print $2}') } export -f cmd_to_container \ No newline at end of file diff --git a/functions/script_create.sh b/functions/script_create.sh index 78b4d287..b1448218 100644 --- a/functions/script_create.sh +++ b/functions/script_create.sh @@ -1,174 +1,174 @@ #!/bin/bash script_create(){ - while true - do - clear -x - title - echo "Choose Your Update Type" - echo "-----------------------" - echo "1) -U | Update all applications, ignores versions" - echo "2) -u | Update all applications, does not update Major releases" - echo - echo "0) Exit" - echo - read -rt 120 -p "Type the Number or Flag: " current_selection || { echo -e "\nFailed to make a selection in time" ; exit; } - case $current_selection in - 0 | [Ee][Xx][Ii][Tt]) - echo "Exiting.." - exit - ;; - 1 | -U) - while true - do - echo -e "\nHow many applications do you want updating at the same time?" - read -rt 120 -p "Please type an integer greater than 0: " up_async || { echo -e "\nFailed to make a selection in time" ; exit; } - if [[ $up_async == 0 ]]; then - echo "Error: \"$up_async\" is less than 1" - echo "NOT adding it to the list" - sleep 3 - continue - elif ! [[ $up_async =~ ^[0-9]+$ ]]; then - echo "Error: \"$up_async\" is invalid, it needs to be an integer" - echo "NOT adding it to the list" - sleep 3 - continue - else - update_selection+=("-U" "$up_async") - break - fi - done - break - ;; - 2 | -u) - while true - do - echo -e "\nHow many applications do you want updating at the same time?" - read -rt 120 -p "Please type an integer greater than 0: " up_async || { echo -e "\nFailed to make a selection in time" ; exit; } - if [[ $up_async == 0 ]]; then - echo "Error: \"$up_async\" is less than 1" - echo "NOT adding it to the list" - sleep 3 - continue - elif ! [[ $up_async =~ ^[0-9]+$ ]]; then - echo "Error: \"$up_async\" is invalid, it needs to be an integer" - echo "NOT adding it to the list" - sleep 3 - continue - else - update_selection+=("-u" "$up_async") - break - fi - done - break - ;; - *) - echo "$current_selection was not an option, try again" && sleep 3 - continue - ;; - esac - done - while true - do - clear -x - title - echo "Update Options" - echo "--------------" - echo "1) -r | Roll-back applications if they fail to update" - echo "2) -i | Add application to ignore list" - echo "3) -S | Shutdown applications prior to updating" - echo "4) -v | verbose output" - echo "5) -t | Set a custom timeout in seconds when checking if either an App or Mountpoint correctly Started, Stopped or (un)Mounted. Defaults to 500 seconds" - echo - echo "Additional Options" - echo "------------------" - echo "6) -b | Back-up your ix-applications dataset, specify a number after -b" - echo "7) -s | sync catalog" - echo "8) -p | Prune unused/old docker images" - echo "9) --self-update | Updates HeavyScript prior to running any other commands" - echo - echo "99) Remove Update Options, Restart" - echo "00) Done making selections, proceed with update" - echo - echo "0) Exit" - echo - echo "Current Choices" - echo "---------------" - echo "bash heavy_script.sh ${update_selection[*]}" - echo - read -rt 600 -p "Type the Number or Flag: " current_selection || { echo -e "\nFailed to make a selection in time" ; exit; } - case $current_selection in - 0 | [Ee][Xx][Ii][Tt]) - echo "Exiting.." - exit - ;; - 00) - clear -x - echo "Running \"bash heavy_script.sh ${update_selection[*]}\"" - echo - exec bash "$script_name" "${update_selection[@]}" - exit - ;; - 1 | -r) - printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-r" && echo -e "\"-r\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it - update_selection+=("-r") - ;; - 2 | -i) - read -rt 120 -p "What is the name of the application we should ignore?: " up_ignore || { echo -e "\nFailed to make a selection in time" ; exit; } - ! [[ $up_ignore =~ ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ ]] && echo -e "Error: \"$up_ignore\" is not a possible option for an application name" && sleep 3 && continue - update_selection+=("-i" "$up_ignore") - ;; - 3 | -S) - printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-S" && echo -e "\"-S\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it - update_selection+=("-S") - ;; - 4 | -v) - printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-v" && echo -e "\"-v\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it - update_selection+=("-v") - ;; - 5 | -t) - printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-t" && echo -e "\"-t\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it - echo "What do you want your timeout to be?" - read -rt 120 -p "Please type an integer: " up_timeout || { echo -e "\nFailed to make a selection in time" ; exit; } - ! [[ $up_timeout =~ ^[0-9]+$ ]] && echo -e "Error: \"$up_timeout\" is invalid, it needs to be an integer\nNOT adding it to the list" && sleep 3 && continue - update_selection+=("-t" "$up_timeout") - ;; - 6 | -b) - printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-b" && echo -e "\"-b\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it - echo "Up to how many backups should we keep?" - read -rt 120 -p "Please type an integer: " up_backups || { echo -e "\nFailed to make a selection in time" ; exit; } - ! [[ $up_backups =~ ^[0-9]+$ ]] && echo -e "Error: \"$up_backups\" is invalid, it needs to be an integer\nNOT adding it to the list" && sleep 3 && continue - [[ $up_backups == 0 ]] && echo -e "Error: Number of backups cannot be 0\nNOT adding it to the list" && sleep 3 && continue - update_selection+=("-b" "$up_backups") - ;; - 7 | -s) - printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-s" && echo -e "\"-s\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it - update_selection+=("-s") - ;; - 8 | -p) - printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-p" && echo -e "\"-p\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it - update_selection+=("-p") - ;; - 9 | --self-update ) - printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "--self-update" && echo -e "\"--self-update\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it - update_selection+=("--self-update") - ;; - 99) - count=2 - echo "restarting" - for i in "${update_selection[@]:2}" - do - unset "update_selection[$count]" - echo "$i removed" - ((count++)) - done +while true +do + clear -x + title + echo "Choose Your Update Type" + echo "-----------------------" + echo "1) -U | Update all applications, ignores versions" + echo "2) -u | Update all applications, does not update Major releases" + echo + echo "0) Exit" + echo + read -rt 120 -p "Type the Number or Flag: " current_selection || { echo -e "\nFailed to make a selection in time" ; exit; } + case $current_selection in + 0 | [Ee][Xx][Ii][Tt]) + echo "Exiting.." + exit + ;; + 1 | -U) + while true + do + echo -e "\nHow many applications do you want updating at the same time?" + read -rt 120 -p "Please type an integer greater than 0: " up_async || { echo -e "\nFailed to make a selection in time" ; exit; } + if [[ $up_async == 0 ]]; then + echo "Error: \"$up_async\" is less than 1" + echo "NOT adding it to the list" sleep 3 continue - ;; - *) - echo "\"$current_selection\" was not an option, try again" && sleep 3 && continue - ;; - esac - done + elif ! [[ $up_async =~ ^[0-9]+$ ]]; then + echo "Error: \"$up_async\" is invalid, it needs to be an integer" + echo "NOT adding it to the list" + sleep 3 + continue + else + update_selection+=("-U" "$up_async") + break + fi + done + break + ;; + 2 | -u) + while true + do + echo -e "\nHow many applications do you want updating at the same time?" + read -rt 120 -p "Please type an integer greater than 0: " up_async || { echo -e "\nFailed to make a selection in time" ; exit; } + if [[ $up_async == 0 ]]; then + echo "Error: \"$up_async\" is less than 1" + echo "NOT adding it to the list" + sleep 3 + continue + elif ! [[ $up_async =~ ^[0-9]+$ ]]; then + echo "Error: \"$up_async\" is invalid, it needs to be an integer" + echo "NOT adding it to the list" + sleep 3 + continue + else + update_selection+=("-u" "$up_async") + break + fi + done + break + ;; + *) + echo "$current_selection was not an option, try again" && sleep 3 + continue + ;; + esac +done +while true +do + clear -x + title + echo "Update Options" + echo "--------------" + echo "1) -r | Roll-back applications if they fail to update" + echo "2) -i | Add application to ignore list" + echo "3) -S | Shutdown applications prior to updating" + echo "4) -v | verbose output" + echo "5) -t | Set a custom timeout in seconds when checking if either an App or Mountpoint correctly Started, Stopped or (un)Mounted. Defaults to 500 seconds" + echo + echo "Additional Options" + echo "------------------" + echo "6) -b | Back-up your ix-applications dataset, specify a number after -b" + echo "7) -s | sync catalog" + echo "8) -p | Prune unused/old docker images" + echo "9) --self-update | Updates HeavyScript prior to running any other commands" + echo + echo "99) Remove Update Options, Restart" + echo "00) Done making selections, proceed with update" + echo + echo "0) Exit" + echo + echo "Current Choices" + echo "---------------" + echo "bash heavy_script.sh ${update_selection[*]}" + echo + read -rt 600 -p "Type the Number or Flag: " current_selection || { echo -e "\nFailed to make a selection in time" ; exit; } + case $current_selection in + 0 | [Ee][Xx][Ii][Tt]) + echo "Exiting.." + exit + ;; + 00) + clear -x + echo "Running \"bash heavy_script.sh ${update_selection[*]}\"" + echo + exec bash "$script_name" "${update_selection[@]}" + exit + ;; + 1 | -r) + printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-r" && echo -e "\"-r\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it + update_selection+=("-r") + ;; + 2 | -i) + read -rt 120 -p "What is the name of the application we should ignore?: " up_ignore || { echo -e "\nFailed to make a selection in time" ; exit; } + ! [[ $up_ignore =~ ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ ]] && echo -e "Error: \"$up_ignore\" is not a possible option for an application name" && sleep 3 && continue + update_selection+=("-i" "$up_ignore") + ;; + 3 | -S) + printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-S" && echo -e "\"-S\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it + update_selection+=("-S") + ;; + 4 | -v) + printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-v" && echo -e "\"-v\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it + update_selection+=("-v") + ;; + 5 | -t) + printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-t" && echo -e "\"-t\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it + echo "What do you want your timeout to be?" + read -rt 120 -p "Please type an integer: " up_timeout || { echo -e "\nFailed to make a selection in time" ; exit; } + ! [[ $up_timeout =~ ^[0-9]+$ ]] && echo -e "Error: \"$up_timeout\" is invalid, it needs to be an integer\nNOT adding it to the list" && sleep 3 && continue + update_selection+=("-t" "$up_timeout") + ;; + 6 | -b) + printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-b" && echo -e "\"-b\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it + echo "Up to how many backups should we keep?" + read -rt 120 -p "Please type an integer: " up_backups || { echo -e "\nFailed to make a selection in time" ; exit; } + ! [[ $up_backups =~ ^[0-9]+$ ]] && echo -e "Error: \"$up_backups\" is invalid, it needs to be an integer\nNOT adding it to the list" && sleep 3 && continue + [[ $up_backups == 0 ]] && echo -e "Error: Number of backups cannot be 0\nNOT adding it to the list" && sleep 3 && continue + update_selection+=("-b" "$up_backups") + ;; + 7 | -s) + printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-s" && echo -e "\"-s\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it + update_selection+=("-s") + ;; + 8 | -p) + printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-p" && echo -e "\"-p\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it + update_selection+=("-p") + ;; + 9 | --self-update ) + printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "--self-update" && echo -e "\"--self-update\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it + update_selection+=("--self-update") + ;; + 99) + count=2 + echo "restarting" + for i in "${update_selection[@]:2}" + do + unset "update_selection[$count]" + echo "$i removed" + ((count++)) + done + sleep 3 + continue + ;; + *) + echo "\"$current_selection\" was not an option, try again" && sleep 3 && continue + ;; + esac +done } export -f script_create \ No newline at end of file diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 470c342a..ccc4cf4c 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -30,15 +30,16 @@ do do update_apps "${array[$it]}" & processes+=($!) + sleep 2 ((it++)) ((proc_count++)) done - ((ttl++)) - if [[ $ttl -eq 1 ]]; then - sleep 15 - else - sleep 6 - fi + # ((ttl++)) + # if [[ $ttl -eq 1 ]]; then + # sleep 15 + # else + # sleep 6 + # fi elif [[ $proc_count != 0 ]]; then # Wait for all processes to finish sleep 6 else # All processes must be completed, break out of loop From 1b238e22519ca6d052f2632ab86ff4c855a37a6d Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 8 Aug 2022 22:43:07 -0600 Subject: [PATCH 0632/1229] test timeout --- functions/update_apps.sh | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index ccc4cf4c..d6069fe3 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -14,8 +14,16 @@ it=0 ttl=0 while true do - while_status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status') - echo "$while_status" > temp.txt + while true + do + if ! while_status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' 2>/dev/null); then + sleep 5 + else + echo "$while_status" > temp.txt + break + fi + done + proc_count=${#processes[@]} count=0 for proc in "${processes[@]}" @@ -30,7 +38,7 @@ do do update_apps "${array[$it]}" & processes+=($!) - sleep 2 + sleep 3 ((it++)) ((proc_count++)) done From 4df204e15b2f380ca287214d817f6e3b97be68d9 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 8 Aug 2022 22:44:51 -0600 Subject: [PATCH 0633/1229] combo sleep --- functions/update_apps.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index d6069fe3..57daeb88 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -38,16 +38,16 @@ do do update_apps "${array[$it]}" & processes+=($!) - sleep 3 + sleep 1 ((it++)) ((proc_count++)) done - # ((ttl++)) - # if [[ $ttl -eq 1 ]]; then - # sleep 15 - # else - # sleep 6 - # fi + ((ttl++)) + if [[ $ttl -eq 1 ]]; then + sleep 15 + else + sleep 6 + fi elif [[ $proc_count != 0 ]]; then # Wait for all processes to finish sleep 6 else # All processes must be completed, break out of loop From 9155fd135dc7006b8fc5b3addc2fa870cacfaa67 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 8 Aug 2022 22:45:47 -0600 Subject: [PATCH 0634/1229] message --- functions/update_apps.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 57daeb88..a6ac26e2 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -17,6 +17,7 @@ do while true do if ! while_status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' 2>/dev/null); then + echo "Middlewared timed out, consider lowering your async updates" sleep 5 else echo "$while_status" > temp.txt From 68daf5f343c7cbe99ed43b5302fb2a196847a170 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 8 Aug 2022 23:14:53 -0600 Subject: [PATCH 0635/1229] test sleep --- functions/update_apps.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index a6ac26e2..cfeecea8 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -24,7 +24,6 @@ do break fi done - proc_count=${#processes[@]} count=0 for proc in "${processes[@]}" @@ -45,7 +44,7 @@ do done ((ttl++)) if [[ $ttl -eq 1 ]]; then - sleep 15 + sleep 25 else sleep 6 fi From 99208d516590c352a0b107e76d4730ab4877ddb2 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 8 Aug 2022 23:30:41 -0600 Subject: [PATCH 0636/1229] who knows --- functions/update_apps.sh | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index cfeecea8..b278a31e 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -11,7 +11,7 @@ echo "Asynchronous Updates: $update_limit" # previous 20% 2 min 9 seconds it=0 -ttl=0 +first_run=0 while true do while true @@ -34,19 +34,24 @@ do if [[ "$proc_count" -ge "$update_limit" ]]; then sleep 6 elif [[ $it -lt ${#array[@]} ]]; then + ttl=0 until [[ "$proc_count" -ge "$update_limit" || $it -ge ${#array[@]} ]] do update_apps "${array[$it]}" & processes+=($!) - sleep 1 ((it++)) ((proc_count++)) + ((ttl++)) done - ((ttl++)) - if [[ $ttl -eq 1 ]]; then - sleep 25 - else - sleep 6 + ((first_run++)) + if [[ $first_run == 1 ]]; then + if [[ $ttl -le 5 ]]; then + sleep 15 + elif [[ $ttl -le 10 ]]; then + sleep 25 + elif [[ $ttl -gt 10 ]]; then + sleep 35 + fi fi elif [[ $proc_count != 0 ]]; then # Wait for all processes to finish sleep 6 From 68f8934708c5b47a784a54abb156d6103dda70ed Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 8 Aug 2022 23:47:34 -0600 Subject: [PATCH 0637/1229] test trigger --- functions/update_apps.sh | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index b278a31e..d5ab9391 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -12,18 +12,23 @@ echo "Asynchronous Updates: $update_limit" # previous 20% 2 min 9 seconds it=0 first_run=0 +while_status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' 2>/dev/null) while true do - while true - do - if ! while_status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' 2>/dev/null); then - echo "Middlewared timed out, consider lowering your async updates" - sleep 5 - else - echo "$while_status" > temp.txt - break - fi - done + # while true + # do + # if ! while_status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' 2>/dev/null); then + # echo "Middlewared timed out, consider lowering your async updates" + # sleep 5 + # else + # echo "$while_status" > temp.txt + # break + # fi + # done + if [ ! -e "$file" ] ; then + while_status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' 2>/dev/null) + echo "$while_status" > temp.txt + fi proc_count=${#processes[@]} count=0 for proc in "${processes[@]}" @@ -101,6 +106,7 @@ if [[ "$diff_app" == "$diff_chart" || "$update_all_apps" == "true" ]]; then #con [[ "$verbose" == "true" ]] && echo_array+=("Stopping prior to update..") midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null || echo_array+=("Error: Failed to stop $app_name") SECONDS=0 + [[ ! -e trigger ]] && touch trigger while [[ "$status" != "STOPPED" ]] do status=$( grep "^$app_name," temp.txt | awk -F ',' '{print $2}') @@ -135,6 +141,7 @@ export -f update_apps after_update_actions(){ SECONDS=0 count=0 +[[ ! -e trigger ]] && touch trigger if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then while true do From a5b6f912fdbec29dca20edef94bdbb9a696105ec Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 8 Aug 2022 23:48:02 -0600 Subject: [PATCH 0638/1229] forgot to rm trigger --- functions/update_apps.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index d5ab9391..25868faf 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -65,6 +65,7 @@ do fi done rm temp.txt +rm trigger echo echo } From 9a0bc10b8eb63ae6d79a20d8e15921413f7ec5c5 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 8 Aug 2022 23:48:29 -0600 Subject: [PATCH 0639/1229] comment out un-needed --- functions/update_apps.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 25868faf..76d78053 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -48,16 +48,16 @@ do ((proc_count++)) ((ttl++)) done - ((first_run++)) - if [[ $first_run == 1 ]]; then - if [[ $ttl -le 5 ]]; then - sleep 15 - elif [[ $ttl -le 10 ]]; then - sleep 25 - elif [[ $ttl -gt 10 ]]; then - sleep 35 - fi - fi + # ((first_run++)) + # if [[ $first_run == 1 ]]; then + # if [[ $ttl -le 5 ]]; then + # sleep 15 + # elif [[ $ttl -le 10 ]]; then + # sleep 25 + # elif [[ $ttl -gt 10 ]]; then + # sleep 35 + # fi + # fi elif [[ $proc_count != 0 ]]; then # Wait for all processes to finish sleep 6 else # All processes must be completed, break out of loop From da8df6b1807291c6818fb61343b7df70b3a87e61 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 8 Aug 2022 23:53:01 -0600 Subject: [PATCH 0640/1229] temp creation --- functions/update_apps.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 76d78053..cdb9fd2e 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -11,8 +11,8 @@ echo "Asynchronous Updates: $update_limit" # previous 20% 2 min 9 seconds it=0 -first_run=0 -while_status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' 2>/dev/null) +# first_run=0 +while_status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' 2>/dev/null) > temp.txt while true do # while true From 053d971f7a8c57a6e05fe827657e234da46544c4 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 8 Aug 2022 23:58:07 -0600 Subject: [PATCH 0641/1229] wooo trigger works --- functions/update_apps.sh | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index cdb9fd2e..e9cd4d37 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -11,20 +11,9 @@ echo "Asynchronous Updates: $update_limit" # previous 20% 2 min 9 seconds it=0 -# first_run=0 while_status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' 2>/dev/null) > temp.txt while true do - # while true - # do - # if ! while_status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' 2>/dev/null); then - # echo "Middlewared timed out, consider lowering your async updates" - # sleep 5 - # else - # echo "$while_status" > temp.txt - # break - # fi - # done if [ ! -e "$file" ] ; then while_status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' 2>/dev/null) echo "$while_status" > temp.txt @@ -48,16 +37,6 @@ do ((proc_count++)) ((ttl++)) done - # ((first_run++)) - # if [[ $first_run == 1 ]]; then - # if [[ $ttl -le 5 ]]; then - # sleep 15 - # elif [[ $ttl -le 10 ]]; then - # sleep 25 - # elif [[ $ttl -gt 10 ]]; then - # sleep 35 - # fi - # fi elif [[ $proc_count != 0 ]]; then # Wait for all processes to finish sleep 6 else # All processes must be completed, break out of loop From fbfce5ce269b795684441416ad539487ba94ec5e Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 8 Aug 2022 23:59:32 -0600 Subject: [PATCH 0642/1229] uhh --- functions/update_apps.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index e9cd4d37..2ef0f803 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -14,7 +14,7 @@ it=0 while_status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' 2>/dev/null) > temp.txt while true do - if [ ! -e "$file" ] ; then + if [ ! -e trigger ] ; then while_status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' 2>/dev/null) echo "$while_status" > temp.txt fi @@ -28,14 +28,12 @@ do if [[ "$proc_count" -ge "$update_limit" ]]; then sleep 6 elif [[ $it -lt ${#array[@]} ]]; then - ttl=0 until [[ "$proc_count" -ge "$update_limit" || $it -ge ${#array[@]} ]] do update_apps "${array[$it]}" & processes+=($!) ((it++)) ((proc_count++)) - ((ttl++)) done elif [[ $proc_count != 0 ]]; then # Wait for all processes to finish sleep 6 From e97b61b2726c9e8aca901770ab64309e68870909 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 9 Aug 2022 00:03:27 -0600 Subject: [PATCH 0643/1229] test --- functions/update_apps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 2ef0f803..aecb5a6d 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -14,7 +14,7 @@ it=0 while_status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' 2>/dev/null) > temp.txt while true do - if [ ! -e trigger ] ; then + if [ -f trigger ]; then while_status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' 2>/dev/null) echo "$while_status" > temp.txt fi From 9c545ca9c6fdc6b885617db6ec797af24fccb2a5 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Tue, 9 Aug 2022 00:42:07 +0000 Subject: [PATCH 0644/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.152.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 4830211b..7c53289d 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@f489d66310a2026c6e780a14840973f662f7a138 # tag=v32.135.1 + uses: renovatebot/github-action@1a9f0da34c786cf451cd66ef015e7647e41cd67e # tag=v32.152.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From ba1f1f5358c21339edc066d612f2ab2130d5523c Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 9 Aug 2022 00:31:04 -0600 Subject: [PATCH 0645/1229] global sleep 5 --- functions/update_apps.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index aecb5a6d..70641491 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -98,7 +98,7 @@ if [[ "$diff_app" == "$diff_chart" || "$update_all_apps" == "true" ]]; then #con break elif [[ "$status" != "STOPPED" ]]; then [[ "$verbose" == "true" ]] && echo_array+=("Waiting $((timeout-SECONDS)) more seconds for $app_name to be STOPPED") - sleep 15 + sleep 5 fi done fi @@ -132,14 +132,14 @@ if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then echo_array+=("Stopped") break else - [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Active..") && sleep 15 && continue #if reports active on FIRST time through loop, double check - [[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports active on FIRST time through loop, double check + [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Active..") && sleep 5 && continue #if reports active on FIRST time through loop, double check + [[ "$count" -le 1 && -z "$verbose" ]] && sleep 5 && continue #if reports active on FIRST time through loop, double check echo_array+=("Active") break #if reports active any time after the first loop, assume actually active. fi elif [[ "$status" == "STOPPED" ]]; then - [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Stopped..") && sleep 15 && continue #if reports stopped on FIRST time through loop, double check - [[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports stopped on FIRST time through loop, double check + [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Stopped..") && sleep 5 && continue #if reports stopped on FIRST time through loop, double check + [[ "$count" -le 1 && -z "$verbose" ]] && sleep 5 && continue #if reports stopped on FIRST time through loop, double check echo_array+=("Stopped") break #if reports stopped any time after the first loop, assume its extermal services. elif [[ "$SECONDS" -ge "$timeout" && "$status" == "DEPLOYING" ]]; then @@ -167,7 +167,7 @@ if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then fi else [[ "$verbose" == "true" ]] && echo_array+=("Waiting $((timeout-SECONDS)) more seconds for $app_name to be ACTIVE") - sleep 15 + sleep 5 continue fi done From f0b95738500d4810cb08c273306c54091d6e456c Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 9 Aug 2022 00:48:12 -0600 Subject: [PATCH 0646/1229] regression in speed --- functions/update_apps.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 70641491..e8733940 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -32,6 +32,7 @@ do do update_apps "${array[$it]}" & processes+=($!) + sleep 3 ((it++)) ((proc_count++)) done From d75003c6f01d44ee37bcebf1a3ca3757e4817d37 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 9 Aug 2022 12:05:18 -0600 Subject: [PATCH 0647/1229] revert global --- functions/update_apps.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index e8733940..00ffeead 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -133,14 +133,14 @@ if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then echo_array+=("Stopped") break else - [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Active..") && sleep 5 && continue #if reports active on FIRST time through loop, double check - [[ "$count" -le 1 && -z "$verbose" ]] && sleep 5 && continue #if reports active on FIRST time through loop, double check + [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Active..") && sleep 15 && continue #if reports active on FIRST time through loop, double check + [[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports active on FIRST time through loop, double check echo_array+=("Active") break #if reports active any time after the first loop, assume actually active. fi elif [[ "$status" == "STOPPED" ]]; then - [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Stopped..") && sleep 5 && continue #if reports stopped on FIRST time through loop, double check - [[ "$count" -le 1 && -z "$verbose" ]] && sleep 5 && continue #if reports stopped on FIRST time through loop, double check + [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Stopped..") && sleep 15 && continue #if reports stopped on FIRST time through loop, double check + [[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports stopped on FIRST time through loop, double check echo_array+=("Stopped") break #if reports stopped any time after the first loop, assume its extermal services. elif [[ "$SECONDS" -ge "$timeout" && "$status" == "DEPLOYING" ]]; then @@ -168,7 +168,7 @@ if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then fi else [[ "$verbose" == "true" ]] && echo_array+=("Waiting $((timeout-SECONDS)) more seconds for $app_name to be ACTIVE") - sleep 5 + sleep 15 continue fi done From 8dafa5eb44ddbe6ab4a7254c1f67213c324ca0a8 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 9 Aug 2022 12:16:15 -0600 Subject: [PATCH 0648/1229] major release fix --- functions/update_apps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 00ffeead..fab7ada7 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -109,7 +109,7 @@ if [[ "$diff_app" == "$diff_chart" || "$update_all_apps" == "true" ]]; then #con cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo_array+=("Updated\n$old_full_ver\n$new_full_ver") || echo_array+=("FAILED") fi else - echo_array+=("\n$app_name\nMajor Release, update manually") + echo -e "\n$app_name\nMajor Release, update manually" return 0 fi after_update_actions From 734f1b7ebc7eaf4fd85212cf81acba2c37425c3f Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 9 Aug 2022 12:19:24 -0600 Subject: [PATCH 0649/1229] check for file before deletion --- functions/update_apps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index fab7ada7..e1c7b45d 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -43,7 +43,7 @@ do fi done rm temp.txt -rm trigger +[[ -e trigger ]] && rm trigger echo echo } From bac1658480eec127bd44ca758ce430871549a34c Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 9 Aug 2022 12:24:13 -0600 Subject: [PATCH 0650/1229] file rather than anything --- functions/update_apps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index e1c7b45d..9516b0a3 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -43,7 +43,7 @@ do fi done rm temp.txt -[[ -e trigger ]] && rm trigger +[[ -f trigger ]] && rm trigger echo echo } From 495205253a7f437a5b293b6513a8f87c1fc0fb76 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 9 Aug 2022 17:32:47 -0600 Subject: [PATCH 0651/1229] test new update --- functions/update_apps.sh | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 9516b0a3..0c51132e 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -78,8 +78,7 @@ if [[ "$diff_app" == "$diff_chart" || "$update_all_apps" == "true" ]]; then #con if [[ "$startstatus" == "STOPPED" ]]; then # if status is already stopped, skip while loop echo_array+=("\n$app_name") [[ "$verbose" == "true" ]] && echo_array+=("Updating..") - cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo_array+=("Updated\n$old_full_ver\n$new_full_ver") || echo_array+=("FAILED") - return 0 + update else # if status was not STOPPED, stop the app prior to updating echo_array+=("\n$app_name") [[ "$verbose" == "true" ]] && echo_array+=("Stopping prior to update..") @@ -92,8 +91,7 @@ if [[ "$diff_app" == "$diff_chart" || "$update_all_apps" == "true" ]]; then #con if [[ "$status" == "STOPPED" ]]; then echo_array+=("Stopped") [[ "$verbose" == "true" ]] && echo_array+=("Updating..") - cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo_array+=("Updated\n$old_full_ver\n$new_full_ver") || echo_array+=("Failed to update") - break + update elif [[ "$SECONDS" -ge "$timeout" ]]; then echo_array+=("Error: Run Time($SECONDS) has exceeded Timeout($timeout)") break @@ -106,7 +104,7 @@ if [[ "$diff_app" == "$diff_chart" || "$update_all_apps" == "true" ]]; then #con else #user must not be using -S, just update echo_array+=("\n$app_name") [[ "$verbose" == "true" ]] && echo_array+=("Updating..") - cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo_array+=("Updated\n$old_full_ver\n$new_full_ver") || echo_array+=("FAILED") + update fi else echo -e "\n$app_name\nMajor Release, update manually" @@ -117,6 +115,23 @@ after_update_actions export -f update_apps +update(){ +count=0 +while [[ $count -lt 3 ]] +do + updated=$(grep "^$app_name," temp.txt | awk -F ',' '{print $3}') + if cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null || [[ $updated == "false" ]]; then + echo_array+=("Updated\n$old_full_ver\n$new_full_ver") + break + else + echo_array+=("Failed, trying again..") + ((count++)) + sleep 5 + fi +done +} +export -f update + after_update_actions(){ SECONDS=0 count=0 From b8616e988c639a189cbf380f08a6c31c3a649357 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 9 Aug 2022 17:46:59 -0600 Subject: [PATCH 0652/1229] error message on failed update --- functions/update_apps.sh | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 0c51132e..f5c9e086 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -78,7 +78,12 @@ if [[ "$diff_app" == "$diff_chart" || "$update_all_apps" == "true" ]]; then #con if [[ "$startstatus" == "STOPPED" ]]; then # if status is already stopped, skip while loop echo_array+=("\n$app_name") [[ "$verbose" == "true" ]] && echo_array+=("Updating..") - update + if update ;then + echo_array+=("Updated\n$old_full_ver\n$new_full_ver") + else + echo_array+=("Failed to update") + return + fi else # if status was not STOPPED, stop the app prior to updating echo_array+=("\n$app_name") [[ "$verbose" == "true" ]] && echo_array+=("Stopping prior to update..") @@ -91,7 +96,12 @@ if [[ "$diff_app" == "$diff_chart" || "$update_all_apps" == "true" ]]; then #con if [[ "$status" == "STOPPED" ]]; then echo_array+=("Stopped") [[ "$verbose" == "true" ]] && echo_array+=("Updating..") - update + if update ;then + echo_array+=("Updated\n$old_full_ver\n$new_full_ver") + else + echo_array+=("Failed to update") + return + fi elif [[ "$SECONDS" -ge "$timeout" ]]; then echo_array+=("Error: Run Time($SECONDS) has exceeded Timeout($timeout)") break @@ -104,7 +114,12 @@ if [[ "$diff_app" == "$diff_chart" || "$update_all_apps" == "true" ]]; then #con else #user must not be using -S, just update echo_array+=("\n$app_name") [[ "$verbose" == "true" ]] && echo_array+=("Updating..") - update + if update ;then + echo_array+=("Updated\n$old_full_ver\n$new_full_ver") + else + echo_array+=("Failed to update") + return + fi fi else echo -e "\n$app_name\nMajor Release, update manually" @@ -121,10 +136,8 @@ while [[ $count -lt 3 ]] do updated=$(grep "^$app_name," temp.txt | awk -F ',' '{print $3}') if cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null || [[ $updated == "false" ]]; then - echo_array+=("Updated\n$old_full_ver\n$new_full_ver") break else - echo_array+=("Failed, trying again..") ((count++)) sleep 5 fi From ad4f507f6f1070af89bdcd969c7d5375e429248f Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 9 Aug 2022 17:52:11 -0600 Subject: [PATCH 0653/1229] return codes for failures --- functions/update_apps.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index f5c9e086..ce410810 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -137,9 +137,11 @@ do updated=$(grep "^$app_name," temp.txt | awk -F ',' '{print $3}') if cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null || [[ $updated == "false" ]]; then break - else + elif [[ $count -lt 3 ]]; then ((count++)) sleep 5 + else + return 1 fi done } From 03c16717ccadaa603cb413812208695aa4b1e688 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 9 Aug 2022 17:52:56 -0600 Subject: [PATCH 0654/1229] lower sleep --- functions/update_apps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index ce410810..7e1941a9 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -32,7 +32,7 @@ do do update_apps "${array[$it]}" & processes+=($!) - sleep 3 + sleep 2 ((it++)) ((proc_count++)) done From 213bf0f879c1645b2faac1ffde87b91383eb1ddc Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Tue, 9 Aug 2022 18:08:01 +0000 Subject: [PATCH 0655/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.153.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 7c53289d..31885922 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@1a9f0da34c786cf451cd66ef015e7647e41cd67e # tag=v32.152.0 + uses: renovatebot/github-action@ba1c9bdc824fcaec7ff9aa49e65f9c396d520a7b # tag=v32.153.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 0d30de9e22ef2bfbdbc5a6769cf79004f56a7095 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 9 Aug 2022 21:50:22 -0600 Subject: [PATCH 0656/1229] test shell --- functions/cmd_to_container.sh | 53 ++++++++++++++++++++++++++++------- 1 file changed, 43 insertions(+), 10 deletions(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index 8b51cf76..e7603d74 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -52,15 +52,48 @@ do done container=$(echo "$containers" | grep ^"$selection)" | awk '{print $2}') container_id=$(echo "$search" | grep -E "[[:space:]]${container}[[:space:]]" | awk '{print $1}') -clear -x -title -echo "App Name: $app_name" -echo "Container: $container" -echo -echo "0) Exit" -read -rt 120 -p "What command would you like to run?: " command || { echo -e "\nFailed to make a selection in time" ; exit; } -[[ $command == 0 ]] && echo "Exiting.." && exit -k3s crictl exec "$container_id" $command -container=$(echo -e "$app_name" | grep ^"$selection)" | awk '{print $2}') +while true +do + clear -x + title + echo "App Name: $app_name" + echo "Container: $container" + echo + echo "1) Run a single command" + echo "2) Open Shell" + echo + echo "0) Exit" + read -rt 120 -p "Please choose an option: " selection || { echo -e "\nFailed to make a selection in time" ; exit; } + case $selection in + 0) + echo "Exiting.." + exit + ;; + + 1) + clear -x + title + read -rt 120 -p "What command do you want to run?: " command || { echo -e "\nFailed to make a selection in time" ; exit; } + k3s crictl exec -it "$container_id" $command + break + ;; + + 2) + clear -x + title + + if ! k3s crictl exec -it "$container_id" /bin/bash ; then + k3s crictl exec -it "$container_id" /bin/sh + fi + break + ;; + + *) + echo "That was not an option.. Try again" + sleep 3 + ;; + esac +done + } export -f cmd_to_container \ No newline at end of file From 6b9be5102c052fb4dfebddd2bf117d7d536c33aa Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 9 Aug 2022 21:53:47 -0600 Subject: [PATCH 0657/1229] error code --- functions/cmd_to_container.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index e7603d74..49b8ab29 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -82,7 +82,7 @@ do clear -x title - if ! k3s crictl exec -it "$container_id" /bin/bash ; then + if ! k3s crictl exec -it "$container_id" /bin/bash && $? != 130 ; then k3s crictl exec -it "$container_id" /bin/sh fi break From 7842b83700d6c5b04dfb6fb77f6ee3942204c247 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 9 Aug 2022 22:06:41 -0600 Subject: [PATCH 0658/1229] test --- functions/cmd_to_container.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index 49b8ab29..e7603d74 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -82,7 +82,7 @@ do clear -x title - if ! k3s crictl exec -it "$container_id" /bin/bash && $? != 130 ; then + if ! k3s crictl exec -it "$container_id" /bin/bash ; then k3s crictl exec -it "$container_id" /bin/sh fi break From 9c1258e02ece1a2245a64181c633cc249ed8d030 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 9 Aug 2022 22:11:07 -0600 Subject: [PATCH 0659/1229] error message upon both sh and bash failure --- functions/cmd_to_container.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index e7603d74..24492c91 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -83,7 +83,7 @@ do title if ! k3s crictl exec -it "$container_id" /bin/bash ; then - k3s crictl exec -it "$container_id" /bin/sh + k3s crictl exec -it "$container_id" /bin/sh || echo "This application does not accept shell access apparently" fi break ;; From e331dc2deb727215336261229a44fa7545a5b471 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 9 Aug 2022 22:12:15 -0600 Subject: [PATCH 0660/1229] better message --- functions/cmd_to_container.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index 24492c91..9b3f128d 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -83,7 +83,7 @@ do title if ! k3s crictl exec -it "$container_id" /bin/bash ; then - k3s crictl exec -it "$container_id" /bin/sh || echo "This application does not accept shell access apparently" + k3s crictl exec -it "$container_id" /bin/sh || echo "This container does not accept shell access, try a different one." fi break ;; From c69d1b29831211f724be0c3c6328104e08b10ea2 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 9 Aug 2022 22:14:27 -0600 Subject: [PATCH 0661/1229] remove error messages --- functions/cmd_to_container.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index 9b3f128d..d86e82b4 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -82,8 +82,8 @@ do clear -x title - if ! k3s crictl exec -it "$container_id" /bin/bash ; then - k3s crictl exec -it "$container_id" /bin/sh || echo "This container does not accept shell access, try a different one." + if ! k3s crictl exec -it "$container_id" /bin/bash 2>/dev/null; then + k3s crictl exec -it "$container_id" /bin/sh 2>/dev/null || echo "This container does not accept shell access, try a different one." fi break ;; From b935c755c9befcfa81c2f28380dd8f9fb59b9a50 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 9 Aug 2022 22:15:21 -0600 Subject: [PATCH 0662/1229] hide both error and info --- functions/cmd_to_container.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index d86e82b4..3c50d5bf 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -82,8 +82,8 @@ do clear -x title - if ! k3s crictl exec -it "$container_id" /bin/bash 2>/dev/null; then - k3s crictl exec -it "$container_id" /bin/sh 2>/dev/null || echo "This container does not accept shell access, try a different one." + if ! k3s crictl exec -it "$container_id" /bin/bash &>/dev/null; then + k3s crictl exec -it "$container_id" /bin/sh &>/dev/null || echo "This container does not accept shell access, try a different one." fi break ;; From d05b8674b3a68119e0a99e65fd63fab25a7aa9e3 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 9 Aug 2022 22:16:49 -0600 Subject: [PATCH 0663/1229] only show stdout --- functions/cmd_to_container.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index 3c50d5bf..d86e82b4 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -82,8 +82,8 @@ do clear -x title - if ! k3s crictl exec -it "$container_id" /bin/bash &>/dev/null; then - k3s crictl exec -it "$container_id" /bin/sh &>/dev/null || echo "This container does not accept shell access, try a different one." + if ! k3s crictl exec -it "$container_id" /bin/bash 2>/dev/null; then + k3s crictl exec -it "$container_id" /bin/sh 2>/dev/null || echo "This container does not accept shell access, try a different one." fi break ;; From 1c0e223648f2ceba1b8553be21d69c95628f5a47 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 9 Aug 2022 22:27:16 -0600 Subject: [PATCH 0664/1229] cleanup --- functions/cmd_to_container.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index d86e82b4..ef378b14 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -69,7 +69,6 @@ do echo "Exiting.." exit ;; - 1) clear -x title @@ -77,17 +76,14 @@ do k3s crictl exec -it "$container_id" $command break ;; - 2) clear -x title - if ! k3s crictl exec -it "$container_id" /bin/bash 2>/dev/null; then k3s crictl exec -it "$container_id" /bin/sh 2>/dev/null || echo "This container does not accept shell access, try a different one." fi break ;; - *) echo "That was not an option.. Try again" sleep 3 From 51a5e5fcc2c447c41aa3f47eaaf7aee32518c1c2 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 9 Aug 2022 22:47:59 -0600 Subject: [PATCH 0665/1229] better update handler --- functions/update_apps.sh | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 7e1941a9..362cadab 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -134,14 +134,19 @@ update(){ count=0 while [[ $count -lt 3 ]] do - updated=$(grep "^$app_name," temp.txt | awk -F ',' '{print $3}') - if cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null || [[ $updated == "false" ]]; then + update_avail=$(grep "^$app_name," temp.txt | awk -F ',' '{print $3}') + if [[ $update_avail == "true" ]]; then + if ! cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null ; then + sleep 6 + ((count++)) + continue + fi + break + elif [[ $update_avail == "false" ]]; then break - elif [[ $count -lt 3 ]]; then - ((count++)) - sleep 5 else - return 1 + ((count++)) + sleep 6 fi done } From dcd562462bbfcdc3fffd6f94abbe6067159e3b95 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 9 Aug 2022 23:03:39 -0600 Subject: [PATCH 0666/1229] add trigger to update --- functions/update_apps.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 362cadab..7fa3327d 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -12,6 +12,7 @@ echo "Asynchronous Updates: $update_limit" # previous 20% 2 min 9 seconds it=0 while_status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' 2>/dev/null) > temp.txt +echo "$while_status" > temp.txt while true do if [ -f trigger ]; then @@ -131,6 +132,7 @@ export -f update_apps update(){ +[[ ! -e trigger ]] && touch trigger count=0 while [[ $count -lt 3 ]] do @@ -155,7 +157,7 @@ export -f update after_update_actions(){ SECONDS=0 count=0 -[[ ! -e trigger ]] && touch trigger +# [[ ! -e trigger ]] && touch trigger if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then while true do From 96b462fd5d4b05ad62d35452fe9001426bb368cd Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 9 Aug 2022 23:34:06 -0600 Subject: [PATCH 0667/1229] trigger fix --- functions/update_apps.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 7fa3327d..38462066 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -13,9 +13,10 @@ echo "Asynchronous Updates: $update_limit" it=0 while_status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' 2>/dev/null) > temp.txt echo "$while_status" > temp.txt +rm trigger &>/dev/null while true do - if [ -f trigger ]; then + if [[ -f trigger ]]; then while_status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' 2>/dev/null) echo "$while_status" > temp.txt fi From d60da339d372e63a20f75bebf5d78460da6d5d82 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Wed, 10 Aug 2022 06:10:31 +0000 Subject: [PATCH 0668/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.153.4 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 31885922..bf901e8d 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@ba1c9bdc824fcaec7ff9aa49e65f9c396d520a7b # tag=v32.153.0 + uses: renovatebot/github-action@26a0b952ac06eaefcb28b89aa1a522cb4f759f8f # tag=v32.153.4 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 591120e2fe0afdea3e77385e06bed526d953d517 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 10 Aug 2022 11:52:34 -0600 Subject: [PATCH 0669/1229] better placements of trigger file --- functions/update_apps.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 38462066..dec7a1fc 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -133,13 +133,13 @@ export -f update_apps update(){ -[[ ! -e trigger ]] && touch trigger count=0 while [[ $count -lt 3 ]] do update_avail=$(grep "^$app_name," temp.txt | awk -F ',' '{print $3}') if [[ $update_avail == "true" ]]; then if ! cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null ; then + [[ ! -e trigger ]] && touch trigger sleep 6 ((count++)) continue @@ -158,8 +158,8 @@ export -f update after_update_actions(){ SECONDS=0 count=0 -# [[ ! -e trigger ]] && touch trigger if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then + [[ ! -e trigger ]] && touch trigger while true do (( count++ )) From fcd07cfa4fa4882745b2219f57cad7c4380d48f1 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 10 Aug 2022 11:53:24 -0600 Subject: [PATCH 0670/1229] slightly lower commander sleep timer --- functions/update_apps.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index dec7a1fc..74641ac9 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -28,7 +28,7 @@ do ((count++)) done if [[ "$proc_count" -ge "$update_limit" ]]; then - sleep 6 + sleep 4 elif [[ $it -lt ${#array[@]} ]]; then until [[ "$proc_count" -ge "$update_limit" || $it -ge ${#array[@]} ]] do @@ -39,7 +39,7 @@ do ((proc_count++)) done elif [[ $proc_count != 0 ]]; then # Wait for all processes to finish - sleep 6 + sleep 4 else # All processes must be completed, break out of loop break fi From e3e85cf38e5d435c97ca3fd66957b9f3c63b59e7 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 10 Aug 2022 13:57:50 -0600 Subject: [PATCH 0671/1229] pod_id regex --- functions/cmd_to_container.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index ef378b14..173aaca7 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -24,7 +24,7 @@ do done app_name=$(echo -e "$app_name" | grep ^"$selection)" | awk '{print $2}') search=$(k3s crictl ps -a -s running) -mapfile -t pod_id < <(echo "$search" | grep -E " $app_name([[:space:]]|-([-[:alnum:]])*[[:space:]])" | awk '{print $9}') +mapfile -t pod_id < <(echo "$search" | grep -E "[[:space:]]$app_name([[:space:]]|-([-[:alnum:]])*[[:space:]])" | awk '{print $9}') [[ "${#pod_id[@]}" == 0 ]] && echo -e "No containers available\nAre you sure the application in running?" && exit containers=$( for pod in "${pod_id[@]}" From 82a2deffa071668d2c53fa88cc79286a46f79a8b Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 10 Aug 2022 14:14:24 -0600 Subject: [PATCH 0672/1229] print only last column for pod --- functions/cmd_to_container.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index 173aaca7..0dca8e79 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -29,7 +29,7 @@ mapfile -t pod_id < <(echo "$search" | grep -E "[[:space:]]$app_name([[:space:]] containers=$( for pod in "${pod_id[@]}" do - echo "$search" | grep "$pod" | awk '{print $7}' + echo "$search" | grep "$pod" | awk '{print $(NF)}' done | nl -s ") " | column -t) while true do From 84c1fcd006d98bd91e45e0e25415a85f460ed669 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 10 Aug 2022 14:16:31 -0600 Subject: [PATCH 0673/1229] whoops --- functions/cmd_to_container.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index 0dca8e79..e5ae6e7b 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -24,12 +24,12 @@ do done app_name=$(echo -e "$app_name" | grep ^"$selection)" | awk '{print $2}') search=$(k3s crictl ps -a -s running) -mapfile -t pod_id < <(echo "$search" | grep -E "[[:space:]]$app_name([[:space:]]|-([-[:alnum:]])*[[:space:]])" | awk '{print $9}') +mapfile -t pod_id < <(echo "$search" | grep -E "[[:space:]]$app_name([[:space:]]|-([-[:alnum:]])*[[:space:]])" | awk '{print $(NF)}') [[ "${#pod_id[@]}" == 0 ]] && echo -e "No containers available\nAre you sure the application in running?" && exit containers=$( for pod in "${pod_id[@]}" do - echo "$search" | grep "$pod" | awk '{print $(NF)}' + echo "$search" | grep "$pod" | awk '{print $7}' done | nl -s ") " | column -t) while true do From 0852e29d8a9696a15baca61e49d8f70c0ecb5146 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 10 Aug 2022 14:33:41 -0600 Subject: [PATCH 0674/1229] test remove dates, they messed up awk --- functions/cmd_to_container.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index e5ae6e7b..1428c4a1 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -23,13 +23,13 @@ do fi done app_name=$(echo -e "$app_name" | grep ^"$selection)" | awk '{print $2}') -search=$(k3s crictl ps -a -s running) +search=$(k3s crictl ps -a -s running | sed -E 's/([0-9]*|About)[[:space:]](an|hours)[[:space:]](hour)?[[:space:]]?ago//') mapfile -t pod_id < <(echo "$search" | grep -E "[[:space:]]$app_name([[:space:]]|-([-[:alnum:]])*[[:space:]])" | awk '{print $(NF)}') [[ "${#pod_id[@]}" == 0 ]] && echo -e "No containers available\nAre you sure the application in running?" && exit containers=$( for pod in "${pod_id[@]}" do - echo "$search" | grep "$pod" | awk '{print $7}' + echo "$search" | grep "$pod" | awk '{print $4}' done | nl -s ") " | column -t) while true do From 074b3d09cf2e2dafbbd169daf3c1a324b4fed4d6 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 10 Aug 2022 14:51:01 -0600 Subject: [PATCH 0675/1229] incase days are added --- functions/cmd_to_container.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index 1428c4a1..85061063 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -23,7 +23,7 @@ do fi done app_name=$(echo -e "$app_name" | grep ^"$selection)" | awk '{print $2}') -search=$(k3s crictl ps -a -s running | sed -E 's/([0-9]*|About)[[:space:]](an|hours)[[:space:]](hour)?[[:space:]]?ago//') +search=$(k3s crictl ps -a -s running | sed -E 's/([0-9]*|About)[[:space:]][a-z]{2,5}[[:space:]](hour)?[[:space:]]?ago//') mapfile -t pod_id < <(echo "$search" | grep -E "[[:space:]]$app_name([[:space:]]|-([-[:alnum:]])*[[:space:]])" | awk '{print $(NF)}') [[ "${#pod_id[@]}" == 0 ]] && echo -e "No containers available\nAre you sure the application in running?" && exit containers=$( From 6f7f18d6a4a5b0ed5b8390277bd3ac0588f31179 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 10 Aug 2022 16:30:07 -0600 Subject: [PATCH 0676/1229] if only one container, auto select it --- functions/cmd_to_container.sh | 46 +++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index 85061063..5af6cb4a 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -31,27 +31,31 @@ for pod in "${pod_id[@]}" do echo "$search" | grep "$pod" | awk '{print $4}' done | nl -s ") " | column -t) -while true -do - clear -x - title - echo "$containers" - echo - echo "0) Exit" - read -rt 120 -p "Choose a container by number: " selection || { echo -e "\nFailed to make a selection in time" ; exit; } - if [[ $selection == 0 ]]; then - echo "Exiting.." - exit - elif ! echo -e "$containers" | grep -qs ^"$selection)" ; then - echo "Error: \"$selection\" was not an option.. Try again" - sleep 3 - continue - else - break - fi -done -container=$(echo "$containers" | grep ^"$selection)" | awk '{print $2}') -container_id=$(echo "$search" | grep -E "[[:space:]]${container}[[:space:]]" | awk '{print $1}') +if [[ "${#pod_id[@]}" == 1 ]]; then + container_id=$(echo "$search" | grep -E "[[:space:]]${container}[[:space:]]" | awk '{print $1}') +else + while true + do + clear -x + title + echo "$containers" + echo + echo "0) Exit" + read -rt 120 -p "Choose a container by number: " selection || { echo -e "\nFailed to make a selection in time" ; exit; } + if [[ $selection == 0 ]]; then + echo "Exiting.." + exit + elif ! echo -e "$containers" | grep -qs ^"$selection)" ; then + echo "Error: \"$selection\" was not an option.. Try again" + sleep 3 + continue + else + break + fi + done + container=$(echo "$containers" | grep ^"$selection)" | awk '{print $2}') + container_id=$(echo "$search" | grep -E "[[:space:]]${container}[[:space:]]" | awk '{print $1}') +fi while true do clear -x From d830f7e10cc1dc4981114d9c4489b083ec9ac95d Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 10 Aug 2022 16:31:29 -0600 Subject: [PATCH 0677/1229] replace with podid --- functions/cmd_to_container.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index 5af6cb4a..1effb5f0 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -32,7 +32,7 @@ do echo "$search" | grep "$pod" | awk '{print $4}' done | nl -s ") " | column -t) if [[ "${#pod_id[@]}" == 1 ]]; then - container_id=$(echo "$search" | grep -E "[[:space:]]${container}[[:space:]]" | awk '{print $1}') + container_id=$(echo "$search" | grep -E "[[:space:]]${pod_id[*]}[[:space:]]" | awk '{print $1}') else while true do From 2dc9cc4742a98dbd88c61223765d72b7c0a7f033 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 10 Aug 2022 16:33:59 -0600 Subject: [PATCH 0678/1229] whew --- functions/cmd_to_container.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index 1effb5f0..9c198555 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -32,7 +32,7 @@ do echo "$search" | grep "$pod" | awk '{print $4}' done | nl -s ") " | column -t) if [[ "${#pod_id[@]}" == 1 ]]; then - container_id=$(echo "$search" | grep -E "[[:space:]]${pod_id[*]}[[:space:]]" | awk '{print $1}') + container_id=$(echo "$search" | grep -E "[[:space:]]${containers}[[:space:]]" | awk '{print $1}') else while true do From 26362944a5eb1d0ecc1374bd5c7657caf430d9e4 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 10 Aug 2022 16:39:42 -0600 Subject: [PATCH 0679/1229] fix --- functions/cmd_to_container.sh | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index 9c198555..56274270 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -25,15 +25,19 @@ done app_name=$(echo -e "$app_name" | grep ^"$selection)" | awk '{print $2}') search=$(k3s crictl ps -a -s running | sed -E 's/([0-9]*|About)[[:space:]][a-z]{2,5}[[:space:]](hour)?[[:space:]]?ago//') mapfile -t pod_id < <(echo "$search" | grep -E "[[:space:]]$app_name([[:space:]]|-([-[:alnum:]])*[[:space:]])" | awk '{print $(NF)}') -[[ "${#pod_id[@]}" == 0 ]] && echo -e "No containers available\nAre you sure the application in running?" && exit -containers=$( -for pod in "${pod_id[@]}" -do - echo "$search" | grep "$pod" | awk '{print $4}' -done | nl -s ") " | column -t) + if [[ "${#pod_id[@]}" == 1 ]]; then - container_id=$(echo "$search" | grep -E "[[:space:]]${containers}[[:space:]]" | awk '{print $1}') + container=$(echo "$search" | grep "${pod_id[*]}" | awk '{print $4}') + container_id=$(echo "$search" | grep -E "[[:space:]]${container}[[:space:]]" | awk '{print $1}') +elif [[ "${#pod_id[@]}" == 0 ]]; then + echo -e "No containers available\nAre you sure the application in running?" + exit else + containers=$( + for pod in "${pod_id[@]}" + do + echo "$search" | grep "$pod" | awk '{print $4}' + done | nl -s ") " | column -t) while true do clear -x From a8b60f5c7175cd95c0aa6426991367067873cb7d Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 10 Aug 2022 16:58:07 -0600 Subject: [PATCH 0680/1229] check for number of containers not pods --- functions/cmd_to_container.sh | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index 56274270..8c68f768 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -25,24 +25,30 @@ done app_name=$(echo -e "$app_name" | grep ^"$selection)" | awk '{print $2}') search=$(k3s crictl ps -a -s running | sed -E 's/([0-9]*|About)[[:space:]][a-z]{2,5}[[:space:]](hour)?[[:space:]]?ago//') mapfile -t pod_id < <(echo "$search" | grep -E "[[:space:]]$app_name([[:space:]]|-([-[:alnum:]])*[[:space:]])" | awk '{print $(NF)}') +for pod in "${pod_id[@]}" +do + mapfile -t containers < <(echo "$search" | grep "$pod" | awk '{print $4}') +done -if [[ "${#pod_id[@]}" == 1 ]]; then +if [[ "${#containers[@]}" == 1 ]]; then container=$(echo "$search" | grep "${pod_id[*]}" | awk '{print $4}') container_id=$(echo "$search" | grep -E "[[:space:]]${container}[[:space:]]" | awk '{print $1}') -elif [[ "${#pod_id[@]}" == 0 ]]; then +elif [[ "${#containers[@]}" == 0 ]]; then echo -e "No containers available\nAre you sure the application in running?" exit else - containers=$( for pod in "${pod_id[@]}" do - echo "$search" | grep "$pod" | awk '{print $4}' - done | nl -s ") " | column -t) + mapfile -t containers < <(echo "$search" | grep "$pod" | awk '{print $4}') + done while true do clear -x title - echo "$containers" + for container in "${containers[@]}" + do + echo "$container" + done | nl -s ") " | column -t echo echo "0) Exit" read -rt 120 -p "Choose a container by number: " selection || { echo -e "\nFailed to make a selection in time" ; exit; } From bc694852a9709826821fb3220ba4949ffd6f7774 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 10 Aug 2022 17:00:10 -0600 Subject: [PATCH 0681/1229] expand all for grep --- functions/cmd_to_container.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index 8c68f768..d8eee929 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -55,7 +55,7 @@ else if [[ $selection == 0 ]]; then echo "Exiting.." exit - elif ! echo -e "$containers" | grep -qs ^"$selection)" ; then + elif ! echo -e "${containers[*]}" | grep -qs ^"$selection)" ; then echo "Error: \"$selection\" was not an option.. Try again" sleep 3 continue @@ -63,7 +63,7 @@ else break fi done - container=$(echo "$containers" | grep ^"$selection)" | awk '{print $2}') + container=$(echo "${containers[*]}" | grep ^"$selection)" | awk '{print $2}') container_id=$(echo "$search" | grep -E "[[:space:]]${container}[[:space:]]" | awk '{print $1}') fi while true From a9b4cd02ed8df95edf50cc7b39f88a3eabb114ba Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 10 Aug 2022 17:03:37 -0600 Subject: [PATCH 0682/1229] add nl to grep --- functions/cmd_to_container.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index d8eee929..9b30bbe1 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -55,7 +55,7 @@ else if [[ $selection == 0 ]]; then echo "Exiting.." exit - elif ! echo -e "${containers[*]}" | grep -qs ^"$selection)" ; then + elif ! echo -e "${containers[*]}" | nl -s ") " | grep -qs ^"$selection)" ; then echo "Error: \"$selection\" was not an option.. Try again" sleep 3 continue From dc5fd00681a335f2982c82986dfe542059a9187e Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 10 Aug 2022 17:04:46 -0600 Subject: [PATCH 0683/1229] expand by row --- functions/cmd_to_container.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index 9b30bbe1..0362dead 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -55,7 +55,7 @@ else if [[ $selection == 0 ]]; then echo "Exiting.." exit - elif ! echo -e "${containers[*]}" | nl -s ") " | grep -qs ^"$selection)" ; then + elif ! echo -e "${containers[@]}" | nl -s ") " | grep -qs ^"$selection)" ; then echo "Error: \"$selection\" was not an option.. Try again" sleep 3 continue From 1949c2100c7878e676aa4705a63ad6cbcd8021cb Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 10 Aug 2022 17:09:30 -0600 Subject: [PATCH 0684/1229] append to variable to search works --- functions/cmd_to_container.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index 0362dead..b6da7333 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -45,17 +45,20 @@ else do clear -x title + cont_search=$( for container in "${containers[@]}" do echo "$container" done | nl -s ") " | column -t + ) + echo "$cont_search" echo echo "0) Exit" read -rt 120 -p "Choose a container by number: " selection || { echo -e "\nFailed to make a selection in time" ; exit; } if [[ $selection == 0 ]]; then echo "Exiting.." exit - elif ! echo -e "${containers[@]}" | nl -s ") " | grep -qs ^"$selection)" ; then + elif ! echo -e "$cont_search}" | nl -s ") " | grep -qs ^"$selection)" ; then echo "Error: \"$selection\" was not an option.. Try again" sleep 3 continue @@ -63,7 +66,7 @@ else break fi done - container=$(echo "${containers[*]}" | grep ^"$selection)" | awk '{print $2}') + container=$(echo "$cont_search" | grep ^"$selection)" | awk '{print $2}') container_id=$(echo "$search" | grep -E "[[:space:]]${container}[[:space:]]" | awk '{print $1}') fi while true From bff29b16378142a79feff80a97c355e821c415f8 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 10 Aug 2022 17:11:01 -0600 Subject: [PATCH 0685/1229] remove nl --- functions/cmd_to_container.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index b6da7333..5ce76e68 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -58,7 +58,7 @@ else if [[ $selection == 0 ]]; then echo "Exiting.." exit - elif ! echo -e "$cont_search}" | nl -s ") " | grep -qs ^"$selection)" ; then + elif ! echo -e "$cont_search}" | grep -qs ^"$selection)" ; then echo "Error: \"$selection\" was not an option.. Try again" sleep 3 continue From 04c0a983a2fc9b0ca67a63d67f2ed348d0d3788a Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 10 Aug 2022 17:13:48 -0600 Subject: [PATCH 0686/1229] pod id and container check --- functions/cmd_to_container.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index 5ce76e68..00c0e6d5 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -30,7 +30,7 @@ do mapfile -t containers < <(echo "$search" | grep "$pod" | awk '{print $4}') done -if [[ "${#containers[@]}" == 1 ]]; then +if [[ "${#containers[@]}" == 1 && "${#pod_id[@]}" == 1 ]]; then container=$(echo "$search" | grep "${pod_id[*]}" | awk '{print $4}') container_id=$(echo "$search" | grep -E "[[:space:]]${container}[[:space:]]" | awk '{print $1}') elif [[ "${#containers[@]}" == 0 ]]; then From dc1f9bb6030b5c4dd98bee095be2e534ba8e1f41 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 10 Aug 2022 17:16:45 -0600 Subject: [PATCH 0687/1229] replace ind check with count --- functions/cmd_to_container.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index 00c0e6d5..6df7509e 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -25,12 +25,14 @@ done app_name=$(echo -e "$app_name" | grep ^"$selection)" | awk '{print $2}') search=$(k3s crictl ps -a -s running | sed -E 's/([0-9]*|About)[[:space:]][a-z]{2,5}[[:space:]](hour)?[[:space:]]?ago//') mapfile -t pod_id < <(echo "$search" | grep -E "[[:space:]]$app_name([[:space:]]|-([-[:alnum:]])*[[:space:]])" | awk '{print $(NF)}') +count=0 for pod in "${pod_id[@]}" do mapfile -t containers < <(echo "$search" | grep "$pod" | awk '{print $4}') + ((count++)) done -if [[ "${#containers[@]}" == 1 && "${#pod_id[@]}" == 1 ]]; then +if [[ $count == 1 ]]; then container=$(echo "$search" | grep "${pod_id[*]}" | awk '{print $4}') container_id=$(echo "$search" | grep -E "[[:space:]]${container}[[:space:]]" | awk '{print $1}') elif [[ "${#containers[@]}" == 0 ]]; then From 94e78f756b21b1b89e0d915c6c053628820085eb Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 10 Aug 2022 17:20:34 -0600 Subject: [PATCH 0688/1229] variable is only being saved once --- functions/cmd_to_container.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index 6df7509e..4f335a49 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -48,9 +48,9 @@ else clear -x title cont_search=$( - for container in "${containers[@]}" + for i in "${containers[@]}" do - echo "$container" + echo "$i" done | nl -s ") " | column -t ) echo "$cont_search" From b18818bbd503c932547f9876a439b918278d1b36 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 10 Aug 2022 17:25:13 -0600 Subject: [PATCH 0689/1229] attempt new for loop --- functions/cmd_to_container.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index 4f335a49..f1c35399 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -41,7 +41,8 @@ elif [[ "${#containers[@]}" == 0 ]]; then else for pod in "${pod_id[@]}" do - mapfile -t containers < <(echo "$search" | grep "$pod" | awk '{print $4}') + # mapfile -t containers < <(echo "$search" | grep "$pod" | awk '{print $4}') + IFS=" " read -r -a containers <<< "$(echo "$search" | grep "$pod" | awk '{print $4}')" done while true do From fd1b04279eed0db30717c566e4e770c495ba7777 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 10 Aug 2022 17:28:42 -0600 Subject: [PATCH 0690/1229] testing --- functions/cmd_to_container.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index f1c35399..856b3756 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -41,8 +41,7 @@ elif [[ "${#containers[@]}" == 0 ]]; then else for pod in "${pod_id[@]}" do - # mapfile -t containers < <(echo "$search" | grep "$pod" | awk '{print $4}') - IFS=" " read -r -a containers <<< "$(echo "$search" | grep "$pod" | awk '{print $4}')" + echo "$pod" done while true do From a03eebb4beb43077a8bd94355b724b642453fd48 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 10 Aug 2022 17:33:19 -0600 Subject: [PATCH 0691/1229] remove different pod id --- functions/cmd_to_container.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index 856b3756..c4d0e34d 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -39,10 +39,6 @@ elif [[ "${#containers[@]}" == 0 ]]; then echo -e "No containers available\nAre you sure the application in running?" exit else - for pod in "${pod_id[@]}" - do - echo "$pod" - done while true do clear -x From 7b0cacbfebd04968352a44fab531018b51180547 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 10 Aug 2022 17:36:42 -0600 Subject: [PATCH 0692/1229] sanity check --- functions/cmd_to_container.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index c4d0e34d..1f1c8d51 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -43,13 +43,13 @@ else do clear -x title - cont_search=$( + for i in "${containers[@]}" do echo "$i" done | nl -s ") " | column -t - ) - echo "$cont_search" + + echo echo "0) Exit" read -rt 120 -p "Choose a container by number: " selection || { echo -e "\nFailed to make a selection in time" ; exit; } From a5b17cdb964a34caf4e6b36b160f37e5d5d666ca Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 10 Aug 2022 17:37:53 -0600 Subject: [PATCH 0693/1229] what the hell --- functions/cmd_to_container.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index 1f1c8d51..3a55241a 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -29,6 +29,7 @@ count=0 for pod in "${pod_id[@]}" do mapfile -t containers < <(echo "$search" | grep "$pod" | awk '{print $4}') + echo "${#containers[@]}" ((count++)) done @@ -43,13 +44,13 @@ else do clear -x title - + cont_search=$( for i in "${containers[@]}" do echo "$i" done | nl -s ") " | column -t - - + ) + echo "$cont_search" echo echo "0) Exit" read -rt 120 -p "Choose a container by number: " selection || { echo -e "\nFailed to make a selection in time" ; exit; } From ba58fecf89cb5894a17e3ea5d5089673111d620b Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 10 Aug 2022 17:40:33 -0600 Subject: [PATCH 0694/1229] new array append method --- functions/cmd_to_container.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index 3a55241a..70484252 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -25,15 +25,13 @@ done app_name=$(echo -e "$app_name" | grep ^"$selection)" | awk '{print $2}') search=$(k3s crictl ps -a -s running | sed -E 's/([0-9]*|About)[[:space:]][a-z]{2,5}[[:space:]](hour)?[[:space:]]?ago//') mapfile -t pod_id < <(echo "$search" | grep -E "[[:space:]]$app_name([[:space:]]|-([-[:alnum:]])*[[:space:]])" | awk '{print $(NF)}') -count=0 for pod in "${pod_id[@]}" do - mapfile -t containers < <(echo "$search" | grep "$pod" | awk '{print $4}') + containers+=("$(echo "$search" | grep "$pod" | awk '{print $4}')") echo "${#containers[@]}" - ((count++)) done -if [[ $count == 1 ]]; then +if [[ "${#containers[@]}" == 1 ]]; then container=$(echo "$search" | grep "${pod_id[*]}" | awk '{print $4}') container_id=$(echo "$search" | grep -E "[[:space:]]${container}[[:space:]]" | awk '{print $1}') elif [[ "${#containers[@]}" == 0 ]]; then From c6d0926fc2b2aa390aa57974814e6c22d8e03757 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 10 Aug 2022 17:41:51 -0600 Subject: [PATCH 0695/1229] works --- functions/cmd_to_container.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index 70484252..d1dc1870 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -28,15 +28,14 @@ mapfile -t pod_id < <(echo "$search" | grep -E "[[:space:]]$app_name([[:space:]] for pod in "${pod_id[@]}" do containers+=("$(echo "$search" | grep "$pod" | awk '{print $4}')") - echo "${#containers[@]}" done -if [[ "${#containers[@]}" == 1 ]]; then - container=$(echo "$search" | grep "${pod_id[*]}" | awk '{print $4}') - container_id=$(echo "$search" | grep -E "[[:space:]]${container}[[:space:]]" | awk '{print $1}') -elif [[ "${#containers[@]}" == 0 ]]; then +if [[ "${#containers[@]}" == 0 ]]; then echo -e "No containers available\nAre you sure the application in running?" exit +elif [[ "${#containers[@]}" == 1 ]]; then + container=$(echo "$search" | grep "${pod_id[*]}" | awk '{print $4}') + container_id=$(echo "$search" | grep -E "[[:space:]]${container}[[:space:]]" | awk '{print $1}') else while true do From 665db11d8cb0c31d021a1780b99c2d11c0c4c290 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 10 Aug 2022 17:46:01 -0600 Subject: [PATCH 0696/1229] replace ugly if statement with case --- functions/cmd_to_container.sh | 109 +++++++++++++++++++++++----------- 1 file changed, 75 insertions(+), 34 deletions(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index d1dc1870..787b1c62 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -30,41 +30,82 @@ do containers+=("$(echo "$search" | grep "$pod" | awk '{print $4}')") done -if [[ "${#containers[@]}" == 0 ]]; then - echo -e "No containers available\nAre you sure the application in running?" - exit -elif [[ "${#containers[@]}" == 1 ]]; then - container=$(echo "$search" | grep "${pod_id[*]}" | awk '{print $4}') - container_id=$(echo "$search" | grep -E "[[:space:]]${container}[[:space:]]" | awk '{print $1}') -else - while true - do - clear -x - title - cont_search=$( - for i in "${containers[@]}" +case "${#containers[@]}" in + 0) + echo -e "No containers available\nAre you sure the application in running?" + exit + ;; + 1) + container=$(echo "$search" | grep "${pod_id[*]}" | awk '{print $4}') + container_id=$(echo "$search" | grep -E "[[:space:]]${container}[[:space:]]" | awk '{print $1}') + ;; + + *) + while true do - echo "$i" - done | nl -s ") " | column -t - ) - echo "$cont_search" - echo - echo "0) Exit" - read -rt 120 -p "Choose a container by number: " selection || { echo -e "\nFailed to make a selection in time" ; exit; } - if [[ $selection == 0 ]]; then - echo "Exiting.." - exit - elif ! echo -e "$cont_search}" | grep -qs ^"$selection)" ; then - echo "Error: \"$selection\" was not an option.. Try again" - sleep 3 - continue - else - break - fi - done - container=$(echo "$cont_search" | grep ^"$selection)" | awk '{print $2}') - container_id=$(echo "$search" | grep -E "[[:space:]]${container}[[:space:]]" | awk '{print $1}') -fi + clear -x + title + cont_search=$( + for i in "${containers[@]}" + do + echo "$i" + done | nl -s ") " | column -t + ) + echo "$cont_search" + echo + echo "0) Exit" + read -rt 120 -p "Choose a container by number: " selection || { echo -e "\nFailed to make a selection in time" ; exit; } + if [[ $selection == 0 ]]; then + echo "Exiting.." + exit + elif ! echo -e "$cont_search}" | grep -qs ^"$selection)" ; then + echo "Error: \"$selection\" was not an option.. Try again" + sleep 3 + continue + else + break + fi + done + container=$(echo "$cont_search" | grep ^"$selection)" | awk '{print $2}') + container_id=$(echo "$search" | grep -E "[[:space:]]${container}[[:space:]]" | awk '{print $1}') + ;; +esac + +# if [[ "${#containers[@]}" == 0 ]]; then +# echo -e "No containers available\nAre you sure the application in running?" +# exit +# elif [[ "${#containers[@]}" == 1 ]]; then +# container=$(echo "$search" | grep "${pod_id[*]}" | awk '{print $4}') +# container_id=$(echo "$search" | grep -E "[[:space:]]${container}[[:space:]]" | awk '{print $1}') +# else +# while true +# do +# clear -x +# title +# cont_search=$( +# for i in "${containers[@]}" +# do +# echo "$i" +# done | nl -s ") " | column -t +# ) +# echo "$cont_search" +# echo +# echo "0) Exit" +# read -rt 120 -p "Choose a container by number: " selection || { echo -e "\nFailed to make a selection in time" ; exit; } +# if [[ $selection == 0 ]]; then +# echo "Exiting.." +# exit +# elif ! echo -e "$cont_search}" | grep -qs ^"$selection)" ; then +# echo "Error: \"$selection\" was not an option.. Try again" +# sleep 3 +# continue +# else +# break +# fi +# done +# container=$(echo "$cont_search" | grep ^"$selection)" | awk '{print $2}') +# container_id=$(echo "$search" | grep -E "[[:space:]]${container}[[:space:]]" | awk '{print $1}') +# fi while true do clear -x From fc8dba252a018873be44788081d734c254d88b6d Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 10 Aug 2022 17:47:37 -0600 Subject: [PATCH 0697/1229] remove commented out if statement --- functions/cmd_to_container.sh | 37 ----------------------------------- 1 file changed, 37 deletions(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index 787b1c62..2d011172 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -29,7 +29,6 @@ for pod in "${pod_id[@]}" do containers+=("$(echo "$search" | grep "$pod" | awk '{print $4}')") done - case "${#containers[@]}" in 0) echo -e "No containers available\nAre you sure the application in running?" @@ -70,42 +69,6 @@ case "${#containers[@]}" in container_id=$(echo "$search" | grep -E "[[:space:]]${container}[[:space:]]" | awk '{print $1}') ;; esac - -# if [[ "${#containers[@]}" == 0 ]]; then -# echo -e "No containers available\nAre you sure the application in running?" -# exit -# elif [[ "${#containers[@]}" == 1 ]]; then -# container=$(echo "$search" | grep "${pod_id[*]}" | awk '{print $4}') -# container_id=$(echo "$search" | grep -E "[[:space:]]${container}[[:space:]]" | awk '{print $1}') -# else -# while true -# do -# clear -x -# title -# cont_search=$( -# for i in "${containers[@]}" -# do -# echo "$i" -# done | nl -s ") " | column -t -# ) -# echo "$cont_search" -# echo -# echo "0) Exit" -# read -rt 120 -p "Choose a container by number: " selection || { echo -e "\nFailed to make a selection in time" ; exit; } -# if [[ $selection == 0 ]]; then -# echo "Exiting.." -# exit -# elif ! echo -e "$cont_search}" | grep -qs ^"$selection)" ; then -# echo "Error: \"$selection\" was not an option.. Try again" -# sleep 3 -# continue -# else -# break -# fi -# done -# container=$(echo "$cont_search" | grep ^"$selection)" | awk '{print $2}') -# container_id=$(echo "$search" | grep -E "[[:space:]]${container}[[:space:]]" | awk '{print $1}') -# fi while true do clear -x From 83e7657c37de4647a8d3be21e445f2c895a5181a Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 10 Aug 2022 17:50:39 -0600 Subject: [PATCH 0698/1229] increase timeout for command submission --- functions/cmd_to_container.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index 2d011172..115ad619 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -89,7 +89,7 @@ do 1) clear -x title - read -rt 120 -p "What command do you want to run?: " command || { echo -e "\nFailed to make a selection in time" ; exit; } + read -rt 500 -p "What command do you want to run?: " command || { echo -e "\nFailed to make a selection in time" ; exit; } k3s crictl exec -it "$container_id" $command break ;; From e21736cb8b0e5d3171362139de8b82f311b9478b Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 10 Aug 2022 18:44:52 -0600 Subject: [PATCH 0699/1229] sleep 1.5 instead of 2 --- functions/update_apps.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 74641ac9..44e78211 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -11,7 +11,7 @@ echo "Asynchronous Updates: $update_limit" # previous 20% 2 min 9 seconds it=0 -while_status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' 2>/dev/null) > temp.txt +while_status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' 2>/dev/null) echo "$while_status" > temp.txt rm trigger &>/dev/null while true @@ -34,7 +34,7 @@ do do update_apps "${array[$it]}" & processes+=($!) - sleep 2 + sleep 1.5 ((it++)) ((proc_count++)) done From 2e146d1e581db8e44181b1b254b3e19a4af37dc5 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 10 Aug 2022 18:57:50 -0600 Subject: [PATCH 0700/1229] if status check times out, try again immediately --- functions/update_apps.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 44e78211..20095e28 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -17,8 +17,11 @@ rm trigger &>/dev/null while true do if [[ -f trigger ]]; then - while_status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' 2>/dev/null) - echo "$while_status" > temp.txt + if while_status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' 2>/dev/null) ; then + echo "$while_status" > temp.txt + else + continue + fi fi proc_count=${#processes[@]} count=0 From ffd23b7e154fc735e30ba31afeb52e13e6762508 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 10 Aug 2022 19:05:10 -0600 Subject: [PATCH 0701/1229] set delay higher on trigger --- functions/update_apps.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 20095e28..a2c78df3 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -14,9 +14,11 @@ it=0 while_status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' 2>/dev/null) echo "$while_status" > temp.txt rm trigger &>/dev/null +delay=2 while true do if [[ -f trigger ]]; then + delay=4 if while_status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' 2>/dev/null) ; then echo "$while_status" > temp.txt else @@ -31,7 +33,7 @@ do ((count++)) done if [[ "$proc_count" -ge "$update_limit" ]]; then - sleep 4 + sleep $delay elif [[ $it -lt ${#array[@]} ]]; then until [[ "$proc_count" -ge "$update_limit" || $it -ge ${#array[@]} ]] do @@ -42,7 +44,7 @@ do ((proc_count++)) done elif [[ $proc_count != 0 ]]; then # Wait for all processes to finish - sleep 4 + sleep $delay else # All processes must be completed, break out of loop break fi From 984b51e6b0a093398fab62c4103a2ec6dd6e6fd2 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 10 Aug 2022 19:11:52 -0600 Subject: [PATCH 0702/1229] echo error on middleware timeout --- functions/update_apps.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index a2c78df3..cd2ea0b5 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -22,6 +22,7 @@ do if while_status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' 2>/dev/null) ; then echo "$while_status" > temp.txt else + echo "Middlewared timed out. Consider setting a lower number for async applications" continue fi fi From 5511cbde46b7a5320be3574c560dc3557efb904e Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 10 Aug 2022 20:04:15 -0600 Subject: [PATCH 0703/1229] global sleep to 10, proper loop check for stopped --- functions/update_apps.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index cd2ea0b5..252158e8 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -172,19 +172,21 @@ if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then status=$( grep "^$app_name," temp.txt | awk -F ',' '{print $2}') if [[ "$status" == "ACTIVE" ]]; then if [[ "$startstatus" == "STOPPED" ]]; then + [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Active..") && sleep 10 && continue #if reports active on FIRST time through loop, double check + [[ "$count" -le 1 && -z "$verbose" ]] && sleep 10 && continue #if reports active on FIRST time through loop, double check [[ "$verbose" == "true" ]] && echo_array+=("Returing to STOPPED state..") midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null || { echo_array+=("Error: Failed to stop $app_name") ; break ; } echo_array+=("Stopped") break else - [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Active..") && sleep 15 && continue #if reports active on FIRST time through loop, double check - [[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports active on FIRST time through loop, double check + [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Active..") && sleep 10 && continue #if reports active on FIRST time through loop, double check + [[ "$count" -le 1 && -z "$verbose" ]] && sleep 10 && continue #if reports active on FIRST time through loop, double check echo_array+=("Active") break #if reports active any time after the first loop, assume actually active. fi elif [[ "$status" == "STOPPED" ]]; then - [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Stopped..") && sleep 15 && continue #if reports stopped on FIRST time through loop, double check - [[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports stopped on FIRST time through loop, double check + [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Stopped..") && sleep 10 && continue #if reports stopped on FIRST time through loop, double check + [[ "$count" -le 1 && -z "$verbose" ]] && sleep 10 && continue #if reports stopped on FIRST time through loop, double check echo_array+=("Stopped") break #if reports stopped any time after the first loop, assume its extermal services. elif [[ "$SECONDS" -ge "$timeout" && "$status" == "DEPLOYING" ]]; then @@ -212,7 +214,7 @@ if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then fi else [[ "$verbose" == "true" ]] && echo_array+=("Waiting $((timeout-SECONDS)) more seconds for $app_name to be ACTIVE") - sleep 15 + sleep 5 continue fi done From e57cb90642417e449a355a8cad3dd926f36f985b Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 10 Aug 2022 20:15:38 -0600 Subject: [PATCH 0704/1229] test --- functions/update_apps.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 252158e8..0a0c6bf0 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -172,21 +172,21 @@ if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then status=$( grep "^$app_name," temp.txt | awk -F ',' '{print $2}') if [[ "$status" == "ACTIVE" ]]; then if [[ "$startstatus" == "STOPPED" ]]; then - [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Active..") && sleep 10 && continue #if reports active on FIRST time through loop, double check - [[ "$count" -le 1 && -z "$verbose" ]] && sleep 10 && continue #if reports active on FIRST time through loop, double check + [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Active..") && sleep 15 && continue #if reports active on FIRST time through loop, double check + [[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports active on FIRST time through loop, double check [[ "$verbose" == "true" ]] && echo_array+=("Returing to STOPPED state..") midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null || { echo_array+=("Error: Failed to stop $app_name") ; break ; } echo_array+=("Stopped") break else - [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Active..") && sleep 10 && continue #if reports active on FIRST time through loop, double check - [[ "$count" -le 1 && -z "$verbose" ]] && sleep 10 && continue #if reports active on FIRST time through loop, double check + [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Active..") && sleep 15 && continue #if reports active on FIRST time through loop, double check + [[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports active on FIRST time through loop, double check echo_array+=("Active") break #if reports active any time after the first loop, assume actually active. fi elif [[ "$status" == "STOPPED" ]]; then - [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Stopped..") && sleep 10 && continue #if reports stopped on FIRST time through loop, double check - [[ "$count" -le 1 && -z "$verbose" ]] && sleep 10 && continue #if reports stopped on FIRST time through loop, double check + [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Stopped..") && sleep 15 && continue #if reports stopped on FIRST time through loop, double check + [[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports stopped on FIRST time through loop, double check echo_array+=("Stopped") break #if reports stopped any time after the first loop, assume its extermal services. elif [[ "$SECONDS" -ge "$timeout" && "$status" == "DEPLOYING" ]]; then From 83d65a2a8fbcea235b99ce05822d12b31e7a5502 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 10 Aug 2022 20:23:03 -0600 Subject: [PATCH 0705/1229] replace manual counter with array count --- functions/update_apps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 0a0c6bf0..2403ff2e 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -44,7 +44,7 @@ do ((it++)) ((proc_count++)) done - elif [[ $proc_count != 0 ]]; then # Wait for all processes to finish + elif [[ ${#processes[@]} != 0 ]]; then # Wait for all processes to finish sleep $delay else # All processes must be completed, break out of loop break From 36002c59fbf75f821a4c755b01578faa04000fc8 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 10 Aug 2022 20:36:24 -0600 Subject: [PATCH 0706/1229] once last check prior to exiting script --- functions/update_apps.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 2403ff2e..d2a917ad 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -15,6 +15,7 @@ while_status=$(cli -m csv -c 'app chart_release query name,update_available,huma echo "$while_status" > temp.txt rm trigger &>/dev/null delay=2 +final_check=0 while true do if [[ -f trigger ]]; then @@ -44,9 +45,10 @@ do ((it++)) ((proc_count++)) done - elif [[ ${#processes[@]} != 0 ]]; then # Wait for all processes to finish + elif [[ $proc_count != 0 ]]; then # Wait for all processes to finish sleep $delay else # All processes must be completed, break out of loop + [[ $final_check == 0 ]] && ((final_check++)) && continue break fi done From 0ff74e42a7d27334aa1e7cab35cf635f0e37077d Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 10 Aug 2022 20:40:33 -0600 Subject: [PATCH 0707/1229] first app waits after trigger --- functions/update_apps.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index d2a917ad..7e5ec6de 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -147,7 +147,7 @@ do update_avail=$(grep "^$app_name," temp.txt | awk -F ',' '{print $3}') if [[ $update_avail == "true" ]]; then if ! cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null ; then - [[ ! -e trigger ]] && touch trigger + [[ ! -e trigger ]] && touch trigger && sleep 10 sleep 6 ((count++)) continue @@ -167,7 +167,7 @@ after_update_actions(){ SECONDS=0 count=0 if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then - [[ ! -e trigger ]] && touch trigger + [[ ! -e trigger ]] && touch trigger && sleep 10 while true do (( count++ )) From 3e0ad6d18e88d8cfae44871982ef1b387805fa8f Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 10 Aug 2022 21:09:20 -0600 Subject: [PATCH 0708/1229] test new sleep. just racing --- functions/update_apps.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 7e5ec6de..aa885700 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -41,7 +41,7 @@ do do update_apps "${array[$it]}" & processes+=($!) - sleep 1.5 + # sleep 1.5 ((it++)) ((proc_count++)) done @@ -174,21 +174,21 @@ if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then status=$( grep "^$app_name," temp.txt | awk -F ',' '{print $2}') if [[ "$status" == "ACTIVE" ]]; then if [[ "$startstatus" == "STOPPED" ]]; then - [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Active..") && sleep 15 && continue #if reports active on FIRST time through loop, double check - [[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports active on FIRST time through loop, double check + [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Active..") && sleep 10 && continue #if reports active on FIRST time through loop, double check + [[ "$count" -le 1 && -z "$verbose" ]] && sleep 10 && continue #if reports active on FIRST time through loop, double check [[ "$verbose" == "true" ]] && echo_array+=("Returing to STOPPED state..") midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null || { echo_array+=("Error: Failed to stop $app_name") ; break ; } echo_array+=("Stopped") break else - [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Active..") && sleep 15 && continue #if reports active on FIRST time through loop, double check - [[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports active on FIRST time through loop, double check + [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Active..") && sleep 10 && continue #if reports active on FIRST time through loop, double check + [[ "$count" -le 1 && -z "$verbose" ]] && sleep 10 && continue #if reports active on FIRST time through loop, double check echo_array+=("Active") break #if reports active any time after the first loop, assume actually active. fi elif [[ "$status" == "STOPPED" ]]; then - [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Stopped..") && sleep 15 && continue #if reports stopped on FIRST time through loop, double check - [[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports stopped on FIRST time through loop, double check + [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Stopped..") && sleep 10 && continue #if reports stopped on FIRST time through loop, double check + [[ "$count" -le 1 && -z "$verbose" ]] && sleep 10 && continue #if reports stopped on FIRST time through loop, double check echo_array+=("Stopped") break #if reports stopped any time after the first loop, assume its extermal services. elif [[ "$SECONDS" -ge "$timeout" && "$status" == "DEPLOYING" ]]; then From 006d47503eec55c349730418ce40e0e8f076ee83 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 10 Aug 2022 21:23:21 -0600 Subject: [PATCH 0709/1229] internal sleep 2 --- functions/update_apps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index aa885700..c69aa950 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -41,7 +41,7 @@ do do update_apps "${array[$it]}" & processes+=($!) - # sleep 1.5 + sleep 2 ((it++)) ((proc_count++)) done From 2bf137fbc55ba089c0a1f7f31aedde328c9294cd Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 10 Aug 2022 21:37:29 -0600 Subject: [PATCH 0710/1229] longer sleep --- functions/update_apps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index c69aa950..1f78da16 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -41,7 +41,7 @@ do do update_apps "${array[$it]}" & processes+=($!) - sleep 2 + sleep 4 ((it++)) ((proc_count++)) done From 31285a8d68f20e4ded74586e93de63e964f7f418 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 10 Aug 2022 21:46:08 -0600 Subject: [PATCH 0711/1229] revert to original method +2 at a time --- functions/update_apps.sh | 84 +++++++++++++++++++++++++++++----------- 1 file changed, 62 insertions(+), 22 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 1f78da16..05a2edec 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -10,23 +10,64 @@ echo "Asynchronous Updates: $update_limit" [[ "$timeout" -le 120 ]] && echo "Warning: Your timeout is set low and may lead to premature rollbacks or skips" # previous 20% 2 min 9 seconds -it=0 -while_status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' 2>/dev/null) -echo "$while_status" > temp.txt -rm trigger &>/dev/null -delay=2 +# it=0 +# while_status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' 2>/dev/null) +# echo "$while_status" > temp.txt +# rm trigger &>/dev/null +# delay=2 +# final_check=0 +# while true +# do +# if [[ -f trigger ]]; then +# delay=4 +# if while_status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' 2>/dev/null) ; then +# echo "$while_status" > temp.txt +# else +# echo "Middlewared timed out. Consider setting a lower number for async applications" +# continue +# fi +# fi +# proc_count=${#processes[@]} +# count=0 +# for proc in "${processes[@]}" +# do +# kill -0 "$proc" &> /dev/null || { unset "processes[$count]"; ((proc_count--)); } +# ((count++)) +# done +# if [[ "$proc_count" -ge "$update_limit" ]]; then +# sleep $delay +# elif [[ $it -lt ${#array[@]} ]]; then +# until [[ "$proc_count" -ge "$update_limit" || $it -ge ${#array[@]} ]] +# do +# update_apps "${array[$it]}" & +# processes+=($!) +# sleep 4 +# ((it++)) +# ((proc_count++)) +# done +# elif [[ $proc_count != 0 ]]; then # Wait for all processes to finish +# sleep $delay +# else # All processes must be completed, break out of loop +# [[ $final_check == 0 ]] && ((final_check++)) && continue +# break +# fi +# done +# rm temp.txt +# [[ -f trigger ]] && rm trigger +# echo +# echo + final_check=0 +it=0 while true do - if [[ -f trigger ]]; then - delay=4 - if while_status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' 2>/dev/null) ; then - echo "$while_status" > temp.txt - else - echo "Middlewared timed out. Consider setting a lower number for async applications" - continue - fi + if while_status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' 2>/dev/null) ; then + echo "$while_status" > temp.txt + else + echo "Middlewared timed out. Consider setting a lower number for async applications" + continue fi + echo "$while_status" > temp.txt proc_count=${#processes[@]} count=0 for proc in "${processes[@]}" @@ -35,27 +76,26 @@ do ((count++)) done if [[ "$proc_count" -ge "$update_limit" ]]; then - sleep $delay + sleep 3 elif [[ $it -lt ${#array[@]} ]]; then - until [[ "$proc_count" -ge "$update_limit" || $it -ge ${#array[@]} ]] + until [[ "$proc_count" -ge 2 || $it -ge ${#array[@]} ]]; do update_apps "${array[$it]}" & processes+=($!) - sleep 4 - ((it++)) ((proc_count++)) + ((it++)) done elif [[ $proc_count != 0 ]]; then # Wait for all processes to finish - sleep $delay + sleep 3 else # All processes must be completed, break out of loop [[ $final_check == 0 ]] && ((final_check++)) && continue break fi done rm temp.txt -[[ -f trigger ]] && rm trigger echo echo + } export -f commander @@ -99,7 +139,7 @@ if [[ "$diff_app" == "$diff_chart" || "$update_all_apps" == "true" ]]; then #con [[ "$verbose" == "true" ]] && echo_array+=("Stopping prior to update..") midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null || echo_array+=("Error: Failed to stop $app_name") SECONDS=0 - [[ ! -e trigger ]] && touch trigger + # [[ ! -e trigger ]] && touch trigger while [[ "$status" != "STOPPED" ]] do status=$( grep "^$app_name," temp.txt | awk -F ',' '{print $2}') @@ -147,7 +187,7 @@ do update_avail=$(grep "^$app_name," temp.txt | awk -F ',' '{print $3}') if [[ $update_avail == "true" ]]; then if ! cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null ; then - [[ ! -e trigger ]] && touch trigger && sleep 10 + # [[ ! -e trigger ]] && touch trigger && sleep 10 sleep 6 ((count++)) continue @@ -167,7 +207,7 @@ after_update_actions(){ SECONDS=0 count=0 if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then - [[ ! -e trigger ]] && touch trigger && sleep 10 + # [[ ! -e trigger ]] && touch trigger && sleep 10 while true do (( count++ )) From eddf0937c440e8750be50bec09df5558bc142a37 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 10 Aug 2022 21:50:32 -0600 Subject: [PATCH 0712/1229] give until loop its own variable.. --- functions/update_apps.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 05a2edec..73f1b7b6 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -78,11 +78,12 @@ do if [[ "$proc_count" -ge "$update_limit" ]]; then sleep 3 elif [[ $it -lt ${#array[@]} ]]; then - until [[ "$proc_count" -ge 2 || $it -ge ${#array[@]} ]]; + loop=0 + until [[ "$loop" -ge 2 || $it -ge ${#array[@]} ]]; do update_apps "${array[$it]}" & processes+=($!) - ((proc_count++)) + ((loop++)) ((it++)) done elif [[ $proc_count != 0 ]]; then # Wait for all processes to finish From b012416a07c4972b407a70392506b114b47605f9 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 10 Aug 2022 22:04:33 -0600 Subject: [PATCH 0713/1229] test --- functions/update_apps.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 73f1b7b6..fc0bdae3 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -78,14 +78,14 @@ do if [[ "$proc_count" -ge "$update_limit" ]]; then sleep 3 elif [[ $it -lt ${#array[@]} ]]; then - loop=0 - until [[ "$loop" -ge 2 || $it -ge ${#array[@]} ]]; - do + # loop=0 + # until [[ "$loop" -ge 2 || $it -ge ${#array[@]} ]]; + # do update_apps "${array[$it]}" & processes+=($!) ((loop++)) ((it++)) - done + # done elif [[ $proc_count != 0 ]]; then # Wait for all processes to finish sleep 3 else # All processes must be completed, break out of loop From 06bb4e569f6cc9b2e0fa8c6493deff9d03290501 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 10 Aug 2022 22:14:30 -0600 Subject: [PATCH 0714/1229] racing --- functions/update_apps.sh | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index fc0bdae3..45a24abc 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -57,7 +57,6 @@ echo "Asynchronous Updates: $update_limit" # echo # echo -final_check=0 it=0 while true do @@ -78,18 +77,17 @@ do if [[ "$proc_count" -ge "$update_limit" ]]; then sleep 3 elif [[ $it -lt ${#array[@]} ]]; then - # loop=0 - # until [[ "$loop" -ge 2 || $it -ge ${#array[@]} ]]; - # do + loop=0 + until [[ "$loop" -ge 2 || $it -ge ${#array[@]} ]]; + do update_apps "${array[$it]}" & processes+=($!) ((loop++)) ((it++)) - # done + done elif [[ $proc_count != 0 ]]; then # Wait for all processes to finish sleep 3 else # All processes must be completed, break out of loop - [[ $final_check == 0 ]] && ((final_check++)) && continue break fi done From c7afe81a387d129c595936658583639fa8339479 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 10 Aug 2022 22:26:39 -0600 Subject: [PATCH 0715/1229] add proc count to Until loop --- functions/update_apps.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 45a24abc..afa35d51 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -78,11 +78,12 @@ do sleep 3 elif [[ $it -lt ${#array[@]} ]]; then loop=0 - until [[ "$loop" -ge 2 || $it -ge ${#array[@]} ]]; + until [[ $loop -ge 2 || $proc_count -ge $update_limit || $it -ge ${#array[@]} ]]; do update_apps "${array[$it]}" & processes+=($!) ((loop++)) + ((proc_count++)) ((it++)) done elif [[ $proc_count != 0 ]]; then # Wait for all processes to finish From 8af787f2d4f77055bf91b3acfa5e000ee25249dd Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 10 Aug 2022 22:27:49 -0600 Subject: [PATCH 0716/1229] revert, un-needed due to condition above it --- functions/update_apps.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index afa35d51..078b6cd8 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -78,12 +78,11 @@ do sleep 3 elif [[ $it -lt ${#array[@]} ]]; then loop=0 - until [[ $loop -ge 2 || $proc_count -ge $update_limit || $it -ge ${#array[@]} ]]; + until [[ $loop -ge 2 || $it -ge ${#array[@]} ]]; do update_apps "${array[$it]}" & processes+=($!) ((loop++)) - ((proc_count++)) ((it++)) done elif [[ $proc_count != 0 ]]; then # Wait for all processes to finish From 116279db37b41b722c8c087724abe6c2f3dcb0b0 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 10 Aug 2022 22:35:30 -0600 Subject: [PATCH 0717/1229] sticking to one at a time, anymore is overloading --- functions/update_apps.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 078b6cd8..b5f08e75 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -77,14 +77,14 @@ do if [[ "$proc_count" -ge "$update_limit" ]]; then sleep 3 elif [[ $it -lt ${#array[@]} ]]; then - loop=0 - until [[ $loop -ge 2 || $it -ge ${#array[@]} ]]; - do - update_apps "${array[$it]}" & - processes+=($!) - ((loop++)) - ((it++)) - done + # loop=0 + # until [[ $loop -ge 2 || $it -ge ${#array[@]} ]]; + # do + update_apps "${array[$it]}" & + processes+=($!) + ((loop++)) + ((it++)) + # done elif [[ $proc_count != 0 ]]; then # Wait for all processes to finish sleep 3 else # All processes must be completed, break out of loop From 4f944a62997eac30b9fa0ac4160c1763b9c75735 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 10 Aug 2022 22:50:44 -0600 Subject: [PATCH 0718/1229] add count to the status file for cont change --- functions/update_apps.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index b5f08e75..8397f580 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -61,7 +61,7 @@ it=0 while true do if while_status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' 2>/dev/null) ; then - echo "$while_status" > temp.txt + echo -e "$it\n$while_status" > temp.txt else echo "Middlewared timed out. Consider setting a lower number for async applications" continue @@ -255,7 +255,7 @@ if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then fi else [[ "$verbose" == "true" ]] && echo_array+=("Waiting $((timeout-SECONDS)) more seconds for $app_name to be ACTIVE") - sleep 5 + sleep 10 continue fi done From 54e4c3876e4ca7037511f8988ba4a5d9c49e7228 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 10 Aug 2022 22:51:58 -0600 Subject: [PATCH 0719/1229] use its own count --- functions/update_apps.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 8397f580..74012adc 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -58,10 +58,12 @@ echo "Asynchronous Updates: $update_limit" # echo it=0 +while_count=0 while true do if while_status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' 2>/dev/null) ; then - echo -e "$it\n$while_status" > temp.txt + ((while_count++)) + echo -e "$while_count\n$while_status" > temp.txt else echo "Middlewared timed out. Consider setting a lower number for async applications" continue From 5edeb8c80bc1558c06f3757ba028dc0ed0accf59 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 10 Aug 2022 22:55:20 -0600 Subject: [PATCH 0720/1229] count was not being appended --- functions/update_apps.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 74012adc..4a241f64 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -63,7 +63,8 @@ while true do if while_status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' 2>/dev/null) ; then ((while_count++)) - echo -e "$while_count\n$while_status" > temp.txt + echo "$while_status" > temp.txt + echo "$while_count" >> temp.txt else echo "Middlewared timed out. Consider setting a lower number for async applications" continue From 4e617893470473bac49f3fbe9fc4f2842c8d366d Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 10 Aug 2022 22:58:51 -0600 Subject: [PATCH 0721/1229] remove redundant creation --- functions/update_apps.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 4a241f64..95b9030a 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -63,13 +63,11 @@ while true do if while_status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' 2>/dev/null) ; then ((while_count++)) - echo "$while_status" > temp.txt - echo "$while_count" >> temp.txt + echo -e "$while_count\n$while_status" > temp.txt else echo "Middlewared timed out. Consider setting a lower number for async applications" continue fi - echo "$while_status" > temp.txt proc_count=${#processes[@]} count=0 for proc in "${processes[@]}" From 5888efa3d7a62af7bffe75556b2d70749d3a2da7 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 10 Aug 2022 23:27:11 -0600 Subject: [PATCH 0722/1229] wait for file change before continuing --- functions/update_apps.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 95b9030a..28801d9d 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -210,8 +210,18 @@ if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then # [[ ! -e trigger ]] && touch trigger && sleep 10 while true do - (( count++ )) + if [[ $count -lt 1 ]]; then + while_count=$(head -n 1 temp.txt) + else + until [[ $while_count -lt $current_count ]] # Wait for a change in the file BEFORE continuing + do + current_count=$(head -n 1 temp.txt) + sleep 2 + done + while_count=$current_count + fi status=$( grep "^$app_name," temp.txt | awk -F ',' '{print $2}') + (( count++ )) if [[ "$status" == "ACTIVE" ]]; then if [[ "$startstatus" == "STOPPED" ]]; then [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Active..") && sleep 10 && continue #if reports active on FIRST time through loop, double check From c1793c530691a2e6abd664a5f8bfa7ca9a079903 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 10 Aug 2022 23:37:53 -0600 Subject: [PATCH 0723/1229] reduce sleep on file difference check --- functions/update_apps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 28801d9d..2c20ca27 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -216,7 +216,7 @@ if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then until [[ $while_count -lt $current_count ]] # Wait for a change in the file BEFORE continuing do current_count=$(head -n 1 temp.txt) - sleep 2 + sleep 1 done while_count=$current_count fi From c62da2c13dfaf614eb6b4b71399375ef15f253a7 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 10 Aug 2022 23:41:20 -0600 Subject: [PATCH 0724/1229] attempt removal of status double checks --- functions/update_apps.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 2c20ca27..16a03446 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -224,21 +224,21 @@ if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then (( count++ )) if [[ "$status" == "ACTIVE" ]]; then if [[ "$startstatus" == "STOPPED" ]]; then - [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Active..") && sleep 10 && continue #if reports active on FIRST time through loop, double check - [[ "$count" -le 1 && -z "$verbose" ]] && sleep 10 && continue #if reports active on FIRST time through loop, double check + # [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Active..") && sleep 10 && continue #if reports active on FIRST time through loop, double check + # [[ "$count" -le 1 && -z "$verbose" ]] && sleep 10 && continue #if reports active on FIRST time through loop, double check [[ "$verbose" == "true" ]] && echo_array+=("Returing to STOPPED state..") midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null || { echo_array+=("Error: Failed to stop $app_name") ; break ; } echo_array+=("Stopped") break else - [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Active..") && sleep 10 && continue #if reports active on FIRST time through loop, double check - [[ "$count" -le 1 && -z "$verbose" ]] && sleep 10 && continue #if reports active on FIRST time through loop, double check + # [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Active..") && sleep 10 && continue #if reports active on FIRST time through loop, double check + # [[ "$count" -le 1 && -z "$verbose" ]] && sleep 10 && continue #if reports active on FIRST time through loop, double check echo_array+=("Active") break #if reports active any time after the first loop, assume actually active. fi elif [[ "$status" == "STOPPED" ]]; then - [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Stopped..") && sleep 10 && continue #if reports stopped on FIRST time through loop, double check - [[ "$count" -le 1 && -z "$verbose" ]] && sleep 10 && continue #if reports stopped on FIRST time through loop, double check + # [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Stopped..") && sleep 10 && continue #if reports stopped on FIRST time through loop, double check + # [[ "$count" -le 1 && -z "$verbose" ]] && sleep 10 && continue #if reports stopped on FIRST time through loop, double check echo_array+=("Stopped") break #if reports stopped any time after the first loop, assume its extermal services. elif [[ "$SECONDS" -ge "$timeout" && "$status" == "DEPLOYING" ]]; then From f56b03c0ebd5c34c63a769f6f4161a88f09f80da Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 10 Aug 2022 23:45:46 -0600 Subject: [PATCH 0725/1229] still need the counter. --- functions/update_apps.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 16a03446..4d69cb16 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -224,21 +224,21 @@ if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then (( count++ )) if [[ "$status" == "ACTIVE" ]]; then if [[ "$startstatus" == "STOPPED" ]]; then - # [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Active..") && sleep 10 && continue #if reports active on FIRST time through loop, double check - # [[ "$count" -le 1 && -z "$verbose" ]] && sleep 10 && continue #if reports active on FIRST time through loop, double check + [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Active..") && sleep 15 && continue #if reports active on FIRST time through loop, double check + [[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports active on FIRST time through loop, double check [[ "$verbose" == "true" ]] && echo_array+=("Returing to STOPPED state..") midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null || { echo_array+=("Error: Failed to stop $app_name") ; break ; } echo_array+=("Stopped") break else - # [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Active..") && sleep 10 && continue #if reports active on FIRST time through loop, double check - # [[ "$count" -le 1 && -z "$verbose" ]] && sleep 10 && continue #if reports active on FIRST time through loop, double check + [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Active..") && sleep 15 && continue #if reports active on FIRST time through loop, double check + [[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports active on FIRST time through loop, double check echo_array+=("Active") break #if reports active any time after the first loop, assume actually active. fi elif [[ "$status" == "STOPPED" ]]; then - # [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Stopped..") && sleep 10 && continue #if reports stopped on FIRST time through loop, double check - # [[ "$count" -le 1 && -z "$verbose" ]] && sleep 10 && continue #if reports stopped on FIRST time through loop, double check + [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Stopped..") && sleep 15 && continue #if reports stopped on FIRST time through loop, double check + [[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports stopped on FIRST time through loop, double check echo_array+=("Stopped") break #if reports stopped any time after the first loop, assume its extermal services. elif [[ "$SECONDS" -ge "$timeout" && "$status" == "DEPLOYING" ]]; then From 850303e3287806c6d73a36561b871ef1c627033e Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 10 Aug 2022 23:55:45 -0600 Subject: [PATCH 0726/1229] try app specific status check instead of global --- functions/update_apps.sh | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 4d69cb16..946249ec 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -210,35 +210,46 @@ if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then # [[ ! -e trigger ]] && touch trigger && sleep 10 while true do - if [[ $count -lt 1 ]]; then - while_count=$(head -n 1 temp.txt) + if [[ $count -lt 1 ]]; then + old_status=$(grep "^$app_name," temp.txt) else - until [[ $while_count -lt $current_count ]] # Wait for a change in the file BEFORE continuing + until [[ "$new_status" != "$old_status" ]] # Wait for a change in the file BEFORE continuing do - current_count=$(head -n 1 temp.txt) + new_status=$(grep "^$app_name," temp.txt) sleep 1 done - while_count=$current_count + old_status=$new_status fi + + # if [[ $count -lt 1 ]]; then + # while_count=$(head -n 1 temp.txt) + # else + # until [[ $while_count -lt $current_count ]] # Wait for a change in the file BEFORE continuing + # do + # current_count=$(head -n 1 temp.txt) + # sleep 1 + # done + # while_count=$current_count + # fi status=$( grep "^$app_name," temp.txt | awk -F ',' '{print $2}') (( count++ )) if [[ "$status" == "ACTIVE" ]]; then if [[ "$startstatus" == "STOPPED" ]]; then - [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Active..") && sleep 15 && continue #if reports active on FIRST time through loop, double check - [[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports active on FIRST time through loop, double check + # [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Active..") && sleep 15 && continue #if reports active on FIRST time through loop, double check + # [[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports active on FIRST time through loop, double check [[ "$verbose" == "true" ]] && echo_array+=("Returing to STOPPED state..") midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null || { echo_array+=("Error: Failed to stop $app_name") ; break ; } echo_array+=("Stopped") break else - [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Active..") && sleep 15 && continue #if reports active on FIRST time through loop, double check - [[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports active on FIRST time through loop, double check + # [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Active..") && sleep 15 && continue #if reports active on FIRST time through loop, double check + # [[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports active on FIRST time through loop, double check echo_array+=("Active") break #if reports active any time after the first loop, assume actually active. fi elif [[ "$status" == "STOPPED" ]]; then - [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Stopped..") && sleep 15 && continue #if reports stopped on FIRST time through loop, double check - [[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports stopped on FIRST time through loop, double check + # [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Stopped..") && sleep 15 && continue #if reports stopped on FIRST time through loop, double check + # [[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports stopped on FIRST time through loop, double check echo_array+=("Stopped") break #if reports stopped any time after the first loop, assume its extermal services. elif [[ "$SECONDS" -ge "$timeout" && "$status" == "DEPLOYING" ]]; then From 0bbad3fb18e06d50e94da7321a49b68c657ef158 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Thu, 11 Aug 2022 00:38:33 +0000 Subject: [PATCH 0727/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.154.7 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index bf901e8d..34eba44c 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@26a0b952ac06eaefcb28b89aa1a522cb4f759f8f # tag=v32.153.4 + uses: renovatebot/github-action@30205fb0288d4b06ba6a23b86084fddf59a8fc82 # tag=v32.154.7 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From bef42eaaebf704ad1cc8a54021d10c7c209f6523 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 11 Aug 2022 00:18:53 -0600 Subject: [PATCH 0728/1229] check for file changes and specific status --- functions/update_apps.sh | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 946249ec..bc44d24c 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -213,10 +213,15 @@ if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then if [[ $count -lt 1 ]]; then old_status=$(grep "^$app_name," temp.txt) else - until [[ "$new_status" != "$old_status" ]] # Wait for a change in the file BEFORE continuing + before_loop=$(head -n 1 temp.txt) + until [[ "$new_status" != "$old_status" || $current_loop -gt 3 ]] # Wait for a change in the file BEFORE continuing do new_status=$(grep "^$app_name," temp.txt) sleep 1 + if ! echo -e "$(head -n 1 temp.txt)" | grep -qs ^"$before_loop" ; then + before_loop=$(head -n 1 temp.txt) + ((current_loop++)) + fi done old_status=$new_status fi @@ -235,21 +240,21 @@ if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then (( count++ )) if [[ "$status" == "ACTIVE" ]]; then if [[ "$startstatus" == "STOPPED" ]]; then - # [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Active..") && sleep 15 && continue #if reports active on FIRST time through loop, double check - # [[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports active on FIRST time through loop, double check + [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Active..") && continue #if reports active on FIRST time through loop, double check + [[ "$count" -le 1 && -z "$verbose" ]] && continue #if reports active on FIRST time through loop, double check [[ "$verbose" == "true" ]] && echo_array+=("Returing to STOPPED state..") midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null || { echo_array+=("Error: Failed to stop $app_name") ; break ; } echo_array+=("Stopped") break else - # [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Active..") && sleep 15 && continue #if reports active on FIRST time through loop, double check - # [[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports active on FIRST time through loop, double check + [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Active..") && continue #if reports active on FIRST time through loop, double check + [[ "$count" -le 1 && -z "$verbose" ]] && continue #if reports active on FIRST time through loop, double check echo_array+=("Active") break #if reports active any time after the first loop, assume actually active. fi elif [[ "$status" == "STOPPED" ]]; then - # [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Stopped..") && sleep 15 && continue #if reports stopped on FIRST time through loop, double check - # [[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports stopped on FIRST time through loop, double check + [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Stopped..") && continue #if reports stopped on FIRST time through loop, double check + [[ "$count" -le 1 && -z "$verbose" ]] && continue #if reports stopped on FIRST time through loop, double check echo_array+=("Stopped") break #if reports stopped any time after the first loop, assume its extermal services. elif [[ "$SECONDS" -ge "$timeout" && "$status" == "DEPLOYING" ]]; then From 06f0f7ea3aac75c4c53116794d4b1a6ff680cdc0 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 11 Aug 2022 01:48:31 -0600 Subject: [PATCH 0729/1229] fix status check --- functions/update_apps.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index bc44d24c..339fb7bf 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -214,6 +214,7 @@ if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then old_status=$(grep "^$app_name," temp.txt) else before_loop=$(head -n 1 temp.txt) + new_status=old_status until [[ "$new_status" != "$old_status" || $current_loop -gt 3 ]] # Wait for a change in the file BEFORE continuing do new_status=$(grep "^$app_name," temp.txt) From ec422e8db9e2e19226b34b067fd3d4508213e6bd Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 11 Aug 2022 01:50:41 -0600 Subject: [PATCH 0730/1229] assigned literal on accident.. --- functions/update_apps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 339fb7bf..f3734dc5 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -214,7 +214,7 @@ if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then old_status=$(grep "^$app_name," temp.txt) else before_loop=$(head -n 1 temp.txt) - new_status=old_status + new_status=$old_status until [[ "$new_status" != "$old_status" || $current_loop -gt 3 ]] # Wait for a change in the file BEFORE continuing do new_status=$(grep "^$app_name," temp.txt) From ea7a3e94907ff4f478d7021d0f44d0627aee7f3c Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 11 Aug 2022 16:37:19 -0600 Subject: [PATCH 0731/1229] remove commented stuff --- functions/update_apps.sh | 76 ++++------------------------------------ 1 file changed, 7 insertions(+), 69 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index f3734dc5..4cadd7f5 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -9,54 +9,6 @@ echo "Asynchronous Updates: $update_limit" [[ -z $timeout ]] && echo "Default Timeout: 500" && timeout=500 || echo "Custom Timeout: $timeout" [[ "$timeout" -le 120 ]] && echo "Warning: Your timeout is set low and may lead to premature rollbacks or skips" -# previous 20% 2 min 9 seconds -# it=0 -# while_status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' 2>/dev/null) -# echo "$while_status" > temp.txt -# rm trigger &>/dev/null -# delay=2 -# final_check=0 -# while true -# do -# if [[ -f trigger ]]; then -# delay=4 -# if while_status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' 2>/dev/null) ; then -# echo "$while_status" > temp.txt -# else -# echo "Middlewared timed out. Consider setting a lower number for async applications" -# continue -# fi -# fi -# proc_count=${#processes[@]} -# count=0 -# for proc in "${processes[@]}" -# do -# kill -0 "$proc" &> /dev/null || { unset "processes[$count]"; ((proc_count--)); } -# ((count++)) -# done -# if [[ "$proc_count" -ge "$update_limit" ]]; then -# sleep $delay -# elif [[ $it -lt ${#array[@]} ]]; then -# until [[ "$proc_count" -ge "$update_limit" || $it -ge ${#array[@]} ]] -# do -# update_apps "${array[$it]}" & -# processes+=($!) -# sleep 4 -# ((it++)) -# ((proc_count++)) -# done -# elif [[ $proc_count != 0 ]]; then # Wait for all processes to finish -# sleep $delay -# else # All processes must be completed, break out of loop -# [[ $final_check == 0 ]] && ((final_check++)) && continue -# break -# fi -# done -# rm temp.txt -# [[ -f trigger ]] && rm trigger -# echo -# echo - it=0 while_count=0 while true @@ -83,8 +35,8 @@ do # do update_apps "${array[$it]}" & processes+=($!) - ((loop++)) ((it++)) + # ((loop++)) # done elif [[ $proc_count != 0 ]]; then # Wait for all processes to finish sleep 3 @@ -182,12 +134,13 @@ export -f update_apps update(){ count=0 -while [[ $count -lt 3 ]] +while true do update_avail=$(grep "^$app_name," temp.txt | awk -F ',' '{print $3}') - if [[ $update_avail == "true" ]]; then + if [[ $count -gt 2 ]]; then + return 1 + elif [[ $update_avail == "true" ]]; then if ! cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null ; then - # [[ ! -e trigger ]] && touch trigger && sleep 10 sleep 6 ((count++)) continue @@ -195,9 +148,6 @@ do break elif [[ $update_avail == "false" ]]; then break - else - ((count++)) - sleep 6 fi done } @@ -207,15 +157,14 @@ after_update_actions(){ SECONDS=0 count=0 if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then - # [[ ! -e trigger ]] && touch trigger && sleep 10 while true do - if [[ $count -lt 1 ]]; then + if [[ $count -lt 1 ]]; then old_status=$(grep "^$app_name," temp.txt) else before_loop=$(head -n 1 temp.txt) new_status=$old_status - until [[ "$new_status" != "$old_status" || $current_loop -gt 3 ]] # Wait for a change in the file BEFORE continuing + until [[ "$new_status" != "$old_status" || $current_loop -gt 3 ]] # Wait for a specific change to app status, or 3 refreshes of the file to go by. do new_status=$(grep "^$app_name," temp.txt) sleep 1 @@ -226,17 +175,6 @@ if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then done old_status=$new_status fi - - # if [[ $count -lt 1 ]]; then - # while_count=$(head -n 1 temp.txt) - # else - # until [[ $while_count -lt $current_count ]] # Wait for a change in the file BEFORE continuing - # do - # current_count=$(head -n 1 temp.txt) - # sleep 1 - # done - # while_count=$current_count - # fi status=$( grep "^$app_name," temp.txt | awk -F ',' '{print $2}') (( count++ )) if [[ "$status" == "ACTIVE" ]]; then From 1ff79e5921f5f3977d5a375bdd747d20d262a80a Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Thu, 11 Aug 2022 18:08:26 +0000 Subject: [PATCH 0732/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.154.9 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 34eba44c..01f6a343 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@30205fb0288d4b06ba6a23b86084fddf59a8fc82 # tag=v32.154.7 + uses: renovatebot/github-action@01fb8393be499048fa9fc63a5ed6e60468d09462 # tag=v32.154.9 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 5d3470c2dd4b3cbb3c7404bc9fe87b06a3210eda Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 11 Aug 2022 20:30:49 -0600 Subject: [PATCH 0733/1229] loop on update failure --- functions/update_apps.sh | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 4cadd7f5..4ec0713a 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -141,9 +141,19 @@ do return 1 elif [[ $update_avail == "true" ]]; then if ! cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null ; then - sleep 6 - ((count++)) - continue + # sleep 6 + # ((count++)) + # continue + before_loop=$(head -n 1 temp.txt) + current_loop=0 + until [[ "$(grep "^$app_name," temp.txt | awk -F ',' '{print $3}')" != "$update_avail" || $current_loop -gt 3 ]] # Wait for a specific change to app status, or 3 refreshes of the file to go by. + do + sleep 1 + if ! echo -e "$(head -n 1 temp.txt)" | grep -qs ^"$before_loop" ; then + before_loop=$(head -n 1 temp.txt) + ((current_loop++)) + fi + done fi break elif [[ $update_avail == "false" ]]; then @@ -164,6 +174,7 @@ if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then else before_loop=$(head -n 1 temp.txt) new_status=$old_status + current_loop=0 until [[ "$new_status" != "$old_status" || $current_loop -gt 3 ]] # Wait for a specific change to app status, or 3 refreshes of the file to go by. do new_status=$(grep "^$app_name," temp.txt) From e2942dd6264fe2a9eed8a94fd0f5fd0aff1f1a93 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 11 Aug 2022 20:41:31 -0600 Subject: [PATCH 0734/1229] update update function --- functions/update_apps.sh | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 4ec0713a..b87e8a18 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -137,27 +137,31 @@ count=0 while true do update_avail=$(grep "^$app_name," temp.txt | awk -F ',' '{print $3}') - if [[ $count -gt 2 ]]; then - return 1 - elif [[ $update_avail == "true" ]]; then + # if [[ $count -gt 2 ]]; then + # return 1 + if [[ $update_avail == "true" ]]; then if ! cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null ; then # sleep 6 # ((count++)) # continue before_loop=$(head -n 1 temp.txt) current_loop=0 - until [[ "$(grep "^$app_name," temp.txt | awk -F ',' '{print $3}')" != "$update_avail" || $current_loop -gt 3 ]] # Wait for a specific change to app status, or 3 refreshes of the file to go by. + until [[ "$(grep "^$app_name," temp.txt | awk -F ',' '{print $3}')" != "$update_avail" ]] # Wait for a specific change to app status, or 3 refreshes of the file to go by. do - sleep 1 - if ! echo -e "$(head -n 1 temp.txt)" | grep -qs ^"$before_loop" ; then + if [[ $current_loop -gt 3 ]]; then + return 1 #App failed to update, return error code to update_apps func + elif ! echo -e "$(head -n 1 temp.txt)" | grep -qs ^"$before_loop" ; then # The file has been updated, but nothing changed specifically for the app. before_loop=$(head -n 1 temp.txt) ((current_loop++)) fi + sleep 1 done fi break elif [[ $update_avail == "false" ]]; then break + else + sleep 3 fi done } From d926bf938d46d164e708473801a6019d11223363 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 11 Aug 2022 20:51:42 -0600 Subject: [PATCH 0735/1229] only enter loop if status is not deploying --- functions/update_apps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index b87e8a18..99d169fa 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -175,7 +175,7 @@ if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then do if [[ $count -lt 1 ]]; then old_status=$(grep "^$app_name," temp.txt) - else + elif [[ $status != "DEPLOYING" ]]; then before_loop=$(head -n 1 temp.txt) new_status=$old_status current_loop=0 From 1473a969e275e6557329cce1f64a0ebf14fcd782 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 11 Aug 2022 20:55:37 -0600 Subject: [PATCH 0736/1229] change status to activity specific --- functions/update_apps.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 99d169fa..7427fcfc 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -173,15 +173,16 @@ count=0 if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then while true do + status=$( grep "^$app_name," temp.txt | awk -F ',' '{print $2}') if [[ $count -lt 1 ]]; then - old_status=$(grep "^$app_name," temp.txt) + old_status=$status elif [[ $status != "DEPLOYING" ]]; then before_loop=$(head -n 1 temp.txt) new_status=$old_status current_loop=0 until [[ "$new_status" != "$old_status" || $current_loop -gt 3 ]] # Wait for a specific change to app status, or 3 refreshes of the file to go by. do - new_status=$(grep "^$app_name," temp.txt) + new_status=$( grep "^$app_name," temp.txt | awk -F ',' '{print $2}') sleep 1 if ! echo -e "$(head -n 1 temp.txt)" | grep -qs ^"$before_loop" ; then before_loop=$(head -n 1 temp.txt) @@ -190,7 +191,6 @@ if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then done old_status=$new_status fi - status=$( grep "^$app_name," temp.txt | awk -F ',' '{print $2}') (( count++ )) if [[ "$status" == "ACTIVE" ]]; then if [[ "$startstatus" == "STOPPED" ]]; then From 99dc8fcef83d2a55368b1850b8af9f3bd79dff9f Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 11 Aug 2022 21:20:04 -0600 Subject: [PATCH 0737/1229] use bool to only verify if active/stopped 1st time --- functions/update_apps.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 7427fcfc..b5844fa0 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -176,7 +176,7 @@ if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then status=$( grep "^$app_name," temp.txt | awk -F ',' '{print $2}') if [[ $count -lt 1 ]]; then old_status=$status - elif [[ $status != "DEPLOYING" ]]; then + elif [[ $verify == "true" ]]; then before_loop=$(head -n 1 temp.txt) new_status=$old_status current_loop=0 @@ -194,21 +194,21 @@ if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then (( count++ )) if [[ "$status" == "ACTIVE" ]]; then if [[ "$startstatus" == "STOPPED" ]]; then - [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Active..") && continue #if reports active on FIRST time through loop, double check - [[ "$count" -le 1 && -z "$verbose" ]] && continue #if reports active on FIRST time through loop, double check + [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Active..") && verify="true" && continue #if reports active on FIRST time through loop, double check + [[ "$count" -le 1 && -z "$verbose" ]] && verify="true" && continue #if reports active on FIRST time through loop, double check [[ "$verbose" == "true" ]] && echo_array+=("Returing to STOPPED state..") midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null || { echo_array+=("Error: Failed to stop $app_name") ; break ; } echo_array+=("Stopped") break else - [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Active..") && continue #if reports active on FIRST time through loop, double check - [[ "$count" -le 1 && -z "$verbose" ]] && continue #if reports active on FIRST time through loop, double check + [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Active..") && verify="true" && continue #if reports active on FIRST time through loop, double check + [[ "$count" -le 1 && -z "$verbose" ]] && verify="true" && continue #if reports active on FIRST time through loop, double check echo_array+=("Active") break #if reports active any time after the first loop, assume actually active. fi elif [[ "$status" == "STOPPED" ]]; then - [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Stopped..") && continue #if reports stopped on FIRST time through loop, double check - [[ "$count" -le 1 && -z "$verbose" ]] && continue #if reports stopped on FIRST time through loop, double check + [[ "$count" -le 1 && "$verbose" == "true" ]] && verify="true" && echo_array+=("Verifying Stopped..") && continue #if reports stopped on FIRST time through loop, double check + [[ "$count" -le 1 && -z "$verbose" ]] && verify="true" && continue #if reports stopped on FIRST time through loop, double check echo_array+=("Stopped") break #if reports stopped any time after the first loop, assume its extermal services. elif [[ "$SECONDS" -ge "$timeout" && "$status" == "DEPLOYING" ]]; then @@ -236,7 +236,7 @@ if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then fi else [[ "$verbose" == "true" ]] && echo_array+=("Waiting $((timeout-SECONDS)) more seconds for $app_name to be ACTIVE") - sleep 10 + sleep 5 continue fi done From 97896b27a2aac9362b7a1690d921af8df2ac1752 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 11 Aug 2022 21:37:38 -0600 Subject: [PATCH 0738/1229] status check when leaving verify --- functions/update_apps.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index b5844fa0..766ace10 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -190,6 +190,8 @@ if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then fi done old_status=$new_status + status=$( grep "^$app_name," temp.txt | awk -F ',' '{print $2}') + unset verify fi (( count++ )) if [[ "$status" == "ACTIVE" ]]; then From 61eea4c9a5f25fc72607ebda2ac51445de300a83 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 11 Aug 2022 21:43:15 -0600 Subject: [PATCH 0739/1229] remove newstatus variable, just use status instead --- functions/update_apps.sh | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 766ace10..ec807f5d 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -178,19 +178,16 @@ if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then old_status=$status elif [[ $verify == "true" ]]; then before_loop=$(head -n 1 temp.txt) - new_status=$old_status current_loop=0 - until [[ "$new_status" != "$old_status" || $current_loop -gt 3 ]] # Wait for a specific change to app status, or 3 refreshes of the file to go by. + until [[ "$status" != "$old_status" || $current_loop -gt 3 ]] # Wait for a specific change to app status, or 3 refreshes of the file to go by. do - new_status=$( grep "^$app_name," temp.txt | awk -F ',' '{print $2}') + status=$( grep "^$app_name," temp.txt | awk -F ',' '{print $2}') sleep 1 if ! echo -e "$(head -n 1 temp.txt)" | grep -qs ^"$before_loop" ; then before_loop=$(head -n 1 temp.txt) ((current_loop++)) fi done - old_status=$new_status - status=$( grep "^$app_name," temp.txt | awk -F ',' '{print $2}') unset verify fi (( count++ )) From 653e54804ad31db04280ad9136e1d3d9321e3c7b Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 11 Aug 2022 21:55:09 -0600 Subject: [PATCH 0740/1229] testing update function --- functions/update_apps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index ec807f5d..82f4fe7d 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -133,7 +133,7 @@ export -f update_apps update(){ -count=0 +# count=0 while true do update_avail=$(grep "^$app_name," temp.txt | awk -F ',' '{print $3}') From c45bf0a5887477ac35ccf63b07285d4ba1d3c8d2 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 11 Aug 2022 22:15:17 -0600 Subject: [PATCH 0741/1229] add trigger for debugging --- functions/update_apps.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 82f4fe7d..00a1c32f 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -141,6 +141,7 @@ do # return 1 if [[ $update_avail == "true" ]]; then if ! cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null ; then + echo "Fail Trigger - Debugging" # sleep 6 # ((count++)) # continue From 4469d96cb69ea97157094b1d3e47db4d95c74788 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 11 Aug 2022 22:42:43 -0600 Subject: [PATCH 0742/1229] if while status is empty.. call again --- functions/update_apps.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 00a1c32f..0aaea2e2 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -14,8 +14,8 @@ while_count=0 while true do if while_status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' 2>/dev/null) ; then - ((while_count++)) - echo -e "$while_count\n$while_status" > temp.txt + ((while_count++)) + [[ -z $while_status ]] && continue || echo -e "$while_count\n$while_status" > temp.txt else echo "Middlewared timed out. Consider setting a lower number for async applications" continue From 3f5d8d4c734d10c58c5a7d8c5ab1ce77b5be9e63 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 11 Aug 2022 22:52:45 -0600 Subject: [PATCH 0743/1229] attempt second update, if while_status empty, skip --- functions/update_apps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 0aaea2e2..cf0b6f77 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -150,7 +150,7 @@ do until [[ "$(grep "^$app_name," temp.txt | awk -F ',' '{print $3}')" != "$update_avail" ]] # Wait for a specific change to app status, or 3 refreshes of the file to go by. do if [[ $current_loop -gt 3 ]]; then - return 1 #App failed to update, return error code to update_apps func + cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null || return 1 # After waiting, attempt an update once more, if fails, return error code elif ! echo -e "$(head -n 1 temp.txt)" | grep -qs ^"$before_loop" ; then # The file has been updated, but nothing changed specifically for the app. before_loop=$(head -n 1 temp.txt) ((current_loop++)) From b3eb52cd20d97928bd117c85754f57e8ef2cc5c0 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Fri, 12 Aug 2022 06:09:17 +0000 Subject: [PATCH 0744/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.156.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 01f6a343..34390c75 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@01fb8393be499048fa9fc63a5ed6e60468d09462 # tag=v32.154.9 + uses: renovatebot/github-action@4f3429dc34975d83a2fbdd1f9317cd05429b9eee # tag=v32.156.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 592b739bf06d0fd2862c7e35480283668bd2ae04 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 12 Aug 2022 06:37:30 -0600 Subject: [PATCH 0745/1229] stop app to cli rather than midctl, wait for compl --- functions/update_apps.sh | 71 +++++++++++++++++++++------------------- 1 file changed, 38 insertions(+), 33 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index cf0b6f77..12c5543e 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -89,29 +89,12 @@ if [[ "$diff_app" == "$diff_chart" || "$update_all_apps" == "true" ]]; then #con else # if status was not STOPPED, stop the app prior to updating echo_array+=("\n$app_name") [[ "$verbose" == "true" ]] && echo_array+=("Stopping prior to update..") - midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null || echo_array+=("Error: Failed to stop $app_name") - SECONDS=0 - # [[ ! -e trigger ]] && touch trigger - while [[ "$status" != "STOPPED" ]] - do - status=$( grep "^$app_name," temp.txt | awk -F ',' '{print $2}') - if [[ "$status" == "STOPPED" ]]; then - echo_array+=("Stopped") - [[ "$verbose" == "true" ]] && echo_array+=("Updating..") - if update ;then - echo_array+=("Updated\n$old_full_ver\n$new_full_ver") - else - echo_array+=("Failed to update") - return - fi - elif [[ "$SECONDS" -ge "$timeout" ]]; then - echo_array+=("Error: Run Time($SECONDS) has exceeded Timeout($timeout)") - break - elif [[ "$status" != "STOPPED" ]]; then - [[ "$verbose" == "true" ]] && echo_array+=("Waiting $((timeout-SECONDS)) more seconds for $app_name to be STOPPED") - sleep 5 - fi - done + if stop_app ; then + echo_array+=("Stopped") + else + echo_array+=("Error: Failed to stop $app_name") + return 1 + fi fi else #user must not be using -S, just update echo_array+=("\n$app_name") @@ -133,23 +116,18 @@ export -f update_apps update(){ -# count=0 +current_loop=0 while true do update_avail=$(grep "^$app_name," temp.txt | awk -F ',' '{print $3}') - # if [[ $count -gt 2 ]]; then - # return 1 if [[ $update_avail == "true" ]]; then if ! cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null ; then echo "Fail Trigger - Debugging" - # sleep 6 - # ((count++)) - # continue before_loop=$(head -n 1 temp.txt) current_loop=0 until [[ "$(grep "^$app_name," temp.txt | awk -F ',' '{print $3}')" != "$update_avail" ]] # Wait for a specific change to app status, or 3 refreshes of the file to go by. do - if [[ $current_loop -gt 3 ]]; then + if [[ $current_loop -gt 2 ]]; then cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null || return 1 # After waiting, attempt an update once more, if fails, return error code elif ! echo -e "$(head -n 1 temp.txt)" | grep -qs ^"$before_loop" ; then # The file has been updated, but nothing changed specifically for the app. before_loop=$(head -n 1 temp.txt) @@ -168,6 +146,29 @@ done } export -f update +stop_app(){ +count=0 +while [[ "$status" != "STOPPED" ]] +do + status=$( grep "^$app_name," temp.txt | awk -F ',' '{print $2}') + if [[ $count -gt 2 ]]; then # If failed to stop app 3 times, return failure to parent shell + return 1 + elif ! cli -c 'app chart_release scale release_name='\""$app_name"\"\ 'scale_options={"replica_count": 0}' &> /dev/null ; then + echo "Fail Trigger Stop - Debugging" + before_loop=$(head -n 1 temp.txt) + ((count++)) + until [[ $(head -n 1 temp.txt) != "$before_loop" ]] # Upon failure, wait for status update before continuing + do + sleep 1 + done + else + break + fi +done +} +export -f stop_app + + after_update_actions(){ SECONDS=0 count=0 @@ -197,8 +198,12 @@ if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Active..") && verify="true" && continue #if reports active on FIRST time through loop, double check [[ "$count" -le 1 && -z "$verbose" ]] && verify="true" && continue #if reports active on FIRST time through loop, double check [[ "$verbose" == "true" ]] && echo_array+=("Returing to STOPPED state..") - midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null || { echo_array+=("Error: Failed to stop $app_name") ; break ; } - echo_array+=("Stopped") + if stop_app ; then + echo_array+=("Stopped") + else + echo_array+=("Error: Failed to stop $app_name") + return 1 + fi break else [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Active..") && verify="true" && continue #if reports active on FIRST time through loop, double check @@ -249,4 +254,4 @@ do echo -e "$i" done } -export -f after_update_actions \ No newline at end of file +export -f after_update_actions From 7c7f42b9cb0348e35f602def497b9ea462760c05 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 12 Aug 2022 06:53:35 -0600 Subject: [PATCH 0746/1229] always update prior to a_u_a --- functions/update_apps.sh | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 12c5543e..987dad83 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -79,13 +79,6 @@ if [[ "$diff_app" == "$diff_chart" || "$update_all_apps" == "true" ]]; then #con if [[ $stop_before_update == "true" ]]; then # Check to see if user is using -S or not if [[ "$startstatus" == "STOPPED" ]]; then # if status is already stopped, skip while loop echo_array+=("\n$app_name") - [[ "$verbose" == "true" ]] && echo_array+=("Updating..") - if update ;then - echo_array+=("Updated\n$old_full_ver\n$new_full_ver") - else - echo_array+=("Failed to update") - return - fi else # if status was not STOPPED, stop the app prior to updating echo_array+=("\n$app_name") [[ "$verbose" == "true" ]] && echo_array+=("Stopping prior to update..") @@ -98,18 +91,18 @@ if [[ "$diff_app" == "$diff_chart" || "$update_all_apps" == "true" ]]; then #con fi else #user must not be using -S, just update echo_array+=("\n$app_name") - [[ "$verbose" == "true" ]] && echo_array+=("Updating..") - if update ;then - echo_array+=("Updated\n$old_full_ver\n$new_full_ver") - else - echo_array+=("Failed to update") - return - fi fi else echo -e "\n$app_name\nMajor Release, update manually" return 0 fi +[[ "$verbose" == "true" ]] && echo_array+=("Updating..") +if update ;then + echo_array+=("Updated\n$old_full_ver\n$new_full_ver") +else + echo_array+=("Failed to update") +return +fi after_update_actions } export -f update_apps From 714842a33f5d5a058a81b1accf365f181deb623f Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 12 Aug 2022 07:33:13 -0600 Subject: [PATCH 0747/1229] clean-up after_update_actions --- functions/update_apps.sh | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 987dad83..45f84f87 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -169,9 +169,9 @@ if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then while true do status=$( grep "^$app_name," temp.txt | awk -F ',' '{print $2}') - if [[ $count -lt 1 ]]; then + if [[ $count -lt 1 && $status != "Deploying" ]]; then # If status shows up as Active or Stopped on the first check, verify that. Otherwise it may be a false report.. + [[ "$verbose" == "true" ]] && echo_array+=("Verifying $status..") old_status=$status - elif [[ $verify == "true" ]]; then before_loop=$(head -n 1 temp.txt) current_loop=0 until [[ "$status" != "$old_status" || $current_loop -gt 3 ]] # Wait for a specific change to app status, or 3 refreshes of the file to go by. @@ -183,13 +183,10 @@ if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then ((current_loop++)) fi done - unset verify fi (( count++ )) if [[ "$status" == "ACTIVE" ]]; then if [[ "$startstatus" == "STOPPED" ]]; then - [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Active..") && verify="true" && continue #if reports active on FIRST time through loop, double check - [[ "$count" -le 1 && -z "$verbose" ]] && verify="true" && continue #if reports active on FIRST time through loop, double check [[ "$verbose" == "true" ]] && echo_array+=("Returing to STOPPED state..") if stop_app ; then echo_array+=("Stopped") @@ -199,16 +196,12 @@ if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then fi break else - [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Active..") && verify="true" && continue #if reports active on FIRST time through loop, double check - [[ "$count" -le 1 && -z "$verbose" ]] && verify="true" && continue #if reports active on FIRST time through loop, double check echo_array+=("Active") - break #if reports active any time after the first loop, assume actually active. + break fi elif [[ "$status" == "STOPPED" ]]; then - [[ "$count" -le 1 && "$verbose" == "true" ]] && verify="true" && echo_array+=("Verifying Stopped..") && continue #if reports stopped on FIRST time through loop, double check - [[ "$count" -le 1 && -z "$verbose" ]] && verify="true" && continue #if reports stopped on FIRST time through loop, double check echo_array+=("Stopped") - break #if reports stopped any time after the first loop, assume its extermal services. + break elif [[ "$SECONDS" -ge "$timeout" && "$status" == "DEPLOYING" ]]; then if [[ $rollback == "true" ]]; then if [[ "$failed" != "true" ]]; then From 0fbe428507e09e01771eba53cd14b3c1bfa64915 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 12 Aug 2022 07:53:58 -0600 Subject: [PATCH 0748/1229] fix deploying comparison --- functions/update_apps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 45f84f87..afedf65a 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -169,7 +169,7 @@ if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then while true do status=$( grep "^$app_name," temp.txt | awk -F ',' '{print $2}') - if [[ $count -lt 1 && $status != "Deploying" ]]; then # If status shows up as Active or Stopped on the first check, verify that. Otherwise it may be a false report.. + if [[ $count -lt 1 && $status != "DEPLOYING" ]]; then # If status shows up as Active or Stopped on the first check, verify that. Otherwise it may be a false report.. [[ "$verbose" == "true" ]] && echo_array+=("Verifying $status..") old_status=$status before_loop=$(head -n 1 temp.txt) From 7f6018b5d591ff443bf5116f1d8ccd6ec601305b Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 12 Aug 2022 08:10:15 -0600 Subject: [PATCH 0749/1229] cmd to container regex --- functions/cmd_to_container.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index 115ad619..d0a6c47b 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -23,7 +23,7 @@ do fi done app_name=$(echo -e "$app_name" | grep ^"$selection)" | awk '{print $2}') -search=$(k3s crictl ps -a -s running | sed -E 's/([0-9]*|About)[[:space:]][a-z]{2,5}[[:space:]](hour)?[[:space:]]?ago//') +search=$(k3s crictl ps -a -s running | sed -E 's/[[:space:]]([0-9]*|About)[a-z0-9 ]{5,12}ago[[:space:]]//') mapfile -t pod_id < <(echo "$search" | grep -E "[[:space:]]$app_name([[:space:]]|-([-[:alnum:]])*[[:space:]])" | awk '{print $(NF)}') for pod in "${pod_id[@]}" do From a03598b1b7f45abd3072f8ad733f8e90a2b5cb8f Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 12 Aug 2022 09:13:37 -0600 Subject: [PATCH 0750/1229] do not add duplicate containers --- functions/cmd_to_container.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index d0a6c47b..277da7bb 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -27,6 +27,7 @@ search=$(k3s crictl ps -a -s running | sed -E 's/[[:space:]]([0-9]*|About)[a-z0- mapfile -t pod_id < <(echo "$search" | grep -E "[[:space:]]$app_name([[:space:]]|-([-[:alnum:]])*[[:space:]])" | awk '{print $(NF)}') for pod in "${pod_id[@]}" do + printf '%s\0' "${containers[@]}" | grep -Fxqz -- "$(echo "$search" | grep "$pod" | awk '{print $4}')" && continue containers+=("$(echo "$search" | grep "$pod" | awk '{print $4}')") done case "${#containers[@]}" in From 7cbcf11fb2c6a9cdadeaa678175f4e969c7abee1 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 12 Aug 2022 09:22:00 -0600 Subject: [PATCH 0751/1229] try different method for rm-ing dupes --- functions/cmd_to_container.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index 277da7bb..a4748c07 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -27,9 +27,9 @@ search=$(k3s crictl ps -a -s running | sed -E 's/[[:space:]]([0-9]*|About)[a-z0- mapfile -t pod_id < <(echo "$search" | grep -E "[[:space:]]$app_name([[:space:]]|-([-[:alnum:]])*[[:space:]])" | awk '{print $(NF)}') for pod in "${pod_id[@]}" do - printf '%s\0' "${containers[@]}" | grep -Fxqz -- "$(echo "$search" | grep "$pod" | awk '{print $4}')" && continue - containers+=("$(echo "$search" | grep "$pod" | awk '{print $4}')") + containers_temp+=("$(echo "$search" | grep "$pod" | awk '{print $4}')") done +containers=(); while IFS= read -r -d '' x; do containers+=("$x"); done < <(printf "%s\0" "${containers_temp[@]}" | sort -uz) case "${#containers[@]}" in 0) echo -e "No containers available\nAre you sure the application in running?" From cc8a0d370805b067610284f0543bfca09b6ef53d Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 12 Aug 2022 09:26:34 -0600 Subject: [PATCH 0752/1229] 3rd attempt --- functions/cmd_to_container.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index a4748c07..695c73ea 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -27,9 +27,9 @@ search=$(k3s crictl ps -a -s running | sed -E 's/[[:space:]]([0-9]*|About)[a-z0- mapfile -t pod_id < <(echo "$search" | grep -E "[[:space:]]$app_name([[:space:]]|-([-[:alnum:]])*[[:space:]])" | awk '{print $(NF)}') for pod in "${pod_id[@]}" do - containers_temp+=("$(echo "$search" | grep "$pod" | awk '{print $4}')") + containers+=("$(echo "$search" | grep "$pod" | awk '{print $4}')") done -containers=(); while IFS= read -r -d '' x; do containers+=("$x"); done < <(printf "%s\0" "${containers_temp[@]}" | sort -uz) +# containers=(); while IFS= read -r -d '' x; do containers+=("$x"); done < <(printf "%s\0" "${containers_temp[@]}" | sort -uz) case "${#containers[@]}" in 0) echo -e "No containers available\nAre you sure the application in running?" @@ -49,7 +49,7 @@ case "${#containers[@]}" in for i in "${containers[@]}" do echo "$i" - done | nl -s ") " | column -t + done | uniq | nl -s ") " | column -t ) echo "$cont_search" echo From 60418e846b738033b62f7875df8251d3315830ec Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 12 Aug 2022 09:36:07 -0600 Subject: [PATCH 0753/1229] test --- functions/cmd_to_container.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index 695c73ea..b2eda4cb 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -27,9 +27,9 @@ search=$(k3s crictl ps -a -s running | sed -E 's/[[:space:]]([0-9]*|About)[a-z0- mapfile -t pod_id < <(echo "$search" | grep -E "[[:space:]]$app_name([[:space:]]|-([-[:alnum:]])*[[:space:]])" | awk '{print $(NF)}') for pod in "${pod_id[@]}" do - containers+=("$(echo "$search" | grep "$pod" | awk '{print $4}')") + printf '%s\0' "${containers[@]}" | grep -Fxqz -- "$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")" && continue + containers+=("$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")") done -# containers=(); while IFS= read -r -d '' x; do containers+=("$x"); done < <(printf "%s\0" "${containers_temp[@]}" | sort -uz) case "${#containers[@]}" in 0) echo -e "No containers available\nAre you sure the application in running?" @@ -49,7 +49,7 @@ case "${#containers[@]}" in for i in "${containers[@]}" do echo "$i" - done | uniq | nl -s ") " | column -t + done | nl -s ") " | column -t ) echo "$cont_search" echo From 80d10a5df22d3b180a66367ecb8a44f5c9078f3e Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 12 Aug 2022 09:47:35 -0600 Subject: [PATCH 0754/1229] debugging --- functions/cmd_to_container.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index b2eda4cb..3b7fc50d 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -29,6 +29,7 @@ for pod in "${pod_id[@]}" do printf '%s\0' "${containers[@]}" | grep -Fxqz -- "$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")" && continue containers+=("$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")") + echo "ADDED" "$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")" done case "${#containers[@]}" in 0) From b0a4119df0f4437811ef245233986f0c66b96acf Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 12 Aug 2022 09:49:26 -0600 Subject: [PATCH 0755/1229] set array to 0 --- functions/cmd_to_container.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index 3b7fc50d..b2938c9a 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -37,7 +37,7 @@ case "${#containers[@]}" in exit ;; 1) - container=$(echo "$search" | grep "${pod_id[*]}" | awk '{print $4}') + container=$(echo "$search" | grep "${pod_id[0]}" | awk '{print $4}') container_id=$(echo "$search" | grep -E "[[:space:]]${container}[[:space:]]" | awk '{print $1}') ;; From 61e46514d9e3bcd35e0ed41e19ee375bfb3444ca Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 12 Aug 2022 09:51:06 -0600 Subject: [PATCH 0756/1229] use 0 element in array if 0-1 are equal --- functions/cmd_to_container.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index b2938c9a..6e7be5d7 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -27,9 +27,8 @@ search=$(k3s crictl ps -a -s running | sed -E 's/[[:space:]]([0-9]*|About)[a-z0- mapfile -t pod_id < <(echo "$search" | grep -E "[[:space:]]$app_name([[:space:]]|-([-[:alnum:]])*[[:space:]])" | awk '{print $(NF)}') for pod in "${pod_id[@]}" do - printf '%s\0' "${containers[@]}" | grep -Fxqz -- "$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")" && continue - containers+=("$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")") - echo "ADDED" "$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")" + printf '%s\0' "${containers[@]}" | grep -Fxqz -- "$(echo "$search" | grep "$pod" | awk '{print $4}')" && continue + containers+=("$(echo "$search" | grep "$pod" | awk '{print $4}')") done case "${#containers[@]}" in 0) From 3b90402416a1719c660396fc06d415c42ce5668f Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 12 Aug 2022 09:54:59 -0600 Subject: [PATCH 0757/1229] test --- functions/cmd_to_container.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index 6e7be5d7..43d2b8a7 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -27,8 +27,8 @@ search=$(k3s crictl ps -a -s running | sed -E 's/[[:space:]]([0-9]*|About)[a-z0- mapfile -t pod_id < <(echo "$search" | grep -E "[[:space:]]$app_name([[:space:]]|-([-[:alnum:]])*[[:space:]])" | awk '{print $(NF)}') for pod in "${pod_id[@]}" do - printf '%s\0' "${containers[@]}" | grep -Fxqz -- "$(echo "$search" | grep "$pod" | awk '{print $4}')" && continue - containers+=("$(echo "$search" | grep "$pod" | awk '{print $4}')") + printf '%s\0' "${containers[@]}" | grep -Fxqz -- "$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")" && continue + containers+=("$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")") done case "${#containers[@]}" in 0) From fc785b71b5102cada0a09ae7e7799429adcfb9dc Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 12 Aug 2022 09:59:56 -0600 Subject: [PATCH 0758/1229] test rebuild --- functions/cmd_to_container.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index 43d2b8a7..16d8f5a5 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -27,9 +27,10 @@ search=$(k3s crictl ps -a -s running | sed -E 's/[[:space:]]([0-9]*|About)[a-z0- mapfile -t pod_id < <(echo "$search" | grep -E "[[:space:]]$app_name([[:space:]]|-([-[:alnum:]])*[[:space:]])" | awk '{print $(NF)}') for pod in "${pod_id[@]}" do - printf '%s\0' "${containers[@]}" | grep -Fxqz -- "$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")" && continue - containers+=("$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")") + printf '%s\0' "${containers_temp[@]}" | grep -Fxqz -- "$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")" && continue + containers_temp+=("$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")") done +containers=(); while IFS= read -r -d '' x; do containers+=("$x"); done < <(printf "%s\0" "${containers_temp[@]}" | sort -uz) case "${#containers[@]}" in 0) echo -e "No containers available\nAre you sure the application in running?" From 6aa4458b1402e5ac5dc48c4b08a87e2891e97299 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 12 Aug 2022 10:07:33 -0600 Subject: [PATCH 0759/1229] test --- functions/cmd_to_container.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index 16d8f5a5..35f045b6 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -27,10 +27,14 @@ search=$(k3s crictl ps -a -s running | sed -E 's/[[:space:]]([0-9]*|About)[a-z0- mapfile -t pod_id < <(echo "$search" | grep -E "[[:space:]]$app_name([[:space:]]|-([-[:alnum:]])*[[:space:]])" | awk '{print $(NF)}') for pod in "${pod_id[@]}" do - printf '%s\0' "${containers_temp[@]}" | grep -Fxqz -- "$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")" && continue - containers_temp+=("$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")") + if [[ $(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r " | wc -l) -gt 1 ]]; then + readarray -t containers <<<"$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")" + continue + fi + printf '%s\0' "${containers[@]}" | grep -Fxqz -- "$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")" && continue + containers+=("$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")") + done -containers=(); while IFS= read -r -d '' x; do containers+=("$x"); done < <(printf "%s\0" "${containers_temp[@]}" | sort -uz) case "${#containers[@]}" in 0) echo -e "No containers available\nAre you sure the application in running?" From dc51517ccb34d1cb10eadaed3c0c7a2abef65001 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 12 Aug 2022 10:09:20 -0600 Subject: [PATCH 0760/1229] test --- functions/cmd_to_container.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index 35f045b6..7be74b0b 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -27,12 +27,13 @@ search=$(k3s crictl ps -a -s running | sed -E 's/[[:space:]]([0-9]*|About)[a-z0- mapfile -t pod_id < <(echo "$search" | grep -E "[[:space:]]$app_name([[:space:]]|-([-[:alnum:]])*[[:space:]])" | awk '{print $(NF)}') for pod in "${pod_id[@]}" do - if [[ $(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r " | wc -l) -gt 1 ]]; then - readarray -t containers <<<"$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")" - continue - fi printf '%s\0' "${containers[@]}" | grep -Fxqz -- "$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")" && continue - containers+=("$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")") + # if [[ $(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r " | wc -l) -gt 1 ]]; then + readarray -t containers <<<"$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")" + # continue + # fi + + # containers+=("$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")") done case "${#containers[@]}" in From 4294a1565fc7316a64025a0052ec8040fffe36a7 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 12 Aug 2022 10:10:32 -0600 Subject: [PATCH 0761/1229] revert --- functions/cmd_to_container.sh | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index 7be74b0b..35f045b6 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -27,13 +27,12 @@ search=$(k3s crictl ps -a -s running | sed -E 's/[[:space:]]([0-9]*|About)[a-z0- mapfile -t pod_id < <(echo "$search" | grep -E "[[:space:]]$app_name([[:space:]]|-([-[:alnum:]])*[[:space:]])" | awk '{print $(NF)}') for pod in "${pod_id[@]}" do - printf '%s\0' "${containers[@]}" | grep -Fxqz -- "$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")" && continue - # if [[ $(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r " | wc -l) -gt 1 ]]; then + if [[ $(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r " | wc -l) -gt 1 ]]; then readarray -t containers <<<"$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")" - # continue - # fi - - # containers+=("$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")") + continue + fi + printf '%s\0' "${containers[@]}" | grep -Fxqz -- "$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")" && continue + containers+=("$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")") done case "${#containers[@]}" in From c528757b887f23ffe2959ca933bc27575e3ef105 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 12 Aug 2022 10:33:54 -0600 Subject: [PATCH 0762/1229] simplification of update_apps --- functions/update_apps.sh | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index afedf65a..ef554b5b 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -33,7 +33,7 @@ do # loop=0 # until [[ $loop -ge 2 || $it -ge ${#array[@]} ]]; # do - update_apps "${array[$it]}" & + pre_process "${array[$it]}" & processes+=($!) ((it++)) # ((loop++)) @@ -52,7 +52,7 @@ echo export -f commander -update_apps(){ +pre_process(){ app_name=$(echo "${array[$it]}" | awk -F ',' '{print $1}') #print out first catagory, name. printf '%s\0' "${ignore[@]}" | grep -iFxqz "${app_name}" && echo -e "\n$app_name\nIgnored, skipping" && return 0 #If application is on ignore list, skip old_app_ver=$(echo "${array[$it]}" | awk -F ',' '{print $4}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #previous/current Application MAJOR Version @@ -76,28 +76,23 @@ if grep -qs "^$app_name," failed.txt ; then fi fi if [[ "$diff_app" == "$diff_chart" || "$update_all_apps" == "true" ]]; then #continue to update - if [[ $stop_before_update == "true" ]]; then # Check to see if user is using -S or not - if [[ "$startstatus" == "STOPPED" ]]; then # if status is already stopped, skip while loop - echo_array+=("\n$app_name") - else # if status was not STOPPED, stop the app prior to updating - echo_array+=("\n$app_name") - [[ "$verbose" == "true" ]] && echo_array+=("Stopping prior to update..") - if stop_app ; then - echo_array+=("Stopped") - else - echo_array+=("Error: Failed to stop $app_name") - return 1 - fi - fi - else #user must not be using -S, just update + if [[ $stop_before_update == "true" && "$startstatus" != "STOPPED" ]]; then # Check to see if user is using -S or not echo_array+=("\n$app_name") + [[ "$verbose" == "true" ]] && echo_array+=("Stopping prior to update..") + if stop_app ; then + echo_array+=("Stopped") + else + echo_array+=("Error: Failed to stop $app_name") + return 1 + fi fi else echo -e "\n$app_name\nMajor Release, update manually" return 0 fi +[[ ! $stop_before_update == "true" && "$startstatus" != "STOPPED" ]] && echo_array+=("\n$app_name") [[ "$verbose" == "true" ]] && echo_array+=("Updating..") -if update ;then +if update_app ;then echo_array+=("Updated\n$old_full_ver\n$new_full_ver") else echo_array+=("Failed to update") @@ -105,10 +100,10 @@ return fi after_update_actions } -export -f update_apps +export -f pre_process -update(){ +update_app(){ current_loop=0 while true do @@ -137,7 +132,7 @@ do fi done } -export -f update +export -f update_app stop_app(){ count=0 From bb50772fc2403f2d43a1bce45cf5571d931bb12f Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 12 Aug 2022 10:44:32 -0600 Subject: [PATCH 0763/1229] re-arrange echo array --- functions/update_apps.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index ef554b5b..2807098f 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -75,9 +75,9 @@ if grep -qs "^$app_name," failed.txt ; then sed -i /"$app_name",/d failed.txt fi fi -if [[ "$diff_app" == "$diff_chart" || "$update_all_apps" == "true" ]]; then #continue to update +echo_array+=("\n$app_name") +if [[ "$diff_app" == "$diff_chart" || "$update_all_apps" == "true" ]]; then #Check for major versions or -U if [[ $stop_before_update == "true" && "$startstatus" != "STOPPED" ]]; then # Check to see if user is using -S or not - echo_array+=("\n$app_name") [[ "$verbose" == "true" ]] && echo_array+=("Stopping prior to update..") if stop_app ; then echo_array+=("Stopped") @@ -90,7 +90,6 @@ else echo -e "\n$app_name\nMajor Release, update manually" return 0 fi -[[ ! $stop_before_update == "true" && "$startstatus" != "STOPPED" ]] && echo_array+=("\n$app_name") [[ "$verbose" == "true" ]] && echo_array+=("Updating..") if update_app ;then echo_array+=("Updated\n$old_full_ver\n$new_full_ver") From edf40ced53c450332960a8fc43e66a6b2117667e Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 12 Aug 2022 11:08:51 -0600 Subject: [PATCH 0764/1229] echo array to function to control output better --- functions/update_apps.sh | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 2807098f..6846ed97 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -62,6 +62,7 @@ new_chart_ver=$(echo "${array[$it]}" | awk -F ',' '{print $5}' | awk -F '_' '{pr startstatus=$(echo "${array[$it]}" | awk -F ',' '{print $2}') #status of the app: STOPPED / DEPLOYING / ACTIVE diff_app=$(diff <(echo "$old_app_ver") <(echo "$new_app_ver")) #caluclating difference in major app versions diff_chart=$(diff <(echo "$old_chart_ver") <(echo "$new_chart_ver")) #caluclating difference in Chart versions +[[ "$diff_app" != "$diff_chart" ]] && echo -e "\n$app_name\nMajor Release, update manually" && return old_full_ver=$(echo "${array[$it]}" | awk -F ',' '{print $4}') #Upgraded From new_full_ver=$(echo "${array[$it]}" | awk -F ',' '{print $5}') #Upraded To rollback_version=$(echo "${array[$it]}" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}') @@ -76,26 +77,23 @@ if grep -qs "^$app_name," failed.txt ; then fi fi echo_array+=("\n$app_name") -if [[ "$diff_app" == "$diff_chart" || "$update_all_apps" == "true" ]]; then #Check for major versions or -U - if [[ $stop_before_update == "true" && "$startstatus" != "STOPPED" ]]; then # Check to see if user is using -S or not - [[ "$verbose" == "true" ]] && echo_array+=("Stopping prior to update..") - if stop_app ; then - echo_array+=("Stopped") - else - echo_array+=("Error: Failed to stop $app_name") - return 1 - fi +if [[ $stop_before_update == "true" && "$startstatus" != "STOPPED" ]]; then # Check to see if user is using -S or not + [[ "$verbose" == "true" ]] && echo_array+=("Stopping prior to update..") + if stop_app ; then + echo_array+=("Stopped") + else + echo_array+=("Error: Failed to stop $app_name") + echo_array + return 1 fi -else - echo -e "\n$app_name\nMajor Release, update manually" - return 0 fi [[ "$verbose" == "true" ]] && echo_array+=("Updating..") if update_app ;then echo_array+=("Updated\n$old_full_ver\n$new_full_ver") else echo_array+=("Failed to update") -return + echo_array + return fi after_update_actions } @@ -186,6 +184,7 @@ if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then echo_array+=("Stopped") else echo_array+=("Error: Failed to stop $app_name") + echo_array return 1 fi break @@ -226,12 +225,17 @@ if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then fi done fi +echo_array +} +export -f after_update_actions +echo_array(){ #Dump the echo_array, ensures all output is in a neat order. for i in "${echo_array[@]}" do echo -e "$i" done + } -export -f after_update_actions +export -f echo_array From 43c9adc0db765e073e026d8fd267fb448f92243c Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Fri, 12 Aug 2022 18:08:22 +0000 Subject: [PATCH 0765/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.156.1 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 34390c75..5cf1c6d0 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@4f3429dc34975d83a2fbdd1f9317cd05429b9eee # tag=v32.156.0 + uses: renovatebot/github-action@0b8b7b6124915204d005a994abd973cc1725e61b # tag=v32.156.1 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 04739c4f111fcac9d4011e5b82a6e3ef8a4cc973 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Sat, 13 Aug 2022 06:08:28 +0000 Subject: [PATCH 0766/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.159.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 5cf1c6d0..be42edab 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@0b8b7b6124915204d005a994abd973cc1725e61b # tag=v32.156.1 + uses: renovatebot/github-action@4cd8f31fcc2511c10bf47c89e0f95d4dfb4f53d7 # tag=v32.159.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 0a9d157821b70147414187c11be6602426c9db5e Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sat, 13 Aug 2022 00:35:24 -0600 Subject: [PATCH 0767/1229] limit major check to only -u not -U --- functions/update_apps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 6846ed97..2435b449 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -62,7 +62,7 @@ new_chart_ver=$(echo "${array[$it]}" | awk -F ',' '{print $5}' | awk -F '_' '{pr startstatus=$(echo "${array[$it]}" | awk -F ',' '{print $2}') #status of the app: STOPPED / DEPLOYING / ACTIVE diff_app=$(diff <(echo "$old_app_ver") <(echo "$new_app_ver")) #caluclating difference in major app versions diff_chart=$(diff <(echo "$old_chart_ver") <(echo "$new_chart_ver")) #caluclating difference in Chart versions -[[ "$diff_app" != "$diff_chart" ]] && echo -e "\n$app_name\nMajor Release, update manually" && return +[[ "$diff_app" != "$diff_chart" && $update_apps == "true" ]] && echo -e "\n$app_name\nMajor Release, update manually" && return old_full_ver=$(echo "${array[$it]}" | awk -F ',' '{print $4}') #Upgraded From new_full_ver=$(echo "${array[$it]}" | awk -F ',' '{print $5}') #Upraded To rollback_version=$(echo "${array[$it]}" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}') From ad4b9b24617110c6903a483e63feb2a6d4ffe195 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sat, 13 Aug 2022 10:37:48 -0600 Subject: [PATCH 0768/1229] test ext service --- functions/update_apps.sh | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 2435b449..8d89fac5 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -8,6 +8,7 @@ echo -e "🅄 🄿 🄳 🄰 🅃 🄴 🅂" echo "Asynchronous Updates: $update_limit" [[ -z $timeout ]] && echo "Default Timeout: 500" && timeout=500 || echo "Custom Timeout: $timeout" [[ "$timeout" -le 120 ]] && echo "Warning: Your timeout is set low and may lead to premature rollbacks or skips" +pool=$(cli -c 'app kubernetes config' | grep -E "dataset\s\|" | awk -F '|' '{print $3}' | awk -F '/' '{print $1}' | tr -d " \t\n\r") it=0 while_count=0 @@ -76,6 +77,21 @@ if grep -qs "^$app_name," failed.txt ; then sed -i /"$app_name",/d failed.txt fi fi + + +[[ ! -e external_services ]] && touch external_services + +if ! grep -qs "^$app_name," external_services ; then + if ! grep qs "/external-service" /mnt/"$pool"/ix-applications/releases/"$app_name"/charts/"$(find . -maxdepth 1 -type d -printf '%P\n' | sort -r | head -n 1)"/Chart.yaml ; then + echo "$app_name,false" >> external_services + else + echo "$app_name,true" >> external_services + fi +fi + + + + echo_array+=("\n$app_name") if [[ $stop_before_update == "true" && "$startstatus" != "STOPPED" ]]; then # Check to see if user is using -S or not [[ "$verbose" == "true" ]] && echo_array+=("Stopping prior to update..") @@ -166,7 +182,7 @@ if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then old_status=$status before_loop=$(head -n 1 temp.txt) current_loop=0 - until [[ "$status" != "$old_status" || $current_loop -gt 3 ]] # Wait for a specific change to app status, or 3 refreshes of the file to go by. + until [[ "$status" != "$old_status" || $current_loop -gt 4 ]] # Wait for a specific change to app status, or 3 refreshes of the file to go by. do status=$( grep "^$app_name," temp.txt | awk -F ',' '{print $2}') sleep 1 From d6f95fa76b3e4e3cf23ac8452029f7ffe570aaf2 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sat, 13 Aug 2022 10:41:35 -0600 Subject: [PATCH 0769/1229] test --- functions/update_apps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 8d89fac5..7ca830fc 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -82,7 +82,7 @@ fi [[ ! -e external_services ]] && touch external_services if ! grep -qs "^$app_name," external_services ; then - if ! grep qs "/external-service" /mnt/"$pool"/ix-applications/releases/"$app_name"/charts/"$(find . -maxdepth 1 -type d -printf '%P\n' | sort -r | head -n 1)"/Chart.yaml ; then + if ! grep qs "/external-service" /mnt/"$pool"/ix-applications/releases/"$app_name"/charts/"$(find /mnt/"$pool"/ix-applications/releases/"$app_name"/charts/ -maxdepth 1 -type d -printf '%P\n' | sort -r | head -n 1)"/Chart.yaml ; then echo "$app_name,false" >> external_services else echo "$app_name,true" >> external_services From be064a818b07fb6536b6fa015d6b1c5ee01548ec Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sat, 13 Aug 2022 10:49:47 -0600 Subject: [PATCH 0770/1229] if app is external services, do not post process --- functions/update_apps.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 7ca830fc..20beb654 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -78,7 +78,6 @@ if grep -qs "^$app_name," failed.txt ; then fi fi - [[ ! -e external_services ]] && touch external_services if ! grep -qs "^$app_name," external_services ; then @@ -111,7 +110,12 @@ else echo_array return fi -after_update_actions +if grep -qs "^$app_name,true" external_services ; then + echo_array + return +else + after_update_actions +fi } export -f pre_process From 0faeefa71d9a32ab00bd71dc43250967ecbe9357 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sat, 13 Aug 2022 10:52:31 -0600 Subject: [PATCH 0771/1229] while sleep to 5 --- functions/update_apps.sh | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 20beb654..c977978f 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -29,7 +29,7 @@ do ((count++)) done if [[ "$proc_count" -ge "$update_limit" ]]; then - sleep 3 + sleep 5 elif [[ $it -lt ${#array[@]} ]]; then # loop=0 # until [[ $loop -ge 2 || $it -ge ${#array[@]} ]]; @@ -40,7 +40,7 @@ do # ((loop++)) # done elif [[ $proc_count != 0 ]]; then # Wait for all processes to finish - sleep 3 + sleep 5 else # All processes must be completed, break out of loop break fi @@ -79,7 +79,6 @@ if grep -qs "^$app_name," failed.txt ; then fi [[ ! -e external_services ]] && touch external_services - if ! grep -qs "^$app_name," external_services ; then if ! grep qs "/external-service" /mnt/"$pool"/ix-applications/releases/"$app_name"/charts/"$(find /mnt/"$pool"/ix-applications/releases/"$app_name"/charts/ -maxdepth 1 -type d -printf '%P\n' | sort -r | head -n 1)"/Chart.yaml ; then echo "$app_name,false" >> external_services @@ -88,9 +87,6 @@ if ! grep -qs "^$app_name," external_services ; then fi fi - - - echo_array+=("\n$app_name") if [[ $stop_before_update == "true" && "$startstatus" != "STOPPED" ]]; then # Check to see if user is using -S or not [[ "$verbose" == "true" ]] && echo_array+=("Stopping prior to update..") From 67c2f39f869c5ee83bf7c1a69de1c4070270a578 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sat, 13 Aug 2022 15:07:06 -0600 Subject: [PATCH 0772/1229] test deploying file --- functions/update_apps.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index c977978f..ae65f945 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -17,6 +17,15 @@ do if while_status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' 2>/dev/null) ; then ((while_count++)) [[ -z $while_status ]] && continue || echo -e "$while_count\n$while_status" > temp.txt + for i in "${while_status[@]}" + do + app_name=$(echo "$i" | awk -F ',' '{print $1}') + status=$(echo "$i" | awk -F ',' '{print $2}') + if [[ $status == "DEPLOYING" ]]; then + [[ ! -e deploying ]] && touch deploying + grep -qs "$app_name,DEPLOYING" deploying || echo "$app_name,DEPLOYING" >> deploying + fi + done else echo "Middlewared timed out. Consider setting a lower number for async applications" continue @@ -46,6 +55,7 @@ do fi done rm temp.txt +rm deploying echo echo @@ -176,8 +186,8 @@ count=0 if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then while true do - status=$( grep "^$app_name," temp.txt | awk -F ',' '{print $2}') - if [[ $count -lt 1 && $status != "DEPLOYING" ]]; then # If status shows up as Active or Stopped on the first check, verify that. Otherwise it may be a false report.. + status=$(grep "^$app_name," temp.txt | awk -F ',' '{print $2}') + if [[ $count -lt 1 && $status != "DEPLOYING" && "$(grep "^$app_name," deploying | awk -F ',' '{print $2}')" != "DEPLOYING" ]]; then # If status shows up as Active or Stopped on the first check, verify that. Otherwise it may be a false report.. [[ "$verbose" == "true" ]] && echo_array+=("Verifying $status..") old_status=$status before_loop=$(head -n 1 temp.txt) From e1e7c529533f1b556b834088d3255519f5022f29 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sat, 13 Aug 2022 15:12:35 -0600 Subject: [PATCH 0773/1229] change to an array --- functions/update_apps.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index ae65f945..2db0b3a1 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -14,9 +14,9 @@ it=0 while_count=0 while true do - if while_status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' 2>/dev/null) ; then + if mapfile -t while_status < <(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' 2>/dev/null) ; then ((while_count++)) - [[ -z $while_status ]] && continue || echo -e "$while_count\n$while_status" > temp.txt + [[ -z ${while_status[*]} ]] && continue || echo -e "$while_count\n${while_status[*]}" > temp.txt for i in "${while_status[@]}" do app_name=$(echo "$i" | awk -F ',' '{print $1}') From 978bf40d5a03da234e7120b74643afe97c2c5b31 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sat, 13 Aug 2022 15:26:50 -0600 Subject: [PATCH 0774/1229] new method of deploying check --- functions/update_apps.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 2db0b3a1..563f1913 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -14,16 +14,16 @@ it=0 while_count=0 while true do - if mapfile -t while_status < <(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' 2>/dev/null) ; then + if while_status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' 2>/dev/null) ; then ((while_count++)) - [[ -z ${while_status[*]} ]] && continue || echo -e "$while_count\n${while_status[*]}" > temp.txt - for i in "${while_status[@]}" + [[ -z $while_status ]] && continue || echo -e "$while_count\n$while_status" > temp.txt + mapfile -t deploying_check < <(grep ",DEPLOYING," temp.txt) + for i in "${deploying_check[@]}" do app_name=$(echo "$i" | awk -F ',' '{print $1}') - status=$(echo "$i" | awk -F ',' '{print $2}') - if [[ $status == "DEPLOYING" ]]; then - [[ ! -e deploying ]] && touch deploying - grep -qs "$app_name,DEPLOYING" deploying || echo "$app_name,DEPLOYING" >> deploying + [[ ! -e deploying ]] && touch deploying + if ! grep -qs "$app_name,DEPLOYING" deploying; then + echo "$app_name,DEPLOYING" >> deploying fi done else From e82fa5f8c250b69537cc06177a7436320a04a07a Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sat, 13 Aug 2022 15:29:14 -0600 Subject: [PATCH 0775/1229] rm deploying prior to starting --- functions/update_apps.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 563f1913..60deb582 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -12,6 +12,7 @@ pool=$(cli -c 'app kubernetes config' | grep -E "dataset\s\|" | awk -F '|' '{pri it=0 while_count=0 +rm deploying while true do if while_status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' 2>/dev/null) ; then From 80374b5ea99b5f9bd89202191aab779868ee5a54 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sat, 13 Aug 2022 15:41:50 -0600 Subject: [PATCH 0776/1229] sleep back down to 3 --- functions/update_apps.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 60deb582..f2ee0ea8 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -39,7 +39,7 @@ do ((count++)) done if [[ "$proc_count" -ge "$update_limit" ]]; then - sleep 5 + sleep 3 elif [[ $it -lt ${#array[@]} ]]; then # loop=0 # until [[ $loop -ge 2 || $it -ge ${#array[@]} ]]; @@ -50,7 +50,7 @@ do # ((loop++)) # done elif [[ $proc_count != 0 ]]; then # Wait for all processes to finish - sleep 5 + sleep 3 else # All processes must be completed, break out of loop break fi From 96be5786c98f5ba54250cdda997da54845eb9683 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sat, 13 Aug 2022 17:03:32 -0600 Subject: [PATCH 0777/1229] remove stopped, since ext ser is handled earlier --- functions/update_apps.sh | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index f2ee0ea8..c4fc546b 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -12,7 +12,7 @@ pool=$(cli -c 'app kubernetes config' | grep -E "dataset\s\|" | awk -F '|' '{pri it=0 while_count=0 -rm deploying +rm deploying 2>/dev/null while true do if while_status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' 2>/dev/null) ; then @@ -55,8 +55,8 @@ do break fi done -rm temp.txt -rm deploying +rm temp.txt 2>/dev/null +rm deploying 2>/dev/null echo echo @@ -219,9 +219,6 @@ if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then echo_array+=("Active") break fi - elif [[ "$status" == "STOPPED" ]]; then - echo_array+=("Stopped") - break elif [[ "$SECONDS" -ge "$timeout" && "$status" == "DEPLOYING" ]]; then if [[ $rollback == "true" ]]; then if [[ "$failed" != "true" ]]; then From dff4f7678f2d7e3fc03857699e436d337f976495 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sat, 13 Aug 2022 17:07:27 -0600 Subject: [PATCH 0778/1229] remove deploying requirement on timeout --- functions/update_apps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index c4fc546b..5f9d35a7 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -219,7 +219,7 @@ if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then echo_array+=("Active") break fi - elif [[ "$SECONDS" -ge "$timeout" && "$status" == "DEPLOYING" ]]; then + elif [[ "$SECONDS" -ge "$timeout" ]]; then if [[ $rollback == "true" ]]; then if [[ "$failed" != "true" ]]; then echo_array+=("Error: Run Time($SECONDS) for $app_name has exceeded Timeout($timeout)") From ce2725f289e23ff75ff656b1e7703b327f2eb29f Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sat, 13 Aug 2022 17:12:19 -0600 Subject: [PATCH 0779/1229] only pull in "active" containers --- functions/update_apps.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 5f9d35a7..c5b52c20 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -188,12 +188,11 @@ if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then while true do status=$(grep "^$app_name," temp.txt | awk -F ',' '{print $2}') - if [[ $count -lt 1 && $status != "DEPLOYING" && "$(grep "^$app_name," deploying | awk -F ',' '{print $2}')" != "DEPLOYING" ]]; then # If status shows up as Active or Stopped on the first check, verify that. Otherwise it may be a false report.. + if [[ $count -lt 1 && $status == "ACTIVE" && "$(grep "^$app_name," deploying | awk -F ',' '{print $2}')" != "DEPLOYING" ]]; then # If status shows up as Active or Stopped on the first check, verify that. Otherwise it may be a false report.. [[ "$verbose" == "true" ]] && echo_array+=("Verifying $status..") - old_status=$status before_loop=$(head -n 1 temp.txt) current_loop=0 - until [[ "$status" != "$old_status" || $current_loop -gt 4 ]] # Wait for a specific change to app status, or 3 refreshes of the file to go by. + until [[ "$status" != "ACTIVE" || $current_loop -gt 3 ]] # Wait for a specific change to app status, or 3 refreshes of the file to go by. do status=$( grep "^$app_name," temp.txt | awk -F ',' '{print $2}') sleep 1 From deb99d0af40b302a34f45221c1d834438ea5ee62 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sat, 13 Aug 2022 17:32:44 -0600 Subject: [PATCH 0780/1229] change temp.txt to all_app_status --- functions/update_apps.sh | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index c5b52c20..c6981e3a 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -17,8 +17,8 @@ while true do if while_status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' 2>/dev/null) ; then ((while_count++)) - [[ -z $while_status ]] && continue || echo -e "$while_count\n$while_status" > temp.txt - mapfile -t deploying_check < <(grep ",DEPLOYING," temp.txt) + [[ -z $while_status ]] && continue || echo -e "$while_count\n$while_status" > all_app_status + mapfile -t deploying_check < <(grep ",DEPLOYING," all_app_status) for i in "${deploying_check[@]}" do app_name=$(echo "$i" | awk -F ',' '{print $1}') @@ -55,7 +55,7 @@ do break fi done -rm temp.txt 2>/dev/null +rm all_app_status 2>/dev/null rm deploying 2>/dev/null echo echo @@ -131,18 +131,18 @@ update_app(){ current_loop=0 while true do - update_avail=$(grep "^$app_name," temp.txt | awk -F ',' '{print $3}') + update_avail=$(grep "^$app_name," all_app_status | awk -F ',' '{print $3}') if [[ $update_avail == "true" ]]; then if ! cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null ; then echo "Fail Trigger - Debugging" - before_loop=$(head -n 1 temp.txt) + before_loop=$(head -n 1 all_app_status) current_loop=0 - until [[ "$(grep "^$app_name," temp.txt | awk -F ',' '{print $3}')" != "$update_avail" ]] # Wait for a specific change to app status, or 3 refreshes of the file to go by. + until [[ "$(grep "^$app_name," all_app_status | awk -F ',' '{print $3}')" != "$update_avail" ]] # Wait for a specific change to app status, or 3 refreshes of the file to go by. do if [[ $current_loop -gt 2 ]]; then cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null || return 1 # After waiting, attempt an update once more, if fails, return error code - elif ! echo -e "$(head -n 1 temp.txt)" | grep -qs ^"$before_loop" ; then # The file has been updated, but nothing changed specifically for the app. - before_loop=$(head -n 1 temp.txt) + elif ! echo -e "$(head -n 1 all_app_status)" | grep -qs ^"$before_loop" ; then # The file has been updated, but nothing changed specifically for the app. + before_loop=$(head -n 1 all_app_status) ((current_loop++)) fi sleep 1 @@ -162,14 +162,14 @@ stop_app(){ count=0 while [[ "$status" != "STOPPED" ]] do - status=$( grep "^$app_name," temp.txt | awk -F ',' '{print $2}') + status=$( grep "^$app_name," all_app_status | awk -F ',' '{print $2}') if [[ $count -gt 2 ]]; then # If failed to stop app 3 times, return failure to parent shell return 1 elif ! cli -c 'app chart_release scale release_name='\""$app_name"\"\ 'scale_options={"replica_count": 0}' &> /dev/null ; then echo "Fail Trigger Stop - Debugging" - before_loop=$(head -n 1 temp.txt) + before_loop=$(head -n 1 all_app_status) ((count++)) - until [[ $(head -n 1 temp.txt) != "$before_loop" ]] # Upon failure, wait for status update before continuing + until [[ $(head -n 1 all_app_status) != "$before_loop" ]] # Upon failure, wait for status update before continuing do sleep 1 done @@ -187,17 +187,17 @@ count=0 if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then while true do - status=$(grep "^$app_name," temp.txt | awk -F ',' '{print $2}') + status=$(grep "^$app_name," all_app_status | awk -F ',' '{print $2}') if [[ $count -lt 1 && $status == "ACTIVE" && "$(grep "^$app_name," deploying | awk -F ',' '{print $2}')" != "DEPLOYING" ]]; then # If status shows up as Active or Stopped on the first check, verify that. Otherwise it may be a false report.. [[ "$verbose" == "true" ]] && echo_array+=("Verifying $status..") - before_loop=$(head -n 1 temp.txt) + before_loop=$(head -n 1 all_app_status) current_loop=0 until [[ "$status" != "ACTIVE" || $current_loop -gt 3 ]] # Wait for a specific change to app status, or 3 refreshes of the file to go by. do - status=$( grep "^$app_name," temp.txt | awk -F ',' '{print $2}') + status=$( grep "^$app_name," all_app_status | awk -F ',' '{print $2}') sleep 1 - if ! echo -e "$(head -n 1 temp.txt)" | grep -qs ^"$before_loop" ; then - before_loop=$(head -n 1 temp.txt) + if ! echo -e "$(head -n 1 all_app_status)" | grep -qs ^"$before_loop" ; then + before_loop=$(head -n 1 all_app_status) ((current_loop++)) fi done From 18cfd761e2244e22b1e3d4e44d01935a37035041 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sat, 13 Aug 2022 17:36:19 -0600 Subject: [PATCH 0781/1229] higher req loop for active verification --- functions/update_apps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index c6981e3a..dd1c51a1 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -192,7 +192,7 @@ if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then [[ "$verbose" == "true" ]] && echo_array+=("Verifying $status..") before_loop=$(head -n 1 all_app_status) current_loop=0 - until [[ "$status" != "ACTIVE" || $current_loop -gt 3 ]] # Wait for a specific change to app status, or 3 refreshes of the file to go by. + until [[ "$status" != "ACTIVE" || $current_loop -gt 4 ]] # Wait for a specific change to app status, or 3 refreshes of the file to go by. do status=$( grep "^$app_name," all_app_status | awk -F ',' '{print $2}') sleep 1 From 7375d73ab5e90b15e13594963ad3dada280b86b2 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 14 Aug 2022 17:43:07 -0600 Subject: [PATCH 0782/1229] suppress error messages --- functions/update_apps.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index dd1c51a1..ea226f48 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -78,20 +78,20 @@ diff_chart=$(diff <(echo "$old_chart_ver") <(echo "$new_chart_ver")) #caluclatin old_full_ver=$(echo "${array[$it]}" | awk -F ',' '{print $4}') #Upgraded From new_full_ver=$(echo "${array[$it]}" | awk -F ',' '{print $5}') #Upraded To rollback_version=$(echo "${array[$it]}" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}') -if grep -qs "^$app_name," failed.txt ; then - failed_ver=$(grep "^$app_name," failed.txt | awk -F ',' '{print $2}') +if grep -qs "^$app_name," failed 2>/dev/null; then + failed_ver=$(grep "^$app_name," failed | awk -F ',' '{print $2}') if [[ "$failed_ver" == "$new_full_ver" ]] ; then echo -e "\n$app_name" echo -e "Skipping previously failed version:\n$new_full_ver" return 0 else - sed -i /"$app_name",/d failed.txt + sed -i /"$app_name",/d failed fi fi [[ ! -e external_services ]] && touch external_services if ! grep -qs "^$app_name," external_services ; then - if ! grep qs "/external-service" /mnt/"$pool"/ix-applications/releases/"$app_name"/charts/"$(find /mnt/"$pool"/ix-applications/releases/"$app_name"/charts/ -maxdepth 1 -type d -printf '%P\n' | sort -r | head -n 1)"/Chart.yaml ; then + if ! grep qs "/external-service" /mnt/"$pool"/ix-applications/releases/"$app_name"/charts/"$(find /mnt/"$pool"/ix-applications/releases/"$app_name"/charts/ -maxdepth 1 -type d -printf '%P\n' | sort -r | head -n 1)"/Chart.yaml 2>/dev/null; then echo "$app_name,false" >> external_services else echo "$app_name,true" >> external_services @@ -194,7 +194,7 @@ if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then current_loop=0 until [[ "$status" != "ACTIVE" || $current_loop -gt 4 ]] # Wait for a specific change to app status, or 3 refreshes of the file to go by. do - status=$( grep "^$app_name," all_app_status | awk -F ',' '{print $2}') + status=$(grep "^$app_name," all_app_status | awk -F ',' '{print $2}') sleep 1 if ! echo -e "$(head -n 1 all_app_status)" | grep -qs ^"$before_loop" ; then before_loop=$(head -n 1 all_app_status) @@ -227,7 +227,7 @@ if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then echo_array+=("Reverting update..") midclt call chart.release.rollback "$app_name" "{\"item_version\": \"$rollback_version\"}" &> /dev/null || { echo_array+=("Error: Failed to rollback $app_name") ; break ; } [[ "$startstatus" == "STOPPED" ]] && failed="true" && after_update_actions #run back after_update_actions function if the app was stopped prior to update - echo "$app_name,$new_full_ver" >> failed.txt + echo "$app_name,$new_full_ver" >> failed break else echo_array+=("Error: Run Time($SECONDS) for $app_name has exceeded Timeout($timeout)") From 9b998c85530f87a5bc5c07bf7202840d07723825 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 14 Aug 2022 17:47:56 -0600 Subject: [PATCH 0783/1229] suppress error message --- functions/update_apps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index ea226f48..4ee33c95 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -188,7 +188,7 @@ if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then while true do status=$(grep "^$app_name," all_app_status | awk -F ',' '{print $2}') - if [[ $count -lt 1 && $status == "ACTIVE" && "$(grep "^$app_name," deploying | awk -F ',' '{print $2}')" != "DEPLOYING" ]]; then # If status shows up as Active or Stopped on the first check, verify that. Otherwise it may be a false report.. + if [[ $count -lt 1 && $status == "ACTIVE" && "$(grep "^$app_name," deploying 2>/dev/null | awk -F ',' '{print $2}')" != "DEPLOYING" ]]; then # If status shows up as Active or Stopped on the first check, verify that. Otherwise it may be a false report.. [[ "$verbose" == "true" ]] && echo_array+=("Verifying $status..") before_loop=$(head -n 1 all_app_status) current_loop=0 From 0c6ef2ebe300c20e0efbee71fea38d1fb4a0935a Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Mon, 15 Aug 2022 00:37:20 +0000 Subject: [PATCH 0784/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.159.1 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index be42edab..b00fb74f 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@4cd8f31fcc2511c10bf47c89e0f95d4dfb4f53d7 # tag=v32.159.0 + uses: renovatebot/github-action@c2cf895cd8d117a74cd6b52e74ef5993aac0c30f # tag=v32.159.1 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 60d6a70beb7e2d2a919cdb47c44a63e5dbb905b6 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Tue, 16 Aug 2022 00:43:27 +0000 Subject: [PATCH 0785/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.159.5 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index b00fb74f..0082c0cd 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@c2cf895cd8d117a74cd6b52e74ef5993aac0c30f # tag=v32.159.1 + uses: renovatebot/github-action@75a3723ab697f343a64702b937501960bab9ddaa # tag=v32.159.5 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 2af51cf0495adb5f050c881e36d8dcfd1eeda6ac Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 16 Aug 2022 20:08:03 -0600 Subject: [PATCH 0786/1229] add cmd to container to help and --cmd --- functions/misc.sh | 1 + heavy_script.sh | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/functions/misc.sh b/functions/misc.sh index 050055d8..87278b4b 100644 --- a/functions/misc.sh +++ b/functions/misc.sh @@ -48,6 +48,7 @@ echo "--mount | Initiates mounting feature, choose between unmounting an echo "--restore | Opens a menu to restore a \"heavy_script\" backup that was taken on your \"ix-applications\" dataset" echo "--delete-backup | Opens a menu to delete backups on your system" echo "--dns | list all of your applications DNS names and their web ports" +echo "--cmd | Open a shell for one of your applications" echo echo "Update Types" echo "------------" diff --git a/heavy_script.sh b/heavy_script.sh index 3b970e9f..afea3b3a 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -41,6 +41,9 @@ do dns) dns="true" ;; + cmd) + cmd="true" + ;; restore) restore="true" ;; @@ -136,6 +139,7 @@ done #Continue to call functions in specific order [[ "$self_update" == "true" ]] && self_update [[ "$help" == "true" ]] && help +[[ "$cmd" == "true" ]] && cmd_to_container [[ "$deleteBackup" == "true" ]] && deleteBackup && exit [[ "$dns" == "true" ]] && dns && exit [[ "$restore" == "true" ]] && restore && exit From 89bba86722e10cbb720ec0f70bd1d5411969db69 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 16 Aug 2022 20:17:19 -0600 Subject: [PATCH 0787/1229] Update Readme --- README.md | 45 ++++++++++++++++++++++++++------------------- heavy_script.sh | 2 +- 2 files changed, 27 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 7199c34e..154e2093 100644 --- a/README.md +++ b/README.md @@ -14,27 +14,34 @@
-## Arguments +## Update Arguments +| Flag | Example | Parameter | Description | +|--------------- |------------------------ |----------------- |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| -U | -U
-U 5 | None or Integer | Update applications, ignoring major version changes
_Optionally, you can supply a number after the argument to update multiple applications at once_ | +| -u | -u
-u 5 | None or Integer | Update applications, do NOT update if there was a major version change
_Optionally, you can supply a number after the argument to update multiple applications at once_ | +| -b | -b 14 | Integer | Backup `ix-appliactions` dataset
_Creates backups up to the number you've chosen_ | +| -i | -i nextcloud -i sonarr | String | Applications listed will be ignored during updating
_List one application after another as shown in the example_ | +| -r | -r | None | Monitors applications after they update
If the app does not become "ACTIVE" after either:
The custom Timeout, or Default Timeout,
rollback the application. | +| -v | -v | None | Verbose Output
_Look at the bottom of this page for an example_ | +| -S | -S | None | Shutdown the application prior to updating it | +| -t | -t 150 | Integer | Set a custom timeout to be used with either:
`-m`
_Time the script will wait for application to be "STOPPED"_
or
`-(u\|U)`
_Time the script will wait for application to be either "STOPPED" or "ACTIVE"_ | +| -s | -s | None | Sync Catalogs prior to updating | +| -p | -p | None | Prune old/unused docker images | +| --self-update | --self-update | None | Updates HeavyScript prior to running any other commands | -| Flag | Example | Parameter | Description | -|----------------- |------------------------ |----------------- |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| NULL | NULL | NULL | If you choose not to supply an option, it will open the menu for easier access to the utilities | -| --self-update | --self-update | None | Updates HeavyScript prior to running it
_You no longer need to git pull_ | -| --delete-backup | --delete-backup | None | Opens a menu to delete backups
_Useful if you need to delete old system backups or backups from other scripts_ | -| --restore | --restore | None | Restore HeavyScript specific `ix-applications dataset` snapshot | -| --mount | --mount | None | Initiates mounting feature
Choose between unmounting and mounting PVC data | -| --dns | --dns | None | list all of your applications DNS names and their web ports | -| -U | -U
-U 5 | None or Integer | Update applications, ignoring major version changes
_Optionally, you can supply a number after the argument to update multiple applications at once_ | -| -u | -u
-u 5 | None or Integer | Update applications, do NOT update if there was a major version change
_Optionally, you can supply a number after the argument to update multiple applications at once_ | -| -b | -b 10 | Integer | Backup `ix-appliactions` dataset
_Creates backups up to the number you've chosen_ | -| -i | -i nextcloud -i sonarr | String | Applications listed will be ignored during updating
_List one application after another as shown in the example_ | -| -r | -r | None | Monitors applications after they update
If the app does not become "ACTIVE" after either:
The custom Timeout, or Default Timeout,
rollback the application. | -| -v | -v | None | Verbose Output
_Look at the bottom of this page for an example_ | -| -S | -S | None | Shutdown the application prior to updating it | -| -t | -t 150 | Integer | Set a custom timeout to be used with either:
`-m`
_Time the script will wait for application to be "STOPPED"_
or
`-(u\|U)`
_Time the script will wait for application to be either "STOPPED" or "ACTIVE"_ | -| -s | -s | None | Sync Catalogs prior to updating | -| -p | -p | None | Prune old/unused docker images | +
+
+## Other Utilities +> All of these can ALSO be accessed with the HeavyScript menu, that you can access simply by not providing an argument `bash heavy_script.sh` + +| Flag | Example | Parameter | Description | +|----------------- |----------------- |----------- |---------------------------------------------------------------------------------------------- | +| --mount | --mount | None | Initiates mounting feature, choose between unmounting and mounting PVC data | +| --restore | --restore | None | Opens a menu to restore a heavy_script backup that was taken on your ix-applications dataset | +| --delete-backup | --delete-backup | None | Opens a menu to delete backups on your system | +| --dns | --dns | None | list all of your applications DNS names and their web ports | +| --cmd | --cmd | None | Open a shell for one of your applications |

diff --git a/heavy_script.sh b/heavy_script.sh index afea3b3a..fad37d0c 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -139,7 +139,7 @@ done #Continue to call functions in specific order [[ "$self_update" == "true" ]] && self_update [[ "$help" == "true" ]] && help -[[ "$cmd" == "true" ]] && cmd_to_container +[[ "$cmd" == "true" ]] && cmd_to_container && exit [[ "$deleteBackup" == "true" ]] && deleteBackup && exit [[ "$dns" == "true" ]] && dns && exit [[ "$restore" == "true" ]] && restore && exit From b6e831deb8a5fa8350e7d6024353166b5774b576 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 16 Aug 2022 20:19:46 -0600 Subject: [PATCH 0788/1229] prep menu --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 154e2093..864b7e92 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,11 @@
+## The Menu + + +
+ ## Update Arguments | Flag | Example | Parameter | Description | |--------------- |------------------------ |----------------- |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | From a326f41fc34d0399a1151687a5cc630cc92c39ec Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 17 Aug 2022 02:20:50 +0000 Subject: [PATCH 0789/1229] Picture for README --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 864b7e92..e4c29048 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,8 @@ ## The Menu +![image](https://user-images.githubusercontent.com/20793231/185020236-7b389499-8081-407d-b653-10dffd70de8c.png) +
From 7a23b178e0a830db73302beeb83874a6da261159 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 16 Aug 2022 20:23:26 -0600 Subject: [PATCH 0790/1229] update readme --- README.md | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 864b7e92..0ef62f6b 100644 --- a/README.md +++ b/README.md @@ -34,24 +34,8 @@ | -p | -p | None | Prune old/unused docker images | | --self-update | --self-update | None | Updates HeavyScript prior to running any other commands | -
-
-## Other Utilities -> All of these can ALSO be accessed with the HeavyScript menu, that you can access simply by not providing an argument `bash heavy_script.sh` - -| Flag | Example | Parameter | Description | -|----------------- |----------------- |----------- |---------------------------------------------------------------------------------------------- | -| --mount | --mount | None | Initiates mounting feature, choose between unmounting and mounting PVC data | -| --restore | --restore | None | Opens a menu to restore a heavy_script backup that was taken on your ix-applications dataset | -| --delete-backup | --delete-backup | None | Opens a menu to delete backups on your system | -| --dns | --dns | None | list all of your applications DNS names and their web ports | -| --cmd | --cmd | None | Open a shell for one of your applications | - -
-
- -### Examples +### Example #### Typical Cron Job ``` bash heavy_script.sh --self-update -b 10 -i portainer -i arch -i sonarr -i radarr -t 600 -rsp -u 5 @@ -75,6 +59,22 @@ bash heavy_script.sh --self-update -b 10 -i portainer -i arch -i sonarr -i radar > `--self-update` Will update the script prior to running anything else. +
+ +## Other Utilities +> All of these can ALSO be accessed with the HeavyScript menu, that you can access simply by not providing an argument `bash heavy_script.sh` + +| Flag | Example | Parameter | Description | +|----------------- |----------------- |----------- |---------------------------------------------------------------------------------------------- | +| --mount | --mount | None | Initiates mounting feature, choose between unmounting and mounting PVC data | +| --restore | --restore | None | Opens a menu to restore a heavy_script backup that was taken on your ix-applications dataset | +| --delete-backup | --delete-backup | None | Opens a menu to delete backups on your system | +| --dns | --dns | None | list all of your applications DNS names and their web ports | +| --cmd | --cmd | None | Open a shell for one of your applications | + +
+ +### Examples #### Mounting PVC Data ``` @@ -177,7 +177,7 @@ bash heavyscript.sh --self-update -b 10 -supr | Name | Value | Reason | |------------------------ |------------------------------------------------------------------------------------------------------------------- |------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `Description` | HeavyScript git pull and Update apps | This is up to you, put whatever you think is a good description in here | -| `Command` | `bash /PATH/TO/HEAVY_SCRIPT_DIRECTORY/heavy_script.sh --self-update -b 10 -rsup` | This is the command you will be running on your schedule I personally use: `bash /mnt/speed/scripts/heavy_script/heavy_script.sh --self-update -b 10 -rsup` | +| `Command` | `bash /PATH/TO/HEAVY_SCRIPT_DIRECTORY/heavy_script.sh --self-update -b 10 -rsp -u 10` | This is the command you will be running on your schedule I personally use: `bash /mnt/speed/scripts/heavy_script/heavy_script.sh --self-update -b 10 -rsp -u 10` | | `Run As User` | `root` | Running the script as `root` is REQUIRED. You cannot access all of the kubernetes functions without this user. | | `Schedule` | Up to you, I run mine everyday at `0400` | Again up to you | | `Hide Standard Output` | `False` or Unticked | I like to receive an email report of how the script ran, what apps updated etc. | From 3feb8d97ce55eeb9f22bf37039d3f6ed91c12395 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 16 Aug 2022 20:24:15 -0600 Subject: [PATCH 0791/1229] menu --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index eda5b691..3b2b8060 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ ## The Menu ![image](https://user-images.githubusercontent.com/20793231/185020236-7b389499-8081-407d-b653-10dffd70de8c.png) - +> Access this with `bash heavy_script.sh`
From 00cc643fb50dfeacd9249707bf121c1f75af4010 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 16 Aug 2022 20:25:47 -0600 Subject: [PATCH 0792/1229] spacing in readme --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3b2b8060..baad07ea 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ ![image](https://user-images.githubusercontent.com/20793231/185020236-7b389499-8081-407d-b653-10dffd70de8c.png) > Access this with `bash heavy_script.sh` +

## Update Arguments @@ -60,7 +61,7 @@ bash heavy_script.sh --self-update -b 10 -i portainer -i arch -i sonarr -i radar > `--self-update` Will update the script prior to running anything else. - +

## Other Utilities @@ -74,7 +75,6 @@ bash heavy_script.sh --self-update -b 10 -i portainer -i arch -i sonarr -i radar | --dns | --dns | None | list all of your applications DNS names and their web ports | | --cmd | --cmd | None | Open a shell for one of your applications | -
### Examples #### Mounting PVC Data From 83785c184b1fd92dd4b4824ec72cdef4d4ae3b4f Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 16 Aug 2022 20:27:11 -0600 Subject: [PATCH 0793/1229] rm personal cron, add --cmd --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index baad07ea..c084ee68 100644 --- a/README.md +++ b/README.md @@ -101,10 +101,10 @@ bash /mnt/tank/scripts/heavy_script/heavy_script.sh --delete-backup bash /mnt/tank/scripts/heavy_script/heavy_script.sh --dns ``` -#### My personal Cron Job +#### Open a Containers Shell ``` -bash /mnt/speed/scripts/heavy_script/heavy_script.sh --self-update -b 10 -rsp -u 10 +bash /mnt/speed/scripts/heavy_script/heavy_script.sh --cmd ```
From 1577082435de18d193024ec1a49428226497cb00 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 16 Aug 2022 20:36:13 -0600 Subject: [PATCH 0794/1229] exit menu and backup if no valid selection --- functions/menu.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/menu.sh b/functions/menu.sh index 79993400..5b86ca5f 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -14,7 +14,7 @@ echo "8) Update Applications" echo "9) Command to Container" echo echo "0) Exit" -read -rt 120 -p "Please select an option by number: " selection +read -rt 120 -p "Please select an option by number: " selection || { echo -e "\nFailed to make a selection in time" ; exit; } case $selection in 0) @@ -30,7 +30,7 @@ case $selection in mount ;; 4) - read -rt 120 -p "What is the maximun number of backups you would like?: " number_of_backups || echo "Failed to make a selection" + read -rt 120 -p "What is the maximun number of backups you would like?: " number_of_backups || { echo -e "\nFailed to make a selection in time" ; exit; } backup="true" ;; 5) From fd7819996bcd52b6e5b3a2bfd145384b7987da2a Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Wed, 17 Aug 2022 00:40:03 +0000 Subject: [PATCH 0795/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.161.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 0082c0cd..1d52fa3f 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@75a3723ab697f343a64702b937501960bab9ddaa # tag=v32.159.5 + uses: renovatebot/github-action@5e1c2fed3ac34792fc53009416ff78f15992118c # tag=v32.161.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 6ffd140ac92a55fd8c45fcca5c6ae4d771648560 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Wed, 17 Aug 2022 18:08:25 +0000 Subject: [PATCH 0796/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.161.2 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 1d52fa3f..0280382c 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@5e1c2fed3ac34792fc53009416ff78f15992118c # tag=v32.161.0 + uses: renovatebot/github-action@cc6b72d84352701f15b77b6dd63e0b4f67040d8b # tag=v32.161.2 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 595957f1c408c1e090a475694792cc4e777b49d9 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 18 Aug 2022 00:09:10 -0600 Subject: [PATCH 0797/1229] new test --- functions/cmd_to_container.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index 35f045b6..25c405e2 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -2,7 +2,7 @@ cmd_to_container(){ -app_name=$(k3s kubectl get pods -A | awk '{print $1}' | sort -u | grep -v "system" | sed '1d' | sed 's/^[^-]*-//' | nl -s ") " | column -t) +app_name=$(k3s crictl pods -s ready --namespace ix | sed -E 's/[[:space:]]([0-9]*|About)[a-z0-9 ]{5,12}ago[[:space:]]//' | sed '1d' | awk '{print $4}' | sort -u | nl -s ") " | column -t) while true do clear -x @@ -23,8 +23,9 @@ do fi done app_name=$(echo -e "$app_name" | grep ^"$selection)" | awk '{print $2}') +search=$(k3s crictl pods -s ready --namespace ix) +mapfile -t pod_id < <(echo "$search" | grep -E "[[:space:]]$app_name([[:space:]]|-([-[:alnum:]])*[[:space:]])" | awk '{print $1}') search=$(k3s crictl ps -a -s running | sed -E 's/[[:space:]]([0-9]*|About)[a-z0-9 ]{5,12}ago[[:space:]]//') -mapfile -t pod_id < <(echo "$search" | grep -E "[[:space:]]$app_name([[:space:]]|-([-[:alnum:]])*[[:space:]])" | awk '{print $(NF)}') for pod in "${pod_id[@]}" do if [[ $(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r " | wc -l) -gt 1 ]]; then From d58b25c35582b0665c66ef30a80679e85457e34b Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 18 Aug 2022 00:13:05 -0600 Subject: [PATCH 0798/1229] cut out ix --- functions/cmd_to_container.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index 25c405e2..c1021a5c 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -22,7 +22,7 @@ do break fi done -app_name=$(echo -e "$app_name" | grep ^"$selection)" | awk '{print $2}') +app_name=$(echo -e "$app_name" | grep ^"$selection)" | awk '{print $2}' | cut -c4-) search=$(k3s crictl pods -s ready --namespace ix) mapfile -t pod_id < <(echo "$search" | grep -E "[[:space:]]$app_name([[:space:]]|-([-[:alnum:]])*[[:space:]])" | awk '{print $1}') search=$(k3s crictl ps -a -s running | sed -E 's/[[:space:]]([0-9]*|About)[a-z0-9 ]{5,12}ago[[:space:]]//') From 0e14b8abbb4b5c7808846392297d8046c52f0d3b Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 18 Aug 2022 00:14:12 -0600 Subject: [PATCH 0799/1229] add cut to app list instead --- functions/cmd_to_container.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index c1021a5c..88b5cfaf 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -2,7 +2,7 @@ cmd_to_container(){ -app_name=$(k3s crictl pods -s ready --namespace ix | sed -E 's/[[:space:]]([0-9]*|About)[a-z0-9 ]{5,12}ago[[:space:]]//' | sed '1d' | awk '{print $4}' | sort -u | nl -s ") " | column -t) +app_name=$(k3s crictl pods -s ready --namespace ix | sed -E 's/[[:space:]]([0-9]*|About)[a-z0-9 ]{5,12}ago[[:space:]]//' | sed '1d' | awk '{print $4}' | cut -c4- | sort -u | nl -s ") " | column -t) while true do clear -x @@ -22,7 +22,7 @@ do break fi done -app_name=$(echo -e "$app_name" | grep ^"$selection)" | awk '{print $2}' | cut -c4-) +app_name=$(echo -e "$app_name" | grep ^"$selection)" | awk '{print $2}' ) search=$(k3s crictl pods -s ready --namespace ix) mapfile -t pod_id < <(echo "$search" | grep -E "[[:space:]]$app_name([[:space:]]|-([-[:alnum:]])*[[:space:]])" | awk '{print $1}') search=$(k3s crictl ps -a -s running | sed -E 's/[[:space:]]([0-9]*|About)[a-z0-9 ]{5,12}ago[[:space:]]//') From 3fe9c91f28a0e3f4528fb17a17e48914f15e7c2e Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 18 Aug 2022 00:17:17 -0600 Subject: [PATCH 0800/1229] ix-chart apps are now working --- functions/cmd_to_container.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index 88b5cfaf..79361515 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -22,7 +22,7 @@ do break fi done -app_name=$(echo -e "$app_name" | grep ^"$selection)" | awk '{print $2}' ) +app_name=$(echo -e "$app_name" | grep ^"$selection)" | awk '{print $2}') search=$(k3s crictl pods -s ready --namespace ix) mapfile -t pod_id < <(echo "$search" | grep -E "[[:space:]]$app_name([[:space:]]|-([-[:alnum:]])*[[:space:]])" | awk '{print $1}') search=$(k3s crictl ps -a -s running | sed -E 's/[[:space:]]([0-9]*|About)[a-z0-9 ]{5,12}ago[[:space:]]//') From 423800850d32744d0e0ee706f61a35398f9be14b Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 18 Aug 2022 00:36:54 -0600 Subject: [PATCH 0801/1229] remove ugly spacing --- functions/update_apps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 4ee33c95..0f26acce 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -59,7 +59,6 @@ rm all_app_status 2>/dev/null rm deploying 2>/dev/null echo echo - } export -f commander @@ -158,6 +157,7 @@ done } export -f update_app + stop_app(){ count=0 while [[ "$status" != "STOPPED" ]] From 5c7737f2291684947bf0f82b87cf83e2f4eb8e06 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 18 Aug 2022 00:40:40 -0600 Subject: [PATCH 0802/1229] take out un-needed examples for readme --- README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index c084ee68..ce8d669c 100644 --- a/README.md +++ b/README.md @@ -67,13 +67,13 @@ bash heavy_script.sh --self-update -b 10 -i portainer -i arch -i sonarr -i radar ## Other Utilities > All of these can ALSO be accessed with the HeavyScript menu, that you can access simply by not providing an argument `bash heavy_script.sh` -| Flag | Example | Parameter | Description | -|----------------- |----------------- |----------- |---------------------------------------------------------------------------------------------- | -| --mount | --mount | None | Initiates mounting feature, choose between unmounting and mounting PVC data | -| --restore | --restore | None | Opens a menu to restore a heavy_script backup that was taken on your ix-applications dataset | -| --delete-backup | --delete-backup | None | Opens a menu to delete backups on your system | -| --dns | --dns | None | list all of your applications DNS names and their web ports | -| --cmd | --cmd | None | Open a shell for one of your applications | +| Flag | Description | +|-----------------|----------------------------------------------------------------------------------------------| +| --mount | Initiates mounting feature, choose between unmounting and mounting PVC data | +| --restore | Opens a menu to restore a heavy_script backup that was taken on your ix-applications dataset | +| --delete-backup | Opens a menu to delete backups on your system | +| --dns | list all of your applications DNS names and their web ports | +| --cmd | Open a shell for one of your applications | ### Examples From f4a306334fff77026cf999b5c49521b319fd8e2b Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Thu, 18 Aug 2022 06:09:01 +0000 Subject: [PATCH 0803/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.163.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 0280382c..81fddc5a 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@cc6b72d84352701f15b77b6dd63e0b4f67040d8b # tag=v32.161.2 + uses: renovatebot/github-action@8c403b84af8d183194d4db2ff5586c72017a7d07 # tag=v32.163.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From beeae110568fcb81f9aae8545be45090c4bcb312 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 18 Aug 2022 14:41:51 -0600 Subject: [PATCH 0804/1229] remove search variable --- functions/cmd_to_container.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index 79361515..dfbc5215 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -23,8 +23,7 @@ do fi done app_name=$(echo -e "$app_name" | grep ^"$selection)" | awk '{print $2}') -search=$(k3s crictl pods -s ready --namespace ix) -mapfile -t pod_id < <(echo "$search" | grep -E "[[:space:]]$app_name([[:space:]]|-([-[:alnum:]])*[[:space:]])" | awk '{print $1}') +mapfile -t pod_id < <(k3s crictl pods -s ready --namespace ix | grep -E "[[:space:]]$app_name([[:space:]]|-([-[:alnum:]])*[[:space:]])" | awk '{print $1}') search=$(k3s crictl ps -a -s running | sed -E 's/[[:space:]]([0-9]*|About)[a-z0-9 ]{5,12}ago[[:space:]]//') for pod in "${pod_id[@]}" do From 1db4c18d88bb92994c2becfe28cd5e3eeae44b0e Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 18 Aug 2022 20:56:40 -0600 Subject: [PATCH 0805/1229] prepare for PR --- functions/self_update.sh | 2 +- functions/update_apps.sh | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/functions/self_update.sh b/functions/self_update.sh index b7b3e884..26b2fd56 100644 --- a/functions/self_update.sh +++ b/functions/self_update.sh @@ -2,7 +2,7 @@ args=("$@") self_update() { -branch="ignore-file" +branch="main" git fetch &> /dev/null echo "🅂 🄴 🄻 🄵" echo "🅄 🄿 🄳 🄰 🅃 🄴" diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 0f26acce..a32dc4a9 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -133,7 +133,6 @@ do update_avail=$(grep "^$app_name," all_app_status | awk -F ',' '{print $3}') if [[ $update_avail == "true" ]]; then if ! cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null ; then - echo "Fail Trigger - Debugging" before_loop=$(head -n 1 all_app_status) current_loop=0 until [[ "$(grep "^$app_name," all_app_status | awk -F ',' '{print $3}')" != "$update_avail" ]] # Wait for a specific change to app status, or 3 refreshes of the file to go by. @@ -166,7 +165,6 @@ do if [[ $count -gt 2 ]]; then # If failed to stop app 3 times, return failure to parent shell return 1 elif ! cli -c 'app chart_release scale release_name='\""$app_name"\"\ 'scale_options={"replica_count": 0}' &> /dev/null ; then - echo "Fail Trigger Stop - Debugging" before_loop=$(head -n 1 all_app_status) ((count++)) until [[ $(head -n 1 all_app_status) != "$before_loop" ]] # Upon failure, wait for status update before continuing From b35893247df8e0890aff3a77b79403f40e05ae01 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 19 Aug 2022 03:34:00 +0000 Subject: [PATCH 0806/1229] Update Readme --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ce8d669c..f9bb9fbe 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,8 @@ [HeavySetup - Further In-Depth Explanation](https://heavysetup.info/scripts/heavyscript/about/) ## Table of contents: -* [Arguments](#arguments) -* [Examples](#examples) +* [Update Arguments](#update-arguments) +* [Other Utilities](#other-utilities) * [How to Install](#how-to-install) * [How to Update](#how-to-update) * [Creating a Cron Job](#creating-a-cron-job) @@ -157,7 +157,7 @@ git pull ```
-### Update with the scripts built-in option +### Built-In Option ``` bash heavyscript.sh --self-update -b 10 -supr From 583920162ce416a7f1d993b90fc9e80194fc4295 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 19 Aug 2022 03:36:04 +0000 Subject: [PATCH 0807/1229] Update Readme --- README.md | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index f9bb9fbe..49ded17b 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ## Website -[HeavySetup - Further In-Depth Explanation](https://heavysetup.info/scripts/heavyscript/about/) +[HeavySetup - Further Explanation](https://heavysetup.info/scripts/heavyscript/about/) ## Table of contents: * [Update Arguments](#update-arguments) @@ -142,6 +142,15 @@ From here, you can just run Heavy_Script with `bash heavy_script.sh -ARGUMENTS` ## How to Update +### Built-In Option + +``` +bash heavyscript.sh --self-update -b 10 -supr +``` +> The important argument here is the `--self-update`, you can still use all of your same arguments with this option. + +
+ ### Manually #### Open a Terminal @@ -155,14 +164,6 @@ cd /mnt/speed/scripts/heavy_script ``` git pull ``` -
- -### Built-In Option - -``` -bash heavyscript.sh --self-update -b 10 -supr -``` -> The important argument here is the `--self-update`, you can still use all of your same arguments with this option.
From 2f5ef823efdefb3cfb7d3c3330cf4c78f03bee87 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Fri, 19 Aug 2022 00:40:14 +0000 Subject: [PATCH 0808/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.165.1 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 81fddc5a..7738e66f 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@8c403b84af8d183194d4db2ff5586c72017a7d07 # tag=v32.163.0 + uses: renovatebot/github-action@19818effc293a08ce2ad5966a88694401c7f583b # tag=v32.165.1 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 720fbd38e1c1273af58e503e2b2d51431cb85796 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Sat, 20 Aug 2022 06:08:28 +0000 Subject: [PATCH 0809/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.167.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 7738e66f..199e0fee 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@19818effc293a08ce2ad5966a88694401c7f583b # tag=v32.165.1 + uses: renovatebot/github-action@61bd3d8594eb4f3720b9a28cafc062bad8ba73a0 # tag=v32.167.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 31ddc73d1748a57e309ac2303906e5183a150674 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Sat, 20 Aug 2022 18:07:53 +0000 Subject: [PATCH 0810/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.168.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 199e0fee..014a4f8b 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@61bd3d8594eb4f3720b9a28cafc062bad8ba73a0 # tag=v32.167.0 + uses: renovatebot/github-action@9913be75c9c089940fbf00749f347bf1dba0e2b5 # tag=v32.168.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 0d49bd4c92216248b1f99eacd7c488a775b1f2ac Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 21 Aug 2022 16:44:22 -0600 Subject: [PATCH 0811/1229] add additional checks before exiting --- functions/update_apps.sh | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index a32dc4a9..f8af02f6 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -13,6 +13,7 @@ pool=$(cli -c 'app kubernetes config' | grep -E "dataset\s\|" | awk -F '|' '{pri it=0 while_count=0 rm deploying 2>/dev/null +rm all_app_status 2>/dev/null while true do if while_status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' 2>/dev/null) ; then @@ -49,13 +50,12 @@ do ((it++)) # ((loop++)) # done - elif [[ $proc_count != 0 ]]; then # Wait for all processes to finish + elif [[ $proc_count != 0 ]] || grep -qs ",DEPLOYING," all_app_status 2>/dev/null ; then # Wait for all processes to finish sleep 3 else # All processes must be completed, break out of loop break fi done -rm all_app_status 2>/dev/null rm deploying 2>/dev/null echo echo @@ -230,14 +230,29 @@ if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then else echo_array+=("Error: Run Time($SECONDS) for $app_name has exceeded Timeout($timeout)") echo_array+=("The application failed to be ACTIVE even after a rollback") - echo_array+=("Manual intervention is required\nAbandoning") + echo_array+=("Manual intervention is required\nStopping, then Abandoning") + if stop_app ; then + echo_array+=("Stopped") + else + echo_array+=("Error: Failed to stop $app_name") + echo_array + return 1 + fi break fi else echo_array+=("Error: Run Time($SECONDS) for $app_name has exceeded Timeout($timeout)") echo_array+=("If this is a slow starting application, set a higher timeout with -t") echo_array+=("If this applicaion is always DEPLOYING, you can disable all probes under the Healthcheck Probes Liveness section in the edit configuration") - break + echo_array+=("Manual intervention is required\nStopping, then Abandoning") + if stop_app ; then + echo_array+=("Stopped") + else + echo_array+=("Error: Failed to stop $app_name") + echo_array + return 1 + fi + break fi else [[ "$verbose" == "true" ]] && echo_array+=("Waiting $((timeout-SECONDS)) more seconds for $app_name to be ACTIVE") From fe8c9b05533a4b080f0e4741c2e992613e399fe5 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 21 Aug 2022 16:45:53 -0600 Subject: [PATCH 0812/1229] indention on break --- functions/update_apps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index f8af02f6..5bd890b4 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -252,7 +252,7 @@ if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then echo_array return 1 fi - break + break fi else [[ "$verbose" == "true" ]] && echo_array+=("Waiting $((timeout-SECONDS)) more seconds for $app_name to be ACTIVE") From 846ea6011eb6ec94cbedf8892cb7b1db99472e28 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 21 Aug 2022 17:54:10 -0600 Subject: [PATCH 0813/1229] create finished file to track finished shells --- functions/update_apps.sh | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 5bd890b4..d8e67390 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -13,7 +13,7 @@ pool=$(cli -c 'app kubernetes config' | grep -E "dataset\s\|" | awk -F '|' '{pri it=0 while_count=0 rm deploying 2>/dev/null -rm all_app_status 2>/dev/null +rm finished 2>/dev/null while true do if while_status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' 2>/dev/null) ; then @@ -50,13 +50,14 @@ do ((it++)) # ((loop++)) # done - elif [[ $proc_count != 0 ]] || grep -qs ",DEPLOYING," all_app_status 2>/dev/null ; then # Wait for all processes to finish + elif [[ $proc_count != 0 || $(wc -l finished 2>/dev/null | awk '{ print $1 }') -lt "${#array[@]}" ]]; then # Wait for all processes to finish sleep 3 else # All processes must be completed, break out of loop break fi done rm deploying 2>/dev/null +rm finished 2>/dev/null echo echo } @@ -65,7 +66,7 @@ export -f commander pre_process(){ app_name=$(echo "${array[$it]}" | awk -F ',' '{print $1}') #print out first catagory, name. -printf '%s\0' "${ignore[@]}" | grep -iFxqz "${app_name}" && echo -e "\n$app_name\nIgnored, skipping" && return 0 #If application is on ignore list, skip +printf '%s\0' "${ignore[@]}" | grep -iFxqz "${app_name}" && echo -e "\n$app_name\nIgnored, skipping" && final_check && return 0 #If application is on ignore list, skip old_app_ver=$(echo "${array[$it]}" | awk -F ',' '{print $4}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #previous/current Application MAJOR Version new_app_ver=$(echo "${array[$it]}" | awk -F ',' '{print $5}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #new Application MAJOR Version old_chart_ver=$(echo "${array[$it]}" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}' | awk -F '.' '{print $1}') # Old Chart MAJOR version @@ -73,7 +74,7 @@ new_chart_ver=$(echo "${array[$it]}" | awk -F ',' '{print $5}' | awk -F '_' '{pr startstatus=$(echo "${array[$it]}" | awk -F ',' '{print $2}') #status of the app: STOPPED / DEPLOYING / ACTIVE diff_app=$(diff <(echo "$old_app_ver") <(echo "$new_app_ver")) #caluclating difference in major app versions diff_chart=$(diff <(echo "$old_chart_ver") <(echo "$new_chart_ver")) #caluclating difference in Chart versions -[[ "$diff_app" != "$diff_chart" && $update_apps == "true" ]] && echo -e "\n$app_name\nMajor Release, update manually" && return +[[ "$diff_app" != "$diff_chart" && $update_apps == "true" ]] && echo -e "\n$app_name\nMajor Release, update manually" && final_check && return old_full_ver=$(echo "${array[$it]}" | awk -F ',' '{print $4}') #Upgraded From new_full_ver=$(echo "${array[$it]}" | awk -F ',' '{print $5}') #Upraded To rollback_version=$(echo "${array[$it]}" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}') @@ -82,6 +83,7 @@ if grep -qs "^$app_name," failed 2>/dev/null; then if [[ "$failed_ver" == "$new_full_ver" ]] ; then echo -e "\n$app_name" echo -e "Skipping previously failed version:\n$new_full_ver" + final_check return 0 else sed -i /"$app_name",/d failed @@ -105,6 +107,7 @@ if [[ $stop_before_update == "true" && "$startstatus" != "STOPPED" ]]; then # C else echo_array+=("Error: Failed to stop $app_name") echo_array + final_check return 1 fi fi @@ -114,13 +117,16 @@ if update_app ;then else echo_array+=("Failed to update") echo_array + final_check return fi if grep -qs "^$app_name,true" external_services ; then echo_array + final_check return else after_update_actions + final_check fi } export -f pre_process @@ -275,3 +281,8 @@ done } export -f echo_array + +final_check(){ + [[ ! -e finished ]] && touch finished + echo "$app_name,finished" >> finished +} From 0cadc42d88388d582f3760fae5753ece12d349d2 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Sun, 21 Aug 2022 18:08:08 +0000 Subject: [PATCH 0814/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.169.1 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 014a4f8b..bdd626cc 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@9913be75c9c089940fbf00749f347bf1dba0e2b5 # tag=v32.168.0 + uses: renovatebot/github-action@38162c4cefd10836f1ed8214cacd0ba6b2770c7d # tag=v32.169.1 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 7af36bb1a402b1714dffe57d1eb71edb60f84e5a Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 21 Aug 2022 21:31:01 -0600 Subject: [PATCH 0815/1229] testing cmd-to-container --- functions/cmd_to_container.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index dfbc5215..3752d6c0 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -27,10 +27,10 @@ mapfile -t pod_id < <(k3s crictl pods -s ready --namespace ix | grep -E "[[:spac search=$(k3s crictl ps -a -s running | sed -E 's/[[:space:]]([0-9]*|About)[a-z0-9 ]{5,12}ago[[:space:]]//') for pod in "${pod_id[@]}" do - if [[ $(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r " | wc -l) -gt 1 ]]; then - readarray -t containers <<<"$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")" - continue - fi + # if [[ $(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r " | wc -l) -gt 1 ]]; then + # readarray -t containers <<<"$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")" + # continue + # fi printf '%s\0' "${containers[@]}" | grep -Fxqz -- "$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")" && continue containers+=("$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")") From 9696082cc8c2d935303b417f9da4244afbbd8c2d Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 21 Aug 2022 21:36:27 -0600 Subject: [PATCH 0816/1229] test array rebuild --- functions/cmd_to_container.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index 3752d6c0..66c606ce 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -33,8 +33,8 @@ do # fi printf '%s\0' "${containers[@]}" | grep -Fxqz -- "$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")" && continue containers+=("$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")") - done +readarray -t containers <<<"${containers[@]}" case "${#containers[@]}" in 0) echo -e "No containers available\nAre you sure the application in running?" From d518de6e67b1aef1daf16165d5e1c9b536c0efa0 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 21 Aug 2022 21:37:56 -0600 Subject: [PATCH 0817/1229] change from var to array --- functions/cmd_to_container.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index 66c606ce..0491dd3a 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -32,9 +32,9 @@ do # continue # fi printf '%s\0' "${containers[@]}" | grep -Fxqz -- "$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")" && continue - containers+=("$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")") + containers+="$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")" done -readarray -t containers <<<"${containers[@]}" +readarray -t containers <<<"$containers" case "${#containers[@]}" in 0) echo -e "No containers available\nAre you sure the application in running?" From a0037cb4d095312f9387ae37aa9ac82e0025c89a Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 21 Aug 2022 21:43:01 -0600 Subject: [PATCH 0818/1229] read IFS --- functions/cmd_to_container.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index 0491dd3a..b9bae6cc 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -34,7 +34,7 @@ do printf '%s\0' "${containers[@]}" | grep -Fxqz -- "$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")" && continue containers+="$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")" done -readarray -t containers <<<"$containers" +IFS=" " read -r -a containers <<< "$containers" case "${#containers[@]}" in 0) echo -e "No containers available\nAre you sure the application in running?" From 389e0fbcd05fd86673c809122ef007e70270cffc Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 21 Aug 2022 21:50:59 -0600 Subject: [PATCH 0819/1229] readarray --- functions/cmd_to_container.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index b9bae6cc..1429b9fc 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -34,7 +34,8 @@ do printf '%s\0' "${containers[@]}" | grep -Fxqz -- "$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")" && continue containers+="$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")" done -IFS=" " read -r -a containers <<< "$containers" +readarray -t containers <<<"$containers" + case "${#containers[@]}" in 0) echo -e "No containers available\nAre you sure the application in running?" From ba17b0dd136310601d4e31c1d2966410e6c2fcca Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 21 Aug 2022 21:51:57 -0600 Subject: [PATCH 0820/1229] trying to rebuild array --- functions/cmd_to_container.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index 1429b9fc..4db51b53 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -32,9 +32,9 @@ do # continue # fi printf '%s\0' "${containers[@]}" | grep -Fxqz -- "$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")" && continue - containers+="$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")" + containers+=("$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")") done -readarray -t containers <<<"$containers" +readarray -t containers <<<"${containers[*]}" case "${#containers[@]}" in 0) From bc9fed707e67653ee55a84de7390d2784a4a53d5 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 21 Aug 2022 21:58:24 -0600 Subject: [PATCH 0821/1229] rebuild array --- functions/cmd_to_container.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index 4db51b53..c05228ba 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -34,8 +34,7 @@ do printf '%s\0' "${containers[@]}" | grep -Fxqz -- "$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")" && continue containers+=("$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")") done -readarray -t containers <<<"${containers[*]}" - +readarray -td, containers <<<"${containers[@]}"; declare -p containers; case "${#containers[@]}" in 0) echo -e "No containers available\nAre you sure the application in running?" From 0b786c3ef263412e60328a2019e60da66c16853f Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 21 Aug 2022 22:01:08 -0600 Subject: [PATCH 0822/1229] make only var --- functions/cmd_to_container.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index c05228ba..1ed5bd2d 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -32,9 +32,9 @@ do # continue # fi printf '%s\0' "${containers[@]}" | grep -Fxqz -- "$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")" && continue - containers+=("$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")") + containers+="$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")" done -readarray -td, containers <<<"${containers[@]}"; declare -p containers; +readarray -td, containers <<<"$containers"; declare -p containers; case "${#containers[@]}" in 0) echo -e "No containers available\nAre you sure the application in running?" From 354e132d8fd7d50558709cb0288f7763fe5ade9f Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 21 Aug 2022 22:04:42 -0600 Subject: [PATCH 0823/1229] array rebuild --- functions/cmd_to_container.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index 1ed5bd2d..cfdc13a8 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -32,9 +32,9 @@ do # continue # fi printf '%s\0' "${containers[@]}" | grep -Fxqz -- "$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")" && continue - containers+="$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")" + containers+=("$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")") done -readarray -td, containers <<<"$containers"; declare -p containers; +containers=("${containers[@]}") case "${#containers[@]}" in 0) echo -e "No containers available\nAre you sure the application in running?" From 0aee51e7120e4ee25dc6be78cf66f2742955535d Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 21 Aug 2022 22:07:59 -0600 Subject: [PATCH 0824/1229] test --- functions/cmd_to_container.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index cfdc13a8..0ef71f46 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -34,7 +34,7 @@ do printf '%s\0' "${containers[@]}" | grep -Fxqz -- "$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")" && continue containers+=("$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")") done -containers=("${containers[@]}") +containers=$("$("${containers[@]}")") case "${#containers[@]}" in 0) echo -e "No containers available\nAre you sure the application in running?" From 4ed623d0ab29bfdce4c2c30710958d6b3816f214 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 21 Aug 2022 22:10:49 -0600 Subject: [PATCH 0825/1229] mapfile --- functions/cmd_to_container.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index 0ef71f46..ed18e75e 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -34,7 +34,7 @@ do printf '%s\0' "${containers[@]}" | grep -Fxqz -- "$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")" && continue containers+=("$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")") done -containers=$("$("${containers[@]}")") +mapfile -t containers < <("${containers[@]}") case "${#containers[@]}" in 0) echo -e "No containers available\nAre you sure the application in running?" From 8b60029b375d63879e3b29be2970c9b862f11d2a Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 21 Aug 2022 22:11:35 -0600 Subject: [PATCH 0826/1229] echo containers --- functions/cmd_to_container.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index ed18e75e..af0eaf7f 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -34,7 +34,7 @@ do printf '%s\0' "${containers[@]}" | grep -Fxqz -- "$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")" && continue containers+=("$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")") done -mapfile -t containers < <("${containers[@]}") +mapfile -t containers < <("echo ${containers[*]}") case "${#containers[@]}" in 0) echo -e "No containers available\nAre you sure the application in running?" From 3cacd0bb80e277be3b79d953e90a3036daebff83 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 21 Aug 2022 22:12:13 -0600 Subject: [PATCH 0827/1229] quotations --- functions/cmd_to_container.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index af0eaf7f..84cb7291 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -34,7 +34,7 @@ do printf '%s\0' "${containers[@]}" | grep -Fxqz -- "$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")" && continue containers+=("$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")") done -mapfile -t containers < <("echo ${containers[*]}") +mapfile -t containers < <(echo "${containers[*]}") case "${#containers[@]}" in 0) echo -e "No containers available\nAre you sure the application in running?" From 61bf2efe8509b46d3c3fcbaed05a2fcb2e726c8e Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 21 Aug 2022 22:13:09 -0600 Subject: [PATCH 0828/1229] echo array for testting --- functions/cmd_to_container.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index 84cb7291..bde8c2e9 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -35,6 +35,10 @@ do containers+=("$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")") done mapfile -t containers < <(echo "${containers[*]}") +for i in "${containers[@]}" +do + echo "$i" +done case "${#containers[@]}" in 0) echo -e "No containers available\nAre you sure the application in running?" From 509ee9054326e55af272d93d537d059271c6639f Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 21 Aug 2022 22:14:48 -0600 Subject: [PATCH 0829/1229] print array elements --- functions/cmd_to_container.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index bde8c2e9..2541e095 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -39,6 +39,7 @@ for i in "${containers[@]}" do echo "$i" done +printf '%s\n' "${containers[@]}" case "${#containers[@]}" in 0) echo -e "No containers available\nAre you sure the application in running?" From ec37299970a7c763ea1c265a2b3cec719a2591ce Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 21 Aug 2022 22:16:28 -0600 Subject: [PATCH 0830/1229] space in print output --- functions/cmd_to_container.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index 2541e095..f3b97e6c 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -39,7 +39,7 @@ for i in "${containers[@]}" do echo "$i" done -printf '%s\n' "${containers[@]}" +printf '%s \n' "${containers[@]}" case "${#containers[@]}" in 0) echo -e "No containers available\nAre you sure the application in running?" From cc43fb198374f682359fc23a683067aade233b52 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 21 Aug 2022 22:21:17 -0600 Subject: [PATCH 0831/1229] change to newline with sed --- functions/cmd_to_container.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index f3b97e6c..d4a1d79e 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -32,7 +32,7 @@ do # continue # fi printf '%s\0' "${containers[@]}" | grep -Fxqz -- "$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")" && continue - containers+=("$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")") + containers+=("$(echo "$search" | grep "$pod" | awk '{print $4}' | sed 's/ /\n//')") done mapfile -t containers < <(echo "${containers[*]}") for i in "${containers[@]}" From ed96807938053d0ccb1b0a8aa45276f3e48448af Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 21 Aug 2022 22:26:06 -0600 Subject: [PATCH 0832/1229] try using a file --- functions/cmd_to_container.sh | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index d4a1d79e..19e4a7a3 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -31,15 +31,12 @@ do # readarray -t containers <<<"$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")" # continue # fi - printf '%s\0' "${containers[@]}" | grep -Fxqz -- "$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")" && continue - containers+=("$(echo "$search" | grep "$pod" | awk '{print $4}' | sed 's/ /\n//')") + # printf '%s\0' "${containers[@]}" | grep -Fxqz -- "$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")" && continue + "$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")" >> containers done -mapfile -t containers < <(echo "${containers[*]}") -for i in "${containers[@]}" -do - echo "$i" -done -printf '%s \n' "${containers[@]}" + +cat containers + case "${#containers[@]}" in 0) echo -e "No containers available\nAre you sure the application in running?" From 7907af24ba2ee2178fbc2b59d318d273a74043dd Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 21 Aug 2022 22:26:51 -0600 Subject: [PATCH 0833/1229] dont supress output --- functions/cmd_to_container.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index 19e4a7a3..f0745b97 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -32,7 +32,7 @@ do # continue # fi # printf '%s\0' "${containers[@]}" | grep -Fxqz -- "$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")" && continue - "$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")" >> containers + echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r " >> containers done cat containers From 7615f645543c61c1d0ccec626ca08891493d981d Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 21 Aug 2022 22:28:37 -0600 Subject: [PATCH 0834/1229] try file --- functions/cmd_to_container.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index f0745b97..df336f63 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -32,10 +32,10 @@ do # continue # fi # printf '%s\0' "${containers[@]}" | grep -Fxqz -- "$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")" && continue - echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r " >> containers + echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r " >> cont_file done -cat containers +mapfile -t containers < cont_file case "${#containers[@]}" in 0) From 765a56a04883f930654593824b5d10cb9b0c48e8 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 21 Aug 2022 22:31:21 -0600 Subject: [PATCH 0835/1229] rm file and sort --- functions/cmd_to_container.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index df336f63..dbb7d76b 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -22,6 +22,7 @@ do break fi done +rm cont_file 2> /dev/null app_name=$(echo -e "$app_name" | grep ^"$selection)" | awk '{print $2}') mapfile -t pod_id < <(k3s crictl pods -s ready --namespace ix | grep -E "[[:space:]]$app_name([[:space:]]|-([-[:alnum:]])*[[:space:]])" | awk '{print $1}') search=$(k3s crictl ps -a -s running | sed -E 's/[[:space:]]([0-9]*|About)[a-z0-9 ]{5,12}ago[[:space:]]//') @@ -34,9 +35,8 @@ do # printf '%s\0' "${containers[@]}" | grep -Fxqz -- "$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")" && continue echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r " >> cont_file done - -mapfile -t containers < cont_file - +mapfile -t containers < "$(sort -u cont_file)" +rm cont_file 2> /dev/null case "${#containers[@]}" in 0) echo -e "No containers available\nAre you sure the application in running?" From ffd0d1aaeb90f5a2e9baf61d5a8565fcf0a06a4e Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 21 Aug 2022 22:32:38 -0600 Subject: [PATCH 0836/1229] sort and clean --- functions/cmd_to_container.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index dbb7d76b..b8724a66 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -35,7 +35,8 @@ do # printf '%s\0' "${containers[@]}" | grep -Fxqz -- "$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")" && continue echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r " >> cont_file done -mapfile -t containers < "$(sort -u cont_file)" +clean_list=$(sort -u cont_file) +mapfile -t containers < "$clean_list" rm cont_file 2> /dev/null case "${#containers[@]}" in 0) From fe7604130318c5ca6e57c47d8bd85fa5cc83de10 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 21 Aug 2022 22:33:46 -0600 Subject: [PATCH 0837/1229] proper redirection --- functions/cmd_to_container.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index b8724a66..2adeba8f 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -35,8 +35,7 @@ do # printf '%s\0' "${containers[@]}" | grep -Fxqz -- "$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")" && continue echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r " >> cont_file done -clean_list=$(sort -u cont_file) -mapfile -t containers < "$clean_list" +mapfile -t containers < <(sort -u cont_file) rm cont_file 2> /dev/null case "${#containers[@]}" in 0) From d930c734f733f46cd9f5b59e78fb6dae2bdcde98 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 21 Aug 2022 22:36:24 -0600 Subject: [PATCH 0838/1229] remove error message on STOPPED application --- functions/cmd_to_container.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index 2adeba8f..09f2ee55 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -35,7 +35,7 @@ do # printf '%s\0' "${containers[@]}" | grep -Fxqz -- "$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")" && continue echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r " >> cont_file done -mapfile -t containers < <(sort -u cont_file) +mapfile -t containers < <(sort -u cont_file 2> /dev/null) rm cont_file 2> /dev/null case "${#containers[@]}" in 0) From 25cbd91818b52789e063a245be7deb9c03accb9d Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 21 Aug 2022 22:44:55 -0600 Subject: [PATCH 0839/1229] also grep pod for addon containers --- functions/cmd_to_container.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index 09f2ee55..cda66710 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -74,7 +74,7 @@ case "${#containers[@]}" in fi done container=$(echo "$cont_search" | grep ^"$selection)" | awk '{print $2}') - container_id=$(echo "$search" | grep -E "[[:space:]]${container}[[:space:]]" | awk '{print $1}') + container_id=$(echo "$search" | grep -E "[[:space:]]${container}[[:space:]]" | grep "${pod_id[0]}" | awk '{print $1}') ;; esac while true From fe8abe8938868c50b50198abb62c07d9add7f84d Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 21 Aug 2022 22:48:03 -0600 Subject: [PATCH 0840/1229] revert. looking for better solution --- functions/cmd_to_container.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index cda66710..09f2ee55 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -74,7 +74,7 @@ case "${#containers[@]}" in fi done container=$(echo "$cont_search" | grep ^"$selection)" | awk '{print $2}') - container_id=$(echo "$search" | grep -E "[[:space:]]${container}[[:space:]]" | grep "${pod_id[0]}" | awk '{print $1}') + container_id=$(echo "$search" | grep -E "[[:space:]]${container}[[:space:]]" | awk '{print $1}') ;; esac while true From 58a72fafb3d0d7e1c1e196b90c7a2605e22a6c3c Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 21 Aug 2022 22:58:29 -0600 Subject: [PATCH 0841/1229] testing output for new file --- functions/cmd_to_container.sh | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index 09f2ee55..e68fb3b2 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -28,15 +28,10 @@ mapfile -t pod_id < <(k3s crictl pods -s ready --namespace ix | grep -E "[[:spac search=$(k3s crictl ps -a -s running | sed -E 's/[[:space:]]([0-9]*|About)[a-z0-9 ]{5,12}ago[[:space:]]//') for pod in "${pod_id[@]}" do - # if [[ $(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r " | wc -l) -gt 1 ]]; then - # readarray -t containers <<<"$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")" - # continue - # fi - # printf '%s\0' "${containers[@]}" | grep -Fxqz -- "$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")" && continue - echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r " >> cont_file + echo "$search" | grep "$pod" | tr -d " \t\r " >> cont_file done mapfile -t containers < <(sort -u cont_file 2> /dev/null) -rm cont_file 2> /dev/null +# rm cont_file 2> /dev/null case "${#containers[@]}" in 0) echo -e "No containers available\nAre you sure the application in running?" @@ -46,7 +41,6 @@ case "${#containers[@]}" in container=$(echo "$search" | grep "${pod_id[0]}" | awk '{print $4}') container_id=$(echo "$search" | grep -E "[[:space:]]${container}[[:space:]]" | awk '{print $1}') ;; - *) while true do From 6e6bfe7bf844b632b7939338cabfc38acb1ecec5 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 21 Aug 2022 22:59:29 -0600 Subject: [PATCH 0842/1229] rm tr --- functions/cmd_to_container.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index e68fb3b2..4c6bc98e 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -28,7 +28,7 @@ mapfile -t pod_id < <(k3s crictl pods -s ready --namespace ix | grep -E "[[:spac search=$(k3s crictl ps -a -s running | sed -E 's/[[:space:]]([0-9]*|About)[a-z0-9 ]{5,12}ago[[:space:]]//') for pod in "${pod_id[@]}" do - echo "$search" | grep "$pod" | tr -d " \t\r " >> cont_file + echo "$search" | grep "$pod" >> cont_file done mapfile -t containers < <(sort -u cont_file 2> /dev/null) # rm cont_file 2> /dev/null From 9af91e1e51d36c6d6e5d6b7f7276454a4eb601fc Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 21 Aug 2022 23:02:12 -0600 Subject: [PATCH 0843/1229] grep from file --- functions/cmd_to_container.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index 4c6bc98e..f2d3bc73 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -38,8 +38,8 @@ case "${#containers[@]}" in exit ;; 1) - container=$(echo "$search" | grep "${pod_id[0]}" | awk '{print $4}') - container_id=$(echo "$search" | grep -E "[[:space:]]${container}[[:space:]]" | awk '{print $1}') + container=$(grep "${pod_id[0]}" cont_file | awk '{print $4}') + container_id=$(grep -E "[[:space:]]${container}[[:space:]]" cont_file | awk '{print $1}') ;; *) while true From 2dfd8b01ab3c89f481bd8e9ea98b6a74712b7618 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 21 Aug 2022 23:04:03 -0600 Subject: [PATCH 0844/1229] print name --- functions/cmd_to_container.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index f2d3bc73..88e395a9 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -49,7 +49,7 @@ case "${#containers[@]}" in cont_search=$( for i in "${containers[@]}" do - echo "$i" + echo "$i | awk '{print $4}'" done | nl -s ") " | column -t ) echo "$cont_search" From b5c3bdaf0db3b7fe2d88726fd5a2c91b71419f82 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 21 Aug 2022 23:04:40 -0600 Subject: [PATCH 0845/1229] undo literal awk lol --- functions/cmd_to_container.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index 88e395a9..3a6af823 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -49,7 +49,7 @@ case "${#containers[@]}" in cont_search=$( for i in "${containers[@]}" do - echo "$i | awk '{print $4}'" + echo "$i" | awk '{print $4}' done | nl -s ") " | column -t ) echo "$cont_search" From 518f7fa0d1806a99554bcaf585085c36b83c1c29 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 21 Aug 2022 23:05:46 -0600 Subject: [PATCH 0846/1229] rm file once func is done --- functions/cmd_to_container.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index 3a6af823..e40a1175 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -31,7 +31,6 @@ do echo "$search" | grep "$pod" >> cont_file done mapfile -t containers < <(sort -u cont_file 2> /dev/null) -# rm cont_file 2> /dev/null case "${#containers[@]}" in 0) echo -e "No containers available\nAre you sure the application in running?" @@ -109,6 +108,6 @@ do ;; esac done - +rm cont_file 2> /dev/null } export -f cmd_to_container \ No newline at end of file From 58e7765794772eea5e9ff668c36b35d33a5df80c Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 21 Aug 2022 23:12:32 -0600 Subject: [PATCH 0847/1229] fix container_id var --- functions/cmd_to_container.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index e40a1175..72f79990 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -67,7 +67,7 @@ case "${#containers[@]}" in fi done container=$(echo "$cont_search" | grep ^"$selection)" | awk '{print $2}') - container_id=$(echo "$search" | grep -E "[[:space:]]${container}[[:space:]]" | awk '{print $1}') + container_id=$(grep -E "[[:space:]]${container}[[:space:]]" cont_file | awk '{print $1}') ;; esac while true From 36491f12520ffc441cbd35866f5e75ff8ab68b74 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Mon, 22 Aug 2022 18:08:47 +0000 Subject: [PATCH 0848/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.171.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index bdd626cc..9725c40d 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@38162c4cefd10836f1ed8214cacd0ba6b2770c7d # tag=v32.169.1 + uses: renovatebot/github-action@67772f11e05533fdf1f73f6f84ac8d3070c58129 # tag=v32.171.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 2932bcdf13bf0571d0a63beec776f26a8869bbe1 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Tue, 23 Aug 2022 06:21:00 +0000 Subject: [PATCH 0849/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.172.1 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 9725c40d..29645711 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@67772f11e05533fdf1f73f6f84ac8d3070c58129 # tag=v32.171.0 + uses: renovatebot/github-action@a268351ade4e17ee3f9e4b0a77970ca706c02ec3 # tag=v32.172.1 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 178079a39fee5fcce8b6ecc34ef6a99663421890 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 23 Aug 2022 12:02:41 -0600 Subject: [PATCH 0850/1229] test title release and SU releases --- functions/misc.sh | 1 + functions/self_update.sh | 4 +++- heavy_script.sh | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/functions/misc.sh b/functions/misc.sh index 87278b4b..33b4d4c0 100644 --- a/functions/misc.sh +++ b/functions/misc.sh @@ -31,6 +31,7 @@ echo '| | | | __/ (_| |\ V /| |_| /\__/ / (__| | | | |_) | |_ ' echo '\_| |_/\___|\__,_| \_/ \__, \____/ \___|_| |_| .__/ \__|' echo ' __/ | | | ' echo ' |___/ |_| ' +echo "$hs_version" echo } export -f title diff --git a/functions/self_update.sh b/functions/self_update.sh index 26b2fd56..5df34f34 100644 --- a/functions/self_update.sh +++ b/functions/self_update.sh @@ -16,6 +16,7 @@ if git diff --name-only origin/$branch | grep -qs ".sh" ; then [[ "$i" == "--self-update" ]] && unset "args[$count]" && break ((count++)) done + curl --silent "https://api.github.com/repos/HeavyBullets8/heavy_script/releases/latest" | jq -r .tag_name,.body [[ -z ${args[*]} ]] && echo -e "No more arguments, exiting..\n\n" && exit echo -e "Running the new version...\n\n" sleep 5 @@ -23,7 +24,8 @@ if git diff --name-only origin/$branch | grep -qs ".sh" ; then # Now exit this old instance exit else - echo -e "HeavyScript is already the latest version\n\n" + echo -e "HeavyScript is already the latest version:\n\n" + echo "$hs_version" fi } export -f self_update diff --git a/heavy_script.sh b/heavy_script.sh index fad37d0c..b8878186 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -1,5 +1,7 @@ #!/bin/bash +#Version +hs_version=$(curl --silent "https://api.github.com/repos/HeavyBullets8/heavy_script/releases/latest" | jq -r .tag_name) # cd to script, this ensures the script can find the source scripts below, even when ran from a seperate directory script=$(readlink -f "$0") From 3154177dd77148ca0962ac155b5dce2a5db4cfdc Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 23 Aug 2022 12:04:48 -0600 Subject: [PATCH 0851/1229] place version in title one line up --- functions/misc.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/functions/misc.sh b/functions/misc.sh index 33b4d4c0..fee14883 100644 --- a/functions/misc.sh +++ b/functions/misc.sh @@ -30,8 +30,7 @@ echo "| _ |/ _ \/ _\` \ \ / / | | |\`--. \/ __| '__| | '_ \| __|" echo '| | | | __/ (_| |\ V /| |_| /\__/ / (__| | | | |_) | |_ ' echo '\_| |_/\___|\__,_| \_/ \__, \____/ \___|_| |_| .__/ \__|' echo ' __/ | | | ' -echo ' |___/ |_| ' -echo "$hs_version" +echo "$hs_version |___/ |_| " echo } export -f title From d3c875353d49662827c18e3c974e78f7827c83a3 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 23 Aug 2022 12:05:31 -0600 Subject: [PATCH 0852/1229] add spaces --- functions/misc.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/misc.sh b/functions/misc.sh index fee14883..ee68ad7c 100644 --- a/functions/misc.sh +++ b/functions/misc.sh @@ -30,7 +30,7 @@ echo "| _ |/ _ \/ _\` \ \ / / | | |\`--. \/ __| '__| | '_ \| __|" echo '| | | | __/ (_| |\ V /| |_| /\__/ / (__| | | | |_) | |_ ' echo '\_| |_/\___|\__,_| \_/ \__, \____/ \___|_| |_| .__/ \__|' echo ' __/ | | | ' -echo "$hs_version |___/ |_| " +echo "$hs_version |___/ |_| " echo } export -f title From 202af8f147182d70dbd752eba6e6ac8bd0335c18 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 23 Aug 2022 12:05:52 -0600 Subject: [PATCH 0853/1229] added one too many spaces --- functions/misc.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/misc.sh b/functions/misc.sh index ee68ad7c..8b4aa6b3 100644 --- a/functions/misc.sh +++ b/functions/misc.sh @@ -30,7 +30,7 @@ echo "| _ |/ _ \/ _\` \ \ / / | | |\`--. \/ __| '__| | '_ \| __|" echo '| | | | __/ (_| |\ V /| |_| /\__/ / (__| | | | |_) | |_ ' echo '\_| |_/\___|\__,_| \_/ \__, \____/ \___|_| |_| .__/ \__|' echo ' __/ | | | ' -echo "$hs_version |___/ |_| " +echo "$hs_version |___/ |_| " echo } export -f title From a37a734910cadd0fdb28dd52df290b0990c494a0 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 23 Aug 2022 12:07:37 -0600 Subject: [PATCH 0854/1229] revert, place version under title, not in it --- functions/misc.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/functions/misc.sh b/functions/misc.sh index 8b4aa6b3..33b4d4c0 100644 --- a/functions/misc.sh +++ b/functions/misc.sh @@ -30,7 +30,8 @@ echo "| _ |/ _ \/ _\` \ \ / / | | |\`--. \/ __| '__| | '_ \| __|" echo '| | | | __/ (_| |\ V /| |_| /\__/ / (__| | | | |_) | |_ ' echo '\_| |_/\___|\__,_| \_/ \__, \____/ \___|_| |_| .__/ \__|' echo ' __/ | | | ' -echo "$hs_version |___/ |_| " +echo ' |___/ |_| ' +echo "$hs_version" echo } export -f title From 3a8eabd57938f526924d07fc061bb05ef15b1400 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 23 Aug 2022 12:10:53 -0600 Subject: [PATCH 0855/1229] include changelog in self_update --- functions/self_update.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/functions/self_update.sh b/functions/self_update.sh index 5df34f34..44e07454 100644 --- a/functions/self_update.sh +++ b/functions/self_update.sh @@ -16,6 +16,9 @@ if git diff --name-only origin/$branch | grep -qs ".sh" ; then [[ "$i" == "--self-update" ]] && unset "args[$count]" && break ((count++)) done + echo "Updating from:" + echo "$hs_version" + echo "Updating To:" curl --silent "https://api.github.com/repos/HeavyBullets8/heavy_script/releases/latest" | jq -r .tag_name,.body [[ -z ${args[*]} ]] && echo -e "No more arguments, exiting..\n\n" && exit echo -e "Running the new version...\n\n" @@ -24,8 +27,8 @@ if git diff --name-only origin/$branch | grep -qs ".sh" ; then # Now exit this old instance exit else - echo -e "HeavyScript is already the latest version:\n\n" - echo "$hs_version" + echo "HeavyScript is already the latest version:" + echo -e "$hs_version\n\n" fi } export -f self_update From 9e0e40c12257079197877eef560af943850c245f Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 23 Aug 2022 12:37:16 -0600 Subject: [PATCH 0856/1229] self update tag release updates --- functions/self_update.sh | 7 ++++--- heavy_script.sh | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/functions/self_update.sh b/functions/self_update.sh index 44e07454..6aab3597 100644 --- a/functions/self_update.sh +++ b/functions/self_update.sh @@ -2,14 +2,15 @@ args=("$@") self_update() { -branch="main" + +latest_ver=$(git describe --tags "$(git rev-list --tags --max-count=1)") git fetch &> /dev/null echo "🅂 🄴 🄻 🄵" echo "🅄 🄿 🄳 🄰 🅃 🄴" -if git diff --name-only origin/$branch | grep -qs ".sh" ; then +if [[ "$hs_version" != "$latest_ver" ]] ; then echo "Found a new version of HeavyScript, updating myself..." git reset --hard -q - git pull --force -q + git checkout "$(latest_ver)" count=0 for i in "${args[@]}" do diff --git a/heavy_script.sh b/heavy_script.sh index b8878186..f772cb6d 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -1,7 +1,7 @@ #!/bin/bash #Version -hs_version=$(curl --silent "https://api.github.com/repos/HeavyBullets8/heavy_script/releases/latest" | jq -r .tag_name) +hs_version=$(git describe --tags) # cd to script, this ensures the script can find the source scripts below, even when ran from a seperate directory script=$(readlink -f "$0") From 1595d1963fe57a0b344199e4aa4357b89747de64 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 23 Aug 2022 12:42:02 -0600 Subject: [PATCH 0857/1229] fix latestver --- functions/self_update.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/functions/self_update.sh b/functions/self_update.sh index 6aab3597..47f29854 100644 --- a/functions/self_update.sh +++ b/functions/self_update.sh @@ -9,8 +9,7 @@ echo "🅂 🄴 🄻 🄵" echo "🅄 🄿 🄳 🄰 🅃 🄴" if [[ "$hs_version" != "$latest_ver" ]] ; then echo "Found a new version of HeavyScript, updating myself..." - git reset --hard -q - git checkout "$(latest_ver)" + git checkout "($latest_ver)" count=0 for i in "${args[@]}" do From 66f4a3bdd1eb034d26bda7bb6445b61e97e8ae0c Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 23 Aug 2022 12:51:33 -0600 Subject: [PATCH 0858/1229] null change to push rl --- functions/self_update.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/self_update.sh b/functions/self_update.sh index 47f29854..268cc21e 100644 --- a/functions/self_update.sh +++ b/functions/self_update.sh @@ -31,4 +31,4 @@ else echo -e "$hs_version\n\n" fi } -export -f self_update +export -f self_update \ No newline at end of file From b2e8274eab5aa865c24c333af2de06b562a85e88 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 23 Aug 2022 12:53:19 -0600 Subject: [PATCH 0859/1229] git fetch tags --- functions/self_update.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/self_update.sh b/functions/self_update.sh index 268cc21e..0e32e23a 100644 --- a/functions/self_update.sh +++ b/functions/self_update.sh @@ -4,7 +4,7 @@ args=("$@") self_update() { latest_ver=$(git describe --tags "$(git rev-list --tags --max-count=1)") -git fetch &> /dev/null +git fetch --tags &> /dev/null echo "🅂 🄴 🄻 🄵" echo "🅄 🄿 🄳 🄰 🅃 🄴" if [[ "$hs_version" != "$latest_ver" ]] ; then From 6fe076243431a87c332493652141fe8f53c622c6 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 23 Aug 2022 12:56:01 -0600 Subject: [PATCH 0860/1229] remove parenthesis in latestver --- functions/self_update.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/self_update.sh b/functions/self_update.sh index 0e32e23a..8da4cc08 100644 --- a/functions/self_update.sh +++ b/functions/self_update.sh @@ -9,7 +9,7 @@ echo "🅂 🄴 🄻 🄵" echo "🅄 🄿 🄳 🄰 🅃 🄴" if [[ "$hs_version" != "$latest_ver" ]] ; then echo "Found a new version of HeavyScript, updating myself..." - git checkout "($latest_ver)" + git checkout "$latest_ver" count=0 for i in "${args[@]}" do From c4d52143506eac209515ba08a1fb1d373658344e Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 23 Aug 2022 12:58:51 -0600 Subject: [PATCH 0861/1229] null change for testing --- functions/self_update.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/self_update.sh b/functions/self_update.sh index 8da4cc08..5f47e090 100644 --- a/functions/self_update.sh +++ b/functions/self_update.sh @@ -31,4 +31,4 @@ else echo -e "$hs_version\n\n" fi } -export -f self_update \ No newline at end of file +export -f self_update From cd836ba537a77d81f9a7813112c72b476f40acff Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 23 Aug 2022 13:02:09 -0600 Subject: [PATCH 0862/1229] Formatting, only pull CL in curl --- functions/self_update.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/functions/self_update.sh b/functions/self_update.sh index 5f47e090..a6ff8064 100644 --- a/functions/self_update.sh +++ b/functions/self_update.sh @@ -4,22 +4,22 @@ args=("$@") self_update() { latest_ver=$(git describe --tags "$(git rev-list --tags --max-count=1)") -git fetch --tags &> /dev/null +git fetch --tags &>/dev/null echo "🅂 🄴 🄻 🄵" echo "🅄 🄿 🄳 🄰 🅃 🄴" if [[ "$hs_version" != "$latest_ver" ]] ; then echo "Found a new version of HeavyScript, updating myself..." - git checkout "$latest_ver" + git checkout "$latest_ver" &>/dev/null count=0 for i in "${args[@]}" do [[ "$i" == "--self-update" ]] && unset "args[$count]" && break ((count++)) done - echo "Updating from:" - echo "$hs_version" - echo "Updating To:" - curl --silent "https://api.github.com/repos/HeavyBullets8/heavy_script/releases/latest" | jq -r .tag_name,.body + echo "Updating from: $hs_version" + echo "Updating To: $latest_ver" + echo "Changelog:" + curl --silent "https://api.github.com/repos/HeavyBullets8/heavy_script/releases/latest" | jq -r .body [[ -z ${args[*]} ]] && echo -e "No more arguments, exiting..\n\n" && exit echo -e "Running the new version...\n\n" sleep 5 From 910cde158c9b107531a266094d6227c63d75b42b Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 23 Aug 2022 13:04:10 -0600 Subject: [PATCH 0863/1229] add echo after changelog --- functions/self_update.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/functions/self_update.sh b/functions/self_update.sh index a6ff8064..c38a46bc 100644 --- a/functions/self_update.sh +++ b/functions/self_update.sh @@ -20,6 +20,7 @@ if [[ "$hs_version" != "$latest_ver" ]] ; then echo "Updating To: $latest_ver" echo "Changelog:" curl --silent "https://api.github.com/repos/HeavyBullets8/heavy_script/releases/latest" | jq -r .body + echo [[ -z ${args[*]} ]] && echo -e "No more arguments, exiting..\n\n" && exit echo -e "Running the new version...\n\n" sleep 5 From 3d8fafb75ee3a9d5f8a7f317c226725eab4efbd8 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 23 Aug 2022 13:05:28 -0600 Subject: [PATCH 0864/1229] fetch before checking for new tags.. --- functions/self_update.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/self_update.sh b/functions/self_update.sh index c38a46bc..058f0640 100644 --- a/functions/self_update.sh +++ b/functions/self_update.sh @@ -3,8 +3,8 @@ args=("$@") self_update() { -latest_ver=$(git describe --tags "$(git rev-list --tags --max-count=1)") git fetch --tags &>/dev/null +latest_ver=$(git describe --tags "$(git rev-list --tags --max-count=1)") echo "🅂 🄴 🄻 🄵" echo "🅄 🄿 🄳 🄰 🅃 🄴" if [[ "$hs_version" != "$latest_ver" ]] ; then From cf01ae51b48786ff2ffa36f0f012da57bb3cafcb Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 23 Aug 2022 13:07:10 -0600 Subject: [PATCH 0865/1229] Null change for testing --- functions/self_update.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/self_update.sh b/functions/self_update.sh index 058f0640..9c60d2b5 100644 --- a/functions/self_update.sh +++ b/functions/self_update.sh @@ -32,4 +32,4 @@ else echo -e "$hs_version\n\n" fi } -export -f self_update +export -f self_update \ No newline at end of file From c745c88f954d06e8df8da950fc0ace4f79dcb02d Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 23 Aug 2022 16:08:08 -0600 Subject: [PATCH 0866/1229] update failed update message --- functions/update_apps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index d8e67390..ceb35166 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -115,7 +115,7 @@ fi if update_app ;then echo_array+=("Updated\n$old_full_ver\n$new_full_ver") else - echo_array+=("Failed to update") + echo_array+=("Failed to update\nManual intervention may be required") echo_array final_check return From 46facda1f8c66ccf336ea46d32f709da9e98074e Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 24 Aug 2022 05:09:59 -0600 Subject: [PATCH 0867/1229] fix external service check --- functions/update_apps.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index ceb35166..7b8fc969 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -9,7 +9,7 @@ echo "Asynchronous Updates: $update_limit" [[ -z $timeout ]] && echo "Default Timeout: 500" && timeout=500 || echo "Custom Timeout: $timeout" [[ "$timeout" -le 120 ]] && echo "Warning: Your timeout is set low and may lead to premature rollbacks or skips" pool=$(cli -c 'app kubernetes config' | grep -E "dataset\s\|" | awk -F '|' '{print $3}' | awk -F '/' '{print $1}' | tr -d " \t\n\r") - +rm external_services 2> /dev/null/ # TODO remove later it=0 while_count=0 rm deploying 2>/dev/null @@ -92,7 +92,7 @@ fi [[ ! -e external_services ]] && touch external_services if ! grep -qs "^$app_name," external_services ; then - if ! grep qs "/external-service" /mnt/"$pool"/ix-applications/releases/"$app_name"/charts/"$(find /mnt/"$pool"/ix-applications/releases/"$app_name"/charts/ -maxdepth 1 -type d -printf '%P\n' | sort -r | head -n 1)"/Chart.yaml 2>/dev/null; then + if ! grep -qs "/external-service" /mnt/"$pool"/ix-applications/releases/"$app_name"/charts/"$(find /mnt/"$pool"/ix-applications/releases/"$app_name"/charts/ -maxdepth 1 -type d -printf '%P\n' | sort -r | head -n 1)"/Chart.yaml; then echo "$app_name,false" >> external_services else echo "$app_name,true" >> external_services From 1c9917c9e7978bc977240eff4427a3dada1c820e Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 24 Aug 2022 05:15:21 -0600 Subject: [PATCH 0868/1229] fix space after rm ext services --- functions/update_apps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 7b8fc969..73660172 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -9,7 +9,7 @@ echo "Asynchronous Updates: $update_limit" [[ -z $timeout ]] && echo "Default Timeout: 500" && timeout=500 || echo "Custom Timeout: $timeout" [[ "$timeout" -le 120 ]] && echo "Warning: Your timeout is set low and may lead to premature rollbacks or skips" pool=$(cli -c 'app kubernetes config' | grep -E "dataset\s\|" | awk -F '|' '{print $3}' | awk -F '/' '{print $1}' | tr -d " \t\n\r") -rm external_services 2> /dev/null/ # TODO remove later +rm external_services 2>/dev/null/ # TODO remove later it=0 while_count=0 rm deploying 2>/dev/null From 4f83c3b59926c4ae28062e4269bcb1e93743b57f Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 24 Aug 2022 05:21:43 -0600 Subject: [PATCH 0869/1229] remove trailing line on devnull --- functions/update_apps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 73660172..8a0c353f 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -9,7 +9,7 @@ echo "Asynchronous Updates: $update_limit" [[ -z $timeout ]] && echo "Default Timeout: 500" && timeout=500 || echo "Custom Timeout: $timeout" [[ "$timeout" -le 120 ]] && echo "Warning: Your timeout is set low and may lead to premature rollbacks or skips" pool=$(cli -c 'app kubernetes config' | grep -E "dataset\s\|" | awk -F '|' '{print $3}' | awk -F '/' '{print $1}' | tr -d " \t\n\r") -rm external_services 2>/dev/null/ # TODO remove later +rm external_services 2>/dev/null # TODO remove later it=0 while_count=0 rm deploying 2>/dev/null From d229f2afb568731276d39aa33da7ffce33f3db22 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 24 Aug 2022 05:43:04 -0600 Subject: [PATCH 0870/1229] place ver check after cd --- heavy_script.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index f772cb6d..f9db3b84 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -1,14 +1,13 @@ #!/bin/bash -#Version -hs_version=$(git describe --tags) - # cd to script, this ensures the script can find the source scripts below, even when ran from a seperate directory script=$(readlink -f "$0") script_path=$(dirname "$script") script_name="heavy_script.sh" cd "$script_path" || { echo "Error: Failed to change to script directory" ; exit ; } +#Version +hs_version=$(git describe --tags) source functions/backup.sh source functions/dns.sh From e19b68a2fe6def6edeb76b8392462e45b76e312c Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Wed, 24 Aug 2022 06:12:10 +0000 Subject: [PATCH 0871/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.173.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 29645711..687bb30a 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@a268351ade4e17ee3f9e4b0a77970ca706c02ec3 # tag=v32.172.1 + uses: renovatebot/github-action@87bb2b123c0b433caed829d551896843e84a36ef # tag=v32.173.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From def11937b8a8e8b372783336ec57f5e2cf840961 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 24 Aug 2022 15:51:19 -0600 Subject: [PATCH 0872/1229] improve rollback logic --- functions/update_apps.sh | 37 +++++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 8a0c353f..a72f54d9 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -192,7 +192,7 @@ if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then while true do status=$(grep "^$app_name," all_app_status | awk -F ',' '{print $2}') - if [[ $count -lt 1 && $status == "ACTIVE" && "$(grep "^$app_name," deploying 2>/dev/null | awk -F ',' '{print $2}')" != "DEPLOYING" ]]; then # If status shows up as Active or Stopped on the first check, verify that. Otherwise it may be a false report.. + if [[ $count -lt 1 && $status == "ACTIVE" && "$(grep "^$app_name," deploying 2>/dev/null | awk -F ',' '{print $2}')" != "DEPLOYING" ]]; then # If status shows up as Active or Stopped on the first check, verify that. Otherwise it may be a false report.. [[ "$verbose" == "true" ]] && echo_array+=("Verifying $status..") before_loop=$(head -n 1 all_app_status) current_loop=0 @@ -229,10 +229,18 @@ if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then echo_array+=("If this is a slow starting application, set a higher timeout with -t") echo_array+=("If this applicaion is always DEPLOYING, you can disable all probes under the Healthcheck Probes Liveness section in the edit configuration") echo_array+=("Reverting update..") - midclt call chart.release.rollback "$app_name" "{\"item_version\": \"$rollback_version\"}" &> /dev/null || { echo_array+=("Error: Failed to rollback $app_name") ; break ; } - [[ "$startstatus" == "STOPPED" ]] && failed="true" && after_update_actions #run back after_update_actions function if the app was stopped prior to update echo "$app_name,$new_full_ver" >> failed - break + if rollback_app ; then + echo_array+=("Rolled Back") + else + echo_array+=("Error: Failed to rollback $app_name\nAbandoning") + echo_array + return 1 + fi + failed="true" + SECONDS=0 + count=0 + continue #run back after_update_actions function if the app was stopped prior to update else echo_array+=("Error: Run Time($SECONDS) for $app_name has exceeded Timeout($timeout)") echo_array+=("The application failed to be ACTIVE even after a rollback") @@ -251,6 +259,7 @@ if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then echo_array+=("If this is a slow starting application, set a higher timeout with -t") echo_array+=("If this applicaion is always DEPLOYING, you can disable all probes under the Healthcheck Probes Liveness section in the edit configuration") echo_array+=("Manual intervention is required\nStopping, then Abandoning") + echo "$app_name,$new_full_ver" >> failed if stop_app ; then echo_array+=("Stopped") else @@ -272,6 +281,26 @@ echo_array export -f after_update_actions +rollback_app(){ +count=0 +while [[ $update_avail != "true" ]] +do + update_avail=$(grep "^$app_name," all_app_status | awk -F ',' '{print $3}') + if [[ $count -gt 2 ]]; then # If failed to rollback app 3 times, return failure to parent shell + return 1 + elif ! cli -c "app chart_release rollback release_name=\"$app_name\" rollback_options={\"item_version\": \"$rollback_version\"}" &> /dev/null ; then + before_loop=$(head -n 1 all_app_status) + ((count++)) + until [[ $(head -n 1 all_app_status) != "$before_loop" ]] # Upon failure, wait for status update before continuing + do + sleep 1 + done + else + break + fi +done +} + echo_array(){ #Dump the echo_array, ensures all output is in a neat order. for i in "${echo_array[@]}" From fbdcf88a9995a31f27e5e6720c4cb4a89d3df970 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 24 Aug 2022 16:16:34 -0600 Subject: [PATCH 0873/1229] fix rollback_app logic --- functions/update_apps.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index a72f54d9..d695e4a2 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -283,7 +283,8 @@ export -f after_update_actions rollback_app(){ count=0 -while [[ $update_avail != "true" ]] +update_avail=$(grep "^$app_name," all_app_status | awk -F ',' '{print $3}') +while [[ $update_avail == "false" ]] do update_avail=$(grep "^$app_name," all_app_status | awk -F ',' '{print $3}') if [[ $count -gt 2 ]]; then # If failed to rollback app 3 times, return failure to parent shell From c1dc53c23166c549b07be5d1dc750a967244b485 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 24 Aug 2022 16:39:08 -0600 Subject: [PATCH 0874/1229] add support back for container updates --- functions/update_apps.sh | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index d695e4a2..282e5c03 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -16,7 +16,7 @@ rm deploying 2>/dev/null rm finished 2>/dev/null while true do - if while_status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' 2>/dev/null) ; then + if while_status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,container_images_update_available,status' 2>/dev/null) ; then ((while_count++)) [[ -z $while_status ]] && continue || echo -e "$while_count\n$while_status" > all_app_status mapfile -t deploying_check < <(grep ",DEPLOYING," all_app_status) @@ -107,7 +107,6 @@ if [[ $stop_before_update == "true" && "$startstatus" != "STOPPED" ]]; then # C else echo_array+=("Error: Failed to stop $app_name") echo_array - final_check return 1 fi fi @@ -117,16 +116,13 @@ if update_app ;then else echo_array+=("Failed to update\nManual intervention may be required") echo_array - final_check return fi if grep -qs "^$app_name,true" external_services ; then echo_array - final_check return else after_update_actions - final_check fi } export -f pre_process @@ -136,12 +132,13 @@ update_app(){ current_loop=0 while true do - update_avail=$(grep "^$app_name," all_app_status | awk -F ',' '{print $3}') - if [[ $update_avail == "true" ]]; then + app_update_avail=$(grep "^$app_name," all_app_status | awk -F ',' '{print $3}') + cont_update_avail=$(grep "^$app_name," all_app_status | awk -F ',' '{print $6}') + if [[ $app_update_avail == "true" || $cont_update_avail == "true" ]]; then if ! cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null ; then before_loop=$(head -n 1 all_app_status) current_loop=0 - until [[ "$(grep "^$app_name," all_app_status | awk -F ',' '{print $3}')" != "$update_avail" ]] # Wait for a specific change to app status, or 3 refreshes of the file to go by. + until [[ "$(grep "^$app_name," all_app_status | awk -F ',' '{print $3}')" != "$app_update_avail" || "$(grep "^$app_name," all_app_status | awk -F ',' '{print $6}')" != "$cont_update_avail" ]] # Wait for a specific change to app status, or 3 refreshes of the file to go by. do if [[ $current_loop -gt 2 ]]; then cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null || return 1 # After waiting, attempt an update once more, if fails, return error code @@ -153,7 +150,7 @@ do done fi break - elif [[ $update_avail == "false" ]]; then + elif [[ $app_update_avail == "false" && $cont_update_avail == "false" ]]; then break else sleep 3 @@ -224,7 +221,13 @@ if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then fi elif [[ "$SECONDS" -ge "$timeout" ]]; then if [[ $rollback == "true" ]]; then - if [[ "$failed" != "true" ]]; then + if [[ $old_full_ver == "$new_full_ver" ]]; then + echo_array+=("Error: Run Time($SECONDS) for $app_name has exceeded Timeout($timeout)") + echo_array+=("This is the result of a container image update..") + echo_array+=("Reverting is not possible, Abandoning") + echo_array + return 1 + elif [[ "$failed" != "true" ]]; then echo_array+=("Error: Run Time($SECONDS) for $app_name has exceeded Timeout($timeout)") echo_array+=("If this is a slow starting application, set a higher timeout with -t") echo_array+=("If this applicaion is always DEPLOYING, you can disable all probes under the Healthcheck Probes Liveness section in the edit configuration") @@ -283,10 +286,10 @@ export -f after_update_actions rollback_app(){ count=0 -update_avail=$(grep "^$app_name," all_app_status | awk -F ',' '{print $3}') -while [[ $update_avail == "false" ]] +app_update_avail=$(grep "^$app_name," all_app_status | awk -F ',' '{print $3}') +while [[ $app_update_avail == "false" ]] do - update_avail=$(grep "^$app_name," all_app_status | awk -F ',' '{print $3}') + app_update_avail=$(grep "^$app_name," all_app_status | awk -F ',' '{print $3}') if [[ $count -gt 2 ]]; then # If failed to rollback app 3 times, return failure to parent shell return 1 elif ! cli -c "app chart_release rollback release_name=\"$app_name\" rollback_options={\"item_version\": \"$rollback_version\"}" &> /dev/null ; then @@ -308,10 +311,11 @@ for i in "${echo_array[@]}" do echo -e "$i" done - +final_check } export -f echo_array + final_check(){ [[ ! -e finished ]] && touch finished echo "$app_name,finished" >> finished From 2bc4ba3d6226a19fc5d5346828b9b72a873714a2 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 24 Aug 2022 17:05:16 -0600 Subject: [PATCH 0875/1229] use regex rather than 2 variables to check update --- functions/update_apps.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 282e5c03..61d670a6 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -132,13 +132,12 @@ update_app(){ current_loop=0 while true do - app_update_avail=$(grep "^$app_name," all_app_status | awk -F ',' '{print $3}') - cont_update_avail=$(grep "^$app_name," all_app_status | awk -F ',' '{print $6}') - if [[ $app_update_avail == "true" || $cont_update_avail == "true" ]]; then + update_avail=$(grep "^$app_name," all_app_status | awk -F ',' '{print $3","$6}') + if [[ $update_avail =~ "true" ]]; then if ! cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null ; then before_loop=$(head -n 1 all_app_status) current_loop=0 - until [[ "$(grep "^$app_name," all_app_status | awk -F ',' '{print $3}')" != "$app_update_avail" || "$(grep "^$app_name," all_app_status | awk -F ',' '{print $6}')" != "$cont_update_avail" ]] # Wait for a specific change to app status, or 3 refreshes of the file to go by. + until [[ "$(grep "^$app_name," all_app_status | awk -F ',' '{print $3","$6}')" != "$update_avail" ]] # Wait for a specific change to app status, or 3 refreshes of the file to go by. do if [[ $current_loop -gt 2 ]]; then cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null || return 1 # After waiting, attempt an update once more, if fails, return error code @@ -150,7 +149,7 @@ do done fi break - elif [[ $app_update_avail == "false" && $cont_update_avail == "false" ]]; then + elif [[ ! $update_avail =~ "true" ]]; then break else sleep 3 From 2e91f22110e6b54c140120b66fddcf3e14443b19 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Thu, 25 Aug 2022 06:22:08 +0000 Subject: [PATCH 0876/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.174.2 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 687bb30a..27286eda 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@87bb2b123c0b433caed829d551896843e84a36ef # tag=v32.173.0 + uses: renovatebot/github-action@ff388b7045803e0e197bb4c496f431b01742deb6 # tag=v32.174.2 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 212e894744ef2d2e69aefc3b48e279fdbdb13b6b Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 25 Aug 2022 22:00:26 -0600 Subject: [PATCH 0877/1229] exit code 0 on script end --- heavy_script.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index f9db3b84..7a687b51 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -162,5 +162,5 @@ elif [[ "$sync" == "true" && -z "$backup" ]]; then # If only sync is true, run i sync fi [[ "$update_all_apps" == "true" || "$update_apps" == "true" ]] && commander -[[ "$prune" == "true" ]] && prune - +[[ "$prune" == "true" ]] && prune +exit 0 \ No newline at end of file From fda0b7ca882be2ba2c8df23c3bf60df16093f4cc Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 25 Aug 2022 22:16:44 -0600 Subject: [PATCH 0878/1229] git reset hard to force tagged updates --- functions/self_update.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/functions/self_update.sh b/functions/self_update.sh index 9c60d2b5..a0ee1d01 100644 --- a/functions/self_update.sh +++ b/functions/self_update.sh @@ -3,7 +3,8 @@ args=("$@") self_update() { -git fetch --tags &>/dev/null +git fetch --tags &>/dev/null +git reset --hard latest_ver=$(git describe --tags "$(git rev-list --tags --max-count=1)") echo "🅂 🄴 🄻 🄵" echo "🅄 🄿 🄳 🄰 🅃 🄴" From 72930e2f14a8ec39328849e62eb56a88f3ce7c5b Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 25 Aug 2022 22:39:26 -0600 Subject: [PATCH 0879/1229] spacing, function explanation --- functions/backup.sh | 3 +- functions/menu.sh | 4 +- functions/misc.sh | 3 + functions/mount.sh | 1 + functions/script_create.sh | 1 + functions/self_update.sh | 1 + functions/update_apps.sh | 131 +++++++++++++++++++------------------ heavy_script.sh | 9 +-- 8 files changed, 77 insertions(+), 76 deletions(-) diff --git a/functions/backup.sh b/functions/backup.sh index 642b58f5..0ca69069 100644 --- a/functions/backup.sh +++ b/functions/backup.sh @@ -30,7 +30,6 @@ echo export -f backup - deleteBackup(){ while true do @@ -170,4 +169,4 @@ do done done } -export -f restore +export -f restore \ No newline at end of file diff --git a/functions/menu.sh b/functions/menu.sh index 5b86ca5f..a8677314 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -1,5 +1,6 @@ #!/bin/bash + menu(){ clear -x title @@ -45,7 +46,6 @@ case $selection in 8) script_create ;; - 9) cmd_to_container ;; @@ -55,4 +55,4 @@ case $selection in esac echo } -export -f menu +export -f menu \ No newline at end of file diff --git a/functions/misc.sh b/functions/misc.sh index 33b4d4c0..ebff4ff8 100644 --- a/functions/misc.sh +++ b/functions/misc.sh @@ -15,6 +15,7 @@ echo } export -f sync + prune(){ echo -e "🄿 🅁 🅄 🄽 🄴" echo "Pruned Docker Images" @@ -22,6 +23,7 @@ docker image prune -af | grep "^Total" || echo "Failed to Prune Docker Images" } export -f prune + title(){ echo ' _ _ _____ _ _ ' echo '| | | | / ___| (_) | | ' @@ -36,6 +38,7 @@ echo } export -f title + help(){ [[ $help == "true" ]] && clear -x diff --git a/functions/mount.sh b/functions/mount.sh index 26198633..c915407e 100644 --- a/functions/mount.sh +++ b/functions/mount.sh @@ -1,5 +1,6 @@ #!/bin/bash + mount(){ while true do diff --git a/functions/script_create.sh b/functions/script_create.sh index b1448218..de761cc6 100644 --- a/functions/script_create.sh +++ b/functions/script_create.sh @@ -1,5 +1,6 @@ #!/bin/bash + script_create(){ while true do diff --git a/functions/self_update.sh b/functions/self_update.sh index a0ee1d01..144157d4 100644 --- a/functions/self_update.sh +++ b/functions/self_update.sh @@ -1,5 +1,6 @@ #!/bin/bash + args=("$@") self_update() { diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 61d670a6..50629e2e 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -9,7 +9,6 @@ echo "Asynchronous Updates: $update_limit" [[ -z $timeout ]] && echo "Default Timeout: 500" && timeout=500 || echo "Custom Timeout: $timeout" [[ "$timeout" -le 120 ]] && echo "Warning: Your timeout is set low and may lead to premature rollbacks or skips" pool=$(cli -c 'app kubernetes config' | grep -E "dataset\s\|" | awk -F '|' '{print $3}' | awk -F '/' '{print $1}' | tr -d " \t\n\r") -rm external_services 2>/dev/null # TODO remove later it=0 while_count=0 rm deploying 2>/dev/null @@ -42,14 +41,9 @@ do if [[ "$proc_count" -ge "$update_limit" ]]; then sleep 3 elif [[ $it -lt ${#array[@]} ]]; then - # loop=0 - # until [[ $loop -ge 2 || $it -ge ${#array[@]} ]]; - # do pre_process "${array[$it]}" & processes+=($!) ((it++)) - # ((loop++)) - # done elif [[ $proc_count != 0 || $(wc -l finished 2>/dev/null | awk '{ print $1 }') -lt "${#array[@]}" ]]; then # Wait for all processes to finish sleep 3 else # All processes must be completed, break out of loop @@ -78,6 +72,8 @@ diff_chart=$(diff <(echo "$old_chart_ver") <(echo "$new_chart_ver")) #caluclatin old_full_ver=$(echo "${array[$it]}" | awk -F ',' '{print $4}') #Upgraded From new_full_ver=$(echo "${array[$it]}" | awk -F ',' '{print $5}') #Upraded To rollback_version=$(echo "${array[$it]}" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}') + +# Skip update if application previously failed on this exact update version if grep -qs "^$app_name," failed 2>/dev/null; then failed_ver=$(grep "^$app_name," failed | awk -F ',' '{print $2}') if [[ "$failed_ver" == "$new_full_ver" ]] ; then @@ -90,6 +86,7 @@ if grep -qs "^$app_name," failed 2>/dev/null; then fi fi +# Check if app is external services, append outcome to external_services file [[ ! -e external_services ]] && touch external_services if ! grep -qs "^$app_name," external_services ; then if ! grep -qs "/external-service" /mnt/"$pool"/ix-applications/releases/"$app_name"/charts/"$(find /mnt/"$pool"/ix-applications/releases/"$app_name"/charts/ -maxdepth 1 -type d -printf '%P\n' | sort -r | head -n 1)"/Chart.yaml; then @@ -99,6 +96,7 @@ if ! grep -qs "^$app_name," external_services ; then fi fi +# If user is using -S, stop app prior to updating echo_array+=("\n$app_name") if [[ $stop_before_update == "true" && "$startstatus" != "STOPPED" ]]; then # Check to see if user is using -S or not [[ "$verbose" == "true" ]] && echo_array+=("Stopping prior to update..") @@ -110,6 +108,8 @@ if [[ $stop_before_update == "true" && "$startstatus" != "STOPPED" ]]; then # C return 1 fi fi + +# Send app through update function [[ "$verbose" == "true" ]] && echo_array+=("Updating..") if update_app ;then echo_array+=("Updated\n$old_full_ver\n$new_full_ver") @@ -118,70 +118,19 @@ else echo_array return fi + +# If app is external services, do not send for post processing if grep -qs "^$app_name,true" external_services ; then echo_array return else - after_update_actions + post_process fi } export -f pre_process -update_app(){ -current_loop=0 -while true -do - update_avail=$(grep "^$app_name," all_app_status | awk -F ',' '{print $3","$6}') - if [[ $update_avail =~ "true" ]]; then - if ! cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null ; then - before_loop=$(head -n 1 all_app_status) - current_loop=0 - until [[ "$(grep "^$app_name," all_app_status | awk -F ',' '{print $3","$6}')" != "$update_avail" ]] # Wait for a specific change to app status, or 3 refreshes of the file to go by. - do - if [[ $current_loop -gt 2 ]]; then - cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null || return 1 # After waiting, attempt an update once more, if fails, return error code - elif ! echo -e "$(head -n 1 all_app_status)" | grep -qs ^"$before_loop" ; then # The file has been updated, but nothing changed specifically for the app. - before_loop=$(head -n 1 all_app_status) - ((current_loop++)) - fi - sleep 1 - done - fi - break - elif [[ ! $update_avail =~ "true" ]]; then - break - else - sleep 3 - fi -done -} -export -f update_app - - -stop_app(){ -count=0 -while [[ "$status" != "STOPPED" ]] -do - status=$( grep "^$app_name," all_app_status | awk -F ',' '{print $2}') - if [[ $count -gt 2 ]]; then # If failed to stop app 3 times, return failure to parent shell - return 1 - elif ! cli -c 'app chart_release scale release_name='\""$app_name"\"\ 'scale_options={"replica_count": 0}' &> /dev/null ; then - before_loop=$(head -n 1 all_app_status) - ((count++)) - until [[ $(head -n 1 all_app_status) != "$before_loop" ]] # Upon failure, wait for status update before continuing - do - sleep 1 - done - else - break - fi -done -} -export -f stop_app - - -after_update_actions(){ +post_process(){ SECONDS=0 count=0 if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then @@ -242,7 +191,7 @@ if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then failed="true" SECONDS=0 count=0 - continue #run back after_update_actions function if the app was stopped prior to update + continue #run back post_process function if the app was stopped prior to update else echo_array+=("Error: Run Time($SECONDS) for $app_name has exceeded Timeout($timeout)") echo_array+=("The application failed to be ACTIVE even after a rollback") @@ -280,7 +229,7 @@ if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then fi echo_array } -export -f after_update_actions +export -f post_process rollback_app(){ @@ -304,6 +253,60 @@ do done } + +update_app(){ +current_loop=0 +while true +do + update_avail=$(grep "^$app_name," all_app_status | awk -F ',' '{print $3","$6}') + if [[ $update_avail =~ "true" ]]; then + if ! cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null ; then + before_loop=$(head -n 1 all_app_status) + current_loop=0 + until [[ "$(grep "^$app_name," all_app_status | awk -F ',' '{print $3","$6}')" != "$update_avail" ]] # Wait for a specific change to app status, or 3 refreshes of the file to go by. + do + if [[ $current_loop -gt 2 ]]; then + cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null || return 1 # After waiting, attempt an update once more, if fails, return error code + elif ! echo -e "$(head -n 1 all_app_status)" | grep -qs ^"$before_loop" ; then # The file has been updated, but nothing changed specifically for the app. + before_loop=$(head -n 1 all_app_status) + ((current_loop++)) + fi + sleep 1 + done + fi + break + elif [[ ! $update_avail =~ "true" ]]; then + break + else + sleep 3 + fi +done +} +export -f update_app + + +stop_app(){ +count=0 +while [[ "$status" != "STOPPED" ]] +do + status=$( grep "^$app_name," all_app_status | awk -F ',' '{print $2}') + if [[ $count -gt 2 ]]; then # If failed to stop app 3 times, return failure to parent shell + return 1 + elif ! cli -c 'app chart_release scale release_name='\""$app_name"\"\ 'scale_options={"replica_count": 0}' &> /dev/null ; then + before_loop=$(head -n 1 all_app_status) + ((count++)) + until [[ $(head -n 1 all_app_status) != "$before_loop" ]] # Upon failure, wait for status update before continuing + do + sleep 1 + done + else + break + fi +done +} +export -f stop_app + + echo_array(){ #Dump the echo_array, ensures all output is in a neat order. for i in "${echo_array[@]}" @@ -318,4 +321,4 @@ export -f echo_array final_check(){ [[ ! -e finished ]] && touch finished echo "$app_name,finished" >> finished -} +} \ No newline at end of file diff --git a/heavy_script.sh b/heavy_script.sh index 7a687b51..6858ed4d 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -1,5 +1,6 @@ #!/bin/bash + # cd to script, this ensures the script can find the source scripts below, even when ran from a seperate directory script=$(readlink -f "$0") script_path=$(dirname "$script") @@ -20,13 +21,10 @@ source functions/cmd_to_container.sh source functions/script_create.sh - - #If no argument is passed, kill the script. [[ -z "$*" || "-" == "$*" || "--" == "$*" ]] && menu - # Parse script options while getopts ":si:rb:t:uUpSRv-:" opt do @@ -121,10 +119,6 @@ do v) verbose="true" ;; - \?) - echo -e "Invalid Option \"-$OPTARG\"\n" - help - ;; *) echo -e "Invalid Option \"-$OPTARG\"\n" help @@ -133,7 +127,6 @@ do done - #exit if incompatable functions are called [[ "$update_all_apps" == "true" && "$update_apps" == "true" ]] && echo -e "-U and -u cannot BOTH be called" && exit From f77ffd65430755f4a6ab401b340e9b56035b6021 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 25 Aug 2022 22:40:38 -0600 Subject: [PATCH 0880/1229] README typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 49ded17b..8d4a3bfe 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ |--------------- |------------------------ |----------------- |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | -U | -U
-U 5 | None or Integer | Update applications, ignoring major version changes
_Optionally, you can supply a number after the argument to update multiple applications at once_ | | -u | -u
-u 5 | None or Integer | Update applications, do NOT update if there was a major version change
_Optionally, you can supply a number after the argument to update multiple applications at once_ | -| -b | -b 14 | Integer | Backup `ix-appliactions` dataset
_Creates backups up to the number you've chosen_ | +| -b | -b 14 | Integer | Backup `ix-applications` dataset
_Creates backups up to the number you've chosen_ | | -i | -i nextcloud -i sonarr | String | Applications listed will be ignored during updating
_List one application after another as shown in the example_ | | -r | -r | None | Monitors applications after they update
If the app does not become "ACTIVE" after either:
The custom Timeout, or Default Timeout,
rollback the application. | | -v | -v | None | Verbose Output
_Look at the bottom of this page for an example_ | From 932fcb2a13c1cc2906f9c2ee93efb28c83a0ff11 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Fri, 26 Aug 2022 06:28:04 +0000 Subject: [PATCH 0881/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.177.1 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 27286eda..de7871ea 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@ff388b7045803e0e197bb4c496f431b01742deb6 # tag=v32.174.2 + uses: renovatebot/github-action@941a3d56f33402c25830d6a10e09ad7fb46774f1 # tag=v32.177.1 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 9bf22f524ebc63ab0081e18fca5202f3b9becba0 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Sat, 27 Aug 2022 00:35:00 +0000 Subject: [PATCH 0882/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.179.1 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index de7871ea..8b31e8c8 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@941a3d56f33402c25830d6a10e09ad7fb46774f1 # tag=v32.177.1 + uses: renovatebot/github-action@6d5b2a0885ad64a8b7e7f95030178463c2bc64ed # tag=v32.179.1 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From bac6c0c290e127515acca1ecdab821c54fbe26f0 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Sun, 28 Aug 2022 12:11:29 +0000 Subject: [PATCH 0883/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.180.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 8b31e8c8..baeb8933 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@6d5b2a0885ad64a8b7e7f95030178463c2bc64ed # tag=v32.179.1 + uses: renovatebot/github-action@59a07fba98dcaea797f2d50ec0c478321c250b41 # tag=v32.180.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From d4819c41ce692d9a02984162b6652f5546abbc50 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Mon, 29 Aug 2022 06:37:58 +0000 Subject: [PATCH 0884/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.181.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index baeb8933..526289ec 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@59a07fba98dcaea797f2d50ec0c478321c250b41 # tag=v32.180.0 + uses: renovatebot/github-action@40e79a830326c7c30303c38ff20188b87267e4cd # tag=v32.181.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 08ce9bbb97ac1fe0a884c71e8b7ca5e04a41ed72 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Mon, 29 Aug 2022 18:09:04 +0000 Subject: [PATCH 0885/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.182.1 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 526289ec..6b1f81aa 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@40e79a830326c7c30303c38ff20188b87267e4cd # tag=v32.181.0 + uses: renovatebot/github-action@d01fb1d807b0c8658dc65fdc2eccb3d2056c9622 # tag=v32.182.1 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From accf72c7b130c421847d060b9e628dc4790e43c7 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Tue, 30 Aug 2022 12:17:06 +0000 Subject: [PATCH 0886/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.183.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 6b1f81aa..9ca3afde 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@d01fb1d807b0c8658dc65fdc2eccb3d2056c9622 # tag=v32.182.1 + uses: renovatebot/github-action@181a77c121b90ce0b0d3ad9d7eea5cfc083ec9e7 # tag=v32.183.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From c0f6ed10a83133a8f3dd520fe5089cf4c1ae44f1 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 30 Aug 2022 21:36:34 -0600 Subject: [PATCH 0887/1229] Documentation, remove redundant code, spacing --- functions/menu.sh | 1 - functions/mount.sh | 4 ++-- functions/update_apps.sh | 3 +++ heavy_script.sh | 5 ++--- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/functions/menu.sh b/functions/menu.sh index a8677314..921b64f6 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -32,7 +32,6 @@ case $selection in ;; 4) read -rt 120 -p "What is the maximun number of backups you would like?: " number_of_backups || { echo -e "\nFailed to make a selection in time" ; exit; } - backup="true" ;; 5) restore diff --git a/functions/mount.sh b/functions/mount.sh index c915407e..c58f8571 100644 --- a/functions/mount.sh +++ b/functions/mount.sh @@ -51,7 +51,7 @@ do mapfile -t full_path < <(zfs list | grep "$volume_name" | awk '{print $1}') if [[ "${#full_path[@]}" -gt 1 ]]; then #if there is another app with the same name on another pool, use the current pools application, since the other instance is probably old, or unused, or a backup. echo "$app is using the same volume identifier on more than one pool.. attempting to use your current kubernetes apps pool" - pool=$(cli -c 'app kubernetes config' | grep -E "dataset\s\|" | awk -F '|' '{print $3}' | awk -F '/' '{print $1}' | tr -d " \t\n\r") + pool=$(cli -c 'app kubernetes config' | grep -E "pool\s\|" | awk -F '|' '{print $3}' | tr -d " \t\n\r") full_path=$(zfs list | grep "$volume_name" | grep "$pool" | awk '{print $1}') fi echo -e "\nMounting\n$full_path\nTo\n/mnt/heavyscript/$data_name" @@ -90,7 +90,7 @@ do mapfile -t path < <(find /mnt/*/ix-applications/releases/"$app"/volumes/ -maxdepth 0 | cut -c 6-) if [[ "${#path[@]}" -gt 1 ]]; then #if there is another app with the same name on another pool, use the current pools application, since the other instance is probably old, or unused, or a backup. echo "$i is a name used on more than one pool.. attempting to use your current kubernetes apps pool" - pool=$(cli -c 'app kubernetes config' | grep -E "dataset\s\|" | awk -F '|' '{print $3}' | awk -F '/' '{print $1}' | tr -d " \t\n\r") + pool=$(cli -c 'app kubernetes config' | grep -E "pool\s\|" | awk -F '|' '{print $3}' | tr -d " \t\n\r") full_path=$(find /mnt/"$pool"/ix-applications/releases/"$app"/volumes/ -maxdepth 0 | cut -c 6-) zfs set mountpoint=legacy "$full_path""$pvc" echo "$i unmounted" && rmdir /mnt/heavyscript/"$i" || echo "failed to unmount $i" diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 50629e2e..ce6a4476 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -136,6 +136,8 @@ count=0 if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then while true do + + # If app reports ACTIVE right away, assume its a false positive and wait for it to change, or trust it after 5 updates to all_app_status status=$(grep "^$app_name," all_app_status | awk -F ',' '{print $2}') if [[ $count -lt 1 && $status == "ACTIVE" && "$(grep "^$app_name," deploying 2>/dev/null | awk -F ',' '{print $2}')" != "DEPLOYING" ]]; then # If status shows up as Active or Stopped on the first check, verify that. Otherwise it may be a false report.. [[ "$verbose" == "true" ]] && echo_array+=("Verifying $status..") @@ -152,6 +154,7 @@ if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then done fi (( count++ )) + if [[ "$status" == "ACTIVE" ]]; then if [[ "$startstatus" == "STOPPED" ]]; then [[ "$verbose" == "true" ]] && echo_array+=("Returing to STOPPED state..") diff --git a/heavy_script.sh b/heavy_script.sh index 6858ed4d..76d03a9a 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -66,7 +66,6 @@ do number_of_backups=$OPTARG ! [[ $OPTARG =~ ^[0-9]+$ ]] && echo -e "Error: -b needs to be assigned an interger\n\"""$number_of_backups""\" is not an interger" >&2 && exit [[ "$number_of_backups" -le 0 ]] && echo "Error: Number of backups is required to be at least 1" && exit - backup="true" ;; r) rollback="true" @@ -138,14 +137,14 @@ done [[ "$dns" == "true" ]] && dns && exit [[ "$restore" == "true" ]] && restore && exit [[ "$mount" == "true" ]] && mount && exit -if [[ "$backup" == "true" && "$sync" == "true" ]]; then # Run backup and sync at the same time +if [[ "$backup" -gt 1 && "$sync" == "true" ]]; then # Run backup and sync at the same time echo "🅃 🄰 🅂 🄺 🅂 :" echo -e "-Backing up ix-applications Dataset\n-Syncing catalog(s)" echo -e "This can take a LONG time, Please Wait For Both Output..\n\n" backup & sync & wait -elif [[ "$backup" == "true" && -z "$sync" ]]; then # If only backup is true, run it +elif [[ "$backup" -gt 1 && -z "$sync" ]]; then # If only backup is true, run it echo "🅃 🄰 🅂 🄺 :" echo -e "-Backing up \"ix-applications\" Dataset\nPlease Wait..\n\n" backup From a406406002ffc8668edd121bdf9f7b5382792bb6 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 30 Aug 2022 21:40:08 -0600 Subject: [PATCH 0888/1229] change backup variable --- heavy_script.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/heavy_script.sh b/heavy_script.sh index 76d03a9a..d669aac8 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -137,18 +137,18 @@ done [[ "$dns" == "true" ]] && dns && exit [[ "$restore" == "true" ]] && restore && exit [[ "$mount" == "true" ]] && mount && exit -if [[ "$backup" -gt 1 && "$sync" == "true" ]]; then # Run backup and sync at the same time +if [[ "$number_of_backups" -gt 1 && "$sync" == "true" ]]; then # Run backup and sync at the same time echo "🅃 🄰 🅂 🄺 🅂 :" echo -e "-Backing up ix-applications Dataset\n-Syncing catalog(s)" echo -e "This can take a LONG time, Please Wait For Both Output..\n\n" backup & sync & wait -elif [[ "$backup" -gt 1 && -z "$sync" ]]; then # If only backup is true, run it +elif [[ "$number_of_backups" -gt 1 && -z "$sync" ]]; then # If only backup is true, run it echo "🅃 🄰 🅂 🄺 :" echo -e "-Backing up \"ix-applications\" Dataset\nPlease Wait..\n\n" backup -elif [[ "$sync" == "true" && -z "$backup" ]]; then # If only sync is true, run it +elif [[ "$sync" == "true" && -z "$number_of_backups" ]]; then # If only sync is true, run it echo "🅃 🄰 🅂 🄺 :" echo -e "Syncing Catalog(s)\nThis Takes a LONG Time, Please Wait..\n\n" sync From 5a1f5a087e3e8bd0a75c60350763917b0f84dee7 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 30 Aug 2022 22:06:20 -0600 Subject: [PATCH 0889/1229] validity check for backup --- functions/menu.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/functions/menu.sh b/functions/menu.sh index 921b64f6..e4cf5a45 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -32,6 +32,8 @@ case $selection in ;; 4) read -rt 120 -p "What is the maximun number of backups you would like?: " number_of_backups || { echo -e "\nFailed to make a selection in time" ; exit; } + ! [[ $number_of_backups =~ ^[0-9]+$ ]] && echo -e "Error: -b needs to be assigned an interger\n\"""$number_of_backups""\" is not an interger" >&2 && exit + [[ "$number_of_backups" -le 0 ]] && echo "Error: Number of backups is required to be at least 1" && exit ;; 5) restore From b31818d074c5881186d96a7f9188841dd223d419 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 30 Aug 2022 22:08:29 -0600 Subject: [PATCH 0890/1229] change error message --- functions/menu.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/menu.sh b/functions/menu.sh index e4cf5a45..cef7bc6c 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -32,7 +32,7 @@ case $selection in ;; 4) read -rt 120 -p "What is the maximun number of backups you would like?: " number_of_backups || { echo -e "\nFailed to make a selection in time" ; exit; } - ! [[ $number_of_backups =~ ^[0-9]+$ ]] && echo -e "Error: -b needs to be assigned an interger\n\"""$number_of_backups""\" is not an interger" >&2 && exit + ! [[ $number_of_backups =~ ^[0-9]+$ ]] && echo -e "Error: The input must be an interger\n\"""$number_of_backups""\" is not an interger" >&2 && exit [[ "$number_of_backups" -le 0 ]] && echo "Error: Number of backups is required to be at least 1" && exit ;; 5) From a9bb04de0cb0906f3469866a561647ab7e513482 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Wed, 31 Aug 2022 00:48:13 +0000 Subject: [PATCH 0891/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.185.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 9ca3afde..b1caedb0 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@181a77c121b90ce0b0d3ad9d7eea5cfc083ec9e7 # tag=v32.183.0 + uses: renovatebot/github-action@d9c6c11f21804308b9ec6104843ad758c9f3ef83 # tag=v32.185.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From d2d9a6bc327be58e9d6f58213f3fe8512e716051 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Wed, 31 Aug 2022 18:09:15 +0000 Subject: [PATCH 0892/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.185.3 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index b1caedb0..76d7b694 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@d9c6c11f21804308b9ec6104843ad758c9f3ef83 # tag=v32.185.0 + uses: renovatebot/github-action@491257f795bd1dee942e33e8a8b05e7aea05e7bc # tag=v32.185.3 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From dc2d476937c8a36a6522f0bbdc687fd561c870ee Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 31 Aug 2022 21:30:07 -0600 Subject: [PATCH 0893/1229] always pull pool name --- functions/mount.sh | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/functions/mount.sh b/functions/mount.sh index c58f8571..fd71fc69 100644 --- a/functions/mount.sh +++ b/functions/mount.sh @@ -2,6 +2,7 @@ mount(){ +pool=$(cli -c 'app kubernetes config' | grep -E "pool\s\|" | awk -F '|' '{print $3}' | tr -d " \t\n\r") while true do clear -x @@ -48,12 +49,7 @@ do data_name=$(echo "$pvc" | awk '{print $3}') mount=$(echo "$pvc" | awk '{print $4}') volume_name=$(echo "$pvc" | awk '{print $4}') - mapfile -t full_path < <(zfs list | grep "$volume_name" | awk '{print $1}') - if [[ "${#full_path[@]}" -gt 1 ]]; then #if there is another app with the same name on another pool, use the current pools application, since the other instance is probably old, or unused, or a backup. - echo "$app is using the same volume identifier on more than one pool.. attempting to use your current kubernetes apps pool" - pool=$(cli -c 'app kubernetes config' | grep -E "pool\s\|" | awk -F '|' '{print $3}' | tr -d " \t\n\r") - full_path=$(zfs list | grep "$volume_name" | grep "$pool" | awk '{print $1}') - fi + full_path=$(zfs list | grep "$volume_name" | grep "$pool" | awk '{print $1}') echo -e "\nMounting\n$full_path\nTo\n/mnt/heavyscript/$data_name" zfs set mountpoint=/heavyscript/"$data_name" "$full_path" || echo "Failed to mount $app" echo -e "Mounted\n\nUnmount with:\nzfs set mountpoint=legacy $full_path && rmdir /mnt/heavyscript/$data_name\n\nOr use the Unmount All option\n" @@ -87,17 +83,9 @@ do main=$(k3s kubectl get pvc -A | grep -E "\s$i\s" | awk '{print $1, $2, $4}') app=$(echo "$main" | awk '{print $1}' | cut -c 4-) pvc=$(echo "$main" | awk '{print $3}') - mapfile -t path < <(find /mnt/*/ix-applications/releases/"$app"/volumes/ -maxdepth 0 | cut -c 6-) - if [[ "${#path[@]}" -gt 1 ]]; then #if there is another app with the same name on another pool, use the current pools application, since the other instance is probably old, or unused, or a backup. - echo "$i is a name used on more than one pool.. attempting to use your current kubernetes apps pool" - pool=$(cli -c 'app kubernetes config' | grep -E "pool\s\|" | awk -F '|' '{print $3}' | tr -d " \t\n\r") - full_path=$(find /mnt/"$pool"/ix-applications/releases/"$app"/volumes/ -maxdepth 0 | cut -c 6-) - zfs set mountpoint=legacy "$full_path""$pvc" - echo "$i unmounted" && rmdir /mnt/heavyscript/"$i" || echo "failed to unmount $i" - else - zfs set mountpoint=legacy "$path""$pvc" - echo "$i unmounted" && rmdir /mnt/heavyscript/"$i" || echo "failed to unmount $i" - fi + full_path=$(find /mnt/"$pool"/ix-applications/releases/"$app"/volumes/ -maxdepth 0 | cut -c 6-) + zfs set mountpoint=legacy "$full_path""$pvc" + echo "$i unmounted" && rmdir /mnt/heavyscript/"$i" || echo "failed to unmount $i" done rmdir /mnt/heavyscript sleep 3 From 56536136989b6cb45fa193de81f54108900c6cdc Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 31 Aug 2022 21:37:17 -0600 Subject: [PATCH 0894/1229] use cli version to stop app, cleanup output --- functions/mount.sh | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/functions/mount.sh b/functions/mount.sh index fd71fc69..56bbac73 100644 --- a/functions/mount.sh +++ b/functions/mount.sh @@ -34,25 +34,24 @@ do app=$(echo -e "$list" | grep ^"$selection)" | awk '{print $2}' | cut -c 4- ) [[ -z "$app" ]] && echo "Invalid Selection: $selection, was not an option" && sleep 3 && continue #Check for valid selection. If none, contiue pvc=$(echo -e "$list" | grep ^"$selection)") + + #Stop applicaiton if not stopped status=$(cli -m csv -c 'app chart_release query name,status' | grep -E "^$app\b" | awk -F ',' '{print $2}'| tr -d " \t\n\r") if [[ "$status" != "STOPPED" ]]; then - [[ -z $timeout ]] && echo -e "\nDefault Timeout: 500" && timeout=500 || echo -e "\nCustom Timeout: $timeout" - SECONDS=0 && echo -e "\nScaling down $app" && midclt call chart.release.scale "$app" '{"replica_count": 0}' &> /dev/null + cli -c 'app chart_release scale release_name='\""$app"\"\ 'scale_options={"replica_count": 0}' &> /dev/null else echo -e "\n$app is already stopped" fi - while [[ "$SECONDS" -le "$timeout" && "$status" != "STOPPED" ]] - do - status=$(cli -m csv -c 'app chart_release query name,status' | grep -E "^$app\b" | awk -F ',' '{print $2}'| tr -d " \t\n\r") - echo -e "Waiting $((timeout-SECONDS)) more seconds for $app to be STOPPED" && sleep 5 - done + + #Grab data then output data_name=$(echo "$pvc" | awk '{print $3}') - mount=$(echo "$pvc" | awk '{print $4}') volume_name=$(echo "$pvc" | awk '{print $4}') full_path=$(zfs list | grep "$volume_name" | grep "$pool" | awk '{print $1}') - echo -e "\nMounting\n$full_path\nTo\n/mnt/heavyscript/$data_name" + echo -e "\nMounting\n$data_name" zfs set mountpoint=/heavyscript/"$data_name" "$full_path" || echo "Failed to mount $app" - echo -e "Mounted\n\nUnmount with:\nzfs set mountpoint=legacy $full_path && rmdir /mnt/heavyscript/$data_name\n\nOr use the Unmount All option\n" + echo -e "\nMounted\n\nUnmount with:\nzfs set mountpoint=legacy $full_path && rmdir /mnt/heavyscript/$data_name\n\nOr use the Unmount All option\n" + + #Ask if user would like to mount something else while true do echo From 9b24252dc735fbc2807eae9ad1a0b716fd51889f Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 31 Aug 2022 21:43:23 -0600 Subject: [PATCH 0895/1229] improve output, add error handling --- functions/mount.sh | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/functions/mount.sh b/functions/mount.sh index 56bbac73..db43f8ae 100644 --- a/functions/mount.sh +++ b/functions/mount.sh @@ -38,7 +38,13 @@ do #Stop applicaiton if not stopped status=$(cli -m csv -c 'app chart_release query name,status' | grep -E "^$app\b" | awk -F ',' '{print $2}'| tr -d " \t\n\r") if [[ "$status" != "STOPPED" ]]; then - cli -c 'app chart_release scale release_name='\""$app"\"\ 'scale_options={"replica_count": 0}' &> /dev/null + echo "Stopping $app prior to mount" + if ! cli -c 'app chart_release scale release_name='\""$app"\"\ 'scale_options={"replica_count": 0}' &> /dev/null; then + echo "Failed to stop $app" + exit 1 + else + echo "Stopped" + fi else echo -e "\n$app is already stopped" fi @@ -47,9 +53,13 @@ do data_name=$(echo "$pvc" | awk '{print $3}') volume_name=$(echo "$pvc" | awk '{print $4}') full_path=$(zfs list | grep "$volume_name" | grep "$pool" | awk '{print $1}') - echo -e "\nMounting\n$data_name" - zfs set mountpoint=/heavyscript/"$data_name" "$full_path" || echo "Failed to mount $app" - echo -e "\nMounted\n\nUnmount with:\nzfs set mountpoint=legacy $full_path && rmdir /mnt/heavyscript/$data_name\n\nOr use the Unmount All option\n" + if ! zfs set mountpoint=/heavyscript/"$data_name" "$full_path" ; then + echo "Error: Failed to mount $app" + exit 1 + else + echo -e "\nMounted\n$data_name" + fi + echo -e "\nUnmount with:\nzfs set mountpoint=legacy $full_path && rmdir /mnt/heavyscript/$data_name\n\nOr use the Unmount All option\n" #Ask if user would like to mount something else while true From d7f97836ca81ae81855e180e0994cfc12021aa9d Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 31 Aug 2022 21:45:19 -0600 Subject: [PATCH 0896/1229] debugging --- functions/mount.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/functions/mount.sh b/functions/mount.sh index db43f8ae..5c9c7fab 100644 --- a/functions/mount.sh +++ b/functions/mount.sh @@ -38,11 +38,13 @@ do #Stop applicaiton if not stopped status=$(cli -m csv -c 'app chart_release query name,status' | grep -E "^$app\b" | awk -F ',' '{print $2}'| tr -d " \t\n\r") if [[ "$status" != "STOPPED" ]]; then - echo "Stopping $app prior to mount" + echo -e "\nStopping $app prior to mount" if ! cli -c 'app chart_release scale release_name='\""$app"\"\ 'scale_options={"replica_count": 0}' &> /dev/null; then echo "Failed to stop $app" exit 1 else + status=$(cli -m csv -c 'app chart_release query name,status' | grep -E "^$app\b" | awk -F ',' '{print $2}'| tr -d " \t\n\r") + echo "$status" echo "Stopped" fi else From d0015c876177ab89e07a18802903b74daceab1db Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 31 Aug 2022 21:51:49 -0600 Subject: [PATCH 0897/1229] remove debugging, checks passed, cleanup --- functions/mount.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/functions/mount.sh b/functions/mount.sh index 5c9c7fab..22665cc0 100644 --- a/functions/mount.sh +++ b/functions/mount.sh @@ -30,9 +30,11 @@ do echo echo "0) Exit" read -rt 120 -p "Please type a number: " selection || { echo -e "\nFailed to make a selection in time" ; exit; } + + #Check for valid selection. If no issues, continue [[ $selection == 0 ]] && echo "Exiting.." && exit app=$(echo -e "$list" | grep ^"$selection)" | awk '{print $2}' | cut -c 4- ) - [[ -z "$app" ]] && echo "Invalid Selection: $selection, was not an option" && sleep 3 && continue #Check for valid selection. If none, contiue + [[ -z "$app" ]] && echo "Invalid Selection: $selection, was not an option" && sleep 3 && continue pvc=$(echo -e "$list" | grep ^"$selection)") #Stop applicaiton if not stopped @@ -43,15 +45,13 @@ do echo "Failed to stop $app" exit 1 else - status=$(cli -m csv -c 'app chart_release query name,status' | grep -E "^$app\b" | awk -F ',' '{print $2}'| tr -d " \t\n\r") - echo "$status" echo "Stopped" fi else echo -e "\n$app is already stopped" fi - #Grab data then output + #Grab data then output and mount data_name=$(echo "$pvc" | awk '{print $3}') volume_name=$(echo "$pvc" | awk '{print $4}') full_path=$(zfs list | grep "$volume_name" | grep "$pool" | awk '{print $1}') From 74dc9404b6ceaa17c2e7e46e33c8064854561e71 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 31 Aug 2022 22:32:13 -0600 Subject: [PATCH 0898/1229] refactor code, remove long ignore list --- functions/dns.sh | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/functions/dns.sh b/functions/dns.sh index c4316139..b8a55b92 100644 --- a/functions/dns.sh +++ b/functions/dns.sh @@ -4,24 +4,25 @@ dns(){ clear -x echo "Generating DNS Names.." -#ignored dependency pods, may need to add more in the future. -dep_ignore="\-cronjob\-|^kube-system|\ssvclb|NAME|\-memcached\-.[^custom\-app]|\-postgresql\-.[^custom\-app]|\-redis\-.[^custom\-app]|\-mariadb\-.[^custom\-app]|\-promtail\-.[^custom\-app]" +# Ignore svclb +dep_ignore='svclb-' # Pulling pod names -mapfile -t main < <(k3s kubectl get pods -A | grep -Ev "$dep_ignore" | sort) +k3s crictl pods --namespace ix -s Ready | sed -E 's/[[:space:]]([0-9]*|About)[a-z0-9 ]{5,12}ago[[:space:]]//' | grep -Ev -- "$dep_ignore" | sed '1d' >> dns_file +mapfile -t ixName < <(< dns_file awk '{print $4}' | sort -u ) # Pulling all ports all_ports=$(k3s kubectl get service -A) clear -x count=0 -for i in "${main[@]}" +for i in "${ixName[@]}" do [[ count -le 0 ]] && echo -e "\n" && ((count++)) - appName=$(echo "$i" | awk '{print $2}' | sed 's/-[^-]*-[^-]*$//' | sed 's/-0//') - ixName=$(echo "$i" | awk '{print $1}') + appName=$(grep -E "\s$i\s" "dns_file" | awk '{print $3}' | sed 's/-[^-]*-[^-]*$//' | sed 's/-0//' | head -n 1) port=$(echo "$all_ports" | grep -E "\s$appName\s" | awk '{print $6}' | grep -Eo "^[[:digit:]]+{1}") - echo -e "$appName.$ixName.svc.cluster.local $port" -done | uniq | nl -b t | sed 's/\s\s\s$/- -------- ----/' | column -t -R 1 -N "#,DNS_Name,Port" -L + echo -e "$appName $appName.$i.svc.cluster.local $port" +done | nl -s ") " -b t | sed '0,/\s\s\s/{s/\s\s\s/- ----- -------- ----/}'| column -t -N "#,Name,DNS_Name,Port" +rm dns_file } export -f dns \ No newline at end of file From 2c8c24e2373c31325f9b5a89fa8702517a984602 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 31 Aug 2022 22:36:55 -0600 Subject: [PATCH 0899/1229] remove extra hyphen from name --- functions/dns.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/dns.sh b/functions/dns.sh index b8a55b92..3d9af33a 100644 --- a/functions/dns.sh +++ b/functions/dns.sh @@ -22,7 +22,7 @@ do appName=$(grep -E "\s$i\s" "dns_file" | awk '{print $3}' | sed 's/-[^-]*-[^-]*$//' | sed 's/-0//' | head -n 1) port=$(echo "$all_ports" | grep -E "\s$appName\s" | awk '{print $6}' | grep -Eo "^[[:digit:]]+{1}") echo -e "$appName $appName.$i.svc.cluster.local $port" -done | nl -s ") " -b t | sed '0,/\s\s\s/{s/\s\s\s/- ----- -------- ----/}'| column -t -N "#,Name,DNS_Name,Port" +done | nl -s ") " -b t | sed '0,/\s\s\s/{s/\s\s\s/- ---- -------- ----/}'| column -t -N "#,Name,DNS_Name,Port" rm dns_file } export -f dns \ No newline at end of file From 77e6be35a191d513d2e55fc9e4027e47dde5bb9d Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 31 Aug 2022 22:54:58 -0600 Subject: [PATCH 0900/1229] silence git reset output --- functions/self_update.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/self_update.sh b/functions/self_update.sh index 144157d4..e06b2dc9 100644 --- a/functions/self_update.sh +++ b/functions/self_update.sh @@ -5,7 +5,7 @@ args=("$@") self_update() { git fetch --tags &>/dev/null -git reset --hard +git reset --hard &>/dev/null latest_ver=$(git describe --tags "$(git rev-list --tags --max-count=1)") echo "🅂 🄴 🄻 🄵" echo "🅄 🄿 🄳 🄰 🅃 🄴" From 3f299e0ba3322563632f3b50b9d8357a8a46b5ff Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 31 Aug 2022 23:10:26 -0600 Subject: [PATCH 0901/1229] change variables and appname to non-full --- functions/dns.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/functions/dns.sh b/functions/dns.sh index 3d9af33a..05441da8 100644 --- a/functions/dns.sh +++ b/functions/dns.sh @@ -9,19 +9,20 @@ dep_ignore='svclb-' # Pulling pod names k3s crictl pods --namespace ix -s Ready | sed -E 's/[[:space:]]([0-9]*|About)[a-z0-9 ]{5,12}ago[[:space:]]//' | grep -Ev -- "$dep_ignore" | sed '1d' >> dns_file -mapfile -t ixName < <(< dns_file awk '{print $4}' | sort -u ) +mapfile -t ix_name_array < <(< dns_file awk '{print $4}' | sort -u ) # Pulling all ports all_ports=$(k3s kubectl get service -A) clear -x count=0 -for i in "${ixName[@]}" +for i in "${ix_name_array[@]}" do [[ count -le 0 ]] && echo -e "\n" && ((count++)) - appName=$(grep -E "\s$i\s" "dns_file" | awk '{print $3}' | sed 's/-[^-]*-[^-]*$//' | sed 's/-0//' | head -n 1) - port=$(echo "$all_ports" | grep -E "\s$appName\s" | awk '{print $6}' | grep -Eo "^[[:digit:]]+{1}") - echo -e "$appName $appName.$i.svc.cluster.local $port" + full_app_name=$(grep -E "\s$i\s" "dns_file" | awk '{print $3}' | sed 's/-[^-]*-[^-]*$//' | sed 's/-0//' | head -n 1) + app_name=$(echo $i | cut -c 4-) + port=$(echo "$all_ports" | grep -E "\s$full_app_name\s" | awk '{print $6}' | grep -Eo "^[[:digit:]]+{1}") + echo -e "$app_name $full_app_name.$i.svc.cluster.local $port" done | nl -s ") " -b t | sed '0,/\s\s\s/{s/\s\s\s/- ---- -------- ----/}'| column -t -N "#,Name,DNS_Name,Port" rm dns_file } From 2b758961766bebc85d4dfe03cf4df6ef08cb8bb5 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 31 Aug 2022 23:10:45 -0600 Subject: [PATCH 0902/1229] remove ignore var --- functions/dns.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/functions/dns.sh b/functions/dns.sh index 05441da8..ad6536d3 100644 --- a/functions/dns.sh +++ b/functions/dns.sh @@ -4,11 +4,9 @@ dns(){ clear -x echo "Generating DNS Names.." -# Ignore svclb -dep_ignore='svclb-' # Pulling pod names -k3s crictl pods --namespace ix -s Ready | sed -E 's/[[:space:]]([0-9]*|About)[a-z0-9 ]{5,12}ago[[:space:]]//' | grep -Ev -- "$dep_ignore" | sed '1d' >> dns_file +k3s crictl pods --namespace ix -s Ready | sed -E 's/[[:space:]]([0-9]*|About)[a-z0-9 ]{5,12}ago[[:space:]]//' | grep -v 'svclb-' | sed '1d' >> dns_file mapfile -t ix_name_array < <(< dns_file awk '{print $4}' | sort -u ) # Pulling all ports @@ -20,7 +18,7 @@ for i in "${ix_name_array[@]}" do [[ count -le 0 ]] && echo -e "\n" && ((count++)) full_app_name=$(grep -E "\s$i\s" "dns_file" | awk '{print $3}' | sed 's/-[^-]*-[^-]*$//' | sed 's/-0//' | head -n 1) - app_name=$(echo $i | cut -c 4-) + app_name=$(echo "$i" | cut -c 4-) port=$(echo "$all_ports" | grep -E "\s$full_app_name\s" | awk '{print $6}' | grep -Eo "^[[:digit:]]+{1}") echo -e "$app_name $full_app_name.$i.svc.cluster.local $port" done | nl -s ") " -b t | sed '0,/\s\s\s/{s/\s\s\s/- ---- -------- ----/}'| column -t -N "#,Name,DNS_Name,Port" From 84c86ce11a1fa103588fd53070413404f53f4de7 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Thu, 1 Sep 2022 06:19:17 +0000 Subject: [PATCH 0903/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.186.1 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 76d7b694..5b75a0aa 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@491257f795bd1dee942e33e8a8b05e7aea05e7bc # tag=v32.185.3 + uses: renovatebot/github-action@776a395f216ac92ef3d7f92e5bb4e76b58e03027 # tag=v32.186.1 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 217c82006628c1cfa26ce5be746606847e347dbb Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Fri, 2 Sep 2022 00:38:57 +0000 Subject: [PATCH 0904/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.187.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 5b75a0aa..c3518e2b 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@776a395f216ac92ef3d7f92e5bb4e76b58e03027 # tag=v32.186.1 + uses: renovatebot/github-action@167c13ace2984bee2925c623910af25fa1f43ce8 # tag=v32.187.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 0b062afb2eae2deaf9dd1735b9ed3ec48bf84866 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Fri, 2 Sep 2022 12:13:59 +0000 Subject: [PATCH 0905/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.187.1 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index c3518e2b..8173e65d 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@167c13ace2984bee2925c623910af25fa1f43ce8 # tag=v32.187.0 + uses: renovatebot/github-action@7849a532ee1bd98dc318d9cf784a8dbf7deac665 # tag=v32.187.1 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 046e03f9c223390f1817e1cf246b165521717083 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 2 Sep 2022 17:15:28 -0600 Subject: [PATCH 0906/1229] compact backup menu --- functions/menu.sh | 60 +++++++++++++++++++++++++++++++++-------------- 1 file changed, 43 insertions(+), 17 deletions(-) diff --git a/functions/menu.sh b/functions/menu.sh index cef7bc6c..122390c6 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -7,18 +7,17 @@ title echo "1) Help" echo "2) List DNS Names" echo "3) Mount and Unmount PVC storage" -echo "4) Create a Backup" -echo "5) Restore a Backup" -echo "6) Delete a Backup" -echo "7) Update HeavyScript" -echo "8) Update Applications" -echo "9) Command to Container" +echo "4) Backup Options" +echo "5) Update HeavyScript" +echo "6) Update Applications" +echo "7) Command to Container" echo echo "0) Exit" read -rt 120 -p "Please select an option by number: " selection || { echo -e "\nFailed to make a selection in time" ; exit; } case $selection in 0) + echo "Exiting.." exit ;; 1) @@ -31,23 +30,50 @@ case $selection in mount ;; 4) - read -rt 120 -p "What is the maximun number of backups you would like?: " number_of_backups || { echo -e "\nFailed to make a selection in time" ; exit; } - ! [[ $number_of_backups =~ ^[0-9]+$ ]] && echo -e "Error: The input must be an interger\n\"""$number_of_backups""\" is not an interger" >&2 && exit - [[ "$number_of_backups" -le 0 ]] && echo "Error: Number of backups is required to be at least 1" && exit + while [[ $backup_selection != true ]] + do + clear -x + title + echo "Backup Menu" + echo "1) Create Backup" + echo "2) Delete Backup" + echo "3) Restore Backup" + echo + echo "0) Exit" + read -rt 120 -p "Please select an option by number: " backup_selection || { echo -e "\nFailed to make a selection in time" ; exit; } + case $backup_selection in + 0) + echo "Exiting.." + exit + ;; + 1) + read -rt 120 -p "What is the maximun number of backups you would like?: " number_of_backups || { echo -e "\nFailed to make a selection in time" ; exit; } + ! [[ $number_of_backups =~ ^[0-9]+$ ]] && echo -e "Error: The input must be an interger\n\"""$number_of_backups""\" is not an interger" >&2 && exit + [[ "$number_of_backups" -le 0 ]] && echo "Error: Number of backups is required to be at least 1" && exit + backup_selection=true + ;; + 2) + backup_selection=true + deleteBackup + ;; + 3) + backup_selection=true + restore + ;; + *) + echo "\"$selection\" was not an option, please try agian" && sleep 3 && continue + ;; + esac + done ;; + 5) - restore - ;; - 6) - deleteBackup - ;; - 7) self_update ;; - 8) + 6) script_create ;; - 9) + 7) cmd_to_container ;; *) From 800cac096fed2fb029e0b59d722cf43d1a7427cf Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 2 Sep 2022 17:24:37 -0600 Subject: [PATCH 0907/1229] add titles to utility menu --- functions/cmd_to_container.sh | 4 ++++ functions/menu.sh | 3 +++ 2 files changed, 7 insertions(+) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index 72f79990..ad8bf630 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -7,6 +7,8 @@ while true do clear -x title + echo "Command to Container Menu" + echo "-------------------------" echo "$app_name" echo echo "0) Exit" @@ -45,6 +47,8 @@ case "${#containers[@]}" in do clear -x title + echo "Available Containers" + echo "--------------------" cont_search=$( for i in "${containers[@]}" do diff --git a/functions/menu.sh b/functions/menu.sh index 122390c6..164bdd7b 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -4,6 +4,8 @@ menu(){ clear -x title +echo "Available Utilities" +echo "-------------------" echo "1) Help" echo "2) List DNS Names" echo "3) Mount and Unmount PVC storage" @@ -35,6 +37,7 @@ case $selection in clear -x title echo "Backup Menu" + echo "-----------" echo "1) Create Backup" echo "2) Delete Backup" echo "3) Restore Backup" From 73ce3939fb3c643308c5521e57dfd9e3b1c6160a Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 2 Sep 2022 17:28:47 -0600 Subject: [PATCH 0908/1229] add title for mount menu --- functions/mount.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/functions/mount.sh b/functions/mount.sh index 22665cc0..00c3cf93 100644 --- a/functions/mount.sh +++ b/functions/mount.sh @@ -7,6 +7,8 @@ while true do clear -x title + echo "PVC Mount Menu" + echo "--------------" echo "1) Mount" echo "2) Unmount All" echo From f250a4e07a6c0c51bb7097efbdfec8a056cc38ff Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Sat, 3 Sep 2022 00:35:59 +0000 Subject: [PATCH 0909/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.189.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 8173e65d..efbcde84 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@7849a532ee1bd98dc318d9cf784a8dbf7deac665 # tag=v32.187.1 + uses: renovatebot/github-action@98c137b56d26c6e1e19a951cb19844fc74880fb1 # tag=v32.189.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 7b67b8871b1db03b435130e807e6dfd71f8ad02b Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sat, 3 Sep 2022 18:45:53 -0600 Subject: [PATCH 0910/1229] remove timeout from help --- functions/misc.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/misc.sh b/functions/misc.sh index ebff4ff8..3812e72a 100644 --- a/functions/misc.sh +++ b/functions/misc.sh @@ -67,7 +67,7 @@ echo "-r | Roll-back applications if they fail to update" echo "-i | Add application to ignore list, one by one, see example below." echo "-S | Shutdown applications prior to updating" echo "-v | verbose output" -echo "-t 500| Set a custom timeout in seconds when checking if either an App or Mountpoint correctly Started, Stopped or (un)Mounted. Defaults to 500 seconds" +echo "-t 500| The amount of time HS will wait for an application to be ACTIVE. Defaults to 500 seconds" echo echo "Additional Options" echo "------------------" From b813efbdb73d2d5c08dfd70c54340e74c419210a Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Sun, 4 Sep 2022 00:41:07 +0000 Subject: [PATCH 0911/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.190.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index efbcde84..df5fa7b4 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@98c137b56d26c6e1e19a951cb19844fc74880fb1 # tag=v32.189.0 + uses: renovatebot/github-action@5f26b06916b05fe07918680441d592f3a505dc00 # tag=v32.190.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From b49c21bee87adf2b9719aaada86605580933495b Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 4 Sep 2022 16:56:24 -0600 Subject: [PATCH 0912/1229] Dont send container image updates to post --- functions/update_apps.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index ce6a4476..6a62f9aa 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -112,7 +112,11 @@ fi # Send app through update function [[ "$verbose" == "true" ]] && echo_array+=("Updating..") if update_app ;then - echo_array+=("Updated\n$old_full_ver\n$new_full_ver") + if [[ $old_full_ver == "$new_full_ver" ]]; then + echo_array+=("Container Image Update") + else + echo_array+=("Updated\n$old_full_ver\n$new_full_ver") + fi else echo_array+=("Failed to update\nManual intervention may be required") echo_array @@ -123,6 +127,10 @@ fi if grep -qs "^$app_name,true" external_services ; then echo_array return +# If app is container image update, dont send for post processing +elif [[ $old_full_ver == "$new_full_ver" ]]; then + echo_array + return else post_process fi From 07707135a9b2ae827b08f5e0d907e5e6c9f47886 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 4 Sep 2022 16:58:20 -0600 Subject: [PATCH 0913/1229] more fitting message for container image --- functions/update_apps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 6a62f9aa..a0d286e1 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -113,7 +113,7 @@ fi [[ "$verbose" == "true" ]] && echo_array+=("Updating..") if update_app ;then if [[ $old_full_ver == "$new_full_ver" ]]; then - echo_array+=("Container Image Update") + echo_array+=("Updated Container Image") else echo_array+=("Updated\n$old_full_ver\n$new_full_ver") fi From 19d52e058a6deb4b26d0c2f6a8b83663a4405cdc Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 4 Sep 2022 17:23:22 -0600 Subject: [PATCH 0914/1229] add sleep to while loop --- functions/update_apps.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index a0d286e1..e128e12b 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -96,6 +96,20 @@ if ! grep -qs "^$app_name," external_services ; then fi fi +# If application is deploying prior to updating, attempt to wait for it to finish +if [[ "$startstatus" == "DEPLOYING" ]]; then + SECONDS=0 + while [[ "$status" == "DEPLOYING" ]] + do + status=$(grep "^$app_name," all_app_status | awk -F ',' '{print $2}') + if [[ "$SECONDS" -ge "$timeout" ]]; then + echo_array+=("Application is stuck Deploying, Skipping to avoid damage") + return + fi + sleep 5 + done +fi + # If user is using -S, stop app prior to updating echo_array+=("\n$app_name") if [[ $stop_before_update == "true" && "$startstatus" != "STOPPED" ]]; then # Check to see if user is using -S or not From cc9091de150c7995d44421b8c0704a8ce8e7e65a Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 4 Sep 2022 17:27:58 -0600 Subject: [PATCH 0915/1229] echo array before return --- functions/update_apps.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index e128e12b..df34f752 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -104,6 +104,7 @@ if [[ "$startstatus" == "DEPLOYING" ]]; then status=$(grep "^$app_name," all_app_status | awk -F ',' '{print $2}') if [[ "$SECONDS" -ge "$timeout" ]]; then echo_array+=("Application is stuck Deploying, Skipping to avoid damage") + echo_array return fi sleep 5 From b1f6b01e611ca5d63e1bc7451718daa83cb4f371 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 4 Sep 2022 17:40:29 -0600 Subject: [PATCH 0916/1229] replace while true --- functions/update_apps.sh | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index df34f752..44e19f98 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -13,7 +13,7 @@ it=0 while_count=0 rm deploying 2>/dev/null rm finished 2>/dev/null -while true +while [[ $proc_count != 0 || $(wc -l finished 2>/dev/null | awk '{ print $1 }') -lt "${#array[@]}" ]] do if while_status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,container_images_update_available,status' 2>/dev/null) ; then ((while_count++)) @@ -38,16 +38,12 @@ do kill -0 "$proc" &> /dev/null || { unset "processes[$count]"; ((proc_count--)); } ((count++)) done - if [[ "$proc_count" -ge "$update_limit" ]]; then - sleep 3 - elif [[ $it -lt ${#array[@]} ]]; then + if [[ $it -lt ${#array[@]} && "$proc_count" -lt "$update_limit" ]]; then pre_process "${array[$it]}" & processes+=($!) ((it++)) - elif [[ $proc_count != 0 || $(wc -l finished 2>/dev/null | awk '{ print $1 }') -lt "${#array[@]}" ]]; then # Wait for all processes to finish + else sleep 3 - else # All processes must be completed, break out of loop - break fi done rm deploying 2>/dev/null From 3bd7614654ea37db18827c28003b1fd33d8911be Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Mon, 5 Sep 2022 00:44:42 +0000 Subject: [PATCH 0917/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.190.3 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index df5fa7b4..4fe0cbe0 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@5f26b06916b05fe07918680441d592f3a505dc00 # tag=v32.190.0 + uses: renovatebot/github-action@7cca30712d22d90949e6ed1a2eb59233294c6806 # tag=v32.190.3 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 5e966e148b65655af24649f303d3948b33fbb419 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 5 Sep 2022 00:43:10 -0600 Subject: [PATCH 0918/1229] test new regex to better match apps --- functions/cmd_to_container.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index ad8bf630..472995b5 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -26,7 +26,7 @@ do done rm cont_file 2> /dev/null app_name=$(echo -e "$app_name" | grep ^"$selection)" | awk '{print $2}') -mapfile -t pod_id < <(k3s crictl pods -s ready --namespace ix | grep -E "[[:space:]]$app_name([[:space:]]|-([-[:alnum:]])*[[:space:]])" | awk '{print $1}') +mapfile -t pod_id < <(k3s crictl pods -s ready --namespace ix | grep -E "[[:space:]]$app_name-(ix-chart-)?(custom-app-)?((([[:alnum:]]|[[a-z]]){8,10}-([-[:alnum:]]|[[a-z]]){5})|([[:alnum:]]|[[a-z]])*-0)" | awk '{print $1}') search=$(k3s crictl ps -a -s running | sed -E 's/[[:space:]]([0-9]*|About)[a-z0-9 ]{5,12}ago[[:space:]]//') for pod in "${pod_id[@]}" do From 4348deb7fe56ec48b5add037064fe01f7b90c7f0 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 5 Sep 2022 00:46:17 -0600 Subject: [PATCH 0919/1229] add space after -0 for dep containers --- functions/cmd_to_container.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index 472995b5..b683bcb0 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -26,7 +26,7 @@ do done rm cont_file 2> /dev/null app_name=$(echo -e "$app_name" | grep ^"$selection)" | awk '{print $2}') -mapfile -t pod_id < <(k3s crictl pods -s ready --namespace ix | grep -E "[[:space:]]$app_name-(ix-chart-)?(custom-app-)?((([[:alnum:]]|[[a-z]]){8,10}-([-[:alnum:]]|[[a-z]]){5})|([[:alnum:]]|[[a-z]])*-0)" | awk '{print $1}') +mapfile -t pod_id < <(k3s crictl pods -s ready --namespace ix | grep -E "[[:space:]]$app_name-(ix-chart-)?(custom-app-)?((([[:alnum:]]|[[a-z]]){8,10}-([-[:alnum:]]|[[a-z]]){5})|([[:alnum:]]|[[a-z]])*-0[[:space:]])" | awk '{print $1}') search=$(k3s crictl ps -a -s running | sed -E 's/[[:space:]]([0-9]*|About)[a-z0-9 ]{5,12}ago[[:space:]]//') for pod in "${pod_id[@]}" do From 093d6ca1d7c1f23eabd12d97bd38f67f1baed3e2 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 5 Sep 2022 01:01:43 -0600 Subject: [PATCH 0920/1229] grab containers by namespace name --- functions/cmd_to_container.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index b683bcb0..fa2803b6 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -26,7 +26,7 @@ do done rm cont_file 2> /dev/null app_name=$(echo -e "$app_name" | grep ^"$selection)" | awk '{print $2}') -mapfile -t pod_id < <(k3s crictl pods -s ready --namespace ix | grep -E "[[:space:]]$app_name-(ix-chart-)?(custom-app-)?((([[:alnum:]]|[[a-z]]){8,10}-([-[:alnum:]]|[[a-z]]){5})|([[:alnum:]]|[[a-z]])*-0[[:space:]])" | awk '{print $1}') +mapfile -t pod_id < <(k3s crictl pods -s ready --namespace ix | grep -v "[[:space:]]svclb-" | grep -E "[[:space:]]ix-${app_name}[[:space:]]" | awk '{print $1}') search=$(k3s crictl ps -a -s running | sed -E 's/[[:space:]]([0-9]*|About)[a-z0-9 ]{5,12}ago[[:space:]]//') for pod in "${pod_id[@]}" do From de5ef940fd289a63e4b3c2e2d8be5ac9e9a42cb5 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 5 Sep 2022 01:44:09 -0600 Subject: [PATCH 0921/1229] parse exeptions first --- functions/update_apps.sh | 41 +++++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 44e19f98..bacb008e 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -9,6 +9,31 @@ echo "Asynchronous Updates: $update_limit" [[ -z $timeout ]] && echo "Default Timeout: 500" && timeout=500 || echo "Custom Timeout: $timeout" [[ "$timeout" -le 120 ]] && echo "Warning: Your timeout is set low and may lead to premature rollbacks or skips" pool=$(cli -c 'app kubernetes config' | grep -E "dataset\s\|" | awk -F '|' '{print $3}' | awk -F '/' '{print $1}' | tr -d " \t\n\r") + +index=0 +for app in "${array[@]}" +do + app_name=$(echo "$app" | awk -F ',' '{print $1}') #print out first catagory, name. + old_app_ver=$(echo "$app" | awk -F ',' '{print $4}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #previous/current Application MAJOR Version + new_app_ver=$(echo "$app" | awk -F ',' '{print $5}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #new Application MAJOR Version + old_chart_ver=$(echo "$app" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}' | awk -F '.' '{print $1}') # Old Chart MAJOR version + new_chart_ver=$(echo "$app" | awk -F ',' '{print $5}' | awk -F '_' '{print $2}' | awk -F '.' '{print $1}') # New Chart MAJOR version + diff_app=$(diff <(echo "$old_app_ver") <(echo "$new_app_ver")) #caluclating difference in major app versions + diff_chart=$(diff <(echo "$old_chart_ver") <(echo "$new_chart_ver")) #caluclating difference in Chart versions + + #Skip application if its on ignore list + if printf '%s\0' "${ignore[@]}" | grep -iFxqz "${app_name}" ; then + echo -e "\n$app_name\nIgnored, skipping" + unset "array[$index]" + #Skip appliaction if major update and not ignoreing major versions + elif [[ "$diff_app" != "$diff_chart" && $update_apps == "true" ]] ; then + echo -e "\n$app_name\nMajor Release, update manually" + unset "array[$index]" + fi + ((index++)) +done + + it=0 while_count=0 rm deploying 2>/dev/null @@ -56,15 +81,7 @@ export -f commander pre_process(){ app_name=$(echo "${array[$it]}" | awk -F ',' '{print $1}') #print out first catagory, name. -printf '%s\0' "${ignore[@]}" | grep -iFxqz "${app_name}" && echo -e "\n$app_name\nIgnored, skipping" && final_check && return 0 #If application is on ignore list, skip -old_app_ver=$(echo "${array[$it]}" | awk -F ',' '{print $4}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #previous/current Application MAJOR Version -new_app_ver=$(echo "${array[$it]}" | awk -F ',' '{print $5}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #new Application MAJOR Version -old_chart_ver=$(echo "${array[$it]}" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}' | awk -F '.' '{print $1}') # Old Chart MAJOR version -new_chart_ver=$(echo "${array[$it]}" | awk -F ',' '{print $5}' | awk -F '_' '{print $2}' | awk -F '.' '{print $1}') # New Chart MAJOR version startstatus=$(echo "${array[$it]}" | awk -F ',' '{print $2}') #status of the app: STOPPED / DEPLOYING / ACTIVE -diff_app=$(diff <(echo "$old_app_ver") <(echo "$new_app_ver")) #caluclating difference in major app versions -diff_chart=$(diff <(echo "$old_chart_ver") <(echo "$new_chart_ver")) #caluclating difference in Chart versions -[[ "$diff_app" != "$diff_chart" && $update_apps == "true" ]] && echo -e "\n$app_name\nMajor Release, update manually" && final_check && return old_full_ver=$(echo "${array[$it]}" | awk -F ',' '{print $4}') #Upgraded From new_full_ver=$(echo "${array[$it]}" | awk -F ',' '{print $5}') #Upraded To rollback_version=$(echo "${array[$it]}" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}') @@ -191,13 +208,7 @@ if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then fi elif [[ "$SECONDS" -ge "$timeout" ]]; then if [[ $rollback == "true" ]]; then - if [[ $old_full_ver == "$new_full_ver" ]]; then - echo_array+=("Error: Run Time($SECONDS) for $app_name has exceeded Timeout($timeout)") - echo_array+=("This is the result of a container image update..") - echo_array+=("Reverting is not possible, Abandoning") - echo_array - return 1 - elif [[ "$failed" != "true" ]]; then + if [[ "$failed" != "true" ]]; then echo_array+=("Error: Run Time($SECONDS) for $app_name has exceeded Timeout($timeout)") echo_array+=("If this is a slow starting application, set a higher timeout with -t") echo_array+=("If this applicaion is always DEPLOYING, you can disable all probes under the Healthcheck Probes Liveness section in the edit configuration") From a9a23633845885035e3c73792ff57d3776f3c6b9 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 5 Sep 2022 01:44:29 -0600 Subject: [PATCH 0922/1229] add skip prev failed --- functions/update_apps.sh | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index bacb008e..89753cca 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -29,6 +29,16 @@ do elif [[ "$diff_app" != "$diff_chart" && $update_apps == "true" ]] ; then echo -e "\n$app_name\nMajor Release, update manually" unset "array[$index]" + # Skip update if application previously failed on this exact update version + elif grep -qs "^$app_name," failed 2>/dev/null; then + failed_ver=$(grep "^$app_name," failed | awk -F ',' '{print $2}') + if [[ "$failed_ver" == "$new_full_ver" ]] ; then + echo -e "\n$app_name" + echo -e "Skipping previously failed version:\n$new_full_ver" + else + sed -i /"$app_name",/d failed + fi + unset "array[$index]" fi ((index++)) done @@ -86,18 +96,6 @@ old_full_ver=$(echo "${array[$it]}" | awk -F ',' '{print $4}') #Upgraded From new_full_ver=$(echo "${array[$it]}" | awk -F ',' '{print $5}') #Upraded To rollback_version=$(echo "${array[$it]}" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}') -# Skip update if application previously failed on this exact update version -if grep -qs "^$app_name," failed 2>/dev/null; then - failed_ver=$(grep "^$app_name," failed | awk -F ',' '{print $2}') - if [[ "$failed_ver" == "$new_full_ver" ]] ; then - echo -e "\n$app_name" - echo -e "Skipping previously failed version:\n$new_full_ver" - final_check - return 0 - else - sed -i /"$app_name",/d failed - fi -fi # Check if app is external services, append outcome to external_services file [[ ! -e external_services ]] && touch external_services From fc8af22d07c20f1bb40368c6681f34e471647b9e Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 5 Sep 2022 01:51:35 -0600 Subject: [PATCH 0923/1229] if nothing remains in array, return --- functions/update_apps.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 89753cca..545dfd6b 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -43,6 +43,7 @@ do ((index++)) done +[[ ${#array[@]} == 0 ]] && return it=0 while_count=0 From bb9e332a34fef98622a7224befc17bcd410f0dd9 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 5 Sep 2022 02:46:41 -0600 Subject: [PATCH 0924/1229] rebuild array --- functions/update_apps.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 545dfd6b..a48551d4 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -45,6 +45,8 @@ done [[ ${#array[@]} == 0 ]] && return +array=("${array[@]}") + it=0 while_count=0 rm deploying 2>/dev/null From 7248e8d27fa30a4af60b49651fd6b36380436156 Mon Sep 17 00:00:00 2001 From: UmbraAtrox <33509547+UmbraAtrox@users.noreply.github.com> Date: Mon, 5 Sep 2022 14:46:57 +0200 Subject: [PATCH 0925/1229] Update README.md Fixed Link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 450048c4..fbcfa3c8 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ A easy tool for frequently used TrueNAS SCALE CLI utilities. -Please before using this tool, [read this note](https://truecharts.org/docs/manual/SCALE%20Apps/Quick-Start%20Guides/Important-MUST-READ) +Please before using this tool, [read this note](https://truecharts.org/docs/manual/SCALE%20Apps/Important-MUST-READ) ## Table of contents: * [Synopsis](#synopsis) From 2eebfbac15ed990317328a5f6fd65feae0c6f09f Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Mon, 5 Sep 2022 12:14:17 +0000 Subject: [PATCH 0926/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.190.4 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 4fe0cbe0..62b5168e 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@7cca30712d22d90949e6ed1a2eb59233294c6806 # tag=v32.190.3 + uses: renovatebot/github-action@3bd3b27663e53f987c552ecd809aa69f6a774587 # tag=v32.190.4 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 3b502bd93a2e54dd0104fae8593a5db001063066 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 5 Sep 2022 12:29:45 -0600 Subject: [PATCH 0927/1229] reassign array rather than use proccount --- functions/update_apps.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index a48551d4..a95b67ef 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -51,7 +51,7 @@ it=0 while_count=0 rm deploying 2>/dev/null rm finished 2>/dev/null -while [[ $proc_count != 0 || $(wc -l finished 2>/dev/null | awk '{ print $1 }') -lt "${#array[@]}" ]] +while [[ ${#processes[@]} != 0 || $(wc -l finished 2>/dev/null | awk '{ print $1 }') -lt "${#array[@]}" ]] do if while_status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,container_images_update_available,status' 2>/dev/null) ; then ((while_count++)) @@ -69,14 +69,14 @@ do echo "Middlewared timed out. Consider setting a lower number for async applications" continue fi - proc_count=${#processes[@]} count=0 for proc in "${processes[@]}" do - kill -0 "$proc" &> /dev/null || { unset "processes[$count]"; ((proc_count--)); } + kill -0 "$proc" &> /dev/null || unset "processes[$count]" ((count++)) done - if [[ $it -lt ${#array[@]} && "$proc_count" -lt "$update_limit" ]]; then + processes=("${processes[@]}") + if [[ $it -lt ${#array[@]} && "${#processes[@]}" -lt "$update_limit" ]]; then pre_process "${array[$it]}" & processes+=($!) ((it++)) From ad0c8e07f51952fce53262f72c5687e763dffd32 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 5 Sep 2022 12:38:01 -0600 Subject: [PATCH 0928/1229] reassign array prior to element check --- functions/update_apps.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index a95b67ef..1ad97377 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -42,10 +42,9 @@ do fi ((index++)) done - +array=("${array[@]}") [[ ${#array[@]} == 0 ]] && return -array=("${array[@]}") it=0 while_count=0 From c05570885080d3ed92c8bcaf5acc3eecf6f381a9 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 5 Sep 2022 12:43:01 -0600 Subject: [PATCH 0929/1229] rename it to index --- functions/update_apps.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 1ad97377..01962ff8 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -43,10 +43,10 @@ do ((index++)) done array=("${array[@]}") -[[ ${#array[@]} == 0 ]] && return +[[ ${#array[@]} == 0 ]] && echo && echo && return -it=0 +index=0 while_count=0 rm deploying 2>/dev/null rm finished 2>/dev/null @@ -75,10 +75,10 @@ do ((count++)) done processes=("${processes[@]}") - if [[ $it -lt ${#array[@]} && "${#processes[@]}" -lt "$update_limit" ]]; then - pre_process "${array[$it]}" & + if [[ $index -lt ${#array[@]} && "${#processes[@]}" -lt "$update_limit" ]]; then + pre_process "${array[$index]}" & processes+=($!) - ((it++)) + ((index++)) else sleep 3 fi From 317377705acd501b9a39ea2d29fe9ffae869bd9e Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 5 Sep 2022 13:09:24 -0600 Subject: [PATCH 0930/1229] also rename indexes in pre_process --- functions/update_apps.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 01962ff8..812f4123 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -92,11 +92,11 @@ export -f commander pre_process(){ -app_name=$(echo "${array[$it]}" | awk -F ',' '{print $1}') #print out first catagory, name. -startstatus=$(echo "${array[$it]}" | awk -F ',' '{print $2}') #status of the app: STOPPED / DEPLOYING / ACTIVE -old_full_ver=$(echo "${array[$it]}" | awk -F ',' '{print $4}') #Upgraded From -new_full_ver=$(echo "${array[$it]}" | awk -F ',' '{print $5}') #Upraded To -rollback_version=$(echo "${array[$it]}" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}') +app_name=$(echo "${array[$index]}" | awk -F ',' '{print $1}') #print out first catagory, name. +startstatus=$(echo "${array[$index]}" | awk -F ',' '{print $2}') #status of the app: STOPPED / DEPLOYING / ACTIVE +old_full_ver=$(echo "${array[$index]}" | awk -F ',' '{print $4}') #Upgraded From +new_full_ver=$(echo "${array[$index]}" | awk -F ',' '{print $5}') #Upraded To +rollback_version=$(echo "${array[$index]}" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}') # Check if app is external services, append outcome to external_services file From 9ac0c78daea7bbbefdfc4fbb7bdcea920cf32f5f Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 6 Sep 2022 03:59:15 +0000 Subject: [PATCH 0931/1229] Update README --- README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 8d4a3bfe..cfa6c6b8 100644 --- a/README.md +++ b/README.md @@ -32,25 +32,25 @@ | -r | -r | None | Monitors applications after they update
If the app does not become "ACTIVE" after either:
The custom Timeout, or Default Timeout,
rollback the application. | | -v | -v | None | Verbose Output
_Look at the bottom of this page for an example_ | | -S | -S | None | Shutdown the application prior to updating it | -| -t | -t 150 | Integer | Set a custom timeout to be used with either:
`-m`
_Time the script will wait for application to be "STOPPED"_
or
`-(u\|U)`
_Time the script will wait for application to be either "STOPPED" or "ACTIVE"_ | +| -t | -t 150 | Integer | Time in seconds that HeavyScript will wait for an application to no longer be deploying before declaring failure
Default: 500 | | -s | -s | None | Sync Catalogs prior to updating | | -p | -p | None | Prune old/unused docker images | | --self-update | --self-update | None | Updates HeavyScript prior to running any other commands | ### Example -#### Typical Cron Job +#### Cron Job ``` -bash heavy_script.sh --self-update -b 10 -i portainer -i arch -i sonarr -i radarr -t 600 -rsp -u 5 +bash heavy_script.sh --self-update -b 10 -i nextcloud -i sonarr -t 600 -rsp -u 5 ``` > `-b` is set to 10. Up to 10 snapshots of your ix-applications dataset will be saved -> `-i` is set to ignore portainer, arch, sonarr, and radarr. These applications will be ignored when it comes to updates. +> `-i` is set to ignore __nextcloud__ and __sonarr__. These applications will be skipped if they have an update. -> `-t` I set it to 600 seconds, this means the script will wait 600 seconds for the application to become ACTIVE before timing out and continuing to a different application. +> `-t` I set it to 600 seconds, this means the script will wait 600 seconds for the application to become ACTIVE before timing out and rolling back to the previous version since `-r` is used. -> `-r` Will rollback applications if they fail to deploy after updating. +> `-r` Will rollback applications if they fail to deploy within the timeout, after updating. > `-s` will just sync the repositories, ensuring you are downloading the latest updates. @@ -80,7 +80,7 @@ bash heavy_script.sh --self-update -b 10 -i portainer -i arch -i sonarr -i radar #### Mounting PVC Data ``` -bash /mnt/tank/scripts/heavy_script.sh -t 300 --mount +bash /mnt/tank/scripts/heavy_script.sh --mount ``` #### Restoring ix-applications dataset From fa94f8f600aaa7dcf7379d536ee3aa02ebc25c1a Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Tue, 6 Sep 2022 06:50:14 +0000 Subject: [PATCH 0932/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.190.6 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 62b5168e..e50118a6 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@3bd3b27663e53f987c552ecd809aa69f6a774587 # tag=v32.190.4 + uses: renovatebot/github-action@a7779b2f623084fa48ce3ea83a4f9e48b813ccbc # tag=v32.190.6 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 7a40e12cf9088512416e4978548721111ea853aa Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 6 Sep 2022 20:15:27 -0600 Subject: [PATCH 0933/1229] unset array only if app prev failed --- functions/update_apps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 812f4123..378d3f75 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -35,10 +35,10 @@ do if [[ "$failed_ver" == "$new_full_ver" ]] ; then echo -e "\n$app_name" echo -e "Skipping previously failed version:\n$new_full_ver" + unset "array[$index]" else sed -i /"$app_name",/d failed fi - unset "array[$index]" fi ((index++)) done From 233ecc1820bfbb284e965da0ed58b7efb23ca05a Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 6 Sep 2022 20:23:20 -0600 Subject: [PATCH 0934/1229] failed append fix --- functions/update_apps.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 378d3f75..58cb332f 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -209,11 +209,11 @@ if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then elif [[ "$SECONDS" -ge "$timeout" ]]; then if [[ $rollback == "true" ]]; then if [[ "$failed" != "true" ]]; then + echo "$app_name,$new_full_ver" >> failed echo_array+=("Error: Run Time($SECONDS) for $app_name has exceeded Timeout($timeout)") echo_array+=("If this is a slow starting application, set a higher timeout with -t") echo_array+=("If this applicaion is always DEPLOYING, you can disable all probes under the Healthcheck Probes Liveness section in the edit configuration") - echo_array+=("Reverting update..") - echo "$app_name,$new_full_ver" >> failed + echo_array+=("Reverting update..") if rollback_app ; then echo_array+=("Rolled Back") else @@ -239,11 +239,11 @@ if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then break fi else + echo "$app_name,$new_full_ver" >> failed echo_array+=("Error: Run Time($SECONDS) for $app_name has exceeded Timeout($timeout)") echo_array+=("If this is a slow starting application, set a higher timeout with -t") echo_array+=("If this applicaion is always DEPLOYING, you can disable all probes under the Healthcheck Probes Liveness section in the edit configuration") echo_array+=("Manual intervention is required\nStopping, then Abandoning") - echo "$app_name,$new_full_ver" >> failed if stop_app ; then echo_array+=("Stopped") else From 757a745a8be23c6b2ed13fc29e1a7541e9dbaa44 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Wed, 7 Sep 2022 00:41:40 +0000 Subject: [PATCH 0935/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.192.3 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index e50118a6..0e74ab00 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@a7779b2f623084fa48ce3ea83a4f9e48b813ccbc # tag=v32.190.6 + uses: renovatebot/github-action@c71121090b421b7ced0442a5e70b89ab49383697 # tag=v32.192.3 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From da65de6716430967c61cf44a986537c5e77d4c4c Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Thu, 8 Sep 2022 06:35:50 +0000 Subject: [PATCH 0936/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.194.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 0e74ab00..00b66d0c 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@c71121090b421b7ced0442a5e70b89ab49383697 # tag=v32.192.3 + uses: renovatebot/github-action@2eaf182372872be1a6dabfdede19e897d11cfe76 # tag=v32.194.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 93bd47acc9f68529f59cb9d2d3d3820142324c4c Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 8 Sep 2022 15:02:54 -0600 Subject: [PATCH 0937/1229] add ability to ignore container image updates --- functions/misc.sh | 1 + functions/script_create.sh | 11 ++++++++--- functions/update_apps.sh | 8 ++++++-- heavy_script.sh | 3 +++ 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/functions/misc.sh b/functions/misc.sh index 3812e72a..407c1c41 100644 --- a/functions/misc.sh +++ b/functions/misc.sh @@ -74,6 +74,7 @@ echo "------------------" echo "-b 14 | Back-up your ix-applications dataset, specify a number after -b" echo "-s | sync catalog" echo "-p | Prune unused/old docker images" +echo "--ignore-img | Ignore container image updates" echo "--self-update | Updates HeavyScript prior to running any other commands" echo echo "Examples" diff --git a/functions/script_create.sh b/functions/script_create.sh index de761cc6..63802e63 100644 --- a/functions/script_create.sh +++ b/functions/script_create.sh @@ -83,10 +83,11 @@ do echo echo "Additional Options" echo "------------------" - echo "6) -b | Back-up your ix-applications dataset, specify a number after -b" + echo "6) -b | Back-up your ix-applications dataset" echo "7) -s | sync catalog" echo "8) -p | Prune unused/old docker images" - echo "9) --self-update | Updates HeavyScript prior to running any other commands" + echo "9) --ignore-img | Ignore container image updates" + echo "10) --self-update | Updates HeavyScript prior to running any other commands" echo echo "99) Remove Update Options, Restart" echo "00) Done making selections, proceed with update" @@ -150,7 +151,11 @@ do printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-p" && echo -e "\"-p\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it update_selection+=("-p") ;; - 9 | --self-update ) + 9 | --ignore-img ) + printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "--ignore-img" && echo -e "\"--ignore-img\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it + update_selection+=("--ignore-img") + ;; + 10 | --self-update ) printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "--self-update" && echo -e "\"--self-update\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it update_selection+=("--self-update") ;; diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 58cb332f..40dbdee3 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -8,6 +8,7 @@ echo -e "🅄 🄿 🄳 🄰 🅃 🄴 🅂" echo "Asynchronous Updates: $update_limit" [[ -z $timeout ]] && echo "Default Timeout: 500" && timeout=500 || echo "Custom Timeout: $timeout" [[ "$timeout" -le 120 ]] && echo "Warning: Your timeout is set low and may lead to premature rollbacks or skips" +[[ $ignore_image_update == "true" ]] && echo "Image Updates: Disabled" || echo "Image Updates: Enabled" pool=$(cli -c 'app kubernetes config' | grep -E "dataset\s\|" | awk -F '|' '{print $3}' | awk -F '/' '{print $1}' | tr -d " \t\n\r") index=0 @@ -33,12 +34,15 @@ do elif grep -qs "^$app_name," failed 2>/dev/null; then failed_ver=$(grep "^$app_name," failed | awk -F ',' '{print $2}') if [[ "$failed_ver" == "$new_full_ver" ]] ; then - echo -e "\n$app_name" - echo -e "Skipping previously failed version:\n$new_full_ver" + echo -e "\n$app_name\nSkipping previously failed version:\n$new_full_ver" unset "array[$index]" else sed -i /"$app_name",/d failed fi + #Skip Image updates if ignore image updates is set to true + elif [[ $old_full_ver == "$new_full_ver" && $ignore_image_update == "true" ]]; then + echo -e "\n$app_name\nImage update, skipping.." + unset "array[$index]" fi ((index++)) done diff --git a/heavy_script.sh b/heavy_script.sh index d669aac8..0d39316f 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -52,6 +52,9 @@ do delete-backup) deleteBackup="true" ;; + ignore-img) + ignore_image_update="true" + ;; *) echo -e "Invalid Option \"--$OPTARG\"\n" help From 0d4969042bc874893a030e7d928dd33d1de4332b Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 8 Sep 2022 23:19:12 +0000 Subject: [PATCH 0938/1229] Update README --- README.md | 43 +++++++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index cfa6c6b8..609f09b4 100644 --- a/README.md +++ b/README.md @@ -23,25 +23,26 @@
## Update Arguments -| Flag | Example | Parameter | Description | -|--------------- |------------------------ |----------------- |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| -U | -U
-U 5 | None or Integer | Update applications, ignoring major version changes
_Optionally, you can supply a number after the argument to update multiple applications at once_ | -| -u | -u
-u 5 | None or Integer | Update applications, do NOT update if there was a major version change
_Optionally, you can supply a number after the argument to update multiple applications at once_ | -| -b | -b 14 | Integer | Backup `ix-applications` dataset
_Creates backups up to the number you've chosen_ | -| -i | -i nextcloud -i sonarr | String | Applications listed will be ignored during updating
_List one application after another as shown in the example_ | -| -r | -r | None | Monitors applications after they update
If the app does not become "ACTIVE" after either:
The custom Timeout, or Default Timeout,
rollback the application. | -| -v | -v | None | Verbose Output
_Look at the bottom of this page for an example_ | -| -S | -S | None | Shutdown the application prior to updating it | -| -t | -t 150 | Integer | Time in seconds that HeavyScript will wait for an application to no longer be deploying before declaring failure
Default: 500 | -| -s | -s | None | Sync Catalogs prior to updating | -| -p | -p | None | Prune old/unused docker images | -| --self-update | --self-update | None | Updates HeavyScript prior to running any other commands | +| Flag | Example | Parameter | Description | +|---------------|------------------------|------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| -U | -U
-U 5 | Optional Integer | Update applications, ignoring major version changes
_Optionally, you can supply a number after the argument to update multiple applications at once_ | +| -u | -u
-u 5 | Optional Integer | Update applications, do NOT update if there was a major version change
_Optionally, you can supply a number after the argument to update multiple applications at once_ | +| -b | -b 14 | Integer | Snapshot ix-applications dataset
_Creates backups UP TO the number you've chosen_ | +| -i | -i nextcloud -i sonarr | String | Applications listed will be ignored during updating
_List one application after another as shown in the example_ | +| -r | -r | | Monitors applications after they update
If the app does not become "ACTIVE" after the timeout, rollback the application. | +| -v | -v | | Verbose Output
_Look at the bottom of this page for an example_ | +| -S | -S | | Shutdown the application prior to updating it | +| -t | -t 400 | Integer | Time in seconds that HeavyScript will wait for an application to no longer be deploying before declaring failure
Default: 500 | +| -s | -s | | Sync Catalogs prior to updating | +| -p | -p | | Prune unused docker images | +| --ignore-img | --ignore-img | | Ignore container image updates | +| --self-update | --self-update | | Updates HeavyScript prior to running any other commands | ### Example #### Cron Job ``` -bash heavy_script.sh --self-update -b 10 -i nextcloud -i sonarr -t 600 -rsp -u 5 +bash heavy_script.sh --self-update -b 10 -i nextcloud -i sonarr -t 600 --ignore-img -rsp -u 5 ``` > `-b` is set to 10. Up to 10 snapshots of your ix-applications dataset will be saved @@ -50,6 +51,8 @@ bash heavy_script.sh --self-update -b 10 -i nextcloud -i sonarr -t 600 -rsp -u 5 > `-t` I set it to 600 seconds, this means the script will wait 600 seconds for the application to become ACTIVE before timing out and rolling back to the previous version since `-r` is used. +> `--ignore-img` Will not update the application if it is only a container image update + > `-r` Will rollback applications if they fail to deploy within the timeout, after updating. > `-s` will just sync the repositories, ensuring you are downloading the latest updates. @@ -61,6 +64,13 @@ bash heavy_script.sh --self-update -b 10 -i nextcloud -i sonarr -t 600 -rsp -u 5 > `--self-update` Will update the script prior to running anything else. +
+ +#### My Personal Cron Job +``` +bash /mnt/speed/scripts/heavy_script/heavy_script.sh --self-update -b 10 -rsp -u 10 +``` +

@@ -142,12 +152,13 @@ From here, you can just run Heavy_Script with `bash heavy_script.sh -ARGUMENTS` ## How to Update -### Built-In Option +### Built-In Option (Reccommended) ``` bash heavyscript.sh --self-update -b 10 -supr ``` > The important argument here is the `--self-update`, you can still use all of your same arguments with this option. +>> `--self-update` will place users on the latest tag, as well as showing the changelog when new releases come out. So this is the preferred method. Not using this method, will instead place the user on `main`, where the changes are tested, but not as rigerously as they are on the releases.
@@ -164,7 +175,7 @@ cd /mnt/speed/scripts/heavy_script ``` git pull ``` - +> This is not recommended because the changes to main are not tested as much as the changes that are pushed to releases are tested, think of this method of updating as being in development.

From a6213a65e3c0f05291c2becd8a93ea482592cbee Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 8 Sep 2022 17:26:23 -0600 Subject: [PATCH 0939/1229] fix container updates always marked as true --- functions/update_apps.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 40dbdee3..7bb79888 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -21,6 +21,8 @@ do new_chart_ver=$(echo "$app" | awk -F ',' '{print $5}' | awk -F '_' '{print $2}' | awk -F '.' '{print $1}') # New Chart MAJOR version diff_app=$(diff <(echo "$old_app_ver") <(echo "$new_app_ver")) #caluclating difference in major app versions diff_chart=$(diff <(echo "$old_chart_ver") <(echo "$new_chart_ver")) #caluclating difference in Chart versions + old_full_ver=$(echo "${array[$index]}" | awk -F ',' '{print $4}') #Upgraded From + new_full_ver=$(echo "${array[$index]}" | awk -F ',' '{print $5}') #Upraded To #Skip application if its on ignore list if printf '%s\0' "${ignore[@]}" | grep -iFxqz "${app_name}" ; then From 63dc1ed002f8a986a3154ff728cc737f130d1412 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 8 Sep 2022 23:34:08 +0000 Subject: [PATCH 0940/1229] typo in README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 609f09b4..5d2105ed 100644 --- a/README.md +++ b/README.md @@ -152,7 +152,7 @@ From here, you can just run Heavy_Script with `bash heavy_script.sh -ARGUMENTS` ## How to Update -### Built-In Option (Reccommended) +### Built-In Option (Recommended) ``` bash heavyscript.sh --self-update -b 10 -supr From d50829085a7d1f49910e4a4041d69bb000162079 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Fri, 9 Sep 2022 00:42:33 +0000 Subject: [PATCH 0941/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.194.2 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 00b66d0c..77427565 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@2eaf182372872be1a6dabfdede19e897d11cfe76 # tag=v32.194.0 + uses: renovatebot/github-action@4b9dd463227c8b21dc232bc32fa925d532907981 # tag=v32.194.2 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 683819a3cc54134b959a5f3d0b03a8646240ea1f Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Thu, 8 Sep 2022 18:09:47 +0000 Subject: [PATCH 0942/1229] chore(deps): update github-action actions/setup-python [skip ci] to v4 --- .github/workflows/shellcheck.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml index f7d74e7d..ccdd9981 100644 --- a/.github/workflows/shellcheck.yml +++ b/.github/workflows/shellcheck.yml @@ -22,5 +22,5 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3 - - uses: actions/setup-python@98f2ad02fd48d057ee3b4d4f66525b231c3e52b6 # tag=v3 + - uses: actions/setup-python@b55428b1882923874294fa556849718a1d7f2ca5 # tag=v4 - uses: pre-commit/action@646c83fcd040023954eafda54b4db0192ce70507 # tag=v3.0.0 From b566195a556aaade4f9c9176e089bea082e711a6 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Fri, 9 Sep 2022 18:09:38 +0000 Subject: [PATCH 0943/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.194.3 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 77427565..785bce70 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@4b9dd463227c8b21dc232bc32fa925d532907981 # tag=v32.194.2 + uses: renovatebot/github-action@5eb644467fe589129cee10100500254e38f8f66b # tag=v32.194.3 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 0c5d18449d555fdc40ce2047ca783a77bfcaa0c6 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Sat, 10 Sep 2022 18:09:07 +0000 Subject: [PATCH 0944/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.194.4 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 785bce70..06ee9c94 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@5eb644467fe589129cee10100500254e38f8f66b # tag=v32.194.3 + uses: renovatebot/github-action@1e99a91d658693cad095bd268afe7ac8a5857dba # tag=v32.194.4 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 539d36eb56d38f7beb1ac459d8d3ba89dadf4341 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Mon, 12 Sep 2022 06:47:14 +0000 Subject: [PATCH 0945/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.194.5 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 06ee9c94..d577229a 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@1e99a91d658693cad095bd268afe7ac8a5857dba # tag=v32.194.4 + uses: renovatebot/github-action@822d51f6ad10277da8d43fd0fecc69e2eee5198f # tag=v32.194.5 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 89c6367d4c798bbcdb2fb4a3075e142ecf5d2879 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Tue, 13 Sep 2022 06:45:47 +0000 Subject: [PATCH 0946/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.195.1 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index d577229a..03db5633 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@822d51f6ad10277da8d43fd0fecc69e2eee5198f # tag=v32.194.5 + uses: renovatebot/github-action@0a04ae8c3eefe215c01ae93b59aab82968d71bee # tag=v32.195.1 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 9bfdd80324fdd0e805bc36406a3fa59dc15f2493 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Wed, 14 Sep 2022 00:39:55 +0000 Subject: [PATCH 0947/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.195.3 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 03db5633..59c5a746 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@0a04ae8c3eefe215c01ae93b59aab82968d71bee # tag=v32.195.1 + uses: renovatebot/github-action@3a46d8fe9ed1c361f54ba878d64a17965912bfd6 # tag=v32.195.3 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 6b7c68317bae95b5627e02423cccbb659f7e5ff2 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 14 Sep 2022 19:06:04 -0600 Subject: [PATCH 0948/1229] include truetool backups in overflow --- functions/backup.sh | 6 +++--- functions/update_apps.sh | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/functions/backup.sh b/functions/backup.sh index 0ca69069..c1b2f4a0 100644 --- a/functions/backup.sh +++ b/functions/backup.sh @@ -7,11 +7,11 @@ echo_backup+=("Number of backups was set to $number_of_backups") date=$(date '+%Y_%m_%d_%H_%M_%S') [[ "$verbose" == "true" ]] && cli -c 'app kubernetes backup_chart_releases backup_name=''"'HeavyScript_"$date"'"' &> /dev/null && echo_backup+=(HeavyScript_"$date") [[ -z "$verbose" ]] && echo_backup+=("\nNew Backup Name:") && cli -c 'app kubernetes backup_chart_releases backup_name=''"'HeavyScript_"$date"'"' | tail -n 1 &> /dev/null && echo_backup+=(HeavyScript_"$date") -mapfile -t list_backups < <(cli -c 'app kubernetes list_backups' | grep "HeavyScript_" | sort -t '_' -Vr -k2,7 | awk -F '|' '{print $2}'| tr -d " \t\r") +mapfile -t list_backups < <(cli -c 'app kubernetes list_backups' | grep -E "HeavyScript_|TrueTool_" | sort -t '_' -Vr -k2,7 | awk -F '|' '{print $2}'| tr -d " \t\r") if [[ ${#list_backups[@]} -gt "$number_of_backups" ]]; then echo_backup+=("\nDeleted the oldest backup(s) for exceeding limit:") overflow=$(( ${#list_backups[@]} - "$number_of_backups" )) - mapfile -t list_overflow < <(cli -c 'app kubernetes list_backups' | grep "HeavyScript_" | sort -t '_' -V -k2,7 | awk -F '|' '{print $2}'| tr -d " \t\r" | head -n "$overflow") + mapfile -t list_overflow < <(cli -c 'app kubernetes list_backups' | grep -E "HeavyScript_|TrueTool_" | sort -t '_' -V -k2,7 | awk -F '|' '{print $2}'| tr -d " \t\r" | head -n "$overflow") for i in "${list_overflow[@]}" do cli -c 'app kubernetes delete_backup backup_name=''"'"$i"'"' &> /dev/null || echo_backup+=("Failed to delete $i") @@ -115,7 +115,7 @@ restore(){ while true do clear -x && echo "pulling restore points.." - list_backups=$(cli -c 'app kubernetes list_backups' | grep "HeavyScript_" | sort -t '_' -Vr -k2,7 | tr -d " \t\r" | awk -F '|' '{print $2}' | nl -s ") " | column -t) + list_backups=$(cli -c 'app kubernetes list_backups' | grep -E "HeavyScript_|TrueTool_" | sort -t '_' -Vr -k2,7 | tr -d " \t\r" | awk -F '|' '{print $2}' | nl -s ") " | column -t) if [[ -z "$list_backups" ]]; then echo "No HeavyScript restore points available" exit diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 7bb79888..9f54bb33 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -21,8 +21,8 @@ do new_chart_ver=$(echo "$app" | awk -F ',' '{print $5}' | awk -F '_' '{print $2}' | awk -F '.' '{print $1}') # New Chart MAJOR version diff_app=$(diff <(echo "$old_app_ver") <(echo "$new_app_ver")) #caluclating difference in major app versions diff_chart=$(diff <(echo "$old_chart_ver") <(echo "$new_chart_ver")) #caluclating difference in Chart versions - old_full_ver=$(echo "${array[$index]}" | awk -F ',' '{print $4}') #Upgraded From - new_full_ver=$(echo "${array[$index]}" | awk -F ',' '{print $5}') #Upraded To + old_full_ver=$(echo "$app" | awk -F ',' '{print $4}') #Upgraded From + new_full_ver=$(echo "$app" | awk -F ',' '{print $5}') #Upraded To #Skip application if its on ignore list if printf '%s\0' "${ignore[@]}" | grep -iFxqz "${app_name}" ; then From 054277b3756cf3e08ebeea4fad9fa95295c0f7c9 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Thu, 15 Sep 2022 00:44:07 +0000 Subject: [PATCH 0949/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.195.5 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 59c5a746..f9de9b80 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@3a46d8fe9ed1c361f54ba878d64a17965912bfd6 # tag=v32.195.3 + uses: renovatebot/github-action@41cb77f03584caff344e5fcad5bd771fd4d655f5 # tag=v32.195.5 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From b4e05510018d6af1a3fc13e8d328d3f8aaa07043 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 15 Sep 2022 10:21:53 -0600 Subject: [PATCH 0950/1229] remove } after var --- functions/cmd_to_container.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index fa2803b6..84187526 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -62,7 +62,7 @@ case "${#containers[@]}" in if [[ $selection == 0 ]]; then echo "Exiting.." exit - elif ! echo -e "$cont_search}" | grep -qs ^"$selection)" ; then + elif ! echo -e "$cont_search" | grep -qs ^"$selection)" ; then echo "Error: \"$selection\" was not an option.. Try again" sleep 3 continue From 79558260d9874fd938c5905cd7ff240f1b582915 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Fri, 16 Sep 2022 18:10:43 +0000 Subject: [PATCH 0951/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.196.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index f9de9b80..207ff570 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@41cb77f03584caff344e5fcad5bd771fd4d655f5 # tag=v32.195.5 + uses: renovatebot/github-action@4c0da06b4d1bd7e13be279b41e4e508a68cadb2d # tag=v32.196.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 261e367da822d7bddf5fc594324a1f3a8ba42dcc Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Sat, 17 Sep 2022 18:08:43 +0000 Subject: [PATCH 0952/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.197.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 207ff570..50a509aa 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@4c0da06b4d1bd7e13be279b41e4e508a68cadb2d # tag=v32.196.0 + uses: renovatebot/github-action@f799f1e2a3cf872b3607cdbbb8bc4c54bd6e9b00 # tag=v32.197.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From d898c975ad1dfdb21afdf0d834b9bdaca8dc8ea0 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Sun, 18 Sep 2022 06:12:02 +0000 Subject: [PATCH 0953/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.197.1 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 50a509aa..26277d0a 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@f799f1e2a3cf872b3607cdbbb8bc4c54bd6e9b00 # tag=v32.197.0 + uses: renovatebot/github-action@39846912399a0a6206e1b341ba8406b83e32064f # tag=v32.197.1 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 3f353b130515fbf003d42600b8d2b410839abb12 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Mon, 19 Sep 2022 00:41:20 +0000 Subject: [PATCH 0954/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.198.1 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 26277d0a..cdba760e 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@39846912399a0a6206e1b341ba8406b83e32064f # tag=v32.197.1 + uses: renovatebot/github-action@3813b7118f50aa4043fe511b9735ec774e270f5f # tag=v32.198.1 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From b27133f7decf2bf26707285929bf504c2d05221f Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Tue, 20 Sep 2022 00:42:45 +0000 Subject: [PATCH 0955/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.199.1 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index cdba760e..079490ef 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@3813b7118f50aa4043fe511b9735ec774e270f5f # tag=v32.198.1 + uses: renovatebot/github-action@d5c9b2e89bd31cb4b302b69e60ecb600a9894151 # tag=v32.199.1 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 4c8e3f4e984003968f2b92723becbe6f220ca18b Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Wed, 21 Sep 2022 00:44:48 +0000 Subject: [PATCH 0956/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.201.1 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 079490ef..05980f20 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@d5c9b2e89bd31cb4b302b69e60ecb600a9894151 # tag=v32.199.1 + uses: renovatebot/github-action@682455a348f97d4a4c15be530e5f0d298b049f3e # tag=v32.201.1 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 0096c06c8e038145648599fad67bf477d7f8ced4 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Wed, 21 Sep 2022 18:09:58 +0000 Subject: [PATCH 0957/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.201.2 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 05980f20..10e21db5 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@682455a348f97d4a4c15be530e5f0d298b049f3e # tag=v32.201.1 + uses: renovatebot/github-action@223e302c632f6f4fca4de40ee0df69a7eb9dbe39 # tag=v32.201.2 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 8d50d27fe97934fcfe6c1942b6beb1b5bd15c0ee Mon Sep 17 00:00:00 2001 From: heavybullets8 Date: Wed, 21 Sep 2022 21:02:45 -0600 Subject: [PATCH 0958/1229] zfs list improvements for mount --- functions/mount.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/mount.sh b/functions/mount.sh index 00c3cf93..8615a2b5 100644 --- a/functions/mount.sh +++ b/functions/mount.sh @@ -56,7 +56,7 @@ do #Grab data then output and mount data_name=$(echo "$pvc" | awk '{print $3}') volume_name=$(echo "$pvc" | awk '{print $4}') - full_path=$(zfs list | grep "$volume_name" | grep "$pool" | awk '{print $1}') + full_path=$(zfs list -t filesystem -r "$pool"/ix-applications/releases/"$app"/volumes -o name -H | grep "$volume_name") if ! zfs set mountpoint=/heavyscript/"$data_name" "$full_path" ; then echo "Error: Failed to mount $app" exit 1 From e359c242536e2e6da52f32060d95486663c0f3c6 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Thu, 22 Sep 2022 18:09:49 +0000 Subject: [PATCH 0959/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.202.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 10e21db5..f749b373 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@223e302c632f6f4fca4de40ee0df69a7eb9dbe39 # tag=v32.201.2 + uses: renovatebot/github-action@f7b3b728b18da38cadcf96143615cc8d65245fae # tag=v32.202.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 299dc2264e787753ba1a56eb72ed7b61e66c7f22 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Fri, 23 Sep 2022 06:36:47 +0000 Subject: [PATCH 0960/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.202.1 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index f749b373..5d98e261 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@f7b3b728b18da38cadcf96143615cc8d65245fae # tag=v32.202.0 + uses: renovatebot/github-action@4fe333be6712f3fcb282c57468fb7c2ed57174b8 # tag=v32.202.1 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From c8cba21931dda71c15ae6056df77e4e9c0c11bb4 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Fri, 23 Sep 2022 18:10:58 +0000 Subject: [PATCH 0961/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.202.3 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 5d98e261..c472ef27 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@4fe333be6712f3fcb282c57468fb7c2ed57174b8 # tag=v32.202.1 + uses: renovatebot/github-action@88446f41092c9f7478c3d63199749db7a3b7e6e9 # tag=v32.202.3 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From ae90ad3f7c6ec474f4757874c77eb0dd4597452d Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Sun, 25 Sep 2022 00:40:39 +0000 Subject: [PATCH 0962/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.202.4 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index c472ef27..60e39968 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@88446f41092c9f7478c3d63199749db7a3b7e6e9 # tag=v32.202.3 + uses: renovatebot/github-action@d46f9c6679e39ca1274a71d3ea8d444e11af11c4 # tag=v32.202.4 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From caee00f7eb8d41f19197aea35759cce101e195fe Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Mon, 26 Sep 2022 06:41:17 +0000 Subject: [PATCH 0963/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.204.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 60e39968..25b3297b 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@d46f9c6679e39ca1274a71d3ea8d444e11af11c4 # tag=v32.202.4 + uses: renovatebot/github-action@43a67d96ae2a9d8811775e3653ec77e392033ba0 # tag=v32.204.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 79e9c31a42cfaed23f20a5dc08ec4f171e9c0495 Mon Sep 17 00:00:00 2001 From: SuperQ Date: Mon, 26 Sep 2022 15:08:07 +0200 Subject: [PATCH 0964/1229] Add option to disable Kube API firewall The middlewared adds a firewall at every boot to block the Kubernetes API from external access. Add a command line option to drop the firewall rule. Signed-off-by: SuperQ --- README.md | 1 + includes/chores.sh | 11 +++++++++++ includes/no_args.sh | 4 ++++ truetool.sh | 6 +++++- 4 files changed, 21 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index fbcfa3c8..5b35fab4 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,7 @@ It also offers a few handy shortcuts for commonly required chores, like: Enablin | --dns | --dns | None | list all of your applications DNS names and their web ports | | --list-backups | --list-backups | None | Prints a list of backups available | | --helm-enable | --helm-enable | None | Enables Helm command access on SCALE | +| --kubeapi-enable | --kubeapi-enable | None | Enables external access to Kuberntes API port | | --apt-enable | --apt-enable | None | Enables Apt command access on SCALE | | --no-color | --no-color | None | Disables showing colors in terminal output, usefull for SCALE Email output | | -U | -U | None | Update applications, ignoring major version changes | diff --git a/includes/chores.sh b/includes/chores.sh index df6d3a73..3ffa533c 100755 --- a/includes/chores.sh +++ b/includes/chores.sh @@ -12,6 +12,17 @@ chmod +x /usr/bin/apt* && echo -e "${IGreen}APT enabled${Color_Off}"|| echo -e " } export -f aptEnable +kubeapiEnable(){ +local -r comment='iX Custom Rule to drop connection requests to k8s cluster from external sources' +echo -e "${BWhite}Enabling Apt-Commands${Color_Off}" +if iptables -t filter -L INPUT 2> /dev/null | grep -q "${comment}" ; then + iptables -D INPUT -p tcp -m tcp --dport 6443 -m comment --comment "${comment}" -j DROP && echo -e "${IGreen}Kubernetes API enabled${Color_Off}"|| echo -e "${IRed}Kubernetes API Enable FAILED${Color_Off}" +else + echo -e "${IGreen}Kubernetes API already enabled${Color_Off}" +fi +} +export -f kubeapiEnable + # Prune unused docker images to prevent dataset/snapshot bloat related slowdowns on SCALE prune(){ echo -e "${BWhite}Docker Prune${Color_Off}" diff --git a/includes/no_args.sh b/includes/no_args.sh index 951f009b..9ff0f3c0 100755 --- a/includes/no_args.sh +++ b/includes/no_args.sh @@ -12,6 +12,7 @@ no_args(){ echo "7 Enable Helm Commands" echo "8 Enable Apt and Apt-Get Commands" echo "9 Update All Apps" + echo "10 Enable external access to Kuberntes API port" read -rt 600 -p "Please select an option by number: " selection case $selection in @@ -59,6 +60,9 @@ no_args(){ echo "INVALID ENTRY" && exit 1 fi ;; + 10) + kubeapiEnable="true" + ;; *) echo "Unknown option" && exit 1 ;; diff --git a/truetool.sh b/truetool.sh index c73b7411..3997a3af 100755 --- a/truetool.sh +++ b/truetool.sh @@ -68,6 +68,9 @@ else apt-enable) aptEnable="true" ;; + kubeapi-enable) + kubeapiEnable="true" + ;; no-color) noColor ;; @@ -158,7 +161,8 @@ fi [[ "$help" == "true" ]] && help [[ "$helmEnable" == "true" ]] && helmEnable [[ "$aptEnable" == "true" ]] && aptEnable -[[ "$aptEnable" == "true" || "$helmEnable" == "true" ]] && exit +[[ "$kubeapiEnable" == "true" ]] && kubeapiEnable +[[ "$aptEnable" == "true" || "$helmEnable" == "true" || "$kubeapiEnable" == "true" ]] && exit [[ "$listBackups" == "true" ]] && listBackups && exit [[ "$deleteBackup" == "true" ]] && deleteBackup && exit [[ "$dns" == "true" ]] && dns && exit From 1cbdf73d7ce21cff37fd900640668ad3b91933ad Mon Sep 17 00:00:00 2001 From: SuperQ Date: Mon, 26 Sep 2022 15:40:00 +0200 Subject: [PATCH 0965/1229] Add misssing help text Add help text for `--kubeapi-enable`. Signed-off-by: SuperQ --- includes/chores.sh | 2 +- includes/help.sh | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/includes/chores.sh b/includes/chores.sh index 3ffa533c..9f3cbc6a 100755 --- a/includes/chores.sh +++ b/includes/chores.sh @@ -14,7 +14,7 @@ export -f aptEnable kubeapiEnable(){ local -r comment='iX Custom Rule to drop connection requests to k8s cluster from external sources' -echo -e "${BWhite}Enabling Apt-Commands${Color_Off}" +echo -e "${BWhite}Enabling Kubernetes API${Color_Off}" if iptables -t filter -L INPUT 2> /dev/null | grep -q "${comment}" ; then iptables -D INPUT -p tcp -m tcp --dport 6443 -m comment --comment "${comment}" -j DROP && echo -e "${IGreen}Kubernetes API enabled${Color_Off}"|| echo -e "${IRed}Kubernetes API Enable FAILED${Color_Off}" else diff --git a/includes/help.sh b/includes/help.sh index 28258c9d..48751f0c 100755 --- a/includes/help.sh +++ b/includes/help.sh @@ -4,13 +4,14 @@ help(){ [[ $help == "true" ]] && clear -x echo "" echo -e "${BWhite}Basic Utilities${Color_Off}" -echo "--mount | Initiates mounting feature, choose between unmounting and mounting PVC data" -echo "--restore | Opens a menu to restore a \"truetool\" backup that was taken on your \"ix-applications\" dataset" -echo "--delete-backup | Opens a menu to delete backups on your system" -echo "--list-backups | Prints a list of backups available" -echo "--helm-enable | Enables Helm command access on SCALE" -echo "--apt-enable | Enables Apt command access on SCALE" -echo "--dns | list all of your applications DNS names and their web ports" +echo "--mount | Initiates mounting feature, choose between unmounting and mounting PVC data" +echo "--restore | Opens a menu to restore a \"truetool\" backup that was taken on your \"ix-applications\" dataset" +echo "--delete-backup | Opens a menu to delete backups on your system" +echo "--list-backups | Prints a list of backups available" +echo "--helm-enable | Enables Helm command access on SCALE" +echo "--apt-enable | Enables Apt command access on SCALE" +echo "--kubeapi-enable | Enables external access to Kuberntes API port" +echo "--dns | list all of your applications DNS names and their web ports" echo echo -e "${BWhite}Update Options${Color_Off}" echo "-U | Update all applications, ignores versions" From 97b10d1353c0060e8a3e55f88502d4d6e40b6e35 Mon Sep 17 00:00:00 2001 From: Stavros Kois <47820033+stavros-k@users.noreply.github.com> Date: Mon, 26 Sep 2022 22:58:54 +0300 Subject: [PATCH 0966/1229] Update includes/help.sh --- includes/help.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/help.sh b/includes/help.sh index 48751f0c..a31cd4fc 100755 --- a/includes/help.sh +++ b/includes/help.sh @@ -11,7 +11,7 @@ echo "--list-backups | Prints a list of backups available" echo "--helm-enable | Enables Helm command access on SCALE" echo "--apt-enable | Enables Apt command access on SCALE" echo "--kubeapi-enable | Enables external access to Kuberntes API port" -echo "--dns | list all of your applications DNS names and their web ports" +echo "--dns | List all of your applications DNS names and their web ports" echo echo -e "${BWhite}Update Options${Color_Off}" echo "-U | Update all applications, ignores versions" From 638020b98dae6b7be19163a640701015a863749c Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Tue, 27 Sep 2022 06:40:08 +0000 Subject: [PATCH 0967/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.204.5 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 25b3297b..b948c1cf 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@43a67d96ae2a9d8811775e3653ec77e392033ba0 # tag=v32.204.0 + uses: renovatebot/github-action@22e5361e99f928eaade22e2f55d457e0fcd137b8 # tag=v32.204.5 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 5b37d654c8d8dc95955d030cf37e419b6adeff78 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Wed, 28 Sep 2022 00:51:27 +0000 Subject: [PATCH 0968/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.208.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index b948c1cf..b56b15ca 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@22e5361e99f928eaade22e2f55d457e0fcd137b8 # tag=v32.204.5 + uses: renovatebot/github-action@9c03a9624e1973eecf6b271a4b31f7ddb1f84144 # tag=v32.208.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From b225536544d0afb00ec73e4347e3750709df2105 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Wed, 28 Sep 2022 12:15:42 +0000 Subject: [PATCH 0969/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.208.1 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index b56b15ca..40eab987 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@9c03a9624e1973eecf6b271a4b31f7ddb1f84144 # tag=v32.208.0 + uses: renovatebot/github-action@5c3af5291750a557bd359d10c55c58e0808f1a2c # tag=v32.208.1 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 2c47a156e8d4d95582a06773119a61e975a8df3d Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Thu, 29 Sep 2022 00:55:35 +0000 Subject: [PATCH 0970/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.208.2 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 40eab987..13b20428 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@5c3af5291750a557bd359d10c55c58e0808f1a2c # tag=v32.208.1 + uses: renovatebot/github-action@db21938faafa9c6b7a442ad301da7030f2ed9968 # tag=v32.208.2 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 125645df961026b4dca08b832421700cc61aad05 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Fri, 30 Sep 2022 12:17:22 +0000 Subject: [PATCH 0971/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.209.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 13b20428..1117f058 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@db21938faafa9c6b7a442ad301da7030f2ed9968 # tag=v32.208.2 + uses: renovatebot/github-action@911a8d101cc0a4f640f05187e68dd59f1ba2dd81 # tag=v32.209.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 6b31620ff758144257d0ad096c837cfc0a635119 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Sat, 1 Oct 2022 12:14:25 +0000 Subject: [PATCH 0972/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.211.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 1117f058..88ad9210 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@911a8d101cc0a4f640f05187e68dd59f1ba2dd81 # tag=v32.209.0 + uses: renovatebot/github-action@45486a63d1012d2f409ccb339e142835be3a46f1 # tag=v32.211.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 28a7eea02a81cef401dfc854162ecb3440dfc80f Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Sun, 2 Oct 2022 00:52:33 +0000 Subject: [PATCH 0973/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.211.1 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 88ad9210..f5be138b 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@45486a63d1012d2f409ccb339e142835be3a46f1 # tag=v32.211.0 + uses: renovatebot/github-action@f928f09e1268547d308108dc48cf3ce3bf191078 # tag=v32.211.1 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 2d03b3e2550c41ae4b68919eb330ce8924bab274 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Sun, 2 Oct 2022 12:14:01 +0000 Subject: [PATCH 0974/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.213.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index f5be138b..e1e0b3ca 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@f928f09e1268547d308108dc48cf3ce3bf191078 # tag=v32.211.1 + uses: renovatebot/github-action@a3b10f9b105b46aeda1d358f0d7f040dafd4fae6 # tag=v32.213.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 9285498ba61168ca4a0a95388821f595b4623af6 Mon Sep 17 00:00:00 2001 From: Josh Cox Date: Mon, 3 Oct 2022 10:19:08 -0500 Subject: [PATCH 0975/1229] Adding in a bootstrap file for ease of installation Signed-off-by: Josh Cox --- README.md | 10 +++++++++ bin/truetool | 6 +++++ bootstrap | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 78 insertions(+) create mode 100755 bin/truetool create mode 100755 bootstrap diff --git a/README.md b/README.md index 5b35fab4..e0a83aee 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,16 @@ It also offers a few handy shortcuts for commonly required chores, like: Enablin ## How to Install +### oneliner + +``` +curl -s https://raw.githubusercontent.com/truecharts/truetool/main/bootstrap | bash +``` + +You can now use truetool anywhere `truetool -ARGUMENTS` + +## Manual Install + ### Choose a folder It's important to save the script in a folder that is persistent across TrueNAS System Updates. diff --git a/bin/truetool b/bin/truetool new file mode 100755 index 00000000..4376aa1f --- /dev/null +++ b/bin/truetool @@ -0,0 +1,6 @@ +#!/bin/bash +orig_cwd=$(pwd) +cd "$HOME/truetool" || exit +# pass all arguments '$@' to truetool.sh +bash ./truetool.sh "$@" +cd "$orig_cwd" || exit diff --git a/bootstrap b/bootstrap new file mode 100755 index 00000000..75d0bc48 --- /dev/null +++ b/bootstrap @@ -0,0 +1,62 @@ +#!/bin/bash +# exit on errors +set -e +# Check that we are root +if [[ ! $(whoami) == 'root' ]]; then + echo 'This is intended to be ran as root' + exit 1 +fi + +# Check if the truetool repo already exists +if [[ -d $HOME/truetool ]]; then + cd "$HOME/truetool" || exit + git log -n1|cat +else + cd "$HOME" || exit + git clone https://github.com/truecharts/truetool.git +fi + +# Check if $HOME/bin exists, or make it +if [[ ! -d $HOME/bin ]]; then + mkdir -p "$HOME/bin" +fi + +# Check if the truetool wrapper exists, or make it +if [[ ! -x "$HOME/bin/truetool" ]]; then + install -m555 -v "$HOME/truetool/bin/truetool" "$HOME/bin/" +fi + +# these vars are used by the following functions +LINE_TO_ADD='' +TARGET_FILE_FOR_ADD="$HOME/.profile" + +check_if_line_exists() +{ + if [[ "$VERBOSITY" -gt '7' ]]; then + echo "Checking for '$LINE_TO_ADD' in $TARGET_FILE_FOR_ADD" + fi + grep -qsFx "$LINE_TO_ADD" "$TARGET_FILE_FOR_ADD" +} + +add_line_to() +{ + if [[ "$VERBOSITY" -gt '5' ]]; then + echo "Adding '$LINE_TO_ADD' to $TARGET_FILE_FOR_ADD" + fi + TARGET_FILE=$TARGET_FILE_FOR_ADD + [ -w "$TARGET_FILE" ] || TARGET_FILE=$TARGET_FILE_FOR_ADD + printf "%s\n" "$LINE_TO_ADD" >> "$TARGET_FILE" +} + +dotfiles_install () { + # Adjusting dotfiles by adding $HOME/bin to our path + touch "$HOME/.zshrc" + touch "$HOME/.bashrc" + LINE_TO_ADD="$(printf "export PATH=\"%s:\$PATH\"" '/root/bin')" + TARGET_FILE_FOR_ADD="$HOME/.bashrc" + check_if_line_exists || add_line_to + TARGET_FILE_FOR_ADD="$HOME/.zshrc" + check_if_line_exists || add_line_to +} + +dotfiles_install From 18bdfeb28e26e93c4acc95f25c29ef38586fc794 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Mon, 3 Oct 2022 18:16:36 +0000 Subject: [PATCH 0976/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.213.2 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index e1e0b3ca..446e1323 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@a3b10f9b105b46aeda1d358f0d7f040dafd4fae6 # tag=v32.213.0 + uses: renovatebot/github-action@58ce67d3fa4063395f66a7794f6c14ec16ecb3be # tag=v32.213.2 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From acaea72fa150084f55fb93c05fd1b13dc5fbdffc Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Tue, 4 Oct 2022 12:16:42 +0000 Subject: [PATCH 0977/1229] chore(deps): update github-action actions/checkout [skip ci] to v3.1.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 446e1323..718ea87b 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2 + uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # tag=v3.1.0 with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate From df4a5d3fdd317b903503302612f37f9ce751c652 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Tue, 4 Oct 2022 18:18:23 +0000 Subject: [PATCH 0978/1229] chore(deps): update github-action actions/checkout [skip ci] to 93ea575 --- .github/workflows/shellcheck.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml index ccdd9981..06f92659 100644 --- a/.github/workflows/shellcheck.yml +++ b/.github/workflows/shellcheck.yml @@ -10,7 +10,7 @@ jobs: name: Shellcheck runs-on: ubuntu-latest steps: - - uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3 + - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # tag=v3 - name: Run ShellCheck uses: ludeeus/action-shellcheck@master with: @@ -21,6 +21,6 @@ jobs: pre-commit: runs-on: ubuntu-latest steps: - - uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3 + - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # tag=v3 - uses: actions/setup-python@b55428b1882923874294fa556849718a1d7f2ca5 # tag=v4 - uses: pre-commit/action@646c83fcd040023954eafda54b4db0192ce70507 # tag=v3.0.0 From a3a094138cf735861921dad3cfced00fc6684a19 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Wed, 5 Oct 2022 06:24:55 +0000 Subject: [PATCH 0979/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.216.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 718ea87b..db63619e 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@58ce67d3fa4063395f66a7794f6c14ec16ecb3be # tag=v32.213.2 + uses: renovatebot/github-action@1655c8cead9e0000a3616e7556382cd0e4107a74 # tag=v32.216.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 324e87082f0b5361efb18e4e64ff20eafd2dcea6 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Wed, 5 Oct 2022 12:14:56 +0000 Subject: [PATCH 0980/1229] chore(deps): update github-action actions/checkout [skip ci] to 2541b12 --- .github/workflows/shellcheck.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml index 06f92659..ccdd9981 100644 --- a/.github/workflows/shellcheck.yml +++ b/.github/workflows/shellcheck.yml @@ -10,7 +10,7 @@ jobs: name: Shellcheck runs-on: ubuntu-latest steps: - - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # tag=v3 + - uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3 - name: Run ShellCheck uses: ludeeus/action-shellcheck@master with: @@ -21,6 +21,6 @@ jobs: pre-commit: runs-on: ubuntu-latest steps: - - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # tag=v3 + - uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3 - uses: actions/setup-python@b55428b1882923874294fa556849718a1d7f2ca5 # tag=v4 - uses: pre-commit/action@646c83fcd040023954eafda54b4db0192ce70507 # tag=v3.0.0 From 7681207b8466407aad8d4016a75c3f6f9c426c6a Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Thu, 6 Oct 2022 00:47:38 +0000 Subject: [PATCH 0981/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.217.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index db63619e..34a13e97 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@1655c8cead9e0000a3616e7556382cd0e4107a74 # tag=v32.216.0 + uses: renovatebot/github-action@96d3c6f631324bb327e6c7aca54d7b7fb62d422e # tag=v32.217.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 0e3a95fe93c753dbc1872f23187769018434fb6f Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Fri, 7 Oct 2022 06:03:26 +0000 Subject: [PATCH 0982/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.221.1 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 34a13e97..641d1bba 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@96d3c6f631324bb327e6c7aca54d7b7fb62d422e # tag=v32.217.0 + uses: renovatebot/github-action@40bf6966c29932deae40b0cb5a71c24c61ba5432 # tag=v32.221.1 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 62823ba24c4e58c15a407c7bfe6db56227b57490 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Sat, 8 Oct 2022 12:01:30 +0000 Subject: [PATCH 0983/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.225.1 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 641d1bba..68e1ebc8 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@40bf6966c29932deae40b0cb5a71c24c61ba5432 # tag=v32.221.1 + uses: renovatebot/github-action@716fb9c9871999b4c994b52133d34138115ee840 # tag=v32.225.1 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 5ea8a59da247e84895b2f327bd16fd136b505c65 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Mon, 10 Oct 2022 00:04:14 +0000 Subject: [PATCH 0984/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.226.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 68e1ebc8..4f165bce 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@716fb9c9871999b4c994b52133d34138115ee840 # tag=v32.225.1 + uses: renovatebot/github-action@38ed65e86979ea2724c2768dbb3b1b11472e6ba8 # tag=v32.226.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From b40b074b774d25995a6d96b6e22894278132e545 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Mon, 10 Oct 2022 18:05:13 +0000 Subject: [PATCH 0985/1229] chore(deps): update github-action actions/setup-python [skip ci] to 13ae5bb --- .github/workflows/shellcheck.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml index ccdd9981..baa1dbdb 100644 --- a/.github/workflows/shellcheck.yml +++ b/.github/workflows/shellcheck.yml @@ -22,5 +22,5 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3 - - uses: actions/setup-python@b55428b1882923874294fa556849718a1d7f2ca5 # tag=v4 + - uses: actions/setup-python@13ae5bb136fac2878aff31522b9efb785519f984 # tag=v4 - uses: pre-commit/action@646c83fcd040023954eafda54b4db0192ce70507 # tag=v3.0.0 From a8a2fcada3562f577f7dca65faa6d2823a7166e4 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Mon, 10 Oct 2022 18:05:15 +0000 Subject: [PATCH 0986/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.229.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 4f165bce..490ef055 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@38ed65e86979ea2724c2768dbb3b1b11472e6ba8 # tag=v32.226.0 + uses: renovatebot/github-action@9aa712696b3aa5eef0f8e8b5856f16c1c95dea1e # tag=v32.229.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 5f6154572c3e91cc39ab7e2bd1c548b1a181d3ba Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Tue, 11 Oct 2022 12:01:57 +0000 Subject: [PATCH 0987/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.232.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 490ef055..7c73679a 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@9aa712696b3aa5eef0f8e8b5856f16c1c95dea1e # tag=v32.229.0 + uses: renovatebot/github-action@ff00987e359fdbcfc2825584da5b9f6ba5031148 # tag=v32.232.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 28ac0285759f5befe248186c68bdec807c9b5181 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Wed, 12 Oct 2022 06:08:21 +0000 Subject: [PATCH 0988/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.234.2 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 7c73679a..cda2e758 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@ff00987e359fdbcfc2825584da5b9f6ba5031148 # tag=v32.232.0 + uses: renovatebot/github-action@51b477f3aa2e374a2f0ed5540c22ab9fc7bb35af # tag=v32.234.2 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From c6958dd6ec96d77d6b616cfa70eb038d32ce3c8a Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Wed, 12 Oct 2022 18:06:31 +0000 Subject: [PATCH 0989/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.236.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index cda2e758..4c53dd30 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@51b477f3aa2e374a2f0ed5540c22ab9fc7bb35af # tag=v32.234.2 + uses: renovatebot/github-action@22953954d5ebbce705b14455bf1a57d103043f47 # tag=v32.236.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 3fe4b760bc60e2e511b087bb8f53c7b111ab5edf Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Thu, 13 Oct 2022 12:02:02 +0000 Subject: [PATCH 0990/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.236.2 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 4c53dd30..d8cf9066 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@22953954d5ebbce705b14455bf1a57d103043f47 # tag=v32.236.0 + uses: renovatebot/github-action@417de655e7bda92301a2eea264e7f4b3cc83f82a # tag=v32.236.2 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 4bfb609ddc0c58320ece6e9cfc497a1e9c89f597 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Fri, 14 Oct 2022 00:05:48 +0000 Subject: [PATCH 0991/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.236.4 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index d8cf9066..8f3a112c 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@417de655e7bda92301a2eea264e7f4b3cc83f82a # tag=v32.236.2 + uses: renovatebot/github-action@5e6352112c7b872b09d42d191cbb93d522791f66 # tag=v32.236.4 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From adf458e8b1eb80ec87e6813d1ac56cbfd17b3c73 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Sat, 15 Oct 2022 00:04:37 +0000 Subject: [PATCH 0992/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.238.1 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 8f3a112c..2cfa1cdd 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@5e6352112c7b872b09d42d191cbb93d522791f66 # tag=v32.236.4 + uses: renovatebot/github-action@dd8cc0c6b22bc8361425a5a9ec6bb62258ec261c # tag=v32.238.1 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 934f3dc48174e7540a465b9cec148ef4deaf0a40 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Sun, 16 Oct 2022 00:04:54 +0000 Subject: [PATCH 0993/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.238.3 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 2cfa1cdd..ff2a0bcc 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@dd8cc0c6b22bc8361425a5a9ec6bb62258ec261c # tag=v32.238.1 + uses: renovatebot/github-action@a15017a292456f5222e8688376f51af20d196995 # tag=v32.238.3 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From d690b4b6efdfb38afd7e76c742bd04de8f108225 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Sun, 16 Oct 2022 12:01:46 +0000 Subject: [PATCH 0994/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.238.4 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index ff2a0bcc..91e7fbd5 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@a15017a292456f5222e8688376f51af20d196995 # tag=v32.238.3 + uses: renovatebot/github-action@080bab04c1491ae69912db476fb9a9ac965d4cfe # tag=v32.238.4 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 109bda23f9a30a598a441e5554993168a4417f12 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Tue, 18 Oct 2022 06:24:09 +0000 Subject: [PATCH 0995/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.240.2 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 91e7fbd5..6cab89ba 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@080bab04c1491ae69912db476fb9a9ac965d4cfe # tag=v32.238.4 + uses: renovatebot/github-action@aa98a8c530765fe54cf38a9a1733ef8a5fd119f9 # tag=v32.240.2 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 41c22781019ec8ff7ddd29d19e3f3fc0b5be48de Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Wed, 19 Oct 2022 00:06:01 +0000 Subject: [PATCH 0996/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.240.4 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 6cab89ba..0dbab414 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@aa98a8c530765fe54cf38a9a1733ef8a5fd119f9 # tag=v32.240.2 + uses: renovatebot/github-action@3085271e5cb0b6b9779156c27aa9cb00c3d7e1b2 # tag=v32.240.4 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 91169777eee1d9853e5dce88d81081966ae4264f Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Wed, 19 Oct 2022 18:09:40 +0000 Subject: [PATCH 0997/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.240.5 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 0dbab414..1ff4205d 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@3085271e5cb0b6b9779156c27aa9cb00c3d7e1b2 # tag=v32.240.4 + uses: renovatebot/github-action@22400deb01209fb9d0ba4061c6eb9a0cfd307df1 # tag=v32.240.5 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 4b7520330fad5ee5c23f138b0111993cfdc27109 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Fri, 21 Oct 2022 06:09:25 +0000 Subject: [PATCH 0998/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.241.5 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 1ff4205d..f5a8d4ce 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@22400deb01209fb9d0ba4061c6eb9a0cfd307df1 # tag=v32.240.5 + uses: renovatebot/github-action@c761f52980439cf6e369f45f2f2023ba2eb44659 # tag=v32.241.5 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From bcb6b5c142ef757dd9f2861845b567390391db9e Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Fri, 21 Oct 2022 22:18:40 +0200 Subject: [PATCH 0999/1229] Update backup.sh --- includes/backup.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/includes/backup.sh b/includes/backup.sh index bc219890..6bf2ab4d 100755 --- a/includes/backup.sh +++ b/includes/backup.sh @@ -72,7 +72,9 @@ echo -e "\nWARNING:\nThis is NOT guranteed to work\nThis is ONLY supposed to be # shellcheck disable=SC2015 echo -e "\n\nYou have chosen:\n$restore_point\n\nWould you like to continue?" && echo -e "1 Yes\n2 No" && read -rt 120 -p "Please type a number: " yesno || { echo "${IRed}FAILED${Color_Off}"; exit; } if [[ $yesno == "1" ]]; then - echo -e "\nStarting Backup, this will take a ${BWhite}LONG${Color_Off} time." && cli -c 'app kubernetes restore_backup backup_name=''"'"$restore_point"'"' || echo "Restore ${IRed}FAILED${Color_Off}" + echo -e "\nStarting Restore, this will take a ${BWhite}LONG${Color_Off} time." + zfs set mountpoint=legacy "$(zfs list -t filesystem -r "$(cli -c 'app kubernetes config' | grep -E "pool\s\|" | awk -F '|' '{print $3}' | tr -d " \t\n\r")" -o name -H | grep "volumes/pvc")" && echo "Fixing PVC mountpoints..." || echo "Fixing PVC mountpoints Failed... Continuing with restore..." + cli -c 'app kubernetes restore_backup backup_name=''"'"$restore_point"'"' || echo "Restore ${IRed}FAILED${Color_Off}" elif [[ $yesno == "2" ]]; then echo "You've chosen NO, killing script. Good luck." else From 55067f4899df5a0463fa84c92260594bebe1a7c6 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Fri, 21 Oct 2022 18:03:25 +0000 Subject: [PATCH 1000/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.241.7 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index f5a8d4ce..a1c645ce 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@c761f52980439cf6e369f45f2f2023ba2eb44659 # tag=v32.241.5 + uses: renovatebot/github-action@9f97fa3721997ddf106614f669577a2b9d08b6dd # tag=v32.241.7 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 04d03fe5f859f2318646461e8c4f1fb7e2b3b786 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Sat, 22 Oct 2022 06:06:05 +0000 Subject: [PATCH 1001/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.241.8 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index a1c645ce..a900e0c9 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@9f97fa3721997ddf106614f669577a2b9d08b6dd # tag=v32.241.7 + uses: renovatebot/github-action@f42202af00a4b1ccf69bf2a9eb6b4cd60f5d0386 # tag=v32.241.8 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 8ebbc10ef28059f9b37845d9242290e6968aa492 Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Sat, 22 Oct 2022 14:16:48 +0200 Subject: [PATCH 1002/1229] Update backup.sh --- includes/backup.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/includes/backup.sh b/includes/backup.sh index 6bf2ab4d..9a475199 100755 --- a/includes/backup.sh +++ b/includes/backup.sh @@ -73,7 +73,12 @@ echo -e "\nWARNING:\nThis is NOT guranteed to work\nThis is ONLY supposed to be echo -e "\n\nYou have chosen:\n$restore_point\n\nWould you like to continue?" && echo -e "1 Yes\n2 No" && read -rt 120 -p "Please type a number: " yesno || { echo "${IRed}FAILED${Color_Off}"; exit; } if [[ $yesno == "1" ]]; then echo -e "\nStarting Restore, this will take a ${BWhite}LONG${Color_Off} time." - zfs set mountpoint=legacy "$(zfs list -t filesystem -r "$(cli -c 'app kubernetes config' | grep -E "pool\s\|" | awk -F '|' '{print $3}' | tr -d " \t\n\r")" -o name -H | grep "volumes/pvc")" && echo "Fixing PVC mountpoints..." || echo "Fixing PVC mountpoints Failed... Continuing with restore..." + echo "Correcting PVC mountpoints..." + for pvc in $(zfs list -t filesystem -r "$(cli -c 'app kubernetes config' | grep -E "pool\s\|" | awk -F '|' '{print $3}' | tr -d " \t\n\r")" -o name -H | grep "/ix-applications/" | grep "volumes/pvc") + do + zfs set mountpoint=legacy "${pvc}" || echo "Fixing PVC mountpoints Failed for ${pvc}... Continuing..." + done + echo "Triggering restore process..." cli -c 'app kubernetes restore_backup backup_name=''"'"$restore_point"'"' || echo "Restore ${IRed}FAILED${Color_Off}" elif [[ $yesno == "2" ]]; then echo "You've chosen NO, killing script. Good luck." From c79273cf022711b5ece75b4904b8547f7cd46fd2 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sat, 22 Oct 2022 11:41:06 -0600 Subject: [PATCH 1003/1229] set dataset properties for restore --- functions/backup.sh | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/functions/backup.sh b/functions/backup.sh index c1b2f4a0..e5753072 100644 --- a/functions/backup.sh +++ b/functions/backup.sh @@ -152,8 +152,25 @@ do read -rt 120 -p "Would you like to proceed with restore? (y/N): " yesno || { echo -e "\nFailed to make a selection in time" ; exit; } case $yesno in [Yy] | [Yy][Ee][Ss]) - echo -e "\nStarting Backup, this will take a LONG time." - cli -c 'app kubernetes restore_backup backup_name=''"'"$restore_point"'"' || { echo "Failed to delete backup.."; exit; } + + # Set mountpoints to legacy prior to restore, ensures correct properties for the dataset are set + echo -e "\nSetting correct dataset properties.." + for pvc in $(zfs list -t filesystem -r "$(cli -c 'app kubernetes config' | grep -E "pool\s\|" | awk -F '|' '{print $3}' | tr -d " \t\n\r")" -o name -H | grep "/ix-applications/" | grep "volumes/pvc") + do + if zfs set mountpoint=legacy "$pvc"; then + echo "Success for - \"$pvc\"" + else + echo "Error: Setting properties for \"$pvc\", failed.." + fi + done + echo "Finished setting properties.." + + # Beginning snapshot restore + echo -e "\nStarting restore, this will take a LONG time." + if ! cli -c 'app kubernetes restore_backup backup_name=''"'"$restore_point"'"'; then + echo "Restore failed, exiting.." + exit 1 + fi exit ;; [Nn] | [Nn][Oo]) From 715f50b90660c4dc3d229993ad08cffea0c0b845 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sat, 22 Oct 2022 12:02:25 -0600 Subject: [PATCH 1004/1229] reword message --- functions/backup.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/backup.sh b/functions/backup.sh index e5753072..ccf662bc 100644 --- a/functions/backup.sh +++ b/functions/backup.sh @@ -153,8 +153,8 @@ do case $yesno in [Yy] | [Yy][Ee][Ss]) - # Set mountpoints to legacy prior to restore, ensures correct properties for the dataset are set - echo -e "\nSetting correct dataset properties.." + # Set mountpoints to legacy prior to restore, ensures correct properties for the are set + echo -e "\nSetting correct ZFS properties for application volumes.." for pvc in $(zfs list -t filesystem -r "$(cli -c 'app kubernetes config' | grep -E "pool\s\|" | awk -F '|' '{print $3}' | tr -d " \t\n\r")" -o name -H | grep "/ix-applications/" | grep "volumes/pvc") do if zfs set mountpoint=legacy "$pvc"; then From 7bafe497f8635e2cb2de3926bca817bd878ecc1e Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Sun, 23 Oct 2022 00:05:09 +0000 Subject: [PATCH 1005/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.241.10 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index a900e0c9..10fa5940 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@f42202af00a4b1ccf69bf2a9eb6b4cd60f5d0386 # tag=v32.241.8 + uses: renovatebot/github-action@8d3b4bfb1e3d5972f3d4095e0f875e33bfb5a67a # tag=v32.241.10 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 83d571b7b23c9b476dde94cdcf0f395d836c3dac Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Sun, 23 Oct 2022 18:01:54 +0000 Subject: [PATCH 1006/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v32.241.11 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 10fa5940..cd7dacee 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@8d3b4bfb1e3d5972f3d4095e0f875e33bfb5a67a # tag=v32.241.10 + uses: renovatebot/github-action@7f99195d246af488476cb70691ac85975c8dd321 # tag=v32.241.11 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 554f4084d5aa7ede1a0d798f33eebc5319211f40 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Mon, 24 Oct 2022 06:26:27 +0000 Subject: [PATCH 1007/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v33.1.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index cd7dacee..255b8b84 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@7f99195d246af488476cb70691ac85975c8dd321 # tag=v32.241.11 + uses: renovatebot/github-action@8ff997537af006c7c1a599d36b3e0d65ad463b36 # tag=v33.1.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 4745060aad50b5f28455b5a3e7efa729e76379cb Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Mon, 24 Oct 2022 18:06:10 +0000 Subject: [PATCH 1008/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v33.2.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 255b8b84..e68a0a19 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@8ff997537af006c7c1a599d36b3e0d65ad463b36 # tag=v33.1.0 + uses: renovatebot/github-action@31698c85533a25a2fc1cabb57839dc88c0e9be4a # tag=v33.2.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 7f07425dfb91927d89aaa98757e240aa9f70f30d Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Tue, 25 Oct 2022 18:15:46 +0000 Subject: [PATCH 1009/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v33.2.4 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index e68a0a19..701897ef 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@31698c85533a25a2fc1cabb57839dc88c0e9be4a # tag=v33.2.0 + uses: renovatebot/github-action@22b938d9cc9b50758588a1316dd85f06b3cf365b # tag=v33.2.4 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 2ff0aa10a5861bd65ea25ecd678363199c4aa197 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Wed, 26 Oct 2022 06:01:26 +0000 Subject: [PATCH 1010/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.1.2 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 701897ef..c5b39224 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@22b938d9cc9b50758588a1316dd85f06b3cf365b # tag=v33.2.4 + uses: renovatebot/github-action@eb645c51c8acce3637d7a054150254e61f2f026d # tag=v34.1.2 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 358fe207ca40077b6e22a7c9e0966a39d3114b0c Mon Sep 17 00:00:00 2001 From: heavybullets8 Date: Wed, 26 Oct 2022 20:12:59 -0600 Subject: [PATCH 1011/1229] turn readonly zfs property off --- functions/backup.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/functions/backup.sh b/functions/backup.sh index ccf662bc..c13847f0 100644 --- a/functions/backup.sh +++ b/functions/backup.sh @@ -152,10 +152,11 @@ do read -rt 120 -p "Would you like to proceed with restore? (y/N): " yesno || { echo -e "\nFailed to make a selection in time" ; exit; } case $yesno in [Yy] | [Yy][Ee][Ss]) + pool=$(cli -c 'app kubernetes config' | grep -E "pool\s\|" | awk -F '|' '{print $3}' | tr -d " \t\n\r") # Set mountpoints to legacy prior to restore, ensures correct properties for the are set echo -e "\nSetting correct ZFS properties for application volumes.." - for pvc in $(zfs list -t filesystem -r "$(cli -c 'app kubernetes config' | grep -E "pool\s\|" | awk -F '|' '{print $3}' | tr -d " \t\n\r")" -o name -H | grep "/ix-applications/" | grep "volumes/pvc") + for pvc in $(zfs list -t filesystem -r "$pool"/ix-applications -o name -H | grep "volumes/pvc") do if zfs set mountpoint=legacy "$pvc"; then echo "Success for - \"$pvc\"" @@ -163,6 +164,10 @@ do echo "Error: Setting properties for \"$pvc\", failed.." fi done + + # Ensure readonly is turned off + zfs set readonly=off "$pool"/ix-applications + echo "Finished setting properties.." # Beginning snapshot restore From 639f89962721147d48706305d508b4da250c744c Mon Sep 17 00:00:00 2001 From: heavybullets8 Date: Wed, 26 Oct 2022 20:28:26 -0600 Subject: [PATCH 1012/1229] error message for failed readonly disable --- functions/backup.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/functions/backup.sh b/functions/backup.sh index c13847f0..7985843b 100644 --- a/functions/backup.sh +++ b/functions/backup.sh @@ -166,7 +166,11 @@ do done # Ensure readonly is turned off - zfs set readonly=off "$pool"/ix-applications + if ! zfs set readonly=off "$pool"/ix-applications;then + echo -e "Error: Failed to set ZFS ReadOnly to \"off\"" + echo -e "After the restore, attempt to run the following command manually:" + echo "zfs set readonly=off $pool/ix-applications" + fi echo "Finished setting properties.." From fea0f8f71aeaa15595e6c98d60378217be9f30e2 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Thu, 27 Oct 2022 06:01:30 +0000 Subject: [PATCH 1013/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.2.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index c5b39224..88da3f5f 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@eb645c51c8acce3637d7a054150254e61f2f026d # tag=v34.1.2 + uses: renovatebot/github-action@ce404b2504f00817a4cc3bc42262df9ce3d5476b # tag=v34.2.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 05e7629fa03d75e88a4a4ae489858c365d5afa5c Mon Sep 17 00:00:00 2001 From: pcsmith811 <75634984+pcsmith811@users.noreply.github.com> Date: Thu, 27 Oct 2022 15:09:58 -0700 Subject: [PATCH 1014/1229] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5b35fab4..7b8a9c1a 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ It also offers a few handy shortcuts for commonly required chores, like: Enablin | --no-color | --no-color | None | Disables showing colors in terminal output, usefull for SCALE Email output | | -U | -U | None | Update applications, ignoring major version changes | | -u | -u | None | Update applications, do NOT update if there was a major version change | -| -b | -b 14 | Integer | Backup `ix-appliactions` dataset
_Creates backups up to the number you've chosen_ | +| -b | -b 14 | Integer | Backup `ix-applications` dataset
_Creates backups up to the number you've chosen_ | | -i | -i nextcloud -i sonarr | String | Applications listed will be ignored during updating
_List one application after another as shown in the example_ | | -v | -v | None | Verbose Output
| | -t | -t 150 | Integer | Set a custom timeout to be used with either:
`-m`
_Time the script will wait for application to be "STOPPED"_
or
`-(u\|U)`
_Time the script will wait for application to be either "STOPPED" or "ACTIVE"_ | From ef60b51c1eb8b8160af1767c2f43226b1475b2b0 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Fri, 28 Oct 2022 00:03:15 +0000 Subject: [PATCH 1015/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.4.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 88da3f5f..29bdc18e 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@ce404b2504f00817a4cc3bc42262df9ce3d5476b # tag=v34.2.0 + uses: renovatebot/github-action@037cb82b77d1e205e8fbd208a6607939b89b230e # tag=v34.4.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From fb632dcb84b3d1d609387d73389823f6907fc9ef Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Fri, 28 Oct 2022 06:01:24 +0000 Subject: [PATCH 1016/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.6.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 29bdc18e..23a492cd 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@037cb82b77d1e205e8fbd208a6607939b89b230e # tag=v34.4.0 + uses: renovatebot/github-action@ae0f808fbba759de70dd346574b2821936f6785a # tag=v34.6.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From d3e82a48814af4a8eecd5c9dd51cc089e415cfa5 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Sat, 29 Oct 2022 00:02:49 +0000 Subject: [PATCH 1017/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.8.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 23a492cd..bad63e1c 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@ae0f808fbba759de70dd346574b2821936f6785a # tag=v34.6.0 + uses: renovatebot/github-action@dc5d2820950fc15abc8b42b61c0b13c55f03ca7c # tag=v34.8.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 891803e2a57dcfc12b410ed648722994d2a4b547 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Sat, 29 Oct 2022 18:01:24 +0000 Subject: [PATCH 1018/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.8.2 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index bad63e1c..d1596a83 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@dc5d2820950fc15abc8b42b61c0b13c55f03ca7c # tag=v34.8.0 + uses: renovatebot/github-action@e603f7ea9ae6c850d8cf9c8540b0a277cc1a6b02 # tag=v34.8.2 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 9a284278eb0c94e5a3f7aebd92bc5638d945a961 Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Sat, 29 Oct 2022 23:53:39 +0200 Subject: [PATCH 1019/1229] Update backup.sh --- includes/backup.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/includes/backup.sh b/includes/backup.sh index 9a475199..e09449f9 100755 --- a/includes/backup.sh +++ b/includes/backup.sh @@ -73,11 +73,18 @@ echo -e "\nWARNING:\nThis is NOT guranteed to work\nThis is ONLY supposed to be echo -e "\n\nYou have chosen:\n$restore_point\n\nWould you like to continue?" && echo -e "1 Yes\n2 No" && read -rt 120 -p "Please type a number: " yesno || { echo "${IRed}FAILED${Color_Off}"; exit; } if [[ $yesno == "1" ]]; then echo -e "\nStarting Restore, this will take a ${BWhite}LONG${Color_Off} time." + pool=$(cli -c 'app kubernetes config' | grep -E "pool\s\|" | awk -F '|' '{print $3}' | tr -d " \t\n\r") echo "Correcting PVC mountpoints..." - for pvc in $(zfs list -t filesystem -r "$(cli -c 'app kubernetes config' | grep -E "pool\s\|" | awk -F '|' '{print $3}' | tr -d " \t\n\r")" -o name -H | grep "/ix-applications/" | grep "volumes/pvc") + for pvc in $(zfs list -t filesystem -r "$pool"/ix-applications -o name -H | grep "/ix-applications/" | grep "volumes/pvc") do zfs set mountpoint=legacy "${pvc}" || echo "Fixing PVC mountpoints Failed for ${pvc}... Continuing..." done + # Ensure readonly is turned off + if ! zfs set readonly=off "$pool"/ix-applications;then + echo -e "Error: Failed to set ZFS ReadOnly to \"off\"" + echo -e "After the restore, attempt to run the following command manually:" + echo "zfs set readonly=off $pool/ix-applications" + fi echo "Triggering restore process..." cli -c 'app kubernetes restore_backup backup_name=''"'"$restore_point"'"' || echo "Restore ${IRed}FAILED${Color_Off}" elif [[ $yesno == "2" ]]; then From 9e29b7b0eb50f92811249bea9e45cc26fd65bd95 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sat, 29 Oct 2022 16:01:52 -0600 Subject: [PATCH 1020/1229] tack on releases folder to ZFS restrict --- functions/backup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/backup.sh b/functions/backup.sh index 7985843b..7be2305e 100644 --- a/functions/backup.sh +++ b/functions/backup.sh @@ -156,7 +156,7 @@ do # Set mountpoints to legacy prior to restore, ensures correct properties for the are set echo -e "\nSetting correct ZFS properties for application volumes.." - for pvc in $(zfs list -t filesystem -r "$pool"/ix-applications -o name -H | grep "volumes/pvc") + for pvc in $(zfs list -t filesystem -r "$pool"/ix-applications/releases -o name -H | grep "volumes/pvc") do if zfs set mountpoint=legacy "$pvc"; then echo "Success for - \"$pvc\"" From dcb6bfc4fce7daa266192b03b877c775f8a840be Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Sun, 30 Oct 2022 00:03:15 +0000 Subject: [PATCH 1021/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.9.1 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index d1596a83..37e04d30 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@e603f7ea9ae6c850d8cf9c8540b0a277cc1a6b02 # tag=v34.8.2 + uses: renovatebot/github-action@02e9f15cd0eced488b6751cac54856b8cdefad0f # tag=v34.9.1 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 995ebf039f1cbd15f831315388881fa491f4978e Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Mon, 31 Oct 2022 18:03:36 +0000 Subject: [PATCH 1022/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.10.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 37e04d30..ad304a27 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@02e9f15cd0eced488b6751cac54856b8cdefad0f # tag=v34.9.1 + uses: renovatebot/github-action@f65d704dc047d296dba50b502af53c4ae186e49f # tag=v34.10.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From cc95fb68d6e6d12a9113b08e336ac5f9df6fc806 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Tue, 1 Nov 2022 18:01:32 +0000 Subject: [PATCH 1023/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.12.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index ad304a27..2016da85 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@f65d704dc047d296dba50b502af53c4ae186e49f # tag=v34.10.0 + uses: renovatebot/github-action@808a758c853bb5540c8f8bf0e3942b6b410976b7 # tag=v34.12.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 2a8c9645832a54ae5195024aca8e8ea850bfc2f1 Mon Sep 17 00:00:00 2001 From: heavybullets8 Date: Tue, 1 Nov 2022 18:55:53 -0600 Subject: [PATCH 1024/1229] match app name until comma in mount --- functions/mount.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/mount.sh b/functions/mount.sh index 8615a2b5..7badfc58 100644 --- a/functions/mount.sh +++ b/functions/mount.sh @@ -40,7 +40,7 @@ do pvc=$(echo -e "$list" | grep ^"$selection)") #Stop applicaiton if not stopped - status=$(cli -m csv -c 'app chart_release query name,status' | grep -E "^$app\b" | awk -F ',' '{print $2}'| tr -d " \t\n\r") + status=$(cli -m csv -c 'app chart_release query name,status' | grep "^$app," | awk -F ',' '{print $2}'| tr -d " \t\n\r") if [[ "$status" != "STOPPED" ]]; then echo -e "\nStopping $app prior to mount" if ! cli -c 'app chart_release scale release_name='\""$app"\"\ 'scale_options={"replica_count": 0}' &> /dev/null; then From f1884c35742823991baba8db7ff4872277436a56 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Wed, 2 Nov 2022 06:05:04 +0000 Subject: [PATCH 1025/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.12.1 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 2016da85..38b06680 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@808a758c853bb5540c8f8bf0e3942b6b410976b7 # tag=v34.12.0 + uses: renovatebot/github-action@b085bb394ab5a312e0f30fa70433e7ef54bc73b0 # tag=v34.12.1 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 8d22995f8e25abcc1d269507600c3dfcfd056798 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Thu, 3 Nov 2022 00:03:25 +0000 Subject: [PATCH 1026/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.13.2 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 38b06680..6d85ae35 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@b085bb394ab5a312e0f30fa70433e7ef54bc73b0 # tag=v34.12.1 + uses: renovatebot/github-action@c139522d2282b87bfb9ce0c530d0b67206b9a0bb # tag=v34.13.2 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From c472c9ae00edf07aff59243aefb9758733ed6023 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Fri, 4 Nov 2022 06:01:39 +0000 Subject: [PATCH 1027/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.17.1 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 6d85ae35..408e55f5 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@c139522d2282b87bfb9ce0c530d0b67206b9a0bb # tag=v34.13.2 + uses: renovatebot/github-action@462efd5c25ceec184b8b9f6859acfa9b5b701e18 # tag=v34.17.1 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 0bf4b39e6da6f6d5f42ad989c8584c1f96148c41 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Sat, 5 Nov 2022 00:03:09 +0000 Subject: [PATCH 1028/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.18.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 408e55f5..5716962e 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@462efd5c25ceec184b8b9f6859acfa9b5b701e18 # tag=v34.17.1 + uses: renovatebot/github-action@a40a82983e7b270730d2804551a0186304918ba7 # tag=v34.18.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From c87a3018d757d2881fae3469ae223da9a543d500 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Sat, 5 Nov 2022 12:01:43 +0000 Subject: [PATCH 1029/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.19.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 5716962e..fe11e9c6 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@a40a82983e7b270730d2804551a0186304918ba7 # tag=v34.18.0 + uses: renovatebot/github-action@d72289f34ec288349ed2e40750abf079dacabbb3 # v34.19.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 0ddee31f3fa49d2396859f657a02561cc2283ce2 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Sun, 6 Nov 2022 18:01:53 +0000 Subject: [PATCH 1030/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.19.3 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index fe11e9c6..92d70792 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@d72289f34ec288349ed2e40750abf079dacabbb3 # v34.19.0 + uses: renovatebot/github-action@6fd485c03fbc4f378d4998463d83a26242ab6420 # v34.19.3 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 87ebe2e0935f39eef3e927a834999bf9535af065 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Mon, 7 Nov 2022 06:01:42 +0000 Subject: [PATCH 1031/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.20.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 92d70792..98dc303b 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@6fd485c03fbc4f378d4998463d83a26242ab6420 # v34.19.3 + uses: renovatebot/github-action@b6006cd852bf40aea81c942848e5748e0d1eaf41 # v34.20.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 12161808a1e833d5b620c4505a8929edd4ee0627 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Wed, 9 Nov 2022 06:01:30 +0000 Subject: [PATCH 1032/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.21.2 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 98dc303b..e8c94127 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@b6006cd852bf40aea81c942848e5748e0d1eaf41 # v34.20.0 + uses: renovatebot/github-action@70f6a15c238cbc2bdf19fa1b33f42dcbf6637dbd # v34.21.2 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From e8757dda247a16430e4db9499566154f62779711 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Thu, 10 Nov 2022 00:02:59 +0000 Subject: [PATCH 1033/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.21.4 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index e8c94127..4ba9786d 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@70f6a15c238cbc2bdf19fa1b33f42dcbf6637dbd # v34.21.2 + uses: renovatebot/github-action@7b14216c30e8c1829e09406870db2c0bfa9d369f # v34.21.4 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From b7db1866a1f0548e8de17f1cd02aa4f635eae387 Mon Sep 17 00:00:00 2001 From: Jesperbelt <70942135+Jesperbelt@users.noreply.github.com> Date: Thu, 10 Nov 2022 22:43:40 +0100 Subject: [PATCH 1034/1229] Update link The link used in this readme does not lead to the page, suggested change fixes the problem. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7b8a9c1a..38d3afc5 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ A easy tool for frequently used TrueNAS SCALE CLI utilities. -Please before using this tool, [read this note](https://truecharts.org/docs/manual/SCALE%20Apps/Important-MUST-READ) +Please before using this tool, [read this note](https://truecharts.org/docs/manual/guides/Important-MUST-READ) ## Table of contents: * [Synopsis](#synopsis) From bed29b73c8d9ced2cef21eec809746c44cb9ef2e Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Thu, 10 Nov 2022 18:01:36 +0000 Subject: [PATCH 1035/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.21.6 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 4ba9786d..f047fca3 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@7b14216c30e8c1829e09406870db2c0bfa9d369f # v34.21.4 + uses: renovatebot/github-action@5e792f6ed12a13ce498a108436d5a9a8d28de31f # v34.21.6 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 1de0d0a9054355cbc8f3dc7184547cc50c194c3d Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Fri, 11 Nov 2022 06:01:41 +0000 Subject: [PATCH 1036/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.22.1 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index f047fca3..775def97 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@5e792f6ed12a13ce498a108436d5a9a8d28de31f # v34.21.6 + uses: renovatebot/github-action@85f3150268ff10d06bc5731dbd3c6a2eec76374c # v34.22.1 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 90db203199456e845a889763ada86ad3cd1ebe20 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Fri, 11 Nov 2022 18:01:40 +0000 Subject: [PATCH 1037/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.22.2 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 775def97..6d2527c0 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@85f3150268ff10d06bc5731dbd3c6a2eec76374c # v34.22.1 + uses: renovatebot/github-action@0c717ba097320072e9ad8b750d041565c975b731 # v34.22.2 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From de65727b9bc956c65370fe4cb8c89fdcee85be5a Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Sat, 12 Nov 2022 18:01:28 +0000 Subject: [PATCH 1038/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.23.1 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 6d2527c0..3a5f7829 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@0c717ba097320072e9ad8b750d041565c975b731 # v34.22.2 + uses: renovatebot/github-action@e72c881863e8edd62b0d7d053fb9ccab0e2c4368 # v34.23.1 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 12ed0643117fdfb1e9eb33b7d030331097f674bf Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Sun, 13 Nov 2022 18:01:36 +0000 Subject: [PATCH 1039/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.24.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 3a5f7829..9938e877 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@e72c881863e8edd62b0d7d053fb9ccab0e2c4368 # v34.23.1 + uses: renovatebot/github-action@e3e5485adcef612196fb016d8b7c432c643f747b # v34.24.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 5bf308174301b294c7f332fbe57ae874705f47c5 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Tue, 15 Nov 2022 06:01:20 +0000 Subject: [PATCH 1040/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.24.1 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 9938e877..b2b87bb6 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@e3e5485adcef612196fb016d8b7c432c643f747b # v34.24.0 + uses: renovatebot/github-action@c1e387f06c4d643560e1d891823557e8cff29abe # v34.24.1 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 4460051be0c80c71482129a9600d5dc7e5f1a818 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Wed, 16 Nov 2022 06:01:25 +0000 Subject: [PATCH 1041/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.26.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index b2b87bb6..8bf75372 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@c1e387f06c4d643560e1d891823557e8cff29abe # v34.24.1 + uses: renovatebot/github-action@0928345052443209e12cca975ab31abd0c44d385 # v34.26.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From c16c40c29c4413b106c25d5c9c5c2d6a98d71b60 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Wed, 16 Nov 2022 12:01:35 +0000 Subject: [PATCH 1042/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.26.1 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 8bf75372..d0fd9cb4 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@0928345052443209e12cca975ab31abd0c44d385 # v34.26.0 + uses: renovatebot/github-action@90cb8097ef51d1ce1b7c23605fb08dcae936487a # v34.26.1 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From e7dd47c48b99e856a39360db39505eee149fc770 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Thu, 17 Nov 2022 00:02:55 +0000 Subject: [PATCH 1043/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.26.2 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index d0fd9cb4..faf8c842 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@90cb8097ef51d1ce1b7c23605fb08dcae936487a # v34.26.1 + uses: renovatebot/github-action@7477a5ca6272e277a2f5b2e460ce00860f463db9 # v34.26.2 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From a6bf9da1d8cf917242adc7f47609482e14bd7cf9 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Thu, 17 Nov 2022 12:01:49 +0000 Subject: [PATCH 1044/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.26.4 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index faf8c842..c513fc01 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@7477a5ca6272e277a2f5b2e460ce00860f463db9 # v34.26.2 + uses: renovatebot/github-action@e10ae44cffa4603afcd86b3c72854f3dcff5dcb4 # v34.26.4 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 0f217d97741afceaf8659580351616d24ee0aa89 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Fri, 18 Nov 2022 00:02:58 +0000 Subject: [PATCH 1045/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.27.1 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index c513fc01..e44aba5a 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@e10ae44cffa4603afcd86b3c72854f3dcff5dcb4 # v34.26.4 + uses: renovatebot/github-action@7a531d7e1c4bf1360392169d5d62c7ea8298cfc9 # v34.27.1 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From f4c8cdd3959dad4271055be7c493df4a010413d8 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Fri, 18 Nov 2022 18:01:40 +0000 Subject: [PATCH 1046/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.27.3 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index e44aba5a..64d8c061 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@7a531d7e1c4bf1360392169d5d62c7ea8298cfc9 # v34.27.1 + uses: renovatebot/github-action@21546284a89a2d6e1086e19ae3ca956496640c51 # v34.27.3 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 424a7d873eaa10af0f31db789bc71c8a1f7252fc Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Sat, 19 Nov 2022 06:01:34 +0000 Subject: [PATCH 1047/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.28.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 64d8c061..b401c03d 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@21546284a89a2d6e1086e19ae3ca956496640c51 # v34.27.3 + uses: renovatebot/github-action@b3e9099763836bdc09ff1f821b54bd51b7af86f1 # v34.28.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 345287c9b56e19c7404c27a030d08aeeac680b86 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Mon, 21 Nov 2022 12:01:44 +0000 Subject: [PATCH 1048/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.29.2 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index b401c03d..80991e7b 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@b3e9099763836bdc09ff1f821b54bd51b7af86f1 # v34.28.0 + uses: renovatebot/github-action@4a34d64760cc3538837eef9d575b8a4fed7bb5f1 # v34.29.2 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From cd4ab612fb69964d3deaedf7e5ef122c200bc8ce Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Tue, 22 Nov 2022 06:01:41 +0000 Subject: [PATCH 1049/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.30.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 80991e7b..1c709624 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@4a34d64760cc3538837eef9d575b8a4fed7bb5f1 # v34.29.2 + uses: renovatebot/github-action@9ee93b392a6776cc0380c3e1d91ba60a71ea22fb # v34.30.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 9f5e9eed4434906c3a63b74b31e680e32be8689b Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Tue, 22 Nov 2022 18:01:34 +0000 Subject: [PATCH 1050/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.30.2 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 1c709624..fb7c09c1 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@9ee93b392a6776cc0380c3e1d91ba60a71ea22fb # v34.30.0 + uses: renovatebot/github-action@82459a9ca391a34ca47dd1dc674822e5f4a95fdc # v34.30.2 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From a352dd06b965db8f9787f185a041a2963b51f0bd Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Thu, 24 Nov 2022 00:03:01 +0000 Subject: [PATCH 1051/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.32.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index fb7c09c1..64e151b1 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@82459a9ca391a34ca47dd1dc674822e5f4a95fdc # v34.30.2 + uses: renovatebot/github-action@29d72ce4be68a2381b8167fe6b989d7726416b31 # v34.32.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 33ac4dc3c190adcd0c7745ef6dcbb23e173f4af9 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Fri, 25 Nov 2022 06:01:31 +0000 Subject: [PATCH 1052/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.34.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 64e151b1..fbe98ac7 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@29d72ce4be68a2381b8167fe6b989d7726416b31 # v34.32.0 + uses: renovatebot/github-action@cd3254b1f914ad04188de04493cdbf708593e92d # v34.34.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From b5fab5dab103c3acadf9da2eb3d8f6ae897eeacb Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Sat, 26 Nov 2022 12:01:40 +0000 Subject: [PATCH 1053/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.39.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index fbe98ac7..a4277ab3 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@cd3254b1f914ad04188de04493cdbf708593e92d # v34.34.0 + uses: renovatebot/github-action@0546b792f88eec7340ea2faf6a6c5e966e1e3ea6 # v34.39.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 8410e4995465fedbb4da019e2f7fda91ed7aed0a Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Sun, 27 Nov 2022 18:01:30 +0000 Subject: [PATCH 1054/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.40.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index a4277ab3..7a93d724 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@0546b792f88eec7340ea2faf6a6c5e966e1e3ea6 # v34.39.0 + uses: renovatebot/github-action@dadce2fda5b23762a9f49d5a23b39a70b60ea8c9 # v34.40.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 4c929254fcf2b723a37444b03e16115d2b1cb913 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Mon, 28 Nov 2022 18:01:51 +0000 Subject: [PATCH 1055/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.40.2 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 7a93d724..8e13bca2 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@dadce2fda5b23762a9f49d5a23b39a70b60ea8c9 # v34.40.0 + uses: renovatebot/github-action@e7bf565604a91a093ba01eebb8d20806fcaa8674 # v34.40.2 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 98cb7a729caccdd7c54646fd9fd33de11c9124ad Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Tue, 29 Nov 2022 18:03:42 +0000 Subject: [PATCH 1056/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.41.1 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 8e13bca2..1b29d2c0 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@e7bf565604a91a093ba01eebb8d20806fcaa8674 # v34.40.2 + uses: renovatebot/github-action@708343d5c41dfd577133569d3153b3e089bac520 # v34.41.1 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 1514b52f3d1dc81ad1d1dc6a935e853389e3dbe6 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Thu, 1 Dec 2022 00:03:07 +0000 Subject: [PATCH 1057/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.42.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 1b29d2c0..1f435283 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@708343d5c41dfd577133569d3153b3e089bac520 # v34.41.1 + uses: renovatebot/github-action@e24c028a6d3b903b79320c97e89e4e9bd7055054 # v34.42.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 03f8142263c1b90a0922b6c85165350a06041824 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Thu, 1 Dec 2022 18:01:46 +0000 Subject: [PATCH 1058/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.44.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 1f435283..c036b933 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@e24c028a6d3b903b79320c97e89e4e9bd7055054 # v34.42.0 + uses: renovatebot/github-action@234c0c062fa7a8766864ba0f464a33e4faf687e5 # v34.44.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 55826af4c053795d9ceacbfb094d06f1fd7e96a3 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Fri, 2 Dec 2022 06:01:35 +0000 Subject: [PATCH 1059/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.47.1 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index c036b933..afce9ffb 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@234c0c062fa7a8766864ba0f464a33e4faf687e5 # v34.44.0 + uses: renovatebot/github-action@60165c48257fbc6c8c55284a2a0e5e7717045437 # v34.47.1 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 3bb6e6618dd8469255cb1f955ef71ce107d5eb43 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Fri, 2 Dec 2022 18:01:29 +0000 Subject: [PATCH 1060/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.48.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index afce9ffb..9379a0b3 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@60165c48257fbc6c8c55284a2a0e5e7717045437 # v34.47.1 + uses: renovatebot/github-action@b41ceaf28bd9b85d5412471c78242cc0dc84552a # v34.48.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From e84ae5faa35fe4a0b18485bdd9ffea4f79168611 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Sun, 4 Dec 2022 18:01:38 +0000 Subject: [PATCH 1061/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.48.3 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 9379a0b3..bdc52464 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@b41ceaf28bd9b85d5412471c78242cc0dc84552a # v34.48.0 + uses: renovatebot/github-action@bf02624761ad4ab4d9eeb1a578654023496831da # v34.48.3 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From fc5f71b3b161b6d42dc410e51e49b8f018e6452e Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Mon, 5 Dec 2022 12:01:39 +0000 Subject: [PATCH 1062/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.48.4 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index bdc52464..7088e8de 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@bf02624761ad4ab4d9eeb1a578654023496831da # v34.48.3 + uses: renovatebot/github-action@1c7ebbc0d4d5ce0fbbc0b95f9c01a1c70cdd907f # v34.48.4 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From fc6b480e93506c6cfb1231b858fc4cc347a2bdce Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Tue, 6 Dec 2022 18:01:42 +0000 Subject: [PATCH 1063/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.50.1 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 7088e8de..fc52f281 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@1c7ebbc0d4d5ce0fbbc0b95f9c01a1c70cdd907f # v34.48.4 + uses: renovatebot/github-action@c4fe3d165675529e18c2a741725fce9b5b4ae794 # v34.50.1 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 7752551e490d1297de3d712776ea5896bc2bf9d9 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Thu, 8 Dec 2022 06:09:18 +0000 Subject: [PATCH 1064/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.51.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index fc52f281..79c7b2c8 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@c4fe3d165675529e18c2a741725fce9b5b4ae794 # v34.50.1 + uses: renovatebot/github-action@cf2f911ffe551c48f7c5cbc0c774f8377ea05156 # v34.51.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 04cfc68cab41041b72265bfd03158db2ea963f8c Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Thu, 8 Dec 2022 18:07:56 +0000 Subject: [PATCH 1065/1229] chore(deps): update github-action actions/setup-python [skip ci] to 2c3dd9e --- .github/workflows/shellcheck.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml index baa1dbdb..27899231 100644 --- a/.github/workflows/shellcheck.yml +++ b/.github/workflows/shellcheck.yml @@ -22,5 +22,5 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3 - - uses: actions/setup-python@13ae5bb136fac2878aff31522b9efb785519f984 # tag=v4 + - uses: actions/setup-python@2c3dd9e7e29afd70cc0950079bde6c979d1f69f9 # v4 - uses: pre-commit/action@646c83fcd040023954eafda54b4db0192ce70507 # tag=v3.0.0 From ad170456ce7b43f1332404e42e1d632b043d9d1b Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Fri, 9 Dec 2022 00:33:49 +0000 Subject: [PATCH 1066/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.52.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 79c7b2c8..f75bcf65 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@cf2f911ffe551c48f7c5cbc0c774f8377ea05156 # v34.51.0 + uses: renovatebot/github-action@af6c318d18917d0877274ac5ad139a19849febe2 # v34.52.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 6a00e1f16d1091e90bab6ae2ffc861f894074ffd Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Fri, 9 Dec 2022 18:08:03 +0000 Subject: [PATCH 1067/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.54.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index f75bcf65..954aa4c6 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@af6c318d18917d0877274ac5ad139a19849febe2 # v34.52.0 + uses: renovatebot/github-action@dee6bc0fd2607aeef440f0055b913e728cd072c0 # v34.54.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From a963bd87de37077f6fd34d31567e83b4e85b8171 Mon Sep 17 00:00:00 2001 From: Martin Rowan Date: Sat, 10 Dec 2022 13:51:50 +0000 Subject: [PATCH 1068/1229] Minor corrections. --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 7b8a9c1a..71417ce3 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,11 @@ # truetool -A easy tool for frequently used TrueNAS SCALE CLI utilities. +An easy tool for frequently used TrueNAS SCALE CLI utilities. Please before using this tool, [read this note](https://truecharts.org/docs/manual/SCALE%20Apps/Important-MUST-READ) ## Table of contents: + * [Synopsis](#synopsis) * [Arguments](#arguments) * [How to Install](#how-to-install) @@ -117,7 +118,7 @@ TrueTool updates itself automatically. #### TrueTool vs HeavyScript -TrueTool and HeavyScript are based, in essence, based on the the original (python based) TrueUpdate and TrueTool. +TrueTool and HeavyScript are based, in essence, based on the original (python based) TrueUpdate and TrueTool. Then Support-Manager for TrueCharts, HeavyBullets8, ported this to Bash and started adding some additional logic and options for tasks we frequently needed our users to do, such as mounting PVC's. After a month or so, the TrueCharts Team officially started refactoring this expanded bash-port. Due to personal reasons, HeavyBullets by then decided to separate from TrueCharts after merging the TrueCharts refactor into his own work. The beauty of OpenSource. @@ -127,4 +128,4 @@ We internally review changes within our staff team, to verify we somewhat stick But this also means we can give guarantees TrueTool works optimally with our Catalog of TrueNAS SCALE Apps, as well as official Apps. Users from HeavyScript can safely start using TrueTool, as we've made precautions to ensure the backups take over smoothly. -We, however, do _not_ advice using HeavyScript with TrueCharts Apps. Not because it's a bad App, but because we offer an alternative that is validated by our Staff. +We, however, do _not_ advise using HeavyScript with TrueCharts Apps. Not because it's a bad App, but because we offer an alternative that is validated by our Staff. From 57ba5d76d084bf9919f2ce42e17c063e54971891 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Sun, 11 Dec 2022 06:07:49 +0000 Subject: [PATCH 1069/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.54.1 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 954aa4c6..87e17b22 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@dee6bc0fd2607aeef440f0055b913e728cd072c0 # v34.54.0 + uses: renovatebot/github-action@8bc2d8057f49655950abaf9af6c098315c24047c # v34.54.1 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 718f29de6330a7d1c96fedd932e44ed7fca8dd28 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Mon, 12 Dec 2022 00:35:38 +0000 Subject: [PATCH 1070/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.54.2 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 87e17b22..b437620a 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@8bc2d8057f49655950abaf9af6c098315c24047c # v34.54.1 + uses: renovatebot/github-action@a125566bae8215faeb01df8d2488e29ded5ee85e # v34.54.2 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 55e827da07927eefc0576d54e744857bec1b423d Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Mon, 12 Dec 2022 18:08:22 +0000 Subject: [PATCH 1071/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.55.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index b437620a..f620fa73 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@a125566bae8215faeb01df8d2488e29ded5ee85e # v34.54.2 + uses: renovatebot/github-action@a9158b09431ff8fbbf824e26fefc13efc447e568 # v34.55.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From cd8e617e19be44c230cfbe9d97381660f8259080 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Tue, 13 Dec 2022 00:36:08 +0000 Subject: [PATCH 1072/1229] chore(deps): update github-action actions/checkout [skip ci] to 7dd9e2a --- .github/workflows/shellcheck.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml index 27899231..2c0027d5 100644 --- a/.github/workflows/shellcheck.yml +++ b/.github/workflows/shellcheck.yml @@ -10,7 +10,7 @@ jobs: name: Shellcheck runs-on: ubuntu-latest steps: - - uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3 + - uses: actions/checkout@7dd9e2a3dc350cf687eb1b2a4fadfee8c8e49675 # v3 - name: Run ShellCheck uses: ludeeus/action-shellcheck@master with: @@ -21,6 +21,6 @@ jobs: pre-commit: runs-on: ubuntu-latest steps: - - uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3 + - uses: actions/checkout@7dd9e2a3dc350cf687eb1b2a4fadfee8c8e49675 # v3 - uses: actions/setup-python@2c3dd9e7e29afd70cc0950079bde6c979d1f69f9 # v4 - uses: pre-commit/action@646c83fcd040023954eafda54b4db0192ce70507 # tag=v3.0.0 From 1fcf99d6001be3bb7585086ae0e91c1b8d17ea50 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Tue, 13 Dec 2022 00:36:11 +0000 Subject: [PATCH 1073/1229] chore(deps): update github-action actions/checkout [skip ci] to v3.2.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index f620fa73..850ec111 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # tag=v3.1.0 + uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3.2.0 with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate From 8bcf02f5ac45a9318ddcaa41781491f2475a214e Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Tue, 13 Dec 2022 18:08:10 +0000 Subject: [PATCH 1074/1229] chore(deps): update github-action actions/checkout [skip ci] to 755da8c --- .github/workflows/shellcheck.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml index 2c0027d5..6ffde0ca 100644 --- a/.github/workflows/shellcheck.yml +++ b/.github/workflows/shellcheck.yml @@ -10,7 +10,7 @@ jobs: name: Shellcheck runs-on: ubuntu-latest steps: - - uses: actions/checkout@7dd9e2a3dc350cf687eb1b2a4fadfee8c8e49675 # v3 + - uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3 - name: Run ShellCheck uses: ludeeus/action-shellcheck@master with: @@ -21,6 +21,6 @@ jobs: pre-commit: runs-on: ubuntu-latest steps: - - uses: actions/checkout@7dd9e2a3dc350cf687eb1b2a4fadfee8c8e49675 # v3 + - uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3 - uses: actions/setup-python@2c3dd9e7e29afd70cc0950079bde6c979d1f69f9 # v4 - uses: pre-commit/action@646c83fcd040023954eafda54b4db0192ce70507 # tag=v3.0.0 From 94d8c610199eaf028050d479cb2b79ea5e883051 Mon Sep 17 00:00:00 2001 From: heavybullets8 Date: Wed, 14 Dec 2022 11:40:26 -0700 Subject: [PATCH 1075/1229] update prune --- functions/misc.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/functions/misc.sh b/functions/misc.sh index 407c1c41..fd0d3845 100644 --- a/functions/misc.sh +++ b/functions/misc.sh @@ -19,7 +19,10 @@ export -f sync prune(){ echo -e "🄿 🅁 🅄 🄽 🄴" echo "Pruned Docker Images" -docker image prune -af | grep "^Total" || echo "Failed to Prune Docker Images" +if ! cli -c 'app container config prune prune_options={"remove_unused_images": true, "remove_stopped_containers": true}' | head -n -4: +then + echo "Failed to Prune Docker Images" +fi } export -f prune From 9af1148705a984f6fda1afdd0a994fd7ca342f47 Mon Sep 17 00:00:00 2001 From: heavybullets8 Date: Wed, 14 Dec 2022 11:43:04 -0700 Subject: [PATCH 1076/1229] whoops --- functions/misc.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/functions/misc.sh b/functions/misc.sh index fd0d3845..5c75583b 100644 --- a/functions/misc.sh +++ b/functions/misc.sh @@ -19,8 +19,7 @@ export -f sync prune(){ echo -e "🄿 🅁 🅄 🄽 🄴" echo "Pruned Docker Images" -if ! cli -c 'app container config prune prune_options={"remove_unused_images": true, "remove_stopped_containers": true}' | head -n -4: -then +if ! cli -c 'app container config prune prune_options={"remove_unused_images": true, "remove_stopped_containers": true}' | head -n -4; then echo "Failed to Prune Docker Images" fi } From 4e53d127f3bd56ea5ccd7cd5c4c84984a456e8c3 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Thu, 15 Dec 2022 00:34:56 +0000 Subject: [PATCH 1077/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.56.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 850ec111..bff70e56 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@a9158b09431ff8fbbf824e26fefc13efc447e568 # v34.55.0 + uses: renovatebot/github-action@d7fcdf297cbeefe89485e10528f45aaadd92be77 # v34.56.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From af302499879a487433fab0e4c12c675e988d1147 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 15 Dec 2022 00:04:18 -0700 Subject: [PATCH 1078/1229] prune based on current version --- functions/misc.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/functions/misc.sh b/functions/misc.sh index 5c75583b..7f4f51de 100644 --- a/functions/misc.sh +++ b/functions/misc.sh @@ -18,9 +18,15 @@ export -f sync prune(){ echo -e "🄿 🅁 🅄 🄽 🄴" -echo "Pruned Docker Images" -if ! cli -c 'app container config prune prune_options={"remove_unused_images": true, "remove_stopped_containers": true}' | head -n -4; then - echo "Failed to Prune Docker Images" +version="$(cli -c 'system version' | awk -F '-' '{print $3}' | tr -d " \t\r\.")" +if (( "$version" <= 22120 )); then + if ! cli -c 'app container config prune prune_options={"remove_unused_images": true, "remove_stopped_containers": true}' | head -n -4; then + echo "Failed to Prune Docker Images" + fi +else + if ! docker image prune -af | grep "^Total"; then + echo "Failed to Prune Docker Images" + fi fi } export -f prune From a3c052dce6a562bdbb2b817e3574f8f9da8b76c9 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 15 Dec 2022 07:10:21 +0000 Subject: [PATCH 1079/1229] reverse gt symbol --- functions/misc.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/misc.sh b/functions/misc.sh index 7f4f51de..c14576d0 100644 --- a/functions/misc.sh +++ b/functions/misc.sh @@ -19,7 +19,7 @@ export -f sync prune(){ echo -e "🄿 🅁 🅄 🄽 🄴" version="$(cli -c 'system version' | awk -F '-' '{print $3}' | tr -d " \t\r\.")" -if (( "$version" <= 22120 )); then +if (( "$version" >= 22120 )); then if ! cli -c 'app container config prune prune_options={"remove_unused_images": true, "remove_stopped_containers": true}' | head -n -4; then echo "Failed to Prune Docker Images" fi @@ -97,4 +97,4 @@ echo "bash /mnt/tank/scripts/heavy_script.sh --delete-backup" echo exit } -export -f help \ No newline at end of file +export -f help From 36d92ddeb071750c4e9b4ab259f3a9fe86958d64 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 15 Dec 2022 00:24:59 -0700 Subject: [PATCH 1080/1229] only print first 4 numbers of version --- functions/misc.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/misc.sh b/functions/misc.sh index c14576d0..66b93410 100644 --- a/functions/misc.sh +++ b/functions/misc.sh @@ -18,8 +18,8 @@ export -f sync prune(){ echo -e "🄿 🅁 🅄 🄽 🄴" -version="$(cli -c 'system version' | awk -F '-' '{print $3}' | tr -d " \t\r\.")" -if (( "$version" >= 22120 )); then +version="$(cli -c 'system version' | awk -F '-' '{print $3}' | awk -F '.' '{print $1 $2}' | tr -d " \t\r\.")" +if (( "$version" >= 2212 )); then if ! cli -c 'app container config prune prune_options={"remove_unused_images": true, "remove_stopped_containers": true}' | head -n -4; then echo "Failed to Prune Docker Images" fi From 4eaf0cc03d558b04956700333fcfd3124c69dee0 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Thu, 15 Dec 2022 12:11:39 +0000 Subject: [PATCH 1081/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.56.3 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index bff70e56..866db330 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@d7fcdf297cbeefe89485e10528f45aaadd92be77 # v34.56.0 + uses: renovatebot/github-action@17af61f7bd131b4171cb09ac07cde5f612fced9c # v34.56.3 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From bcadb12e114b1efea3ef5738eacbb19fdc53dc01 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 15 Dec 2022 17:24:29 -0700 Subject: [PATCH 1082/1229] warning message when restoring to prev version --- functions/backup.sh | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/functions/backup.sh b/functions/backup.sh index 7be2305e..c0acb93f 100644 --- a/functions/backup.sh +++ b/functions/backup.sh @@ -144,6 +144,43 @@ do fi break done + + + # Get the date of system version and when it was updated + current_version=$(cli -m csv -c 'system version' | awk -F '-' '{print $3}') + when_updated=$(cli -m csv -c 'system bootenv query created,realname' | grep "$current_version",\ + | awk -F ',' '{print $2}' | sed 's/[T|-]/_/g' | sed 's/:/_/g' | awk -F '_' '{print $1 $2 $3 $4 $5}') + + + # Get the date of the chosen restore point + restore_point_date=$(echo "$restore_point" | awk -F '_' '{print $2 $3 $4 $5 $6}' | tr -d "_") + + + # Compare the dates + if (("$restore_point_date" < "$when_updated" )); then + clear -x + echo "The restore point you have chosen is from an older version of Truenas Scale" + echo "This is not recommended, as it may cause issues with the system" + if read -rt 120 -p "Would you like to proceed? (y/N): " yesno || { echo -e "\nFailed to make a selection in time" ; exit; }; then + case $yesno in + [Yy] | [Yy][Ee][Ss]) + echo "Proceeding.." + sleep 3 + ;; + [Nn] | [Nn][Oo]) + echo "Exiting" + exit + ;; + *) + echo "That was not an option, try again" + sleep 3 + continue + ;; + esac + fi + fi + + while true do clear -x From 948b3fd5adc3e7ede513126b78fb6f35a4bcce48 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 15 Dec 2022 19:57:32 -0700 Subject: [PATCH 1083/1229] add while loop and general improvements --- functions/backup.sh | 326 ++++++++++++++++++++++---------------------- 1 file changed, 166 insertions(+), 160 deletions(-) diff --git a/functions/backup.sh b/functions/backup.sh index c0acb93f..43b44b70 100644 --- a/functions/backup.sh +++ b/functions/backup.sh @@ -31,193 +31,146 @@ export -f backup deleteBackup(){ +clear -x && echo "pulling all restore points.." +list_backups=$(cli -c 'app kubernetes list_backups' | sort -t '_' -Vr -k2,7 | tr -d " \t\r" | awk -F '|' '{print $2}' | nl -s ") " | column -t) +if [[ -z "$list_backups" ]]; then + echo "No restore points available" + exit +fi + +#Select a restore point while true do - clear -x && echo "pulling all restore points.." - list_backups=$(cli -c 'app kubernetes list_backups' | sort -t '_' -Vr -k2,7 | tr -d " \t\r" | awk -F '|' '{print $2}' | nl -s ") " | column -t) - if [[ -z "$list_backups" ]]; then - echo "No restore points available" + clear -x + title + echo -e "Choose a Restore Point to Delete\nThese may be out of order if they are not HeavyScript backups" + echo "$list_backups" + echo + echo "0) Exit" + read -rt 240 -p "Please type a number: " selection || { echo -e "\nFailed to make a selection in time" ; exit; } + restore_point=$(echo "$list_backups" | grep ^"$selection)" | awk '{print $2}') + if [[ $selection == 0 ]]; then + echo "Exiting.." exit + elif [[ -z "$selection" ]]; then + echo "Your selection cannot be empty" + sleep 3 + continue + elif [[ -z "$restore_point" ]]; then + echo "Invalid Selection: $selection, was not an option" + sleep 3 + continue fi - while true - do - clear -x - title - echo -e "Choose a Restore Point to Delete\nThese may be out of order if they are not HeavyScript backups" - echo "$list_backups" - echo - echo "0) Exit" - read -rt 240 -p "Please type a number: " selection || { echo -e "\nFailed to make a selection in time" ; exit; } - restore_point=$(echo "$list_backups" | grep ^"$selection)" | awk '{print $2}') - if [[ $selection == 0 ]]; then - echo "Exiting.." + break # Break out of the loop if all of the If statement checks above are untrue +done + +#Confirm deletion +while true +do + clear -x + echo -e "WARNING:\nYou CANNOT go back after deleting your restore point" + echo -e "\n\nYou have chosen:\n$restore_point\n\n" + read -rt 120 -p "Would you like to proceed with deletion? (y/N): " yesno || { echo -e "\nFailed to make a selection in time" ; exit; } + case $yesno in + [Yy] | [Yy][Ee][Ss]) + echo -e "\nDeleting $restore_point" + cli -c 'app kubernetes delete_backup backup_name=''"'"$restore_point"'"' &>/dev/null || { echo "Failed to delete backup.."; exit; } + echo "Sucessfully deleted" + break + ;; + [Nn] | [Nn][Oo]) + echo "Exiting" exit - elif [[ -z "$selection" ]]; then - echo "Your selection cannot be empty" + ;; + *) + echo "That was not an option, try again" sleep 3 continue - elif [[ -z "$restore_point" ]]; then - echo "Invalid Selection: $selection, was not an option" - sleep 3 + ;; + esac +done + +#Check if there are more backups to delete +while true +do + read -rt 120 -p "Delete more backups? (y/N): " yesno || { echo -e "\nFailed to make a selection in time" ; exit; } + case $yesno in + [Yy] | [Yy][Ee][Ss]) + break + ;; + [Nn] | [Nn][Oo]) + exit + ;; + *) + echo "$yesno was not an option, try again" + sleep 2 continue - fi - break # Break out of the loop if all of the If statement checks above are untrue - done - while true - do - clear -x - echo -e "WARNING:\nYou CANNOT go back after deleting your restore point" - echo -e "\n\nYou have chosen:\n$restore_point\n\n" - read -rt 120 -p "Would you like to proceed with deletion? (y/N): " yesno || { echo -e "\nFailed to make a selection in time" ; exit; } - case $yesno in - [Yy] | [Yy][Ee][Ss]) - echo -e "\nDeleting $restore_point" - cli -c 'app kubernetes delete_backup backup_name=''"'"$restore_point"'"' &>/dev/null || { echo "Failed to delete backup.."; exit; } - echo "Sucessfully deleted" - break - ;; - [Nn] | [Nn][Oo]) - echo "Exiting" - exit - ;; - *) - echo "That was not an option, try again" - sleep 3 - continue - ;; - esac - done - while true - do - read -rt 120 -p "Delete more backups? (y/N): " yesno || { echo -e "\nFailed to make a selection in time" ; exit; } - case $yesno in - [Yy] | [Yy][Ee][Ss]) - break - ;; - [Nn] | [Nn][Oo]) - exit - ;; - *) - echo "$yesno was not an option, try again" - sleep 2 - continue - ;; + ;; - esac + esac - done done } export -f deleteBackup restore(){ +clear -x && echo "pulling restore points.." +list_backups=$(cli -c 'app kubernetes list_backups' | grep -E "HeavyScript_|TrueTool_" | sort -t '_' -Vr -k2,7 | tr -d " \t\r" | awk -F '|' '{print $2}' | nl -s ") " | column -t) +if [[ -z "$list_backups" ]]; then + echo "No HeavyScript restore points available" + exit +fi + +#Select a restore point while true do - clear -x && echo "pulling restore points.." - list_backups=$(cli -c 'app kubernetes list_backups' | grep -E "HeavyScript_|TrueTool_" | sort -t '_' -Vr -k2,7 | tr -d " \t\r" | awk -F '|' '{print $2}' | nl -s ") " | column -t) - if [[ -z "$list_backups" ]]; then - echo "No HeavyScript restore points available" + clear -x + title + echo "Choose a Restore Point" + echo "$list_backups" + echo + echo "0) Exit" + read -rt 240 -p "Please type a number: " selection || { echo -e "\nFailed to make a selection in time" ; exit; } + restore_point=$(echo "$list_backups" | grep ^"$selection)" | awk '{print $2}') + if [[ $selection == 0 ]]; then + echo "Exiting.." exit + elif [[ -z "$selection" ]]; then + echo "Your selection cannot be empty" + sleep 3 + continue + elif [[ -z "$restore_point" ]]; then + echo "Invalid Selection: $selection, was not an option" + sleep 3 + continue fi - while true - do - clear -x - title - echo "Choose a Restore Point" - echo "$list_backups" - echo - echo "0) Exit" - read -rt 240 -p "Please type a number: " selection || { echo -e "\nFailed to make a selection in time" ; exit; } - restore_point=$(echo "$list_backups" | grep ^"$selection)" | awk '{print $2}') - if [[ $selection == 0 ]]; then - echo "Exiting.." - exit - elif [[ -z "$selection" ]]; then - echo "Your selection cannot be empty" - sleep 3 - continue - elif [[ -z "$restore_point" ]]; then - echo "Invalid Selection: $selection, was not an option" - sleep 3 - continue - fi - break - done + break +done - # Get the date of system version and when it was updated - current_version=$(cli -m csv -c 'system version' | awk -F '-' '{print $3}') - when_updated=$(cli -m csv -c 'system bootenv query created,realname' | grep "$current_version",\ - | awk -F ',' '{print $2}' | sed 's/[T|-]/_/g' | sed 's/:/_/g' | awk -F '_' '{print $1 $2 $3 $4 $5}') +# Get the date of system version and when it was updated +current_version=$(cli -m csv -c 'system version' | awk -F '-' '{print $3}') +when_updated=$(cli -m csv -c 'system bootenv query created,realname' | grep "$current_version",\ +| awk -F ',' '{print $2}' | sed 's/[T|-]/_/g' | sed 's/:/_/g' | awk -F '_' '{print $1 $2 $3 $4 $5}') - # Get the date of the chosen restore point - restore_point_date=$(echo "$restore_point" | awk -F '_' '{print $2 $3 $4 $5 $6}' | tr -d "_") +# Get the date of the chosen restore point +restore_point_date=$(echo "$restore_point" | awk -F '_' '{print $2 $3 $4 $5 $6}' | tr -d "_") - # Compare the dates - if (("$restore_point_date" < "$when_updated" )); then - clear -x - echo "The restore point you have chosen is from an older version of Truenas Scale" - echo "This is not recommended, as it may cause issues with the system" - if read -rt 120 -p "Would you like to proceed? (y/N): " yesno || { echo -e "\nFailed to make a selection in time" ; exit; }; then - case $yesno in - [Yy] | [Yy][Ee][Ss]) - echo "Proceeding.." - sleep 3 - ;; - [Nn] | [Nn][Oo]) - echo "Exiting" - exit - ;; - *) - echo "That was not an option, try again" - sleep 3 - continue - ;; - esac - fi - fi - - - while true - do - clear -x - echo -e "WARNING:\nThis is NOT guranteed to work\nThis is ONLY supposed to be used as a LAST RESORT\nConsider rolling back your applications instead if possible" - echo -e "\n\nYou have chosen:\n$restore_point\n\n" - read -rt 120 -p "Would you like to proceed with restore? (y/N): " yesno || { echo -e "\nFailed to make a selection in time" ; exit; } +# Compare the dates +while (("$restore_point_date" < "$when_updated" )) +do + clear -x + echo "The restore point you have chosen is from an older version of Truenas Scale" + echo "This is not recommended, as it may cause issues with the system" + if read -rt 120 -p "Would you like to proceed? (y/N): " yesno || { echo -e "\nFailed to make a selection in time" ; exit; }; then case $yesno in [Yy] | [Yy][Ee][Ss]) - pool=$(cli -c 'app kubernetes config' | grep -E "pool\s\|" | awk -F '|' '{print $3}' | tr -d " \t\n\r") - - # Set mountpoints to legacy prior to restore, ensures correct properties for the are set - echo -e "\nSetting correct ZFS properties for application volumes.." - for pvc in $(zfs list -t filesystem -r "$pool"/ix-applications/releases -o name -H | grep "volumes/pvc") - do - if zfs set mountpoint=legacy "$pvc"; then - echo "Success for - \"$pvc\"" - else - echo "Error: Setting properties for \"$pvc\", failed.." - fi - done - - # Ensure readonly is turned off - if ! zfs set readonly=off "$pool"/ix-applications;then - echo -e "Error: Failed to set ZFS ReadOnly to \"off\"" - echo -e "After the restore, attempt to run the following command manually:" - echo "zfs set readonly=off $pool/ix-applications" - fi - - echo "Finished setting properties.." - - # Beginning snapshot restore - echo -e "\nStarting restore, this will take a LONG time." - if ! cli -c 'app kubernetes restore_backup backup_name=''"'"$restore_point"'"'; then - echo "Restore failed, exiting.." - exit 1 - fi - exit + echo "Proceeding.." + sleep 3 + break ;; [Nn] | [Nn][Oo]) echo "Exiting" @@ -229,7 +182,60 @@ do continue ;; esac - done + fi done + + +#Confirm restore +while true +do + clear -x + echo -e "WARNING:\nThis is NOT guranteed to work\nThis is ONLY supposed to be used as a LAST RESORT\nConsider rolling back your applications instead if possible" + echo -e "\n\nYou have chosen:\n$restore_point\n\n" + read -rt 120 -p "Would you like to proceed with restore? (y/N): " yesno || { echo -e "\nFailed to make a selection in time" ; exit; } + case $yesno in + [Yy] | [Yy][Ee][Ss]) + pool=$(cli -c 'app kubernetes config' | grep -E "pool\s\|" | awk -F '|' '{print $3}' | tr -d " \t\n\r") + + # Set mountpoints to legacy prior to restore, ensures correct properties for the are set + echo -e "\nSetting correct ZFS properties for application volumes.." + for pvc in $(zfs list -t filesystem -r "$pool"/ix-applications/releases -o name -H | grep "volumes/pvc") + do + if zfs set mountpoint=legacy "$pvc"; then + echo "Success for - \"$pvc\"" + else + echo "Error: Setting properties for \"$pvc\", failed.." + fi + done + + # Ensure readonly is turned off + if ! zfs set readonly=off "$pool"/ix-applications;then + echo -e "Error: Failed to set ZFS ReadOnly to \"off\"" + echo -e "After the restore, attempt to run the following command manually:" + echo "zfs set readonly=off $pool/ix-applications" + fi + + echo "Finished setting properties.." + + # Beginning snapshot restore + echo -e "\nStarting restore, this will take a LONG time." + if ! cli -c 'app kubernetes restore_backup backup_name=''"'"$restore_point"'"'; then + echo "Restore failed, exiting.." + exit 1 + fi + exit + ;; + [Nn] | [Nn][Oo]) + echo "Exiting" + exit + ;; + *) + echo "That was not an option, try again" + sleep 3 + continue + ;; + esac +done + } export -f restore \ No newline at end of file From a11c0414698e01e3247eaaf6792aa9d4278e9513 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Sat, 17 Dec 2022 00:30:06 +0000 Subject: [PATCH 1084/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.60.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 866db330..44ff600c 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@17af61f7bd131b4171cb09ac07cde5f612fced9c # v34.56.3 + uses: renovatebot/github-action@e554d71798f1142b467bc4fabcb8f134b6b7cf35 # v34.60.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 27eec996aaeb98fc07017c23baeafb39a548876d Mon Sep 17 00:00:00 2001 From: heavybullets8 Date: Sat, 17 Dec 2022 20:27:53 -0700 Subject: [PATCH 1085/1229] Edit restore message on scale ver change --- functions/backup.sh | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/functions/backup.sh b/functions/backup.sh index 43b44b70..3d795cd2 100644 --- a/functions/backup.sh +++ b/functions/backup.sh @@ -149,9 +149,13 @@ do done +# Boot Query +boot_query=$(cli -m csv -c 'system bootenv query created,realname') + + # Get the date of system version and when it was updated current_version=$(cli -m csv -c 'system version' | awk -F '-' '{print $3}') -when_updated=$(cli -m csv -c 'system bootenv query created,realname' | grep "$current_version",\ +when_updated=$(echo "$boot_query" | grep "$current_version",\ | awk -F ',' '{print $2}' | sed 's/[T|-]/_/g' | sed 's/:/_/g' | awk -F '_' '{print $1 $2 $3 $4 $5}') @@ -159,12 +163,25 @@ when_updated=$(cli -m csv -c 'system bootenv query created,realname' | grep "$cu restore_point_date=$(echo "$restore_point" | awk -F '_' '{print $2 $3 $4 $5 $6}' | tr -d "_") +# Grab previous version +previous_version=$(echo "$boot_query" | sort -nr | grep -A 1 "$current_version," | tail -n 1) + + # Compare the dates while (("$restore_point_date" < "$when_updated" )) do clear -x echo "The restore point you have chosen is from an older version of Truenas Scale" echo "This is not recommended, as it may cause issues with the system" + echo + echo "Current SCALE Information:" + echo "Version: $current_version" + echo "When Updated: $(echo "$restore_point" | awk -F '_' '{print $2 "-" $3 "-" $4}')" + echo + echo "Restore Point SCALE Information:" + echo "Version: $(echo "$previous_version" | awk -F ',' '{print $1}')" + echo "When Updated: $(echo "$previous_version" | awk -F ',' '{print $2}' | awk -F 'T' '{print $1}')" + echo if read -rt 120 -p "Would you like to proceed? (y/N): " yesno || { echo -e "\nFailed to make a selection in time" ; exit; }; then case $yesno in [Yy] | [Yy][Ee][Ss]) From 0fef1998ae9335e51d9645a362d7c3042026dadc Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Sun, 18 Dec 2022 11:36:53 +0100 Subject: [PATCH 1086/1229] Add first attempt at 22.12 hotpatch --- hotpatch/2212/HP1.patch | 125 ++++++++++++++++++++++++++++++++++++++++ includes/patch.sh | 16 +++++ truetool.sh | 5 ++ 3 files changed, 146 insertions(+) create mode 100644 hotpatch/2212/HP1.patch create mode 100644 includes/patch.sh diff --git a/hotpatch/2212/HP1.patch b/hotpatch/2212/HP1.patch new file mode 100644 index 00000000..85a49410 --- /dev/null +++ b/hotpatch/2212/HP1.patch @@ -0,0 +1,125 @@ +diff --git plugins/chart_releases_linux/chart_release.py plugins/chart_releases_linux/chart_release.py +index 76e3825bc0f..f65cc0eac24 100644 +--- plugins/chart_releases_linux/chart_release.py ++++ plugins/chart_releases_linux/chart_release.py +@@ -606,7 +606,7 @@ async def do_delete(self, job, release_name, options): + # If we had pre-install jobs, it's possible we have leftover pods which the job did not remove + # based on dev specified settings of cleaning it up - let's remove those + for pod in await self.middleware.call('k8s.pod.query', [['metadata.namespace', '=', namespace]]): +- owner_references = pod['metadata'].get('owner_references') ++ owner_references = pod['metadata'].get('ownerReferences') + if not isinstance(owner_references, list) or all( + owner_reference.get('name') not in pre_install_jobs for owner_reference in owner_references + ): +@@ -658,7 +658,7 @@ async def remove_storage_class_and_dataset(self, release_name, job=None): + pvc_volume_ds = os.path.join(release_ds, 'volumes') + for pv in await self.middleware.call( + 'k8s.pv.query', [ +- ['spec.csi.volume_attributes.openebs\\.io/poolname', '=', pvc_volume_ds] ++ ['spec.csi.volumeAttributes.openebs\\.io/poolname', '=', pvc_volume_ds] + ] + ): + await self.middleware.call('k8s.pv.delete', pv['metadata']['name']) +diff --git plugins/chart_releases_linux/resources.py plugins/chart_releases_linux/resources.py +index c7180147a5f..941de79da45 100644 +--- plugins/chart_releases_linux/resources.py ++++ plugins/chart_releases_linux/resources.py +@@ -158,13 +158,13 @@ async def retrieve_pv_pvc_mapping_internal(self, chart_release): + } + + for pv in chart_release['resources']['persistent_volumes']: +- claim_name = pv['spec'].get('claim_ref', {}).get('name') ++ claim_name = pv['spec'].get('claimRef', {}).get('name') + if claim_name: + csi_spec = pv['spec']['csi'] +- volumes_ds = csi_spec['volume_attributes']['openebs.io/poolname'] ++ volumes_ds = csi_spec['volumeAttributes']['openebs.io/poolname'] + if ( + os.path.join(chart_release['dataset'], 'volumes') != volumes_ds or +- csi_spec['volume_handle'] not in zfs_volumes ++ csi_spec['volumeHandle'] not in zfs_volumes + ): + # We are only going to backup/restore pvc's which were consuming + # their respective storage class and we have related zfs volume present +@@ -174,8 +174,8 @@ async def retrieve_pv_pvc_mapping_internal(self, chart_release): + mapping[claim_name] = { + 'name': pv_name, + 'pv_details': pv, +- 'dataset': os.path.join(volumes_ds, csi_spec['volume_handle']), +- 'zv_details': zfs_volumes[csi_spec['volume_handle']], ++ 'dataset': os.path.join(volumes_ds, csi_spec['volumeHandle']), ++ 'zv_details': zfs_volumes[csi_spec['volumeHandle']], + } + return mapping + +@@ -247,11 +247,11 @@ async def get_workload_storage_details(self): + # because of chart release reclaim policy being retain + for pv in await self.middleware.call( + 'k8s.pv.query', [[ +- 'spec.csi.volume_attributes.openebs\\.io/poolname', '^', ++ 'spec.csi.volumeAttributes.openebs\\.io/poolname', '^', + f'{os.path.join(k8s_config["dataset"], "releases")}/' + ]] + ): +- dataset = pv['spec']['csi']['volume_attributes']['openebs.io/poolname'] ++ dataset = pv['spec']['csi']['volumeAttributes']['openebs.io/poolname'] + rl = dataset.split('/', 4) + if len(rl) > 4: + mapping['persistent_volumes'][rl[3]].append(pv) +diff --git plugins/chart_releases_linux/scale_workload.py plugins/chart_releases_linux/scale_workload.py +index 117dab3a79c..e9525150278 100644 +--- plugins/chart_releases_linux/scale_workload.py ++++ plugins/chart_releases_linux/scale_workload.py +@@ -246,10 +246,10 @@ async def get_workload_to_pod_mapping(self, namespace): + for r in await self.middleware.call( + f'k8s.{key}.query', [ + ['metadata.namespace', '=', namespace], +- ['metadata', 'rin', 'owner_references'], ++ ['metadata', 'rin', 'ownerReferences'], + ], {'select': ['metadata']} + ): +- for owner_reference in filter(lambda o: o.get('uid'), r['metadata']['owner_references'] or []): ++ for owner_reference in filter(lambda o: o.get('uid'), r['metadata']['ownerReferences'] or []): + mapping[key][owner_reference['uid']][r['metadata']['uid']] = r + + pod_mapping = defaultdict(list) +diff --git plugins/kubernetes_linux/restore.py plugins/kubernetes_linux/restore.py +index 4897e3f8b7a..ec13a332b6e 100644 +--- plugins/kubernetes_linux/restore.py ++++ plugins/kubernetes_linux/restore.py +@@ -218,7 +218,11 @@ def restore_backup(self, job, backup_name, options): + failed_pv_restores.append(f'Unable to create ZFS Volume for {pvc!r} PVC: {e}') + continue + ++ # We need to safely access claim_ref vollume attribute keys as with k8s client api re-write ++ # camel casing which was done by kubernetes asyncio package is not happening anymore + pv_spec = pv['pv_details']['spec'] ++ claim_ref = pv_spec.get('claim_ref') or pv_spec['claimRef'] ++ pv_volume_attrs = pv_spec['csi'].get('volume_attributes') or pv_spec['csi']['volumeAttributes'] + try: + self.middleware.call_sync('k8s.pv.create', { + 'metadata': { +@@ -229,18 +233,18 @@ def restore_backup(self, job, backup_name, options): + 'storage': pv_spec['capacity']['storage'], + }, + 'claimRef': { +- 'name': pv_spec['claim_ref']['name'], +- 'namespace': pv_spec['claim_ref']['namespace'], ++ 'name': claim_ref['name'], ++ 'namespace': claim_ref['namespace'], + }, + 'csi': { + 'volumeAttributes': { + 'openebs.io/poolname': RE_POOL.sub( +- f'{k8s_pool}\\1', pv_spec['csi']['volume_attributes']['openebs.io/poolname'] ++ f'{k8s_pool}\\1', pv_volume_attrs['openebs.io/poolname'] + ) + }, +- 'volumeHandle': pv_spec['csi']['volume_handle'], ++ 'volumeHandle': pv_spec['csi'].get('volume_handle') or pv_spec['csi']['volumeHandle'], + }, +- 'storageClassName': pv_spec['storage_class_name'], ++ 'storageClassName': pv_spec.get('storage_class_name') or pv_spec['storageClassName'], + }, + }) + except Exception as e: \ No newline at end of file diff --git a/includes/patch.sh b/includes/patch.sh new file mode 100644 index 00000000..aa5e80f2 --- /dev/null +++ b/includes/patch.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +patchv22120(){ +echo "Applying 22.12 HotPatch 1" +( wget -q -P /tmp https://github.com/truecharts/truetool/raw/master/hotpatch/2212/HP1.patch && echo "download completed" || echo "download failed" ) && ( patch -s -p0 -d /usr/lib/python3/dist-packages/middlewared/ < /tmp/HP1.patch && echo "patch completed" || echo "patch failed" ) && rm -rf /tmp/HP1.patch +} +export -f patchv22120 + + +hotpatch(){ +echo "Starting hotpatcher..." +if [ "$(cli -m csv -c 'system version' | awk -F '-' '{print $3}')" == "22.12.0" ]; then + patchv22120 +fi +} +export -f hotpatch \ No newline at end of file diff --git a/truetool.sh b/truetool.sh index 3997a3af..3f505939 100755 --- a/truetool.sh +++ b/truetool.sh @@ -22,6 +22,8 @@ source includes/colors.sh source includes/dns.sh # shellcheck source=includes/help.sh source includes/help.sh +# shellcheck source=includes/help.sh +source includes/patch.sh # shellcheck source=includes/mount.sh source includes/mount.sh # shellcheck source=includes/no_args.sh @@ -134,6 +136,9 @@ if [[ "$no_args" == "true" ]]; then no_args fi +## Always check if a hotpatch needs to be applied +hotpatch + ## Exit if incompatable functions are called [[ "$update_all_apps" == "true" && "$update_apps" == "true" ]] && echo -e "-U and -u cannot BOTH be called" && exit From 6474cfaf6a2b3047c4dd41fbd70cac984931b54b Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Sun, 18 Dec 2022 11:38:18 +0100 Subject: [PATCH 1087/1229] fix pre-commit --- hotpatch/2212/HP1.patch | 10 +++++----- includes/patch.sh | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/hotpatch/2212/HP1.patch b/hotpatch/2212/HP1.patch index 85a49410..72e293a9 100644 --- a/hotpatch/2212/HP1.patch +++ b/hotpatch/2212/HP1.patch @@ -26,7 +26,7 @@ index c7180147a5f..941de79da45 100644 +++ plugins/chart_releases_linux/resources.py @@ -158,13 +158,13 @@ async def retrieve_pv_pvc_mapping_internal(self, chart_release): } - + for pv in chart_release['resources']['persistent_volumes']: - claim_name = pv['spec'].get('claim_ref', {}).get('name') + claim_name = pv['spec'].get('claimRef', {}).get('name') @@ -51,7 +51,7 @@ index c7180147a5f..941de79da45 100644 + 'zv_details': zfs_volumes[csi_spec['volumeHandle']], } return mapping - + @@ -247,11 +247,11 @@ async def get_workload_storage_details(self): # because of chart release reclaim policy being retain for pv in await self.middleware.call( @@ -81,7 +81,7 @@ index 117dab3a79c..e9525150278 100644 - for owner_reference in filter(lambda o: o.get('uid'), r['metadata']['owner_references'] or []): + for owner_reference in filter(lambda o: o.get('uid'), r['metadata']['ownerReferences'] or []): mapping[key][owner_reference['uid']][r['metadata']['uid']] = r - + pod_mapping = defaultdict(list) diff --git plugins/kubernetes_linux/restore.py plugins/kubernetes_linux/restore.py index 4897e3f8b7a..ec13a332b6e 100644 @@ -90,7 +90,7 @@ index 4897e3f8b7a..ec13a332b6e 100644 @@ -218,7 +218,11 @@ def restore_backup(self, job, backup_name, options): failed_pv_restores.append(f'Unable to create ZFS Volume for {pvc!r} PVC: {e}') continue - + + # We need to safely access claim_ref vollume attribute keys as with k8s client api re-write + # camel casing which was done by kubernetes asyncio package is not happening anymore pv_spec = pv['pv_details']['spec'] @@ -122,4 +122,4 @@ index 4897e3f8b7a..ec13a332b6e 100644 + 'storageClassName': pv_spec.get('storage_class_name') or pv_spec['storageClassName'], }, }) - except Exception as e: \ No newline at end of file + except Exception as e: diff --git a/includes/patch.sh b/includes/patch.sh index aa5e80f2..fe0e67da 100644 --- a/includes/patch.sh +++ b/includes/patch.sh @@ -13,4 +13,4 @@ if [ "$(cli -m csv -c 'system version' | awk -F '-' '{print $3}')" == "22.12.0" patchv22120 fi } -export -f hotpatch \ No newline at end of file +export -f hotpatch From 6ad4aa373cb8378935ef9e9818ed77c6c2cac82e Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Sun, 18 Dec 2022 11:40:16 +0100 Subject: [PATCH 1088/1229] fix hotpatch --- includes/patch.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/patch.sh b/includes/patch.sh index fe0e67da..0a623b20 100644 --- a/includes/patch.sh +++ b/includes/patch.sh @@ -2,7 +2,7 @@ patchv22120(){ echo "Applying 22.12 HotPatch 1" -( wget -q -P /tmp https://github.com/truecharts/truetool/raw/master/hotpatch/2212/HP1.patch && echo "download completed" || echo "download failed" ) && ( patch -s -p0 -d /usr/lib/python3/dist-packages/middlewared/ < /tmp/HP1.patch && echo "patch completed" || echo "patch failed" ) && rm -rf /tmp/HP1.patch +( wget -q -P /tmp https://github.com/truecharts/truetool/raw/main/hotpatch/2212/HP1.patch && echo "download completed" || echo "download failed" ) && ( patch -s -p0 -d /usr/lib/python3/dist-packages/middlewared/ < /tmp/HP1.patch && echo "patch completed" || echo "patch failed" ) && rm -rf /tmp/HP1.patch } export -f patchv22120 From 2dbc733d906a4c0b6fa336263eb1a1005f7c1968 Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Sun, 18 Dec 2022 11:44:24 +0100 Subject: [PATCH 1089/1229] ignore already applied --- includes/patch.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/patch.sh b/includes/patch.sh index 0a623b20..5681ca69 100644 --- a/includes/patch.sh +++ b/includes/patch.sh @@ -2,7 +2,7 @@ patchv22120(){ echo "Applying 22.12 HotPatch 1" -( wget -q -P /tmp https://github.com/truecharts/truetool/raw/main/hotpatch/2212/HP1.patch && echo "download completed" || echo "download failed" ) && ( patch -s -p0 -d /usr/lib/python3/dist-packages/middlewared/ < /tmp/HP1.patch && echo "patch completed" || echo "patch failed" ) && rm -rf /tmp/HP1.patch +( wget -q -P /tmp https://github.com/truecharts/truetool/raw/main/hotpatch/2212/HP1.patch && echo "download completed" || echo "download failed" ) && ( patch -N -s -p0 -d /usr/lib/python3/dist-packages/middlewared/ < /tmp/HP1.patch && echo "patch completed" || echo "patch failed or skipped, not critical" ) && rm -rf /tmp/HP1.patch } export -f patchv22120 From 864c3154a6cf4e6adba92999bfae9d5164dfbac1 Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Sun, 18 Dec 2022 12:09:29 +0100 Subject: [PATCH 1090/1229] ensure middleware restart after successfull patch --- includes/patch.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/patch.sh b/includes/patch.sh index 5681ca69..6ed44fd5 100644 --- a/includes/patch.sh +++ b/includes/patch.sh @@ -2,7 +2,7 @@ patchv22120(){ echo "Applying 22.12 HotPatch 1" -( wget -q -P /tmp https://github.com/truecharts/truetool/raw/main/hotpatch/2212/HP1.patch && echo "download completed" || echo "download failed" ) && ( patch -N -s -p0 -d /usr/lib/python3/dist-packages/middlewared/ < /tmp/HP1.patch && echo "patch completed" || echo "patch failed or skipped, not critical" ) && rm -rf /tmp/HP1.patch +( wget -q -P /tmp https://github.com/truecharts/truetool/raw/main/hotpatch/2212/HP1.patch && echo "download completed" || echo "download failed" ) && ( patch -N -s -p0 -d /usr/lib/python3/dist-packages/middlewared/ < /tmp/HP1.patch && service middlewared restart && echo "waiting 20 seconds for middleware restart..." && sleep 20 && echo "patch completed" || echo "patch failed or skipped, not critical" ) && rm -rf /tmp/HP1.patch } export -f patchv22120 From 30f1dc3ac632c478f988c6e0ff79f2963b94054a Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Sun, 18 Dec 2022 06:10:27 +0000 Subject: [PATCH 1091/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.63.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 44ff600c..462fd598 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@e554d71798f1142b467bc4fabcb8f134b6b7cf35 # v34.60.0 + uses: renovatebot/github-action@f25e0646e498d67dab9f3ca2a2a4455b91a7c2be # v34.63.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 12100cf3f04f7d94cb57c248f26360c3f7bbed66 Mon Sep 17 00:00:00 2001 From: heavybullets8 Date: Sun, 18 Dec 2022 10:41:04 -0700 Subject: [PATCH 1092/1229] initial backup validity checks --- functions/backup.sh | 110 +++++++++++++++++++++++++++++++------------- 1 file changed, 78 insertions(+), 32 deletions(-) diff --git a/functions/backup.sh b/functions/backup.sh index 3d795cd2..cd57075e 100644 --- a/functions/backup.sh +++ b/functions/backup.sh @@ -149,40 +149,87 @@ do done -# Boot Query -boot_query=$(cli -m csv -c 'system bootenv query created,realname') +## Check to see if empty PVC data is present in any of the applications ## +# Find all pv_info.json files two subfolders deep +pool=$(cli -c 'app kubernetes config' | grep -E "pool\s\|" | awk -F '|' '{print $3}' | tr -d " \t\n\r") +files=$(find "$(find /mnt/"$pool"/ix-applications/backups -maxdepth 0 )" -name pv_info.json | grep "$restore_point"); -# Get the date of system version and when it was updated -current_version=$(cli -m csv -c 'system version' | awk -F '-' '{print $3}') -when_updated=$(echo "$boot_query" | grep "$current_version",\ -| awk -F ',' '{print $2}' | sed 's/[T|-]/_/g' | sed 's/:/_/g' | awk -F '_' '{print $1 $2 $3 $4 $5}') +# Iterate over the list of files +for file in $files; do + # Check if the file only contains {} subfolders two deep + contents=$(cat $file) + if [[ "$contents" == '{}' ]]; then + # Print the file if it meets the criterion + file=$(echo "$file" | awk -F '/' '{print $7}') + borked_array+="$file\n" + borked=True + fi +done - -# Get the date of the chosen restore point -restore_point_date=$(echo "$restore_point" | awk -F '_' '{print $2 $3 $4 $5 $6}' | tr -d "_") - - -# Grab previous version -previous_version=$(echo "$boot_query" | sort -nr | grep -A 1 "$current_version," | tail -n 1) - - -# Compare the dates -while (("$restore_point_date" < "$when_updated" )) -do - clear -x - echo "The restore point you have chosen is from an older version of Truenas Scale" - echo "This is not recommended, as it may cause issues with the system" - echo - echo "Current SCALE Information:" - echo "Version: $current_version" - echo "When Updated: $(echo "$restore_point" | awk -F '_' '{print $2 "-" $3 "-" $4}')" - echo - echo "Restore Point SCALE Information:" - echo "Version: $(echo "$previous_version" | awk -F ',' '{print $1}')" - echo "When Updated: $(echo "$previous_version" | awk -F ',' '{print $2}' | awk -F 'T' '{print $1}')" - echo - if read -rt 120 -p "Would you like to proceed? (y/N): " yesno || { echo -e "\nFailed to make a selection in time" ; exit; }; then +# If there is empty PVC data, exit +if [[ $borked == True ]]; then + echo "Warning!:" + echo "The following applications have empty PVC data:" + for file in $borked_array; do + echo -e "$file" + done + echo "You need to ensure these applications are not supposed to have PVC data before proceeding" + while true + do + read -rt 120 -p "Would you like to proceed? (y/N): " yesno || { echo -e "\nFailed to make a selection in time" ; exit; } + case $yesno in + [Yy] | [Yy][Ee][Ss]) + echo "Proceeding.." + sleep 3 + break + ;; + [Nn] | [Nn][Oo]) + echo "Exiting" + exit + ;; + *) + echo "That was not an option, try again" + sleep 3 + continue + ;; + esac + done +fi + + + +## Check the restore point, and ensure it is the same version as the current system ## +# Boot Query +boot_query=$(cli -m csv -c 'system bootenv query created,realname') + +# Get the date of system version and when it was updated +current_version=$(cli -m csv -c 'system version' | awk -F '-' '{print $3}') +when_updated=$(echo "$boot_query" | grep "$current_version",\ +| awk -F ',' '{print $2}' | sed 's/[T|-]/_/g' | sed 's/:/_/g' | awk -F '_' '{print $1 $2 $3 $4 $5}') + +# Get the date of the chosen restore point +restore_point_date=$(echo "$restore_point" | awk -F '_' '{print $2 $3 $4 $5 $6}' | tr -d "_") + +# Grab previous version +previous_version=$(echo "$boot_query" | sort -nr | grep -A 1 "$current_version," | tail -n 1) + +# Compare the dates +while (("$restore_point_date" < "$when_updated" )) +do + clear -x + echo "The restore point you have chosen is from an older version of Truenas Scale" + echo "This is not recommended, as it may cause issues with the system" + echo + echo "Current SCALE Information:" + echo "Version: $current_version" + echo "When Updated: $(echo "$restore_point" | awk -F '_' '{print $2 "-" $3 "-" $4}')" + echo + echo "Restore Point SCALE Information:" + echo "Version: $(echo "$previous_version" | awk -F ',' '{print $1}')" + echo "When Updated: $(echo "$previous_version" | awk -F ',' '{print $2}' | awk -F 'T' '{print $1}')" + echo + read -rt 120 -p "Would you like to proceed? (y/N): " yesno || { echo -e "\nFailed to make a selection in time" ; exit; } case $yesno in [Yy] | [Yy][Ee][Ss]) echo "Proceeding.." @@ -199,7 +246,6 @@ do continue ;; esac - fi done From 6bbfa17e1c8100682d983926d623b937bb4749a7 Mon Sep 17 00:00:00 2001 From: heavybullets8 Date: Sun, 18 Dec 2022 13:26:56 -0700 Subject: [PATCH 1093/1229] Hot patch --- functions/menu.sh | 4 +++ functions/misc.sh | 73 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+) diff --git a/functions/menu.sh b/functions/menu.sh index 164bdd7b..67543d08 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -13,6 +13,7 @@ echo "4) Backup Options" echo "5) Update HeavyScript" echo "6) Update Applications" echo "7) Command to Container" +echo "8) Patch 22.12.0" echo echo "0) Exit" read -rt 120 -p "Please select an option by number: " selection || { echo -e "\nFailed to make a selection in time" ; exit; } @@ -79,6 +80,9 @@ case $selection in 7) cmd_to_container ;; + 8) + patch_2212_backups + ;; *) echo "\"$selection\" was not an option, please try agian" && sleep 3 && menu ;; diff --git a/functions/misc.sh b/functions/misc.sh index 66b93410..decf8899 100644 --- a/functions/misc.sh +++ b/functions/misc.sh @@ -98,3 +98,76 @@ echo exit } export -f help + + + +patch_2212_backups(){ +clear -x +#Check TrueNAS version, skip if not 22.12.0 +if ! [ "$(cli -m csv -c 'system version' | awk -F '-' '{print $3}')" == "22.12.0" ]; then + echo "This patch does not apply to your version of TrueNAS" + return +fi + + +#Description +echo "This patch will fix the issue with backups not restoring properly" +echo "Due to Ix-Systems not saving PVC in backups, this patch will fix that" +echo "Otherwise backups will not restore properly" +echo "You only need to run this patch once, it will not run again" +echo + + +#Download patch +echo "Downloading Backup Patch" +if ! wget -q https://github.com/truecharts/truetool/raw/main/hotpatch/2212/HP1.patch; then + echo "Failed to download Backup Patch" + exit +else + echo "Downloaded Backup Patch" +fi + +echo + +# Apply patch +echo "Applying Backup Patch" +if patch -N --reject-file=/dev/null -s -p0 -d /usr/lib/python3/dist-packages/middlewared/ < HP1.patch &>/dev/null; then + echo "Backup Patch applied" + rm -rf HP1.patch +else + echo "Backup Patch already applied" + rm -rf HP1.patch + exit +fi + +echo + +#Restart middlewared +while true +do + echo "We need to restart middlewared to finish the patch" + echo "This will cause a short downtime for your system" + read -rt 120 -p "Would you like to proceed? (y/N): " yesno || { echo -e "\nFailed to make a selection in time" ; exit; } + case $yesno in + [Yy] | [Yy][Ee][Ss]) + echo "Restarting middlewared" + service middlewared restart & + wait $! + break + ;; + [Nn] | [Nn][Oo]) + echo "Exiting" + echo "Please restart middlewared manually" + echo "You can do: service middlewared restart" + exit + ;; + *) + echo "That was not an option, try again" + sleep 3 + continue + ;; + esac +done +} +export -f patchv22120 + From 5083926056f7be3512a80e86f8f142e9ed3e05ef Mon Sep 17 00:00:00 2001 From: heavybullets8 Date: Sun, 18 Dec 2022 13:28:52 -0700 Subject: [PATCH 1094/1229] edit wording --- functions/misc.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/functions/misc.sh b/functions/misc.sh index decf8899..43e2947a 100644 --- a/functions/misc.sh +++ b/functions/misc.sh @@ -153,6 +153,8 @@ do echo "Restarting middlewared" service middlewared restart & wait $! + echo "Restarted middlewared" + echo "You are set, there is no need to run this patch again" break ;; [Nn] | [Nn][Oo]) From 8ef2a91a73c64a8079c7a1297e8830a92dbddf78 Mon Sep 17 00:00:00 2001 From: heavybullets8 Date: Sun, 18 Dec 2022 13:31:25 -0700 Subject: [PATCH 1095/1229] last commit on wording --- functions/misc.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/functions/misc.sh b/functions/misc.sh index 43e2947a..372b42d4 100644 --- a/functions/misc.sh +++ b/functions/misc.sh @@ -146,7 +146,8 @@ echo while true do echo "We need to restart middlewared to finish the patch" - echo "This will cause a short downtime for your system" + echo "This will cause a short downtime for some minor services approximately 10-30 seconds" + echo "Applications should not be affected" read -rt 120 -p "Would you like to proceed? (y/N): " yesno || { echo -e "\nFailed to make a selection in time" ; exit; } case $yesno in [Yy] | [Yy][Ee][Ss]) From e653880e8ea772ee124fc03cd95b4ee87378472d Mon Sep 17 00:00:00 2001 From: heavybullets8 Date: Sun, 18 Dec 2022 15:34:22 -0700 Subject: [PATCH 1096/1229] update backup validation --- functions/backup.sh | 62 ++++++++++++++++++++++++--------------------- 1 file changed, 33 insertions(+), 29 deletions(-) diff --git a/functions/backup.sh b/functions/backup.sh index cd57075e..199b83fe 100644 --- a/functions/backup.sh +++ b/functions/backup.sh @@ -151,50 +151,53 @@ done ## Check to see if empty PVC data is present in any of the applications ## -# Find all pv_info.json files two subfolders deep +# Find all pv_info.json files two subfolders deep with the restore point name pool=$(cli -c 'app kubernetes config' | grep -E "pool\s\|" | awk -F '|' '{print $3}' | tr -d " \t\n\r") files=$(find "$(find /mnt/"$pool"/ix-applications/backups -maxdepth 0 )" -name pv_info.json | grep "$restore_point"); # Iterate over the list of files for file in $files; do - # Check if the file only contains {} subfolders two deep - contents=$(cat $file) + # Check if the file only contains {} subfolders + contents=$(cat "$file") if [[ "$contents" == '{}' ]]; then # Print the file if it meets the criterion file=$(echo "$file" | awk -F '/' '{print $7}') - borked_array+="$file\n" - borked=True + borked_array+=("${file}") fi done -# If there is empty PVC data, exit + +# Grab applications that are supposed to have PVC data +mapfile -t apps_with_pvc < <(k3s kubectl get pvc -A | sort -u | awk '{print $1 "\t" $2 "\t" $4}' | sed "s/^0/ /" | awk '{print $1}' | cut -c 4-) + + +# Iterate over the list of applications with empty PVC data +# Unset the application if it is not supposed to have PVC data +index=0 +for app in "${borked_array[@]}"; do + if ! printf '%s\0' "${apps_with_pvc[@]}" | grep -iFxqz "${app}" ; then + unset "borked_array[$index]" + else + borked=True + fi + index+=1 +done + + + +# If there is still empty PVC data, exit if [[ $borked == True ]]; then echo "Warning!:" echo "The following applications have empty PVC data:" - for file in $borked_array; do - echo -e "$file" + for app in "${borked_array[@]}"; do + echo -e "$app" done - echo "You need to ensure these applications are not supposed to have PVC data before proceeding" - while true - do - read -rt 120 -p "Would you like to proceed? (y/N): " yesno || { echo -e "\nFailed to make a selection in time" ; exit; } - case $yesno in - [Yy] | [Yy][Ee][Ss]) - echo "Proceeding.." - sleep 3 - break - ;; - [Nn] | [Nn][Oo]) - echo "Exiting" - exit - ;; - *) - echo "That was not an option, try again" - sleep 3 - continue - ;; - esac - done + echo "We have no choice but to exit" + echo "If you were to restore, you would lose all of your application data" + echo "If you are on Bluefin version: 22.12.0, and have not yet ran the patch, you will need to run it" + echo "Afterwards you will be able to create backups and restore them" + echo "This is a known ix-systems bug, and has nothing to do with HeavyScript" + exit fi @@ -220,6 +223,7 @@ do clear -x echo "The restore point you have chosen is from an older version of Truenas Scale" echo "This is not recommended, as it may cause issues with the system" + echo "Either that, or your systems date is incorrect.." echo echo "Current SCALE Information:" echo "Version: $current_version" From c65d93bdba7e3455846e6bcb378ac1bd110983e8 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 18 Dec 2022 23:05:44 +0000 Subject: [PATCH 1097/1229] Fix python style incremental --- functions/backup.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/backup.sh b/functions/backup.sh index 199b83fe..1b05177e 100644 --- a/functions/backup.sh +++ b/functions/backup.sh @@ -180,7 +180,7 @@ for app in "${borked_array[@]}"; do else borked=True fi - index+=1 + ((index++)) done @@ -305,4 +305,4 @@ do done } -export -f restore \ No newline at end of file +export -f restore From acde3b753452e25d2e2eb8289c29ae6242b8bff2 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Sun, 18 Dec 2022 18:09:16 +0000 Subject: [PATCH 1098/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.63.1 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 462fd598..962da23e 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@f25e0646e498d67dab9f3ca2a2a4455b91a7c2be # v34.63.0 + uses: renovatebot/github-action@1d7bf6c77525c98076b1048507192146a793fa8c # v34.63.1 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From d50290ba21eff21f9a37632e9fa03cba995a521c Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Mon, 19 Dec 2022 06:34:53 -0700 Subject: [PATCH 1099/1229] remove non-existant func export --- functions/misc.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/functions/misc.sh b/functions/misc.sh index 372b42d4..25501cf7 100644 --- a/functions/misc.sh +++ b/functions/misc.sh @@ -172,5 +172,4 @@ do esac done } -export -f patchv22120 From f4b7f0cca3706b6dd16faa2472b9ea99d348d819 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Mon, 19 Dec 2022 18:08:31 +0000 Subject: [PATCH 1100/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.63.2 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 962da23e..c95b3db4 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@1d7bf6c77525c98076b1048507192146a793fa8c # v34.63.1 + uses: renovatebot/github-action@39e2c46b45e5f435a422aa850d5288a35a2341d4 # v34.63.2 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From b13eaf0ff6de5a0ec723effeb024c7970f16f407 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 20 Dec 2022 07:08:42 -0700 Subject: [PATCH 1101/1229] shellcheck --- .github/workflows/shellcheck.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .github/workflows/shellcheck.yml diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml new file mode 100644 index 00000000..29c41a73 --- /dev/null +++ b/.github/workflows/shellcheck.yml @@ -0,0 +1,21 @@ +on: + push: + pull_request: + workflow_dispatch: + +name: ShellCheck + +jobs: + ShellCheck: + name: ShellCheck + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Run ShellCheck + uses: ludeeus/action-shellcheck@master + env: + SHELLCHECK_OPTS: -e SC2154 + with: + check_together: 'yes' + format: gcc + From d86250e14dfc612198e58e3e45738d65de67cb65 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 20 Dec 2022 11:27:51 -0700 Subject: [PATCH 1102/1229] remove invalid errors --- functions/backup.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/functions/backup.sh b/functions/backup.sh index 1b05177e..3a2e9b71 100644 --- a/functions/backup.sh +++ b/functions/backup.sh @@ -32,7 +32,9 @@ export -f backup deleteBackup(){ clear -x && echo "pulling all restore points.." +# shellcheck disable=SC2178 list_backups=$(cli -c 'app kubernetes list_backups' | sort -t '_' -Vr -k2,7 | tr -d " \t\r" | awk -F '|' '{print $2}' | nl -s ") " | column -t) +# shellcheck disable=SC2128 if [[ -z "$list_backups" ]]; then echo "No restore points available" exit From ed67c026b5b88b99fdec413057ac45f244b08d87 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 20 Dec 2022 11:31:26 -0700 Subject: [PATCH 1103/1229] remove shellcheck error --- functions/cmd_to_container.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index 84187526..e6f36f48 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -95,6 +95,8 @@ do clear -x title read -rt 500 -p "What command do you want to run?: " command || { echo -e "\nFailed to make a selection in time" ; exit; } + # shellcheck disable=SC2086 + # Quoting $command as suggested, causes the k3s command to fail k3s crictl exec -it "$container_id" $command break ;; From f3b630453248c71dea181ce0b0ff9e4e17a3c935 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Tue, 20 Dec 2022 18:07:52 +0000 Subject: [PATCH 1104/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.66.1 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index c95b3db4..fbd09046 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@39e2c46b45e5f435a422aa850d5288a35a2341d4 # v34.63.2 + uses: renovatebot/github-action@65207aa35d382e44f5152d0482bb5334139ecfc4 # v34.66.1 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From ae134d33a3a0932b0a5c1112481d61c701b61ebc Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Wed, 21 Dec 2022 06:01:40 +0000 Subject: [PATCH 1105/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.67.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index fbd09046..dde767eb 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@65207aa35d382e44f5152d0482bb5334139ecfc4 # v34.66.1 + uses: renovatebot/github-action@76773b762d71a961f0e2752175f392a325452150 # v34.67.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 9fea8f6498859ec26438fcd821cbadea31072399 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Thu, 22 Dec 2022 00:02:46 +0000 Subject: [PATCH 1106/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.70.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index dde767eb..2d664bde 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@76773b762d71a961f0e2752175f392a325452150 # v34.67.0 + uses: renovatebot/github-action@bb0173727dc4ea1ce6231ec15d0cae60447b6bbf # v34.70.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From bd8b4ed4274971b9b97c1920f4b2064b2b490605 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Thu, 22 Dec 2022 18:01:36 +0000 Subject: [PATCH 1107/1229] chore(deps): update github-action actions/setup-python [skip ci] to 5ccb29d --- .github/workflows/shellcheck.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml index 6ffde0ca..43b3800b 100644 --- a/.github/workflows/shellcheck.yml +++ b/.github/workflows/shellcheck.yml @@ -22,5 +22,5 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3 - - uses: actions/setup-python@2c3dd9e7e29afd70cc0950079bde6c979d1f69f9 # v4 + - uses: actions/setup-python@5ccb29d8773c3f3f653e1705f474dfaa8a06a912 # v4 - uses: pre-commit/action@646c83fcd040023954eafda54b4db0192ce70507 # tag=v3.0.0 From 1f17e7d2d08f62d27b41b672c4ca7b329a14e227 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Thu, 22 Dec 2022 18:01:39 +0000 Subject: [PATCH 1108/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.70.1 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 2d664bde..8fb5a785 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@bb0173727dc4ea1ce6231ec15d0cae60447b6bbf # v34.70.0 + uses: renovatebot/github-action@869d8695e0d504a6cf0038cbfc081b889b5904ed # v34.70.1 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 43ddeeaa3e1d217198a630414d9fe63f9f87162e Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Fri, 23 Dec 2022 06:01:33 +0000 Subject: [PATCH 1109/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.70.4 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 8fb5a785..93f7b6be 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@869d8695e0d504a6cf0038cbfc081b889b5904ed # v34.70.1 + uses: renovatebot/github-action@1c2afee3cba0211ce505ba614f920ad41de0efbc # v34.70.4 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 31ea396e7690828dd9e040c3639239e0bc6ca507 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Fri, 23 Dec 2022 18:01:31 +0000 Subject: [PATCH 1110/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.72.1 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 93f7b6be..882d5de1 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@1c2afee3cba0211ce505ba614f920ad41de0efbc # v34.70.4 + uses: renovatebot/github-action@3e5882ba651598f59a3f89c3f626d24c87fae0cf # v34.72.1 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 4b45484ecd986c8040ef36d98c1a69f4a530b926 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Sat, 24 Dec 2022 06:01:23 +0000 Subject: [PATCH 1111/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.72.2 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 882d5de1..b043fe00 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@3e5882ba651598f59a3f89c3f626d24c87fae0cf # v34.72.1 + uses: renovatebot/github-action@2f1c0310d8b8c7cf70e0a365bdf9db1b75eccaff # v34.72.2 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From d431af3256b39b20c810c139fefa312b06b3f1fe Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Sun, 25 Dec 2022 00:02:40 +0000 Subject: [PATCH 1112/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.73.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index b043fe00..d87c9b52 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@2f1c0310d8b8c7cf70e0a365bdf9db1b75eccaff # v34.72.2 + uses: renovatebot/github-action@761ee82b6024c43fc707a50ff7458f0140e671a5 # v34.73.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From c18d3b1c68a7cbe62f054e2bb5f1c960d008868f Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Sun, 25 Dec 2022 12:01:29 +0000 Subject: [PATCH 1113/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.73.1 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index d87c9b52..b3f42a6f 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@761ee82b6024c43fc707a50ff7458f0140e671a5 # v34.73.0 + uses: renovatebot/github-action@80572b616dab906bdedfee8225db1c4ebb054f27 # v34.73.1 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 2012a93e5f66232c49fa921811cebe8baeac13b6 Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Mon, 26 Dec 2022 19:16:10 +0100 Subject: [PATCH 1114/1229] feat: Add 22.12 Hot Patch 2 --- hotpatch/2212/HP2.patch | 13 +++++++++++++ includes/patch.sh | 2 ++ 2 files changed, 15 insertions(+) create mode 100644 hotpatch/2212/HP2.patch diff --git a/hotpatch/2212/HP2.patch b/hotpatch/2212/HP2.patch new file mode 100644 index 00000000..744d26fc --- /dev/null +++ b/hotpatch/2212/HP2.patch @@ -0,0 +1,13 @@ +diff --git plugins/kubernetes_linux/backup.py plugins/kubernetes_linux/backup.py +index d8a48d45f89..365cd1718b4 100644 +--- plugins/kubernetes_linux/backup.py ++++ plugins/kubernetes_linux/backup.py +@@ -61,7 +61,8 @@ def backup_chart_releases(self, job, backup_name): + ['metadata.namespace', '=', chart_release['namespace']] + ] + ) +- for secret in sorted(secrets, key=lambda d: d['metadata']['name']): ++ # We ignore this keeping in line with helm behaviour where the secret malformed is ignored by helm ++ for secret in sorted(secrets, key=lambda d: d['metadata']['name'] and d.get('data')): + with open(os.path.join(secrets_dir, secret['metadata']['name']), 'w') as f: + f.write(self.middleware.call_sync('k8s.secret.export_to_yaml_internal', secret)) diff --git a/includes/patch.sh b/includes/patch.sh index 6ed44fd5..82393dea 100644 --- a/includes/patch.sh +++ b/includes/patch.sh @@ -3,6 +3,8 @@ patchv22120(){ echo "Applying 22.12 HotPatch 1" ( wget -q -P /tmp https://github.com/truecharts/truetool/raw/main/hotpatch/2212/HP1.patch && echo "download completed" || echo "download failed" ) && ( patch -N -s -p0 -d /usr/lib/python3/dist-packages/middlewared/ < /tmp/HP1.patch && service middlewared restart && echo "waiting 20 seconds for middleware restart..." && sleep 20 && echo "patch completed" || echo "patch failed or skipped, not critical" ) && rm -rf /tmp/HP1.patch +echo "Applying 22.12 HotPatch 2" +( wget -q -P /tmp https://github.com/truecharts/truetool/raw/main/hotpatch/2212/HP2.patch && echo "download completed" || echo "download failed" ) && ( patch -N -s -p0 -d /usr/lib/python3/dist-packages/middlewared/ < /tmp/HP2.patch && service middlewared restart && echo "waiting 20 seconds for middleware restart..." && sleep 20 && echo "patch completed" || echo "patch failed or skipped, not critical" ) && rm -rf /tmp/HP2.patch } export -f patchv22120 From 95d604c22780a6e0997ecffeeccf68fcc96cc693 Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Mon, 26 Dec 2022 19:20:47 +0100 Subject: [PATCH 1115/1229] fix: always run hotpatcher --- truetool.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/truetool.sh b/truetool.sh index 3f505939..6e03990f 100755 --- a/truetool.sh +++ b/truetool.sh @@ -131,14 +131,14 @@ title [[ "$enableUpdate" == "true" ]] && updater "$@" +## Always check if a hotpatch needs to be applied +hotpatch + # Show menu if menu flag is set if [[ "$no_args" == "true" ]]; then no_args fi -## Always check if a hotpatch needs to be applied -hotpatch - ## Exit if incompatable functions are called [[ "$update_all_apps" == "true" && "$update_apps" == "true" ]] && echo -e "-U and -u cannot BOTH be called" && exit From 4eaf3bd3be8903000a3d07b018785a1854c030f3 Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Mon, 26 Dec 2022 19:37:10 +0100 Subject: [PATCH 1116/1229] Delete HP2.patch --- hotpatch/2212/HP2.patch | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 hotpatch/2212/HP2.patch diff --git a/hotpatch/2212/HP2.patch b/hotpatch/2212/HP2.patch deleted file mode 100644 index 744d26fc..00000000 --- a/hotpatch/2212/HP2.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git plugins/kubernetes_linux/backup.py plugins/kubernetes_linux/backup.py -index d8a48d45f89..365cd1718b4 100644 ---- plugins/kubernetes_linux/backup.py -+++ plugins/kubernetes_linux/backup.py -@@ -61,7 +61,8 @@ def backup_chart_releases(self, job, backup_name): - ['metadata.namespace', '=', chart_release['namespace']] - ] - ) -- for secret in sorted(secrets, key=lambda d: d['metadata']['name']): -+ # We ignore this keeping in line with helm behaviour where the secret malformed is ignored by helm -+ for secret in sorted(secrets, key=lambda d: d['metadata']['name'] and d.get('data')): - with open(os.path.join(secrets_dir, secret['metadata']['name']), 'w') as f: - f.write(self.middleware.call_sync('k8s.secret.export_to_yaml_internal', secret)) From 960ca780b3847869f41e338f939565bb3875fc21 Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Mon, 26 Dec 2022 19:37:36 +0100 Subject: [PATCH 1117/1229] Update patch.sh --- includes/patch.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/patch.sh b/includes/patch.sh index 82393dea..ccc9aa22 100644 --- a/includes/patch.sh +++ b/includes/patch.sh @@ -3,8 +3,8 @@ patchv22120(){ echo "Applying 22.12 HotPatch 1" ( wget -q -P /tmp https://github.com/truecharts/truetool/raw/main/hotpatch/2212/HP1.patch && echo "download completed" || echo "download failed" ) && ( patch -N -s -p0 -d /usr/lib/python3/dist-packages/middlewared/ < /tmp/HP1.patch && service middlewared restart && echo "waiting 20 seconds for middleware restart..." && sleep 20 && echo "patch completed" || echo "patch failed or skipped, not critical" ) && rm -rf /tmp/HP1.patch -echo "Applying 22.12 HotPatch 2" -( wget -q -P /tmp https://github.com/truecharts/truetool/raw/main/hotpatch/2212/HP2.patch && echo "download completed" || echo "download failed" ) && ( patch -N -s -p0 -d /usr/lib/python3/dist-packages/middlewared/ < /tmp/HP2.patch && service middlewared restart && echo "waiting 20 seconds for middleware restart..." && sleep 20 && echo "patch completed" || echo "patch failed or skipped, not critical" ) && rm -rf /tmp/HP2.patch +#echo "Applying 22.12 HotPatch 2" +#( wget -q -P /tmp https://github.com/truecharts/truetool/raw/main/hotpatch/2212/HP2.patch && echo "download completed" || echo "download failed" ) && ( patch -N -s -p0 -d /usr/lib/python3/dist-packages/middlewared/ < /tmp/HP2.patch && service middlewared restart && echo "waiting 20 seconds for middleware restart..." && sleep 20 && echo "patch completed" || echo "patch failed or skipped, not critical" ) && rm -rf /tmp/HP2.patch } export -f patchv22120 From 0065ad60d2c43338262f8a7173bca042c078a63c Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Mon, 26 Dec 2022 21:35:14 +0100 Subject: [PATCH 1118/1229] Create HP2.patch --- hotpatch/2212/HP2.patch | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 hotpatch/2212/HP2.patch diff --git a/hotpatch/2212/HP2.patch b/hotpatch/2212/HP2.patch new file mode 100644 index 00000000..ccb75456 --- /dev/null +++ b/hotpatch/2212/HP2.patch @@ -0,0 +1,13 @@ +diff --git plugins/kubernetes_linux/backup.py plugins/kubernetes_linux/backup.py +index 365cd1718b4..1046a64c2a5 100644 +--- plugins/kubernetes_linux/backup.py ++++ plugins/kubernetes_linux/backup.py +@@ -62,7 +62,7 @@ def backup_chart_releases(self, job, backup_name): + ] + ) + # We ignore this keeping in line with helm behaviour where the secret malformed is ignored by helm +- for secret in sorted(secrets, key=lambda d: d['metadata']['name'] and d.get('data')): ++ for secret in sorted(filter(lambda d: d.get('data'), secrets), key=lambda d: d['metadata']['name']): + with open(os.path.join(secrets_dir, secret['metadata']['name']), 'w') as f: + f.write(self.middleware.call_sync('k8s.secret.export_to_yaml_internal', secret)) + From a02246761c60b0de01eeb64dd0d38c24e9ed700b Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Mon, 26 Dec 2022 21:35:38 +0100 Subject: [PATCH 1119/1229] Update patch.sh --- includes/patch.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/patch.sh b/includes/patch.sh index ccc9aa22..82393dea 100644 --- a/includes/patch.sh +++ b/includes/patch.sh @@ -3,8 +3,8 @@ patchv22120(){ echo "Applying 22.12 HotPatch 1" ( wget -q -P /tmp https://github.com/truecharts/truetool/raw/main/hotpatch/2212/HP1.patch && echo "download completed" || echo "download failed" ) && ( patch -N -s -p0 -d /usr/lib/python3/dist-packages/middlewared/ < /tmp/HP1.patch && service middlewared restart && echo "waiting 20 seconds for middleware restart..." && sleep 20 && echo "patch completed" || echo "patch failed or skipped, not critical" ) && rm -rf /tmp/HP1.patch -#echo "Applying 22.12 HotPatch 2" -#( wget -q -P /tmp https://github.com/truecharts/truetool/raw/main/hotpatch/2212/HP2.patch && echo "download completed" || echo "download failed" ) && ( patch -N -s -p0 -d /usr/lib/python3/dist-packages/middlewared/ < /tmp/HP2.patch && service middlewared restart && echo "waiting 20 seconds for middleware restart..." && sleep 20 && echo "patch completed" || echo "patch failed or skipped, not critical" ) && rm -rf /tmp/HP2.patch +echo "Applying 22.12 HotPatch 2" +( wget -q -P /tmp https://github.com/truecharts/truetool/raw/main/hotpatch/2212/HP2.patch && echo "download completed" || echo "download failed" ) && ( patch -N -s -p0 -d /usr/lib/python3/dist-packages/middlewared/ < /tmp/HP2.patch && service middlewared restart && echo "waiting 20 seconds for middleware restart..." && sleep 20 && echo "patch completed" || echo "patch failed or skipped, not critical" ) && rm -rf /tmp/HP2.patch } export -f patchv22120 From ce012b28901504e2cba854761551dbc5c548fd80 Mon Sep 17 00:00:00 2001 From: heavybullets8 Date: Mon, 26 Dec 2022 14:36:35 -0700 Subject: [PATCH 1120/1229] backup patch 2 --- functions/menu.sh | 4 +++ functions/misc.sh | 58 +++++++++++++++++++++++++++++++++++++ patches/backup_patch2.patch | 11 +++++++ 3 files changed, 73 insertions(+) create mode 100644 patches/backup_patch2.patch diff --git a/functions/menu.sh b/functions/menu.sh index 67543d08..82a04e03 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -14,6 +14,7 @@ echo "5) Update HeavyScript" echo "6) Update Applications" echo "7) Command to Container" echo "8) Patch 22.12.0" +echo "9) Patch 22.12.0 (2)" echo echo "0) Exit" read -rt 120 -p "Please select an option by number: " selection || { echo -e "\nFailed to make a selection in time" ; exit; } @@ -83,6 +84,9 @@ case $selection in 8) patch_2212_backups ;; + 9) + patch_2212_backups2 + ;; *) echo "\"$selection\" was not an option, please try agian" && sleep 3 && menu ;; diff --git a/functions/misc.sh b/functions/misc.sh index 25501cf7..efb503d6 100644 --- a/functions/misc.sh +++ b/functions/misc.sh @@ -173,3 +173,61 @@ do done } + +patch_2212_backups2(){ +clear -x +#Check TrueNAS version, skip if not 22.12.0 +if ! [ "$(cli -m csv -c 'system version' | awk -F '-' '{print $3}')" == "22.12.0" ]; then + echo "This patch does not apply to your version of TrueNAS" + return +fi + + +#Description +echo "This patch will fix the issue certain applicattions breaking backups" +echo "You only need to run this patch once, it will not run again" +echo + + +# Apply patch +echo "Applying Backup Patch" +if patch -N --reject-file=/dev/null -s -p0 -d /usr/lib/python3/dist-packages/middlewared/plugins/kubernetes_linux/backup.py < patches/backup_patch2.patch &>/dev/null; then + echo "Backup Patch applied" +else + echo "Backup Patch already applied" + exit +fi + +echo + +#Restart middlewared +while true +do + echo "We need to restart middlewared to finish the patch" + echo "This will cause a short downtime for some minor services approximately 10-30 seconds" + echo "Applications should not be affected" + read -rt 120 -p "Would you like to proceed? (y/N): " yesno || { echo -e "\nFailed to make a selection in time" ; exit; } + case $yesno in + [Yy] | [Yy][Ee][Ss]) + echo "Restarting middlewared" + service middlewared restart & + wait $! + echo "Restarted middlewared" + echo "You are set, there is no need to run this patch again" + break + ;; + [Nn] | [Nn][Oo]) + echo "Exiting" + echo "Please restart middlewared manually" + echo "You can do: service middlewared restart" + exit + ;; + *) + echo "That was not an option, try again" + sleep 3 + continue + ;; + esac +done +} + diff --git a/patches/backup_patch2.patch b/patches/backup_patch2.patch new file mode 100644 index 00000000..3ce5de06 --- /dev/null +++ b/patches/backup_patch2.patch @@ -0,0 +1,11 @@ +--- /usr/lib/python3/dist-packages/middlewared/plugins/kubernetes_linux/backup.py 2022-12-13 05:32:23.000000000 -0700 ++++ backups.patch 2022-12-26 14:14:25.075037767 -0700 +@@ -61,7 +61,8 @@ + ['metadata.namespace', '=', chart_release['namespace']] + ] + ) +- for secret in sorted(secrets, key=lambda d: d['metadata']['name']): ++ # We ignore this keeping in line with helm behaviour where the secret malformed is ignored by helm ++ for secret in sorted(filter(lambda d: d.get('data'), secrets), key=lambda d: d['metadata']['name']): + with open(os.path.join(secrets_dir, secret['metadata']['name']), 'w') as f: + f.write(self.middleware.call_sync('k8s.secret.export_to_yaml_internal', secret)) \ No newline at end of file From 0d76ba4901bb8bd717920f39405a6f0f4282f6e7 Mon Sep 17 00:00:00 2001 From: heavybullets8 Date: Mon, 26 Dec 2022 14:45:05 -0700 Subject: [PATCH 1121/1229] try this --- heavy_script.sh | 2 +- patches/{backup_patch2.patch => backups.patch} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename patches/{backup_patch2.patch => backups.patch} (100%) diff --git a/heavy_script.sh b/heavy_script.sh index 0d39316f..91c0bc36 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -158,4 +158,4 @@ elif [[ "$sync" == "true" && -z "$number_of_backups" ]]; then # If only sync is fi [[ "$update_all_apps" == "true" || "$update_apps" == "true" ]] && commander [[ "$prune" == "true" ]] && prune -exit 0 \ No newline at end of file +exit 0 diff --git a/patches/backup_patch2.patch b/patches/backups.patch similarity index 100% rename from patches/backup_patch2.patch rename to patches/backups.patch From 05aee2b22c35e0d2715fb31972a6723cd690fb0b Mon Sep 17 00:00:00 2001 From: heavybullets8 Date: Mon, 26 Dec 2022 14:45:52 -0700 Subject: [PATCH 1122/1229] rename command --- functions/misc.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/misc.sh b/functions/misc.sh index efb503d6..7025d0b9 100644 --- a/functions/misc.sh +++ b/functions/misc.sh @@ -191,7 +191,7 @@ echo # Apply patch echo "Applying Backup Patch" -if patch -N --reject-file=/dev/null -s -p0 -d /usr/lib/python3/dist-packages/middlewared/plugins/kubernetes_linux/backup.py < patches/backup_patch2.patch &>/dev/null; then +if patch -N --reject-file=/dev/null -s -p0 -d /usr/lib/python3/dist-packages/middlewared/plugins/kubernetes_linux/backup.py < patches/backups.patch &>/dev/null; then echo "Backup Patch applied" else echo "Backup Patch already applied" From a8fbcfcef71515ac5ad73b495992606462ba9815 Mon Sep 17 00:00:00 2001 From: heavybullets8 Date: Mon, 26 Dec 2022 14:47:33 -0700 Subject: [PATCH 1123/1229] remove directory argument --- functions/misc.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/misc.sh b/functions/misc.sh index 7025d0b9..408fcd58 100644 --- a/functions/misc.sh +++ b/functions/misc.sh @@ -191,7 +191,7 @@ echo # Apply patch echo "Applying Backup Patch" -if patch -N --reject-file=/dev/null -s -p0 -d /usr/lib/python3/dist-packages/middlewared/plugins/kubernetes_linux/backup.py < patches/backups.patch &>/dev/null; then +if patch -N --reject-file=/dev/null -s -p0 /usr/lib/python3/dist-packages/middlewared/plugins/kubernetes_linux/backup.py < patches/backups.patch &>/dev/null; then echo "Backup Patch applied" else echo "Backup Patch already applied" From 6030d8d20133ccb327631287d120d3c6cd62d502 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Mon, 26 Dec 2022 18:01:37 +0000 Subject: [PATCH 1124/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.73.3 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index b3f42a6f..0816077f 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@80572b616dab906bdedfee8225db1c4ebb054f27 # v34.73.1 + uses: renovatebot/github-action@d4496c2d9b06c4e43b227fc3f331a434e99eaef5 # v34.73.3 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From c48acc8d1600d7d12794105f1fc2cffe458c6279 Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Tue, 27 Dec 2022 11:37:54 +0100 Subject: [PATCH 1125/1229] fix the second hotpatch --- hotpatch/2212/HP2.patch | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/hotpatch/2212/HP2.patch b/hotpatch/2212/HP2.patch index ccb75456..30357c93 100644 --- a/hotpatch/2212/HP2.patch +++ b/hotpatch/2212/HP2.patch @@ -1,13 +1,14 @@ diff --git plugins/kubernetes_linux/backup.py plugins/kubernetes_linux/backup.py index 365cd1718b4..1046a64c2a5 100644 +index d8a48d45f89..365cd1718b4 100644 --- plugins/kubernetes_linux/backup.py +++ plugins/kubernetes_linux/backup.py -@@ -62,7 +62,7 @@ def backup_chart_releases(self, job, backup_name): +@@ -61,7 +61,8 @@ def backup_chart_releases(self, job, backup_name): + ['metadata.namespace', '=', chart_release['namespace']] ] ) - # We ignore this keeping in line with helm behaviour where the secret malformed is ignored by helm -- for secret in sorted(secrets, key=lambda d: d['metadata']['name'] and d.get('data')): +- for secret in sorted(secrets, key=lambda d: d['metadata']['name']): ++ # We ignore this keeping in line with helm behaviour where the secret malformed is ignored by helm + for secret in sorted(filter(lambda d: d.get('data'), secrets), key=lambda d: d['metadata']['name']): with open(os.path.join(secrets_dir, secret['metadata']['name']), 'w') as f: f.write(self.middleware.call_sync('k8s.secret.export_to_yaml_internal', secret)) - From 334d8590ef4ffe5c5177295f1161fda6f84f3471 Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Tue, 27 Dec 2022 11:43:04 +0100 Subject: [PATCH 1126/1229] Apply suggestions from code review --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 38d3afc5..7fe5ae88 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ A easy tool for frequently used TrueNAS SCALE CLI utilities. -Please before using this tool, [read this note](https://truecharts.org/docs/manual/guides/Important-MUST-READ) +Please before using this tool, [read this note](https://truecharts.org/manual/guides/Important-MUST-READ) ## Table of contents: * [Synopsis](#synopsis) From b5069589865ba908ee23f425d02273f90b91a4f0 Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Tue, 27 Dec 2022 11:51:56 +0100 Subject: [PATCH 1127/1229] remove current content --- .github/renovate-config.js | 25 ----- .github/renovate.json5 | 23 ---- .github/workflows/renovate.yml | 18 ---- .github/workflows/shellcheck.yml | 26 ----- .pre-commit-config.yaml | 21 ---- LICENSE | 29 ----- README.md | 131 ---------------------- hotpatch/2212/HP1.patch | 125 --------------------- hotpatch/2212/HP2.patch | 14 --- includes/backup.sh | 96 ----------------- includes/chores.sh | 42 -------- includes/colors.sh | 113 ------------------- includes/dns.sh | 27 ----- includes/help.sh | 35 ------ includes/mount.sh | 57 ---------- includes/no_args.sh | 72 ------------- includes/patch.sh | 18 ---- includes/title.sh | 22 ---- includes/update.sh | 123 --------------------- includes/update_self.sh | 31 ------ truetool.sh | 179 ------------------------------- 21 files changed, 1227 deletions(-) delete mode 100644 .github/renovate-config.js delete mode 100644 .github/renovate.json5 delete mode 100644 .github/workflows/renovate.yml delete mode 100644 .github/workflows/shellcheck.yml delete mode 100644 .pre-commit-config.yaml delete mode 100644 LICENSE delete mode 100644 README.md delete mode 100644 hotpatch/2212/HP1.patch delete mode 100644 hotpatch/2212/HP2.patch delete mode 100755 includes/backup.sh delete mode 100755 includes/chores.sh delete mode 100755 includes/colors.sh delete mode 100755 includes/dns.sh delete mode 100755 includes/help.sh delete mode 100755 includes/mount.sh delete mode 100755 includes/no_args.sh delete mode 100644 includes/patch.sh delete mode 100755 includes/title.sh delete mode 100755 includes/update.sh delete mode 100755 includes/update_self.sh delete mode 100755 truetool.sh diff --git a/.github/renovate-config.js b/.github/renovate-config.js deleted file mode 100644 index da91bb42..00000000 --- a/.github/renovate-config.js +++ /dev/null @@ -1,25 +0,0 @@ -module.exports = { - dryRun: false, - username: 'truecharts-admin', - gitAuthor: 'truecharts-admin ', - onboarding: false, - platform: 'github', - repositories: [ - 'truecharts/truetool', - ], - packageRules: [ - { - description: 'lockFileMaintenance', - matchUpdateTypes: [ - 'pin', - 'digest', - 'patch', - 'minor', - 'major', - 'lockFileMaintenance', - ], - dependencyDashboardApproval: false, - stabilityDays: 0, - }, - ], -}; diff --git a/.github/renovate.json5 b/.github/renovate.json5 deleted file mode 100644 index de107f43..00000000 --- a/.github/renovate.json5 +++ /dev/null @@ -1,23 +0,0 @@ -{ - "semanticCommits": "enabled", - "extends": ["helpers:pinGitHubActionDigests"], - "dependencyDashboard": true, - "dependencyDashboardTitle": "Renovate Dashboard 🤖", - "suppressNotifications": ["prIgnoreNotification"], - "commitMessageTopic": "{{depName}}", - "commitMessageExtra": "to {{newVersion}}", - "commitMessageSuffix": "", - "rebaseWhen": "conflicted", - "prConcurrentLimit": 100, - "pinDigests": true, - "automerge": true, - "gitAuthor": "TrueCharts-Admin ", - "packageRules": [ - // Setup datasources for github actions - { - "matchManagers": ["github-actions"], - "commitMessageTopic": "github-action {{depName}} [skip ci]", - "automerge": true, - } - ] -} diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml deleted file mode 100644 index 0816077f..00000000 --- a/.github/workflows/renovate.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: Renovate -on: - workflow_dispatch: - schedule: - - cron: "0 */6 * * *" -jobs: - renovate: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3.2.0 - with: - token: ${{ secrets.BOT_TOKEN }} - - name: Self-hosted Renovate - uses: renovatebot/github-action@d4496c2d9b06c4e43b227fc3f331a434e99eaef5 # v34.73.3 - with: - configurationFile: .github/renovate-config.js - token: ${{ secrets.BOT_TOKEN }} diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml deleted file mode 100644 index 43b3800b..00000000 --- a/.github/workflows/shellcheck.yml +++ /dev/null @@ -1,26 +0,0 @@ -on: - push: - pull_request: - workflow_dispatch: - -name: 'Lint and Test' - -jobs: - shellcheck: - name: Shellcheck - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3 - - name: Run ShellCheck - uses: ludeeus/action-shellcheck@master - with: - check_together: 'yes' - env: - SHELLCHECK_OPTS: -e SC2154 - - pre-commit: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3 - - uses: actions/setup-python@5ccb29d8773c3f3f653e1705f474dfaa8a06a912 # v4 - - uses: pre-commit/action@646c83fcd040023954eafda54b4db0192ce70507 # tag=v3.0.0 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml deleted file mode 100644 index cce767d4..00000000 --- a/.pre-commit-config.yaml +++ /dev/null @@ -1,21 +0,0 @@ -# See https://pre-commit.com for more information -repos: -- repo: https://github.com/Lucas-C/pre-commit-hooks - rev: v1.1.10 - hooks: - - id: remove-tabs - -- repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.0.1 - hooks: - - id: trailing-whitespace - - id: end-of-file-fixer - - id: fix-byte-order-marker - - id: mixed-line-ending - - id: check-merge-conflict - - id: check-case-conflict - - id: check-executables-have-shebangs - - id: check-docstring-first - - id: check-symlinks - - id: destroyed-symlinks - - id: fix-byte-order-marker diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 0a7a3987..00000000 --- a/LICENSE +++ /dev/null @@ -1,29 +0,0 @@ -BSD 3-Clause License - -Copyright (c) 2022, TrueCharts -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -3. Neither the name of the copyright holder nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/README.md b/README.md deleted file mode 100644 index 2e072dc1..00000000 --- a/README.md +++ /dev/null @@ -1,131 +0,0 @@ -# truetool - -An easy tool for frequently used TrueNAS SCALE CLI utilities. - -Please before using this tool, [read this note](https://truecharts.org/manual/guides/Important-MUST-READ) - -## Table of contents: - -* [Synopsis](#synopsis) -* [Arguments](#arguments) -* [How to Install](#how-to-install) -* [How to Update](#how-to-update) -* [Creating a Cron Job](#creating-a-cron-job) -* [Additional Information](#additional-information) - -
- -## Synopsis - -TrueTool is a command line tool, designed to enable some features of TrueNAS SCALE that are either not-enabled by default or not-available in the Web-GUI. -It also offers a few handy shortcuts for commonly required chores, like: Enabling Apt or Helm - -## Arguments - -| Flag | Example | Parameter | Description | -| --------------- | ---------------------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| --delete-backup | --delete-backup | None | Opens a menu to delete backups
_Useful if you need to delete old system backups or backups from other scripts_ | -| --restore | --restore | None | Restore TrueTool specific `ix-applications dataset` snapshot | -| --mount | --mount | None | Initiates mounting feature
Choose between unmounting and mounting PVC data | -| --dns | --dns | None | list all of your applications DNS names and their web ports | -| --list-backups | --list-backups | None | Prints a list of backups available | -| --helm-enable | --helm-enable | None | Enables Helm command access on SCALE | -| --kubeapi-enable | --kubeapi-enable | None | Enables external access to Kuberntes API port | -| --apt-enable | --apt-enable | None | Enables Apt command access on SCALE | -| --no-color | --no-color | None | Disables showing colors in terminal output, usefull for SCALE Email output | -| -U | -U | None | Update applications, ignoring major version changes | -| -u | -u | None | Update applications, do NOT update if there was a major version change | -| -b | -b 14 | Integer | Backup `ix-applications` dataset
_Creates backups up to the number you've chosen_ | -| -i | -i nextcloud -i sonarr | String | Applications listed will be ignored during updating
_List one application after another as shown in the example_ | -| -v | -v | None | Verbose Output
| -| -t | -t 150 | Integer | Set a custom timeout to be used with either:
`-m`
_Time the script will wait for application to be "STOPPED"_
or
`-(u\|U)`
_Time the script will wait for application to be either "STOPPED" or "ACTIVE"_ | -| -s | -s | None | Sync Catalogs prior to updating | -| -p | -p | None | Prune old/unused docker images | - - -
-
- -## How to Install - -### Choose a folder - -It's important to save the script in a folder that is persistent across TrueNAS System Updates. -This saves you from reinstalling or experiencing an accidental lack-of-backups after an update. - -##### New dataset - -In this example we created a `scripts` dataset on the TrueNAS SCALE system, feel free to use another folder. - -##### Root folder - -The `/root` folder houses files for the root user. -It's also persistent across updates and hence can be safely used for storing the script. - -### Open a Terminal - -**Change Directory to your scripts folder** - -``` -cd /mnt/pool/scripts -``` - -**Git Clone truetool** - -``` -git clone https://github.com/truecharts/truetool.git -``` - -**Change Directory to truetool folder** - -``` -cd truetool -``` - -From here, you can just run truetool with `bash truetool.sh -ARGUMENTS` - -
- -## How to Update - -TrueTool updates itself automatically. - -
- - -## Creating a Cron Job - -1. TrueNAS SCALE GUI -2. System Settings -3. Advanced -4. Cron Jobs - 1. Click Add - -| Name | Value | Reason | -| ---------------------- | -------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | -| `Description` | TrueTool Update apps | This is up to you, put whatever you think is a good description in here | -| `Command` | `bash /PATH/TO/truetool_DIRECTORY/truetool.sh --no-color -b 14 -sup` | This is the command you will be running on your schedule, example: `bash /mnt/speed/scripts/truetool/truetool.sh -b 14 -sup` | -| `Run As User` | `root` | Running the script as `root` is REQUIRED. You cannot access all of the kubernetes functions without this user. | -| `Schedule` | Up to you, example: `0400` | Again up to you | -| `Hide Standard Output` | `False` or Un-ticked | It's best to keep an eye on updates and enable this to receive email reports | -| `Hide Standard Error` | `False` or Un-ticked | We definitely want to see what errors occurred during updating | -| `Enabled` | `True` or Ticked | This will Enable the script to run on your schedule | - -
-
- -### Additional Information - -#### TrueTool vs HeavyScript - -TrueTool and HeavyScript are based, in essence, based on the original (python based) TrueUpdate and TrueTool. -Then Support-Manager for TrueCharts, HeavyBullets8, ported this to Bash and started adding some additional logic and options for tasks we frequently needed our users to do, such as mounting PVC's. - -After a month or so, the TrueCharts Team officially started refactoring this expanded bash-port. Due to personal reasons, HeavyBullets by then decided to separate from TrueCharts after merging the TrueCharts refactor into his own work. The beauty of OpenSource. - -From this point onwards the HeavyScript and TrueTool diverged a bit. -We internally review changes within our staff team, to verify we somewhat stick to best-practices. This means, in some cases, we decided not to port certain features from HeavyScript and did decide to add features we think are useful and safe. -But this also means we can give guarantees TrueTool works optimally with our Catalog of TrueNAS SCALE Apps, as well as official Apps. - -Users from HeavyScript can safely start using TrueTool, as we've made precautions to ensure the backups take over smoothly. -We, however, do _not_ advise using HeavyScript with TrueCharts Apps. Not because it's a bad App, but because we offer an alternative that is validated by our Staff. diff --git a/hotpatch/2212/HP1.patch b/hotpatch/2212/HP1.patch deleted file mode 100644 index 72e293a9..00000000 --- a/hotpatch/2212/HP1.patch +++ /dev/null @@ -1,125 +0,0 @@ -diff --git plugins/chart_releases_linux/chart_release.py plugins/chart_releases_linux/chart_release.py -index 76e3825bc0f..f65cc0eac24 100644 ---- plugins/chart_releases_linux/chart_release.py -+++ plugins/chart_releases_linux/chart_release.py -@@ -606,7 +606,7 @@ async def do_delete(self, job, release_name, options): - # If we had pre-install jobs, it's possible we have leftover pods which the job did not remove - # based on dev specified settings of cleaning it up - let's remove those - for pod in await self.middleware.call('k8s.pod.query', [['metadata.namespace', '=', namespace]]): -- owner_references = pod['metadata'].get('owner_references') -+ owner_references = pod['metadata'].get('ownerReferences') - if not isinstance(owner_references, list) or all( - owner_reference.get('name') not in pre_install_jobs for owner_reference in owner_references - ): -@@ -658,7 +658,7 @@ async def remove_storage_class_and_dataset(self, release_name, job=None): - pvc_volume_ds = os.path.join(release_ds, 'volumes') - for pv in await self.middleware.call( - 'k8s.pv.query', [ -- ['spec.csi.volume_attributes.openebs\\.io/poolname', '=', pvc_volume_ds] -+ ['spec.csi.volumeAttributes.openebs\\.io/poolname', '=', pvc_volume_ds] - ] - ): - await self.middleware.call('k8s.pv.delete', pv['metadata']['name']) -diff --git plugins/chart_releases_linux/resources.py plugins/chart_releases_linux/resources.py -index c7180147a5f..941de79da45 100644 ---- plugins/chart_releases_linux/resources.py -+++ plugins/chart_releases_linux/resources.py -@@ -158,13 +158,13 @@ async def retrieve_pv_pvc_mapping_internal(self, chart_release): - } - - for pv in chart_release['resources']['persistent_volumes']: -- claim_name = pv['spec'].get('claim_ref', {}).get('name') -+ claim_name = pv['spec'].get('claimRef', {}).get('name') - if claim_name: - csi_spec = pv['spec']['csi'] -- volumes_ds = csi_spec['volume_attributes']['openebs.io/poolname'] -+ volumes_ds = csi_spec['volumeAttributes']['openebs.io/poolname'] - if ( - os.path.join(chart_release['dataset'], 'volumes') != volumes_ds or -- csi_spec['volume_handle'] not in zfs_volumes -+ csi_spec['volumeHandle'] not in zfs_volumes - ): - # We are only going to backup/restore pvc's which were consuming - # their respective storage class and we have related zfs volume present -@@ -174,8 +174,8 @@ async def retrieve_pv_pvc_mapping_internal(self, chart_release): - mapping[claim_name] = { - 'name': pv_name, - 'pv_details': pv, -- 'dataset': os.path.join(volumes_ds, csi_spec['volume_handle']), -- 'zv_details': zfs_volumes[csi_spec['volume_handle']], -+ 'dataset': os.path.join(volumes_ds, csi_spec['volumeHandle']), -+ 'zv_details': zfs_volumes[csi_spec['volumeHandle']], - } - return mapping - -@@ -247,11 +247,11 @@ async def get_workload_storage_details(self): - # because of chart release reclaim policy being retain - for pv in await self.middleware.call( - 'k8s.pv.query', [[ -- 'spec.csi.volume_attributes.openebs\\.io/poolname', '^', -+ 'spec.csi.volumeAttributes.openebs\\.io/poolname', '^', - f'{os.path.join(k8s_config["dataset"], "releases")}/' - ]] - ): -- dataset = pv['spec']['csi']['volume_attributes']['openebs.io/poolname'] -+ dataset = pv['spec']['csi']['volumeAttributes']['openebs.io/poolname'] - rl = dataset.split('/', 4) - if len(rl) > 4: - mapping['persistent_volumes'][rl[3]].append(pv) -diff --git plugins/chart_releases_linux/scale_workload.py plugins/chart_releases_linux/scale_workload.py -index 117dab3a79c..e9525150278 100644 ---- plugins/chart_releases_linux/scale_workload.py -+++ plugins/chart_releases_linux/scale_workload.py -@@ -246,10 +246,10 @@ async def get_workload_to_pod_mapping(self, namespace): - for r in await self.middleware.call( - f'k8s.{key}.query', [ - ['metadata.namespace', '=', namespace], -- ['metadata', 'rin', 'owner_references'], -+ ['metadata', 'rin', 'ownerReferences'], - ], {'select': ['metadata']} - ): -- for owner_reference in filter(lambda o: o.get('uid'), r['metadata']['owner_references'] or []): -+ for owner_reference in filter(lambda o: o.get('uid'), r['metadata']['ownerReferences'] or []): - mapping[key][owner_reference['uid']][r['metadata']['uid']] = r - - pod_mapping = defaultdict(list) -diff --git plugins/kubernetes_linux/restore.py plugins/kubernetes_linux/restore.py -index 4897e3f8b7a..ec13a332b6e 100644 ---- plugins/kubernetes_linux/restore.py -+++ plugins/kubernetes_linux/restore.py -@@ -218,7 +218,11 @@ def restore_backup(self, job, backup_name, options): - failed_pv_restores.append(f'Unable to create ZFS Volume for {pvc!r} PVC: {e}') - continue - -+ # We need to safely access claim_ref vollume attribute keys as with k8s client api re-write -+ # camel casing which was done by kubernetes asyncio package is not happening anymore - pv_spec = pv['pv_details']['spec'] -+ claim_ref = pv_spec.get('claim_ref') or pv_spec['claimRef'] -+ pv_volume_attrs = pv_spec['csi'].get('volume_attributes') or pv_spec['csi']['volumeAttributes'] - try: - self.middleware.call_sync('k8s.pv.create', { - 'metadata': { -@@ -229,18 +233,18 @@ def restore_backup(self, job, backup_name, options): - 'storage': pv_spec['capacity']['storage'], - }, - 'claimRef': { -- 'name': pv_spec['claim_ref']['name'], -- 'namespace': pv_spec['claim_ref']['namespace'], -+ 'name': claim_ref['name'], -+ 'namespace': claim_ref['namespace'], - }, - 'csi': { - 'volumeAttributes': { - 'openebs.io/poolname': RE_POOL.sub( -- f'{k8s_pool}\\1', pv_spec['csi']['volume_attributes']['openebs.io/poolname'] -+ f'{k8s_pool}\\1', pv_volume_attrs['openebs.io/poolname'] - ) - }, -- 'volumeHandle': pv_spec['csi']['volume_handle'], -+ 'volumeHandle': pv_spec['csi'].get('volume_handle') or pv_spec['csi']['volumeHandle'], - }, -- 'storageClassName': pv_spec['storage_class_name'], -+ 'storageClassName': pv_spec.get('storage_class_name') or pv_spec['storageClassName'], - }, - }) - except Exception as e: diff --git a/hotpatch/2212/HP2.patch b/hotpatch/2212/HP2.patch deleted file mode 100644 index 30357c93..00000000 --- a/hotpatch/2212/HP2.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff --git plugins/kubernetes_linux/backup.py plugins/kubernetes_linux/backup.py -index 365cd1718b4..1046a64c2a5 100644 -index d8a48d45f89..365cd1718b4 100644 ---- plugins/kubernetes_linux/backup.py -+++ plugins/kubernetes_linux/backup.py -@@ -61,7 +61,8 @@ def backup_chart_releases(self, job, backup_name): - ['metadata.namespace', '=', chart_release['namespace']] - ] - ) -- for secret in sorted(secrets, key=lambda d: d['metadata']['name']): -+ # We ignore this keeping in line with helm behaviour where the secret malformed is ignored by helm -+ for secret in sorted(filter(lambda d: d.get('data'), secrets), key=lambda d: d['metadata']['name']): - with open(os.path.join(secrets_dir, secret['metadata']['name']), 'w') as f: - f.write(self.middleware.call_sync('k8s.secret.export_to_yaml_internal', secret)) diff --git a/includes/backup.sh b/includes/backup.sh deleted file mode 100755 index e09449f9..00000000 --- a/includes/backup.sh +++ /dev/null @@ -1,96 +0,0 @@ -#!/bin/bash - -## Simple shortcut to just list the backups without promts and such -listBackups(){ -echo -e "${BWhite}Backup Listing Tool${Color_Off}" -clear -x && echo "pulling all restore points.." -list_backups=$(cli -c 'app kubernetes list_backups' | grep -v system-update | sort -t '_' -Vr -k2,7 | tr -d " \t\r" | awk -F '|' '{print $2}' | nl | column -t) -[[ -z "$list_backups" ]] && echo -e "${IRed}No restore points available${Color_Off}" && exit || echo "Detected Backups:" && echo "$list_backups" -} -export -f listBackups - -## Lists backups, except system-created backups, and promts which one to delete -deleteBackup(){ -echo -e "${BWhite}Backup Deletion Tool${Color_Off}" -clear -x && echo "pulling all restore points.." -list_delete_backups=$(cli -c 'app kubernetes list_backups' | grep -v system-update | sort -t '_' -Vr -k2,7 | tr -d " \t\r" | awk -F '|' '{print $2}' | nl | column -t) -clear -x -# shellcheck disable=SC2015 -[[ -z "$list_delete_backups" ]] && echo -e "${IRed}No restore points available${Color_Off}" && exit || { title; echo -e "Choose a restore point to delete\nThese may be out of order if they are not TrueTool backups" ; } -# shellcheck disable=SC2015 -echo "$list_delete_backups" && read -rt 600 -p "Please type a number: " selection && restore_point=$(echo "$list_delete_backups" | grep ^"$selection " | awk '{print $2}') -[[ -z "$selection" ]] && echo "${IRed}Your selection cannot be empty${Color_Off}" && exit #Check for valid selection. If none, kill script -[[ -z "$restore_point" ]] && echo "Invalid Selection: $selection, was not an option" && exit #Check for valid selection. If none, kill script -echo -e "\nWARNING:\nYou CANNOT go back after deleting your restore point" || { echo "${IRed}FAILED${Color_Off}"; exit; } -# shellcheck disable=SC2015 -echo -e "\n\nYou have chosen:\n$restore_point\n\nWould you like to continue?" && echo -e "1 Yes\n2 No" && read -rt 120 -p "Please type a number: " yesno || { echo "${IRed}FAILED${Color_Off}"; exit; } -if [[ $yesno == "1" ]]; then - echo -e "\nDeleting $restore_point" && cli -c 'app kubernetes delete_backup backup_name=''"'"$restore_point"'"' &>/dev/null && echo -e "${IGreen}Sucessfully deleted${Color_Off}" || echo -e "${IRed}Deletion FAILED${Color_Off}" -elif [[ $yesno == "2" ]]; then - echo "You've chosen NO, killing script." -else - echo -e "${IRed}Invalid Selection${Color_Off}" -fi -} -export -f deleteBackup - -## Creates backups and deletes backups if a "backups to keep"-count is exceeded. -# backups-to-keep takes only heavyscript and truetool created backups into account, as other backups aren't guaranteed to be sorted correctly -backup(){ -echo -e "${BWhite}Backup Tool${Color_Off}" -echo -e "\nNumber of backups was set to $number_of_backups" -date=$(date '+%Y_%m_%d_%H_%M_%S') -[[ "$verbose" == "true" ]] && cli -c 'app kubernetes backup_chart_releases backup_name=''"'TrueTool_"$date"'"' -[[ -z "$verbose" ]] && echo -e "\nNew Backup Name:" && cli -c 'app kubernetes backup_chart_releases backup_name=''"'TrueTool_"$date"'"' | tail -n 1 -mapfile -t list_create_backups < <(cli -c 'app kubernetes list_backups' | grep 'HeavyScript\|TrueTool_' | sort -t '_' -Vr -k2,7 | awk -F '|' '{print $2}'| tr -d " \t\r") -# shellcheck disable=SC2309 -if [[ ${#list_create_backups[@]} -gt "number_of_backups" ]]; then - echo -e "\nDeleting the oldest backup(s) for exceeding limit:" - overflow=$(( ${#list_create_backups[@]} - "$number_of_backups" )) - mapfile -t list_overflow < <(cli -c 'app kubernetes list_backups' | grep "TrueTool_" | sort -t '_' -V -k2,7 | awk -F '|' '{print $2}'| tr -d " \t\r" | head -n "$overflow") - for i in "${list_overflow[@]}" - do - cli -c 'app kubernetes delete_backup backup_name=''"'"$i"'"' &> /dev/null || echo "${IRed}FAILED${Color_Off} to delete $i" - echo "$i" - done -fi -} -export -f backup - -## Lists available backup and prompts the users to select a backup to restore -restore(){ -echo -e "${BWhite}Backup Restoration Tool${Color_Off}" -clear -x && echo "pulling restore points.." -list_restore_backups=$(cli -c 'app kubernetes list_backups' | grep "TrueTool_" | sort -t '_' -Vr -k2,7 | tr -d " \t\r" | awk -F '|' '{print $2}' | nl | column -t) -clear -x -# shellcheck disable=SC2015 -[[ -z "$list_restore_backups" ]] && echo "No TrueTool restore points available" && exit || { title; echo "Choose a restore point" ; } -echo "$list_restore_backups" && read -rt 600 -p "Please type a number: " selection && restore_point=$(echo "$list_restore_backups" | grep ^"$selection " | awk '{print $2}') -[[ -z "$selection" ]] && echo "Your selection cannot be empty" && exit #Check for valid selection. If none, kill script -[[ -z "$restore_point" ]] && echo "Invalid Selection: $selection, was not an option" && exit #Check for valid selection. If none, kill script -echo -e "\nWARNING:\nThis is NOT guranteed to work\nThis is ONLY supposed to be used as a LAST RESORT\nConsider rolling back your applications instead if possible" || { echo "${IRed}FAILED${Color_Off}"; exit; } -# shellcheck disable=SC2015 -echo -e "\n\nYou have chosen:\n$restore_point\n\nWould you like to continue?" && echo -e "1 Yes\n2 No" && read -rt 120 -p "Please type a number: " yesno || { echo "${IRed}FAILED${Color_Off}"; exit; } -if [[ $yesno == "1" ]]; then - echo -e "\nStarting Restore, this will take a ${BWhite}LONG${Color_Off} time." - pool=$(cli -c 'app kubernetes config' | grep -E "pool\s\|" | awk -F '|' '{print $3}' | tr -d " \t\n\r") - echo "Correcting PVC mountpoints..." - for pvc in $(zfs list -t filesystem -r "$pool"/ix-applications -o name -H | grep "/ix-applications/" | grep "volumes/pvc") - do - zfs set mountpoint=legacy "${pvc}" || echo "Fixing PVC mountpoints Failed for ${pvc}... Continuing..." - done - # Ensure readonly is turned off - if ! zfs set readonly=off "$pool"/ix-applications;then - echo -e "Error: Failed to set ZFS ReadOnly to \"off\"" - echo -e "After the restore, attempt to run the following command manually:" - echo "zfs set readonly=off $pool/ix-applications" - fi - echo "Triggering restore process..." - cli -c 'app kubernetes restore_backup backup_name=''"'"$restore_point"'"' || echo "Restore ${IRed}FAILED${Color_Off}" -elif [[ $yesno == "2" ]]; then - echo "You've chosen NO, killing script. Good luck." -else - echo -e "${IRed}Invalid Selection${Color_Off}" -fi -} -export -f restore diff --git a/includes/chores.sh b/includes/chores.sh deleted file mode 100755 index 9f3cbc6a..00000000 --- a/includes/chores.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash - -helmEnable(){ -echo -e "${BWhite}Enabling Helm${Color_Off}" -export KUBECONFIG=/etc/rancher/k3s/k3s.yaml && echo -e "${IGreen}Helm Enabled${Color_Off}"|| echo -e "${IRed}Helm Enable FAILED${Color_Off}" -} -export -f helmEnable - -aptEnable(){ -echo -e "${BWhite}Enabling Apt-Commands${Color_Off}" -chmod +x /usr/bin/apt* && echo -e "${IGreen}APT enabled${Color_Off}"|| echo -e "${IRed}APT Enable FAILED${Color_Off}" -} -export -f aptEnable - -kubeapiEnable(){ -local -r comment='iX Custom Rule to drop connection requests to k8s cluster from external sources' -echo -e "${BWhite}Enabling Kubernetes API${Color_Off}" -if iptables -t filter -L INPUT 2> /dev/null | grep -q "${comment}" ; then - iptables -D INPUT -p tcp -m tcp --dport 6443 -m comment --comment "${comment}" -j DROP && echo -e "${IGreen}Kubernetes API enabled${Color_Off}"|| echo -e "${IRed}Kubernetes API Enable FAILED${Color_Off}" -else - echo -e "${IGreen}Kubernetes API already enabled${Color_Off}" -fi -} -export -f kubeapiEnable - -# Prune unused docker images to prevent dataset/snapshot bloat related slowdowns on SCALE -prune(){ -echo -e "${BWhite}Docker Prune${Color_Off}" -echo "Pruning Docker Images..." -docker image prune -af | grep "^Total" && echo -e "${IGreen}Docker Prune Successfull${Color_Off}" || echo "Docker Prune ${IRed}FAILED${Color_Off}" - -# TODO Switch to middleware prune on next release -# midclt call container.prune '{"remove_unused_images": true, "remove_stopped_containers": true}' &> /dev/null && echo "Docker Prune completed"|| echo "Docker Prune ${IRed}FAILED${Color_Off}" -} -export -f prune - -# -sync(){ -echo -e "${BWhite}Starting Catalog Sync...${Color_Off}" -cli -c 'app catalog sync_all' &> /dev/null && echo -e "${IGreen}Catalog sync complete${Color_Off}" || echo -e "${IRed}Catalog Sync Failed${Color_Off}" -} -export -f sync diff --git a/includes/colors.sh b/includes/colors.sh deleted file mode 100755 index a1f8cbdd..00000000 --- a/includes/colors.sh +++ /dev/null @@ -1,113 +0,0 @@ -#!/bin/bash -# shellcheck disable=SC2034 - -# Reset -Color_Off='\033[0m' # Text Reset - -# Regular Colors -Black='\033[0;30m' # Black -Red='\033[0;31m' # Red -Green='\033[0;32m' # Green -Yellow='\033[0;33m' # Yellow -Blue='\033[0;34m' # Blue -Purple='\033[0;35m' # Purple -Cyan='\033[0;36m' # Cyan -White='\033[0;37m' # White - -# Bold -BBlack='\033[1;30m' # Black -BRed='\033[1;31m' # Red -BGreen='\033[1;32m' # Green -BYellow='\033[1;33m' # Yellow -BBlue='\033[1;34m' # Blue -BPurple='\033[1;35m' # Purple -BCyan='\033[1;36m' # Cyan -BWhite='\033[1;37m' # White - -# Underline -UBlack='\033[4;30m' # Black -URed='\033[4;31m' # Red -UGreen='\033[4;32m' # Green -UYellow='\033[4;33m' # Yellow -UBlue='\033[4;34m' # Blue -UPurple='\033[4;35m' # Purple -UCyan='\033[4;36m' # Cyan -UWhite='\033[4;37m' # White - -# High Intensity -IBlack='\033[0;90m' # Black -IRed='\033[0;91m' # Red -IGreen='\033[0;92m' # Green -IYellow='\033[0;93m' # Yellow -IBlue='\033[0;94m' # Blue -IPurple='\033[0;95m' # Purple -ICyan='\033[0;96m' # Cyan -IWhite='\033[0;97m' # White - - -# Bold High Intensity -BIBlack='\033[1;90m' # Black -BIRed='\033[1;91m' # Red -BIGreen='\033[1;92m' # Green -BIYellow='\033[1;93m' # Yellow -BIBlue='\033[1;94m' # Blue -BIPurple='\033[1;95m' # Purple -BICyan='\033[1;96m' # Cyan -BIWhite='\033[1;97m' # White - -noColor(){ -# Reset -Color_Off="" - -# Regular Colors -Black="" -Red="" -Green="" -Yellow="" -Blue="" -Purple="" -Cyan="" -White="" - -# Bold -BBlack="" -BRed="" -BGreen="" -BYellow="" -BBlue="" -BPurple="" -BCyan="" -BWhite="" - -# Underline -UBlack="" -URed="" -UGreen="" -UYellow="" -UBlue="" -UPurple="" -UCyan="" -UWhite="" - -# High Intensity -IBlack="" -IRed="" -IGreen="" -IYellow="" -IBlue="" -IPurple="" -ICyan="" -IWhite="" - - -# Bold High Intensity -BIBlack="" -BIRed="" -BIGreen="" -BIYellow="" -BIBlue="" -BIPurple="" -BICyan="" -BIWhite="" - } - export -f noColor diff --git a/includes/dns.sh b/includes/dns.sh deleted file mode 100755 index 0e12e90a..00000000 --- a/includes/dns.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash - -dns(){ - echo -e "${BWhite}Service DNS Names Tool${Color_Off}" -clear -x -echo "Generating Internal Service DNS Names..." -#ignored dependency pods, may need to add more in the future. -dep_ignore="\-cronjob\-|^kube-system|\ssvclb|NAME|\-memcached\-.[^custom\-app]|\-postgresql\-.[^custom\-app]|\-redis\-.[^custom\-app]|\-mariadb\-.[^custom\-app]|\-promtail\-.[^custom\-app]" - -# Pulling pod names -mapfile -t main < <(k3s kubectl get pods -A | grep -Ev "$dep_ignore" | sort) - -# Pulling all ports -all_ports=$(k3s kubectl get service -A) - -clear -x -count=0 -for i in "${main[@]}" -do - [[ count -le 0 ]] && echo -e "\n" && ((count++)) - appName=$(echo "$i" | awk '{print $2}' | sed 's/-[^-]*-[^-]*$//' | sed 's/-0//') - ixName=$(echo "$i" | awk '{print $1}') - port=$(echo "$all_ports" | grep -E "\s$appName\s" | awk '{print $6}' | grep -Eo "^[[:digit:]]+{1}") - [[ -n "$port" ]] && echo -e "$appName.$ixName.svc.cluster.local $port" -done | uniq | nl -b t | sed 's/\s\s\s$/- -------- ----/' | column -t -R 1 -N "#,DNS_Name,Port" -L -} -export -f dns diff --git a/includes/help.sh b/includes/help.sh deleted file mode 100755 index a31cd4fc..00000000 --- a/includes/help.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash - -help(){ -[[ $help == "true" ]] && clear -x -echo "" -echo -e "${BWhite}Basic Utilities${Color_Off}" -echo "--mount | Initiates mounting feature, choose between unmounting and mounting PVC data" -echo "--restore | Opens a menu to restore a \"truetool\" backup that was taken on your \"ix-applications\" dataset" -echo "--delete-backup | Opens a menu to delete backups on your system" -echo "--list-backups | Prints a list of backups available" -echo "--helm-enable | Enables Helm command access on SCALE" -echo "--apt-enable | Enables Apt command access on SCALE" -echo "--kubeapi-enable | Enables external access to Kuberntes API port" -echo "--dns | List all of your applications DNS names and their web ports" -echo -echo -e "${BWhite}Update Options${Color_Off}" -echo "-U | Update all applications, ignores versions" -echo "-u | Update all applications, does not update Major releases" -echo "-b | Back-up your ix-applications dataset, specify a number after -b" -echo "-i | Add application to ignore list, one by one, see example below." -echo "-v | verbose output" -echo "-t | Set a custom timeout in seconds when checking if either an App or Mountpoint correctly Started, Stopped or (un)Mounted. Defaults to 500 seconds" -echo "-s | sync catalog" -echo "-p | Prune unused/old docker images" -echo -echo -e "${BWhite}Examples${Color_Off}" -echo "bash truetool.sh -b 14 -i portainer -i arch -i sonarr -i radarr -t 600 -vsUp" -echo "bash /mnt/tank/scripts/truetool.sh -t 150 --mount" -echo "bash /mnt/tank/scripts/truetool.sh --dns" -echo "bash /mnt/tank/scripts/truetool.sh --restore" -echo "bash /mnt/tank/scripts/truetool.sh --delete-backup" -echo -exit -} -export -f help diff --git a/includes/mount.sh b/includes/mount.sh deleted file mode 100755 index 7d5a6019..00000000 --- a/includes/mount.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/bash - -mountPVC(){ -echo -e "${BWhite}PVC Mounting Tool${Color_Off}" -clear -x -title -echo -e "1 Mount\n2 Unmount All" && read -rt 600 -p "Please type a number: " selection -[[ -z "$selection" ]] && echo "Your selection cannot be empty" && exit #Check for valid selection. If none, kill script -if [[ $selection == "1" ]]; then - list=$(k3s kubectl get pvc -A | sort -u | awk '{print NR-1, "\t" $1 "\t" $2 "\t" $4}' | column -t | sed "s/^0/ /") - echo "$list" && read -rt 120 -p "Please type a number: " selection - [[ -z "$selection" ]] && echo "Your selection cannot be empty" && exit #Check for valid selection. If none, kill script - app=$(echo -e "$list" | grep ^"$selection " | awk '{print $2}' | cut -c 4- ) - [[ -z "$app" ]] && echo "Invalid Selection: $selection, was not an option" && exit #Check for valid selection. If none, kill script - pvc=$(echo -e "$list" | grep ^"$selection ") - status=$(cli -m csv -c 'app chart_release query name,status' | grep -E "^$app\b" | awk -F ',' '{print $2}'| tr -d " \t\n\r") - if [[ "$status" != "STOPPED" ]]; then - [[ -z $timeout ]] && echo -e "\nDefault Timeout: 500" && timeout=500 || echo -e "\nCustom Timeout: $timeout" - SECONDS=0 && echo -e "\nScaling down $app" && midclt call chart.release.scale "$app" '{"replica_count": 0}' &> /dev/null - else - echo -e "\n$app is already stopped" - fi - while [[ "$SECONDS" -le "$timeout" && "$status" != "STOPPED" ]] - do - status=$(cli -m csv -c 'app chart_release query name,status' | grep -E "^$app\b" | awk -F ',' '{print $2}'| tr -d " \t\n\r") - echo -e "Waiting $((timeout-SECONDS)) more seconds for $app to be STOPPED" && sleep 5 - done - data_name=$(echo "$pvc" | awk '{print $3}') - volume_name=$(echo "$pvc" | awk '{print $4}') - full_path=$(zfs list | grep "$volume_name" | awk '{print $1}') - echo -e "\nMounting\n$full_path\nTo\n/mnt/truetool/$data_name" && zfs set mountpoint="/truetool/$data_name" "$full_path" && echo -e "Mounted, Use the Unmount All option to unmount\n" - exit -elif [[ $selection == "2" ]]; then - mapfile -t unmount_array < <(basename -a /mnt/truetool/* | sed "s/*//") - [[ -z ${unmount_array[*]} ]] && echo "Theres nothing to unmount" && exit - for i in "${unmount_array[@]}" - do - main=$(k3s kubectl get pvc -A | grep -E "\s$i\s" | awk '{print $1, $2, $4}') - app=$(echo "$main" | awk '{print $1}' | cut -c 4-) - pvc=$(echo "$main" | awk '{print $3}') - mapfile -t path < <(find /mnt/*/ix-applications/releases/"$app"/volumes/ -maxdepth 0 | cut -c 6-) - if [[ "${#path[@]}" -gt 1 ]]; then #if there is another app with the same name on another pool, use the current pools application, since the other instance is probably old, or unused. - echo "$i is a name used on more than one pool.. attempting to use your current kubernetes apps pool" - pool=$(cli -c 'app kubernetes config' | grep -E "dataset\s\|" | awk -F '|' '{print $3}' | awk -F '/' '{print $1}' | tr -d " \t\n\r") - full_path=$(find /mnt/"$pool"/ix-applications/releases/"$app"/volumes/ -maxdepth 0 | cut -c 6-) - zfs set mountpoint=legacy "$full_path""$pvc" && echo "$i unmounted" && rmdir /mnt/truetool/"$i" || echo "${IRed}FAILED${Color_Off} to unmount $i" - else - # shellcheck disable=SC2128 - zfs set mountpoint=legacy "$path""$pvc" && echo "$i unmounted" && rmdir /mnt/truetool/"$i" || echo "${IRed}FAILED${Color_Off} to unmount $i" - fi - done - rmdir /mnt/truetool -else - echo -e "${IRed}Invalid selection, \"$selection\" was not an option${Color_Off}" -fi -} -export -f mountPVC diff --git a/includes/no_args.sh b/includes/no_args.sh deleted file mode 100755 index 9ff0f3c0..00000000 --- a/includes/no_args.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/bin/bash -# shellcheck disable=SC2034 - -no_args(){ - echo "0 Show Help" - echo "1 List Internal Service DNS Names" - echo "2 Mount and Unmount PVC storage for easy access" - echo "3 List Backups" - echo "4 Create a Backup" - echo "5 Restore a Backup" - echo "6 Delete a Backup" - echo "7 Enable Helm Commands" - echo "8 Enable Apt and Apt-Get Commands" - echo "9 Update All Apps" - echo "10 Enable external access to Kuberntes API port" - read -rt 600 -p "Please select an option by number: " selection - - case $selection in - 0) - help="true" - ;; - 1) - dns="true" - ;; - 2) - mountPVC="true" - ;; - 3) - listBackups="true" - ;; - 4) - read -rt 600 -p "Please type the max number of backups to keep: " backups - re='^[0-9]+$' - number_of_backups=$backups - ! [[ $backups =~ $re ]] && echo -e "Error: -b needs to be assigned an interger\n\"""$number_of_backups""\" is not an interger" >&2 && exit - [[ "$number_of_backups" -le 0 ]] && echo "Error: Number of backups is required to be at least 1" && exit - ;; - 5) - restore="true" - ;; - 6) - deleteBackup="true" - ;; - 7) - helmEnable="true" - ;; - 8) - aptEnable="true" - ;; - 9) - echo "" - echo "1 Update Apps Excluding likely breaking major changes" - echo "2 Update Apps Including likely breaking major changes" - read -rt 600 -p "Please select an option by number: " updateType - if [[ "$updateType" == "1" ]]; then - update_apps="true" - elif [[ "$updateType" == "2" ]]; then - update_all_apps="true" - else - echo "INVALID ENTRY" && exit 1 - fi - ;; - 10) - kubeapiEnable="true" - ;; - *) - echo "Unknown option" && exit 1 - ;; - esac - echo "" -} -export -f no_args diff --git a/includes/patch.sh b/includes/patch.sh deleted file mode 100644 index 82393dea..00000000 --- a/includes/patch.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -patchv22120(){ -echo "Applying 22.12 HotPatch 1" -( wget -q -P /tmp https://github.com/truecharts/truetool/raw/main/hotpatch/2212/HP1.patch && echo "download completed" || echo "download failed" ) && ( patch -N -s -p0 -d /usr/lib/python3/dist-packages/middlewared/ < /tmp/HP1.patch && service middlewared restart && echo "waiting 20 seconds for middleware restart..." && sleep 20 && echo "patch completed" || echo "patch failed or skipped, not critical" ) && rm -rf /tmp/HP1.patch -echo "Applying 22.12 HotPatch 2" -( wget -q -P /tmp https://github.com/truecharts/truetool/raw/main/hotpatch/2212/HP2.patch && echo "download completed" || echo "download failed" ) && ( patch -N -s -p0 -d /usr/lib/python3/dist-packages/middlewared/ < /tmp/HP2.patch && service middlewared restart && echo "waiting 20 seconds for middleware restart..." && sleep 20 && echo "patch completed" || echo "patch failed or skipped, not critical" ) && rm -rf /tmp/HP2.patch -} -export -f patchv22120 - - -hotpatch(){ -echo "Starting hotpatcher..." -if [ "$(cli -m csv -c 'system version' | awk -F '-' '{print $3}')" == "22.12.0" ]; then - patchv22120 -fi -} -export -f hotpatch diff --git a/includes/title.sh b/includes/title.sh deleted file mode 100755 index b6c9e740..00000000 --- a/includes/title.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -# Fancy ascii title. -title(){ -if [[ -z $titleShown ]]; then - echo -e "${IRed} _______ _____ _ _ "; - echo " |__ __| / ____| | | | "; - echo " | |_ __ _ _ ___| | | |__ __ _ _ __| |_ ___ "; - echo -e "${IYellow} | | '__| | | |/ _ \ | | '_ \ / _\` | '__| __/ __|"; - echo " | | | | |_| | __/ |____| | | | (_| | | | |_\__ \\"; - echo -e "${IGreen} __|_|_| \__,_|\___|\_____|_| |_|\__,_|_| \__|___/"; - echo " |__ __| |__ __| | | "; - echo -e "${IBlue} | |_ __ _ _ ___| | ___ ___ | | "; - echo " | | '__| | | |/ _ \ |/ _ \ / _ \| | "; - echo -e "${IPurple} | | | | |_| | __/ | (_) | (_) | | "; - echo " |_|_| \__,_|\___|_|\___/ \___/|_| "; - echo " "; - echo -e "${Color_Off} "; -fi -titleShown='true' -} -export -f title diff --git a/includes/update.sh b/includes/update.sh deleted file mode 100755 index 0aaa7506..00000000 --- a/includes/update.sh +++ /dev/null @@ -1,123 +0,0 @@ -#!/bin/bash - -update_apps(){ -echo -e "${BWhite}App Updater${Color_Off}" -[[ -z $timeout ]] && echo -e "Default Timeout: 500" && timeout=500 || echo -e "\nCustom Timeout: $timeout" -[[ "$timeout" -le 120 ]] && echo "Warning: Your timeout is set low and may lead to premature rollbacks or skips" - -echo "" -echo "Creating list of Apps to update..." - -# Render a list of ignored applications, so users can verify their ignores got parsed correctly. -if [[ -z ${ignore[*]} ]]; then - echo "No apps added to ignore list, continuing..." -else - echo "ignored applications:" - for ignored in "${ignore[@]}" - do - echo "${ignored}" - done -fi -echo "" - -mapfile -t array < <(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,container_images_update_available,status' | grep -E ",true(,|$)" | sort) -[[ -z ${array[*]} ]] && echo -e "\nThere are no updates available or middleware timed out" && return 0 || echo -e "\n${#array[@]} update(s) available:" -PIDlist=() - -# Draft a list of app names, seperate from actuall execution -# This prevents outputs getting mixed together -for i in "${array[@]}" -do - app_name=$(echo "$i" | awk -F ',' '{print $1}') #print out first catagory, name. - echo "$app_name" -done - -echo "" -echo "Updating Apps..." - -# Create a background task for each update as async solution -for i in "${array[@]}" -do - executeUpdate "${i}" & - PIDlist+=($!) -done -echo "" -echo "Waiting for update results..." - -# Wait for all the async updates to complete -for p in "${PIDlist[@]}" -do - wait "${p}" ||: -done - -} -export -f update_apps - - - -# This is a combination of stopping previously-stopped apps and apps stuck Deploying after update -after_update_actions(){ -SECONDS=0 -count=0 -sleep 15 - -# Keep this running and exit the endless-loop based on a timer, instead of a countered-while-loop -# shellcheck disable=SC2050 -while [[ "0" != "1" ]] -do - (( count++ )) - status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep "^$app_name," | awk -F ',' '{print $2}') - if [[ "$status" == "ACTIVE" && "$startstatus" == "STOPPED" ]]; then - [[ "$verbose" == "true" ]] && echo "Returing to STOPPED state.." - midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null && echo "Stopped"|| echo "FAILED" - break - elif [[ "$SECONDS" -ge "$timeout" && "$status" == "DEPLOYING" && "$failed" != "true" ]]; then - echo -e "Error: Run Time($SECONDS) for $app_name has exceeded Timeout($timeout)\nIf this is a slow starting application, set a higher timeout with -t\nIf this applicaion is always DEPLOYING, you can disable all probes under the Healthcheck Probes Liveness section in the edit configuration\nReverting update.." - midclt call chart.release.rollback "$app_name" "{\"item_version\": \"$rollback_version\"}" &> /dev/null - [[ "$startstatus" == "STOPPED" ]] && failed="true" && after_update_actions && unset failed #run back after_update_actions function if the app was stopped prior to update - break - elif [[ "$SECONDS" -ge "$timeout" && "$status" == "DEPLOYING" && "$failed" == "true" ]]; then - echo -e "Error: Run Time($SECONDS) for $app_name has exceeded Timeout($timeout)\nThe application failed to be ACTIVE even after a rollback,\nManual intervention is required\nAbandoning" - break - elif [[ "$status" == "STOPPED" ]]; then - [[ "$count" -le 1 && "$verbose" == "true" ]] && echo "Verifying Stopped.." && sleep 15 && continue #if reports stopped on FIRST time through loop, double check - [[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports stopped on FIRST time through loop, double check - echo "Stopped" && break #if reports stopped any time after the first loop, assume its extermal services. - elif [[ "$status" == "ACTIVE" ]]; then - [[ "$count" -le 1 && "$verbose" == "true" ]] && echo "Verifying Active.." && sleep 15 && continue #if reports active on FIRST time through loop, double check - [[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports active on FIRST time through loop, double check - echo "Active" && break #if reports active any time after the first loop, assume actually active. - else - [[ "$verbose" == "true" ]] && echo "Waiting $((timeout-SECONDS)) more seconds for $app_name to be ACTIVE" - sleep 15 - continue - fi -done -} -export -f after_update_actions - -# Determine what all the required information for the App to update, check it and execute the update using the SCALE API -executeUpdate(){ - app_name=$(echo "$1" | awk -F ',' '{print $1}') #print out first catagory, name. - old_app_ver=$(echo "$1" | awk -F ',' '{print $4}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #previous/current Application MAJOR Version - new_app_ver=$(echo "$1" | awk -F ',' '{print $5}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #new Application MAJOR Version - old_chart_ver=$(echo "$1" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}' | awk -F '.' '{print $1}') # Old Chart MAJOR version - new_chart_ver=$(echo "$1" | awk -F ',' '{print $5}' | awk -F '_' '{print $2}' | awk -F '.' '{print $1}') # New Chart MAJOR version - status=$(echo "$1" | awk -F ',' '{print $2}') #status of the app: STOPPED / DEPLOYING / ACTIVE - startstatus=$status - diff_app=$(diff <(echo "$old_app_ver") <(echo "$new_app_ver")) #caluclating difference in major app versions - diff_chart=$(diff <(echo "$old_chart_ver") <(echo "$new_chart_ver")) #caluclating difference in Chart versions - old_full_ver=$(echo "$1" | awk -F ',' '{print $4}') #Upgraded From - new_full_ver=$(echo "$1" | awk -F ',' '{print $5}') #Upraded To - rollback_version=$(echo "$1" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}') - printf '%s\0' "${ignore[@]}" | grep -iFxqz "${app_name}" && echo -e "\n$app_name\nIgnored, skipping" && return #If application is on ignore list, skip - if [[ "$diff_app" == "$diff_chart" || "$update_all_apps" == "true" ]]; then #continue to update - [[ "$verbose" == "true" ]] && echo "Updating.." - # shellcheck disable=SC2015 - cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo -e "Updated $app_name\n$old_full_ver\n$new_full_ver" && after_update_actions || { echo -e "$app_name: update ${IRed}FAILED${Color_Off}"; return; } - else - echo -e "\n$app_name\nMajor Release, update manually" - return - fi -} -export -f executeUpdate diff --git a/includes/update_self.sh b/includes/update_self.sh deleted file mode 100755 index 7ade24e2..00000000 --- a/includes/update_self.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash - -## AutoUpdate TrueTool using Git -updater(){ -echo -e "${BWhite}Checking for updates...${Color_Off}" -git remote set-url origin "${targetRepo}" -BRANCH=$(git rev-parse --abbrev-ref HEAD) -git fetch -q -git update-index -q --refresh -if [[ $(git status --branch --porcelain) == *"behind"* ]]; then - echo -e "${IPurple}TrueTool requires update${Color_Off}" - git reset --hard -q - git checkout -q "${BRANCH}" - git pull -q - echo "script updated" - if [[ "$CHANGED" == "true" ]]; then - echo "LOOP DETECTED, exiting" - exit 1 - else - echo "restarting script after update..." - export CHANGED="true" - . "${SCRIPT_DIR}/truetool.sh" "$@" - exit - fi -else - echo -e "${IGreen}script up-to-date${Color_Off}" - export CHANGED="false" -fi -echo "" -} -export -f updater diff --git a/truetool.sh b/truetool.sh deleted file mode 100755 index 6e03990f..00000000 --- a/truetool.sh +++ /dev/null @@ -1,179 +0,0 @@ -#!/bin/bash - -# Constants -SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]:-$0}"; )" &> /dev/null && pwd 2> /dev/null; )"; -dir=$(basename "$SCRIPT_DIR") - -# Change this if you want to fork the project -enableUpdate="true" -targetRepo="https://github.com/truecharts/truetool.git" - -# CD to the folder containing the script to ensure consistent runs -cd "${SCRIPT_DIR}" || echo -e "ERROR: Something went wrong accessing the script directory" - -# Includes -# shellcheck source=includes/backup.sh -source includes/backup.sh -# shellcheck source=includes/chores.sh -source includes/chores.sh -# shellcheck source=includes/colors.sh -source includes/colors.sh -# shellcheck source=includes/dns.sh -source includes/dns.sh -# shellcheck source=includes/help.sh -source includes/help.sh -# shellcheck source=includes/help.sh -source includes/patch.sh -# shellcheck source=includes/mount.sh -source includes/mount.sh -# shellcheck source=includes/no_args.sh -source includes/no_args.sh -# shellcheck source=includes/title.sh -source includes/title.sh -# shellcheck source=includes/update.sh -source includes/update.sh -# shellcheck source=includes/update_self.sh -source includes/update_self.sh - -#If no argument is passed, set flag to show menu -if [[ -z "$*" || "-" == "$*" || "--" == "$*" ]]; then - no_args="true" -else - - # Parse script options - while getopts ":si:b:t:uUpSv-:" opt - do - case $opt in - -) - case "${OPTARG}" in - help) - help="true" - ;; - dns) - dns="true" - ;; - mount) - mountPVC="true" - ;; - restore) - restore="true" - ;; - delete-backup) - deleteBackup="true" - ;; - list-backups) - listBackups="true" - ;; - helm-enable) - helmEnable="true" - ;; - apt-enable) - aptEnable="true" - ;; - kubeapi-enable) - kubeapiEnable="true" - ;; - no-color) - noColor - ;; - *) - echo -e "Invalid Option \"--$OPTARG\"\n" && help - exit - ;; - esac - ;; - \?) - echo -e "Invalid Option \"-$OPTARG\"\n" && help - exit - ;; - :) - echo -e "Option: \"-$OPTARG\" requires an argument\n" && help - exit - ;; - b) - re='^[0-9]+$' - number_of_backups=$OPTARG - ! [[ $OPTARG =~ $re ]] && echo -e "Error: -b needs to be assigned an interger\n\"""$number_of_backups""\" is not an interger" >&2 && exit - [[ "$number_of_backups" -le 0 ]] && echo "Error: Number of backups is required to be at least 1" && exit - ;; - i) - ignore+=("$OPTARG") - ;; - t) - re='^[0-9]+$' - timeout=$OPTARG - ! [[ $timeout =~ $re ]] && echo -e "Error: -t needs to be assigned an interger\n\"""$timeout""\" is not an interger" >&2 && exit - ;; - s) - sync="true" - ;; - U) - update_all_apps="true" - ;; - u) - update_apps="true" - ;; - p) - prune="true" - ;; - v) - verbose="true" - ;; - *) - echo -e "Invalid Option \"--$OPTARG\"\n" && help - exit - ;; - esac - done -fi - -title - -[[ "$enableUpdate" == "true" ]] && updater "$@" - -## Always check if a hotpatch needs to be applied -hotpatch - -# Show menu if menu flag is set -if [[ "$no_args" == "true" ]]; then - no_args -fi - -## Exit if incompatable functions are called -[[ "$update_all_apps" == "true" && "$update_apps" == "true" ]] && echo -e "-U and -u cannot BOTH be called" && exit - -## Exit if unsafe combinations are used -# Restore and update right after eachother, might cause super weird issues tha are hard to bugtrace -[[ ( "$update_all_apps" == "true" || "$update_apps" == "true" ) && ( "$restore" == "true" ) ]] && echo -e "Update and Restore cannot both be done in the same run..." && exit - -# Backup Deletion is generally considered to be a "once in a while" thing and not great to sync with automated updates for that reason -[[ ( "$update_all_apps" == "true" || "$update_apps" == "true" ) && ( "$deleteBackup" == "true" ) ]] && echo -e "Update Backup-Deletion cannot both be done in the same run..." && exit - -# Backup Deletion is generally considered to be a "once in a while" thing and not great to sync with automated updates for that reason -[[ ( "$update_all_apps" == "true" || "$update_apps" == "true" ) && ( "$deleteBackup" == "true" ) ]] && echo -e "Update and Backup-Deletion cannot both be done in the same run..." && exit - -# Backup listing is a printout, which would either clutter the output or be already outdated when combined with backup -[[ ( "$update_all_apps" == "true" || "$update_apps" == "true" ) && ( "$listBackups" == "true" ) ]] && echo -e "Update and Listing Backups cannot both be done in the same run..." && exit - -# Backup backup would be done after a backup is restored, which would lead to a backup that is... the same as the one restored... -[[ ( "$restore" == "true" && "$number_of_backups" -ge 1 )]] && echo -e "Restoring a backup and making a backup cannot both be done in the same run..." && exit - -# While technically possible, this is asking for user error... where a user by habit mistakes one prompt, for the other. -[[ ( "$restore" == "true" && "$deleteBackup" == "true" )]] && echo -e "restoring a backup and deleting a backup cannot both be done in the same run..." && exit - - -# Continue to call functions in specific order -[[ "$help" == "true" ]] && help -[[ "$helmEnable" == "true" ]] && helmEnable -[[ "$aptEnable" == "true" ]] && aptEnable -[[ "$kubeapiEnable" == "true" ]] && kubeapiEnable -[[ "$aptEnable" == "true" || "$helmEnable" == "true" || "$kubeapiEnable" == "true" ]] && exit -[[ "$listBackups" == "true" ]] && listBackups && exit -[[ "$deleteBackup" == "true" ]] && deleteBackup && exit -[[ "$dns" == "true" ]] && dns && exit -[[ "$restore" == "true" ]] && restore && exit -[[ "$mountPVC" == "true" ]] && mountPVC && exit -[[ "$number_of_backups" -ge 1 ]] && backup -[[ "$sync" == "true" ]] && sync -[[ "$update_all_apps" == "true" || "$update_apps" == "true" ]] && update_apps -[[ "$prune" == "true" ]] && prune From ac1cdb755ca3d4cc88931b00d990d87bc3a514f1 Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Tue, 27 Dec 2022 11:55:52 +0100 Subject: [PATCH 1128/1229] Put back TrueTool content --- .github/renovate-config.js | 25 ++ .github/renovate.json5 | 23 + .github/workflows/renovate.yml | 18 + .github/workflows/shellcheck.yml | 29 +- .pre-commit-config.yaml | 21 + LICENSE | 703 ++----------------------------- README.md | 231 ++++------ hotpatch/2212/HP1.patch | 125 ++++++ hotpatch/2212/HP2.patch | 14 + includes/backup.sh | 96 +++++ includes/chores.sh | 42 ++ includes/colors.sh | 113 +++++ includes/dns.sh | 27 ++ includes/help.sh | 35 ++ includes/mount.sh | 57 +++ includes/no_args.sh | 72 ++++ includes/patch.sh | 18 + includes/title.sh | 22 + includes/update.sh | 123 ++++++ includes/update_self.sh | 31 ++ truetool.sh | 179 ++++++++ 21 files changed, 1160 insertions(+), 844 deletions(-) create mode 100644 .github/renovate-config.js create mode 100644 .github/renovate.json5 create mode 100644 .github/workflows/renovate.yml create mode 100644 .pre-commit-config.yaml create mode 100644 hotpatch/2212/HP1.patch create mode 100644 hotpatch/2212/HP2.patch create mode 100644 includes/backup.sh create mode 100644 includes/chores.sh create mode 100644 includes/colors.sh create mode 100644 includes/dns.sh create mode 100644 includes/help.sh create mode 100644 includes/mount.sh create mode 100644 includes/no_args.sh create mode 100644 includes/patch.sh create mode 100644 includes/title.sh create mode 100644 includes/update.sh create mode 100644 includes/update_self.sh create mode 100644 truetool.sh diff --git a/.github/renovate-config.js b/.github/renovate-config.js new file mode 100644 index 00000000..da91bb42 --- /dev/null +++ b/.github/renovate-config.js @@ -0,0 +1,25 @@ +module.exports = { + dryRun: false, + username: 'truecharts-admin', + gitAuthor: 'truecharts-admin ', + onboarding: false, + platform: 'github', + repositories: [ + 'truecharts/truetool', + ], + packageRules: [ + { + description: 'lockFileMaintenance', + matchUpdateTypes: [ + 'pin', + 'digest', + 'patch', + 'minor', + 'major', + 'lockFileMaintenance', + ], + dependencyDashboardApproval: false, + stabilityDays: 0, + }, + ], +}; diff --git a/.github/renovate.json5 b/.github/renovate.json5 new file mode 100644 index 00000000..de107f43 --- /dev/null +++ b/.github/renovate.json5 @@ -0,0 +1,23 @@ +{ + "semanticCommits": "enabled", + "extends": ["helpers:pinGitHubActionDigests"], + "dependencyDashboard": true, + "dependencyDashboardTitle": "Renovate Dashboard 🤖", + "suppressNotifications": ["prIgnoreNotification"], + "commitMessageTopic": "{{depName}}", + "commitMessageExtra": "to {{newVersion}}", + "commitMessageSuffix": "", + "rebaseWhen": "conflicted", + "prConcurrentLimit": 100, + "pinDigests": true, + "automerge": true, + "gitAuthor": "TrueCharts-Admin ", + "packageRules": [ + // Setup datasources for github actions + { + "matchManagers": ["github-actions"], + "commitMessageTopic": "github-action {{depName}} [skip ci]", + "automerge": true, + } + ] +} diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml new file mode 100644 index 00000000..0816077f --- /dev/null +++ b/.github/workflows/renovate.yml @@ -0,0 +1,18 @@ +name: Renovate +on: + workflow_dispatch: + schedule: + - cron: "0 */6 * * *" +jobs: + renovate: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3.2.0 + with: + token: ${{ secrets.BOT_TOKEN }} + - name: Self-hosted Renovate + uses: renovatebot/github-action@d4496c2d9b06c4e43b227fc3f331a434e99eaef5 # v34.73.3 + with: + configurationFile: .github/renovate-config.js + token: ${{ secrets.BOT_TOKEN }} diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml index 29c41a73..43b3800b 100644 --- a/.github/workflows/shellcheck.yml +++ b/.github/workflows/shellcheck.yml @@ -2,20 +2,25 @@ on: push: pull_request: workflow_dispatch: - -name: ShellCheck + +name: 'Lint and Test' jobs: - ShellCheck: - name: ShellCheck + shellcheck: + name: Shellcheck runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - name: Run ShellCheck - uses: ludeeus/action-shellcheck@master - env: - SHELLCHECK_OPTS: -e SC2154 - with: - check_together: 'yes' - format: gcc + - uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3 + - name: Run ShellCheck + uses: ludeeus/action-shellcheck@master + with: + check_together: 'yes' + env: + SHELLCHECK_OPTS: -e SC2154 + pre-commit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3 + - uses: actions/setup-python@5ccb29d8773c3f3f653e1705f474dfaa8a06a912 # v4 + - uses: pre-commit/action@646c83fcd040023954eafda54b4db0192ce70507 # tag=v3.0.0 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..cce767d4 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,21 @@ +# See https://pre-commit.com for more information +repos: +- repo: https://github.com/Lucas-C/pre-commit-hooks + rev: v1.1.10 + hooks: + - id: remove-tabs + +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.0.1 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: fix-byte-order-marker + - id: mixed-line-ending + - id: check-merge-conflict + - id: check-case-conflict + - id: check-executables-have-shebangs + - id: check-docstring-first + - id: check-symlinks + - id: destroyed-symlinks + - id: fix-byte-order-marker diff --git a/LICENSE b/LICENSE index f288702d..0a7a3987 100644 --- a/LICENSE +++ b/LICENSE @@ -1,674 +1,29 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. +BSD 3-Clause License + +Copyright (c) 2022, TrueCharts +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/README.md b/README.md index 5d2105ed..2e072dc1 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,13 @@ -# heavy_script +# truetool -## Website +An easy tool for frequently used TrueNAS SCALE CLI utilities. -[HeavySetup - Further Explanation](https://heavysetup.info/scripts/heavyscript/about/) +Please before using this tool, [read this note](https://truecharts.org/manual/guides/Important-MUST-READ) ## Table of contents: -* [Update Arguments](#update-arguments) -* [Other Utilities](#other-utilities) + +* [Synopsis](#synopsis) +* [Arguments](#arguments) * [How to Install](#how-to-install) * [How to Update](#how-to-update) * [Creating a Cron Job](#creating-a-cron-job) @@ -14,171 +15,83 @@
-## The Menu +## Synopsis -![image](https://user-images.githubusercontent.com/20793231/185020236-7b389499-8081-407d-b653-10dffd70de8c.png) -> Access this with `bash heavy_script.sh` +TrueTool is a command line tool, designed to enable some features of TrueNAS SCALE that are either not-enabled by default or not-available in the Web-GUI. +It also offers a few handy shortcuts for commonly required chores, like: Enabling Apt or Helm -
-
+## Arguments -## Update Arguments -| Flag | Example | Parameter | Description | -|---------------|------------------------|------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| -U | -U
-U 5 | Optional Integer | Update applications, ignoring major version changes
_Optionally, you can supply a number after the argument to update multiple applications at once_ | -| -u | -u
-u 5 | Optional Integer | Update applications, do NOT update if there was a major version change
_Optionally, you can supply a number after the argument to update multiple applications at once_ | -| -b | -b 14 | Integer | Snapshot ix-applications dataset
_Creates backups UP TO the number you've chosen_ | -| -i | -i nextcloud -i sonarr | String | Applications listed will be ignored during updating
_List one application after another as shown in the example_ | -| -r | -r | | Monitors applications after they update
If the app does not become "ACTIVE" after the timeout, rollback the application. | -| -v | -v | | Verbose Output
_Look at the bottom of this page for an example_ | -| -S | -S | | Shutdown the application prior to updating it | -| -t | -t 400 | Integer | Time in seconds that HeavyScript will wait for an application to no longer be deploying before declaring failure
Default: 500 | -| -s | -s | | Sync Catalogs prior to updating | -| -p | -p | | Prune unused docker images | -| --ignore-img | --ignore-img | | Ignore container image updates | -| --self-update | --self-update | | Updates HeavyScript prior to running any other commands | +| Flag | Example | Parameter | Description | +| --------------- | ---------------------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| --delete-backup | --delete-backup | None | Opens a menu to delete backups
_Useful if you need to delete old system backups or backups from other scripts_ | +| --restore | --restore | None | Restore TrueTool specific `ix-applications dataset` snapshot | +| --mount | --mount | None | Initiates mounting feature
Choose between unmounting and mounting PVC data | +| --dns | --dns | None | list all of your applications DNS names and their web ports | +| --list-backups | --list-backups | None | Prints a list of backups available | +| --helm-enable | --helm-enable | None | Enables Helm command access on SCALE | +| --kubeapi-enable | --kubeapi-enable | None | Enables external access to Kuberntes API port | +| --apt-enable | --apt-enable | None | Enables Apt command access on SCALE | +| --no-color | --no-color | None | Disables showing colors in terminal output, usefull for SCALE Email output | +| -U | -U | None | Update applications, ignoring major version changes | +| -u | -u | None | Update applications, do NOT update if there was a major version change | +| -b | -b 14 | Integer | Backup `ix-applications` dataset
_Creates backups up to the number you've chosen_ | +| -i | -i nextcloud -i sonarr | String | Applications listed will be ignored during updating
_List one application after another as shown in the example_ | +| -v | -v | None | Verbose Output
| +| -t | -t 150 | Integer | Set a custom timeout to be used with either:
`-m`
_Time the script will wait for application to be "STOPPED"_
or
`-(u\|U)`
_Time the script will wait for application to be either "STOPPED" or "ACTIVE"_ | +| -s | -s | None | Sync Catalogs prior to updating | +| -p | -p | None | Prune old/unused docker images | -### Example -#### Cron Job -``` -bash heavy_script.sh --self-update -b 10 -i nextcloud -i sonarr -t 600 --ignore-img -rsp -u 5 -``` - -> `-b` is set to 10. Up to 10 snapshots of your ix-applications dataset will be saved - -> `-i` is set to ignore __nextcloud__ and __sonarr__. These applications will be skipped if they have an update. - -> `-t` I set it to 600 seconds, this means the script will wait 600 seconds for the application to become ACTIVE before timing out and rolling back to the previous version since `-r` is used. - -> `--ignore-img` Will not update the application if it is only a container image update - -> `-r` Will rollback applications if they fail to deploy within the timeout, after updating. - -> `-s` will just sync the repositories, ensuring you are downloading the latest updates. - -> `-p` Prune docker images. - -> `-u` update applications as long as the major version has absolutely no change, if it does have a change it will ask the user to update manually. ->> The `5` after the `-u` means up to 5 applications will be updating and monitored at one time - -> `--self-update` Will update the script prior to running anything else. - -
- -#### My Personal Cron Job -``` -bash /mnt/speed/scripts/heavy_script/heavy_script.sh --self-update -b 10 -rsp -u 10 -``` - -
-
- -## Other Utilities -> All of these can ALSO be accessed with the HeavyScript menu, that you can access simply by not providing an argument `bash heavy_script.sh` - -| Flag | Description | -|-----------------|----------------------------------------------------------------------------------------------| -| --mount | Initiates mounting feature, choose between unmounting and mounting PVC data | -| --restore | Opens a menu to restore a heavy_script backup that was taken on your ix-applications dataset | -| --delete-backup | Opens a menu to delete backups on your system | -| --dns | list all of your applications DNS names and their web ports | -| --cmd | Open a shell for one of your applications | - - -### Examples -#### Mounting PVC Data - -``` -bash /mnt/tank/scripts/heavy_script.sh --mount -``` - -#### Restoring ix-applications dataset - -``` -bash /mnt/tank/scripts/heavy_script/heavy_script.sh --restore -``` - -#### Deleting Backups - -``` -bash /mnt/tank/scripts/heavy_script/heavy_script.sh --delete-backup -``` - -#### List All DNS Names - -``` -bash /mnt/tank/scripts/heavy_script/heavy_script.sh --dns -``` - -#### Open a Containers Shell - -``` -bash /mnt/speed/scripts/heavy_script/heavy_script.sh --cmd -``` -

- ## How to Install -### Create a Scripts Dataset +### Choose a folder -I created a `scripts` dataset on my Truenas SCALE system, this is where all my scripts will remain. +It's important to save the script in a folder that is persistent across TrueNAS System Updates. +This saves you from reinstalling or experiencing an accidental lack-of-backups after an update. -### Open a Terminal +##### New dataset + +In this example we created a `scripts` dataset on the TrueNAS SCALE system, feel free to use another folder. + +##### Root folder + +The `/root` folder houses files for the root user. +It's also persistent across updates and hence can be safely used for storing the script. + +### Open a Terminal **Change Directory to your scripts folder** + ``` -cd /mnt/speed/scripts +cd /mnt/pool/scripts ``` -**Git Clone Heavy_Script** +**Git Clone truetool** + ``` -git clone https://github.com/Heavybullets8/heavy_script.git +git clone https://github.com/truecharts/truetool.git ``` -**Change Directory to Heavy_Script folder** +**Change Directory to truetool folder** + ``` -cd heavy_script +cd truetool ``` -From here, you can just run Heavy_Script with `bash heavy_script.sh -ARGUMENTS` - -> Note: `chmod +x` is NOT required. Doing this will break the `git pull` (or self update) function. Just run the script with `bash heavy_script.sh` +From here, you can just run truetool with `bash truetool.sh -ARGUMENTS`
-## How to Update +## How to Update -### Built-In Option (Recommended) - -``` -bash heavyscript.sh --self-update -b 10 -supr -``` -> The important argument here is the `--self-update`, you can still use all of your same arguments with this option. ->> `--self-update` will place users on the latest tag, as well as showing the changelog when new releases come out. So this is the preferred method. Not using this method, will instead place the user on `main`, where the changes are tested, but not as rigerously as they are on the releases. +TrueTool updates itself automatically.
-### Manually - -#### Open a Terminal - -**Change Directory to your heavy_script folder** -``` -cd /mnt/speed/scripts/heavy_script -``` - -**git pull** -``` -git pull -``` -> This is not recommended because the changes to main are not tested as much as the changes that are pushed to releases are tested, think of this method of updating as being in development. - -
-
## Creating a Cron Job @@ -188,29 +101,31 @@ git pull 4. Cron Jobs 1. Click Add -| Name | Value | Reason | -|------------------------ |------------------------------------------------------------------------------------------------------------------- |------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `Description` | HeavyScript git pull and Update apps | This is up to you, put whatever you think is a good description in here | -| `Command` | `bash /PATH/TO/HEAVY_SCRIPT_DIRECTORY/heavy_script.sh --self-update -b 10 -rsp -u 10` | This is the command you will be running on your schedule I personally use: `bash /mnt/speed/scripts/heavy_script/heavy_script.sh --self-update -b 10 -rsp -u 10` | -| `Run As User` | `root` | Running the script as `root` is REQUIRED. You cannot access all of the kubernetes functions without this user. | -| `Schedule` | Up to you, I run mine everyday at `0400` | Again up to you | -| `Hide Standard Output` | `False` or Unticked | I like to receive an email report of how the script ran, what apps updated etc. | -| `Hide Standard Error` | `False` or Unticked | I want to see any errors that occur | -| `Enabled` | `True` or Ticked | This will Enable the script to run on your schedule | - - +| Name | Value | Reason | +| ---------------------- | -------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | +| `Description` | TrueTool Update apps | This is up to you, put whatever you think is a good description in here | +| `Command` | `bash /PATH/TO/truetool_DIRECTORY/truetool.sh --no-color -b 14 -sup` | This is the command you will be running on your schedule, example: `bash /mnt/speed/scripts/truetool/truetool.sh -b 14 -sup` | +| `Run As User` | `root` | Running the script as `root` is REQUIRED. You cannot access all of the kubernetes functions without this user. | +| `Schedule` | Up to you, example: `0400` | Again up to you | +| `Hide Standard Output` | `False` or Un-ticked | It's best to keep an eye on updates and enable this to receive email reports | +| `Hide Standard Error` | `False` or Un-ticked | We definitely want to see what errors occurred during updating | +| `Enabled` | `True` or Ticked | This will Enable the script to run on your schedule |

### Additional Information -#### Verbose vs Non-Verbose -- Verbose used `bash heavy_script.sh -b 5 -Srupv` -- Non-Verbose used `bash heavy_script.sh -b 5 -Srup` +#### TrueTool vs HeavyScript -| Verbose | Non-Verbose | -|--------- |------------- | -| ![image](https://user-images.githubusercontent.com/20793231/167971188-07f71d02-8da3-4e0c-b9a0-cd26e7f63613.png) | ![image](https://user-images.githubusercontent.com/20793231/167972033-dc8d4ab4-4fb2-4c8a-b7dc-b9311ae55cf8.png) | - +TrueTool and HeavyScript are based, in essence, based on the original (python based) TrueUpdate and TrueTool. +Then Support-Manager for TrueCharts, HeavyBullets8, ported this to Bash and started adding some additional logic and options for tasks we frequently needed our users to do, such as mounting PVC's. +After a month or so, the TrueCharts Team officially started refactoring this expanded bash-port. Due to personal reasons, HeavyBullets by then decided to separate from TrueCharts after merging the TrueCharts refactor into his own work. The beauty of OpenSource. + +From this point onwards the HeavyScript and TrueTool diverged a bit. +We internally review changes within our staff team, to verify we somewhat stick to best-practices. This means, in some cases, we decided not to port certain features from HeavyScript and did decide to add features we think are useful and safe. +But this also means we can give guarantees TrueTool works optimally with our Catalog of TrueNAS SCALE Apps, as well as official Apps. + +Users from HeavyScript can safely start using TrueTool, as we've made precautions to ensure the backups take over smoothly. +We, however, do _not_ advise using HeavyScript with TrueCharts Apps. Not because it's a bad App, but because we offer an alternative that is validated by our Staff. diff --git a/hotpatch/2212/HP1.patch b/hotpatch/2212/HP1.patch new file mode 100644 index 00000000..72e293a9 --- /dev/null +++ b/hotpatch/2212/HP1.patch @@ -0,0 +1,125 @@ +diff --git plugins/chart_releases_linux/chart_release.py plugins/chart_releases_linux/chart_release.py +index 76e3825bc0f..f65cc0eac24 100644 +--- plugins/chart_releases_linux/chart_release.py ++++ plugins/chart_releases_linux/chart_release.py +@@ -606,7 +606,7 @@ async def do_delete(self, job, release_name, options): + # If we had pre-install jobs, it's possible we have leftover pods which the job did not remove + # based on dev specified settings of cleaning it up - let's remove those + for pod in await self.middleware.call('k8s.pod.query', [['metadata.namespace', '=', namespace]]): +- owner_references = pod['metadata'].get('owner_references') ++ owner_references = pod['metadata'].get('ownerReferences') + if not isinstance(owner_references, list) or all( + owner_reference.get('name') not in pre_install_jobs for owner_reference in owner_references + ): +@@ -658,7 +658,7 @@ async def remove_storage_class_and_dataset(self, release_name, job=None): + pvc_volume_ds = os.path.join(release_ds, 'volumes') + for pv in await self.middleware.call( + 'k8s.pv.query', [ +- ['spec.csi.volume_attributes.openebs\\.io/poolname', '=', pvc_volume_ds] ++ ['spec.csi.volumeAttributes.openebs\\.io/poolname', '=', pvc_volume_ds] + ] + ): + await self.middleware.call('k8s.pv.delete', pv['metadata']['name']) +diff --git plugins/chart_releases_linux/resources.py plugins/chart_releases_linux/resources.py +index c7180147a5f..941de79da45 100644 +--- plugins/chart_releases_linux/resources.py ++++ plugins/chart_releases_linux/resources.py +@@ -158,13 +158,13 @@ async def retrieve_pv_pvc_mapping_internal(self, chart_release): + } + + for pv in chart_release['resources']['persistent_volumes']: +- claim_name = pv['spec'].get('claim_ref', {}).get('name') ++ claim_name = pv['spec'].get('claimRef', {}).get('name') + if claim_name: + csi_spec = pv['spec']['csi'] +- volumes_ds = csi_spec['volume_attributes']['openebs.io/poolname'] ++ volumes_ds = csi_spec['volumeAttributes']['openebs.io/poolname'] + if ( + os.path.join(chart_release['dataset'], 'volumes') != volumes_ds or +- csi_spec['volume_handle'] not in zfs_volumes ++ csi_spec['volumeHandle'] not in zfs_volumes + ): + # We are only going to backup/restore pvc's which were consuming + # their respective storage class and we have related zfs volume present +@@ -174,8 +174,8 @@ async def retrieve_pv_pvc_mapping_internal(self, chart_release): + mapping[claim_name] = { + 'name': pv_name, + 'pv_details': pv, +- 'dataset': os.path.join(volumes_ds, csi_spec['volume_handle']), +- 'zv_details': zfs_volumes[csi_spec['volume_handle']], ++ 'dataset': os.path.join(volumes_ds, csi_spec['volumeHandle']), ++ 'zv_details': zfs_volumes[csi_spec['volumeHandle']], + } + return mapping + +@@ -247,11 +247,11 @@ async def get_workload_storage_details(self): + # because of chart release reclaim policy being retain + for pv in await self.middleware.call( + 'k8s.pv.query', [[ +- 'spec.csi.volume_attributes.openebs\\.io/poolname', '^', ++ 'spec.csi.volumeAttributes.openebs\\.io/poolname', '^', + f'{os.path.join(k8s_config["dataset"], "releases")}/' + ]] + ): +- dataset = pv['spec']['csi']['volume_attributes']['openebs.io/poolname'] ++ dataset = pv['spec']['csi']['volumeAttributes']['openebs.io/poolname'] + rl = dataset.split('/', 4) + if len(rl) > 4: + mapping['persistent_volumes'][rl[3]].append(pv) +diff --git plugins/chart_releases_linux/scale_workload.py plugins/chart_releases_linux/scale_workload.py +index 117dab3a79c..e9525150278 100644 +--- plugins/chart_releases_linux/scale_workload.py ++++ plugins/chart_releases_linux/scale_workload.py +@@ -246,10 +246,10 @@ async def get_workload_to_pod_mapping(self, namespace): + for r in await self.middleware.call( + f'k8s.{key}.query', [ + ['metadata.namespace', '=', namespace], +- ['metadata', 'rin', 'owner_references'], ++ ['metadata', 'rin', 'ownerReferences'], + ], {'select': ['metadata']} + ): +- for owner_reference in filter(lambda o: o.get('uid'), r['metadata']['owner_references'] or []): ++ for owner_reference in filter(lambda o: o.get('uid'), r['metadata']['ownerReferences'] or []): + mapping[key][owner_reference['uid']][r['metadata']['uid']] = r + + pod_mapping = defaultdict(list) +diff --git plugins/kubernetes_linux/restore.py plugins/kubernetes_linux/restore.py +index 4897e3f8b7a..ec13a332b6e 100644 +--- plugins/kubernetes_linux/restore.py ++++ plugins/kubernetes_linux/restore.py +@@ -218,7 +218,11 @@ def restore_backup(self, job, backup_name, options): + failed_pv_restores.append(f'Unable to create ZFS Volume for {pvc!r} PVC: {e}') + continue + ++ # We need to safely access claim_ref vollume attribute keys as with k8s client api re-write ++ # camel casing which was done by kubernetes asyncio package is not happening anymore + pv_spec = pv['pv_details']['spec'] ++ claim_ref = pv_spec.get('claim_ref') or pv_spec['claimRef'] ++ pv_volume_attrs = pv_spec['csi'].get('volume_attributes') or pv_spec['csi']['volumeAttributes'] + try: + self.middleware.call_sync('k8s.pv.create', { + 'metadata': { +@@ -229,18 +233,18 @@ def restore_backup(self, job, backup_name, options): + 'storage': pv_spec['capacity']['storage'], + }, + 'claimRef': { +- 'name': pv_spec['claim_ref']['name'], +- 'namespace': pv_spec['claim_ref']['namespace'], ++ 'name': claim_ref['name'], ++ 'namespace': claim_ref['namespace'], + }, + 'csi': { + 'volumeAttributes': { + 'openebs.io/poolname': RE_POOL.sub( +- f'{k8s_pool}\\1', pv_spec['csi']['volume_attributes']['openebs.io/poolname'] ++ f'{k8s_pool}\\1', pv_volume_attrs['openebs.io/poolname'] + ) + }, +- 'volumeHandle': pv_spec['csi']['volume_handle'], ++ 'volumeHandle': pv_spec['csi'].get('volume_handle') or pv_spec['csi']['volumeHandle'], + }, +- 'storageClassName': pv_spec['storage_class_name'], ++ 'storageClassName': pv_spec.get('storage_class_name') or pv_spec['storageClassName'], + }, + }) + except Exception as e: diff --git a/hotpatch/2212/HP2.patch b/hotpatch/2212/HP2.patch new file mode 100644 index 00000000..30357c93 --- /dev/null +++ b/hotpatch/2212/HP2.patch @@ -0,0 +1,14 @@ +diff --git plugins/kubernetes_linux/backup.py plugins/kubernetes_linux/backup.py +index 365cd1718b4..1046a64c2a5 100644 +index d8a48d45f89..365cd1718b4 100644 +--- plugins/kubernetes_linux/backup.py ++++ plugins/kubernetes_linux/backup.py +@@ -61,7 +61,8 @@ def backup_chart_releases(self, job, backup_name): + ['metadata.namespace', '=', chart_release['namespace']] + ] + ) +- for secret in sorted(secrets, key=lambda d: d['metadata']['name']): ++ # We ignore this keeping in line with helm behaviour where the secret malformed is ignored by helm ++ for secret in sorted(filter(lambda d: d.get('data'), secrets), key=lambda d: d['metadata']['name']): + with open(os.path.join(secrets_dir, secret['metadata']['name']), 'w') as f: + f.write(self.middleware.call_sync('k8s.secret.export_to_yaml_internal', secret)) diff --git a/includes/backup.sh b/includes/backup.sh new file mode 100644 index 00000000..e09449f9 --- /dev/null +++ b/includes/backup.sh @@ -0,0 +1,96 @@ +#!/bin/bash + +## Simple shortcut to just list the backups without promts and such +listBackups(){ +echo -e "${BWhite}Backup Listing Tool${Color_Off}" +clear -x && echo "pulling all restore points.." +list_backups=$(cli -c 'app kubernetes list_backups' | grep -v system-update | sort -t '_' -Vr -k2,7 | tr -d " \t\r" | awk -F '|' '{print $2}' | nl | column -t) +[[ -z "$list_backups" ]] && echo -e "${IRed}No restore points available${Color_Off}" && exit || echo "Detected Backups:" && echo "$list_backups" +} +export -f listBackups + +## Lists backups, except system-created backups, and promts which one to delete +deleteBackup(){ +echo -e "${BWhite}Backup Deletion Tool${Color_Off}" +clear -x && echo "pulling all restore points.." +list_delete_backups=$(cli -c 'app kubernetes list_backups' | grep -v system-update | sort -t '_' -Vr -k2,7 | tr -d " \t\r" | awk -F '|' '{print $2}' | nl | column -t) +clear -x +# shellcheck disable=SC2015 +[[ -z "$list_delete_backups" ]] && echo -e "${IRed}No restore points available${Color_Off}" && exit || { title; echo -e "Choose a restore point to delete\nThese may be out of order if they are not TrueTool backups" ; } +# shellcheck disable=SC2015 +echo "$list_delete_backups" && read -rt 600 -p "Please type a number: " selection && restore_point=$(echo "$list_delete_backups" | grep ^"$selection " | awk '{print $2}') +[[ -z "$selection" ]] && echo "${IRed}Your selection cannot be empty${Color_Off}" && exit #Check for valid selection. If none, kill script +[[ -z "$restore_point" ]] && echo "Invalid Selection: $selection, was not an option" && exit #Check for valid selection. If none, kill script +echo -e "\nWARNING:\nYou CANNOT go back after deleting your restore point" || { echo "${IRed}FAILED${Color_Off}"; exit; } +# shellcheck disable=SC2015 +echo -e "\n\nYou have chosen:\n$restore_point\n\nWould you like to continue?" && echo -e "1 Yes\n2 No" && read -rt 120 -p "Please type a number: " yesno || { echo "${IRed}FAILED${Color_Off}"; exit; } +if [[ $yesno == "1" ]]; then + echo -e "\nDeleting $restore_point" && cli -c 'app kubernetes delete_backup backup_name=''"'"$restore_point"'"' &>/dev/null && echo -e "${IGreen}Sucessfully deleted${Color_Off}" || echo -e "${IRed}Deletion FAILED${Color_Off}" +elif [[ $yesno == "2" ]]; then + echo "You've chosen NO, killing script." +else + echo -e "${IRed}Invalid Selection${Color_Off}" +fi +} +export -f deleteBackup + +## Creates backups and deletes backups if a "backups to keep"-count is exceeded. +# backups-to-keep takes only heavyscript and truetool created backups into account, as other backups aren't guaranteed to be sorted correctly +backup(){ +echo -e "${BWhite}Backup Tool${Color_Off}" +echo -e "\nNumber of backups was set to $number_of_backups" +date=$(date '+%Y_%m_%d_%H_%M_%S') +[[ "$verbose" == "true" ]] && cli -c 'app kubernetes backup_chart_releases backup_name=''"'TrueTool_"$date"'"' +[[ -z "$verbose" ]] && echo -e "\nNew Backup Name:" && cli -c 'app kubernetes backup_chart_releases backup_name=''"'TrueTool_"$date"'"' | tail -n 1 +mapfile -t list_create_backups < <(cli -c 'app kubernetes list_backups' | grep 'HeavyScript\|TrueTool_' | sort -t '_' -Vr -k2,7 | awk -F '|' '{print $2}'| tr -d " \t\r") +# shellcheck disable=SC2309 +if [[ ${#list_create_backups[@]} -gt "number_of_backups" ]]; then + echo -e "\nDeleting the oldest backup(s) for exceeding limit:" + overflow=$(( ${#list_create_backups[@]} - "$number_of_backups" )) + mapfile -t list_overflow < <(cli -c 'app kubernetes list_backups' | grep "TrueTool_" | sort -t '_' -V -k2,7 | awk -F '|' '{print $2}'| tr -d " \t\r" | head -n "$overflow") + for i in "${list_overflow[@]}" + do + cli -c 'app kubernetes delete_backup backup_name=''"'"$i"'"' &> /dev/null || echo "${IRed}FAILED${Color_Off} to delete $i" + echo "$i" + done +fi +} +export -f backup + +## Lists available backup and prompts the users to select a backup to restore +restore(){ +echo -e "${BWhite}Backup Restoration Tool${Color_Off}" +clear -x && echo "pulling restore points.." +list_restore_backups=$(cli -c 'app kubernetes list_backups' | grep "TrueTool_" | sort -t '_' -Vr -k2,7 | tr -d " \t\r" | awk -F '|' '{print $2}' | nl | column -t) +clear -x +# shellcheck disable=SC2015 +[[ -z "$list_restore_backups" ]] && echo "No TrueTool restore points available" && exit || { title; echo "Choose a restore point" ; } +echo "$list_restore_backups" && read -rt 600 -p "Please type a number: " selection && restore_point=$(echo "$list_restore_backups" | grep ^"$selection " | awk '{print $2}') +[[ -z "$selection" ]] && echo "Your selection cannot be empty" && exit #Check for valid selection. If none, kill script +[[ -z "$restore_point" ]] && echo "Invalid Selection: $selection, was not an option" && exit #Check for valid selection. If none, kill script +echo -e "\nWARNING:\nThis is NOT guranteed to work\nThis is ONLY supposed to be used as a LAST RESORT\nConsider rolling back your applications instead if possible" || { echo "${IRed}FAILED${Color_Off}"; exit; } +# shellcheck disable=SC2015 +echo -e "\n\nYou have chosen:\n$restore_point\n\nWould you like to continue?" && echo -e "1 Yes\n2 No" && read -rt 120 -p "Please type a number: " yesno || { echo "${IRed}FAILED${Color_Off}"; exit; } +if [[ $yesno == "1" ]]; then + echo -e "\nStarting Restore, this will take a ${BWhite}LONG${Color_Off} time." + pool=$(cli -c 'app kubernetes config' | grep -E "pool\s\|" | awk -F '|' '{print $3}' | tr -d " \t\n\r") + echo "Correcting PVC mountpoints..." + for pvc in $(zfs list -t filesystem -r "$pool"/ix-applications -o name -H | grep "/ix-applications/" | grep "volumes/pvc") + do + zfs set mountpoint=legacy "${pvc}" || echo "Fixing PVC mountpoints Failed for ${pvc}... Continuing..." + done + # Ensure readonly is turned off + if ! zfs set readonly=off "$pool"/ix-applications;then + echo -e "Error: Failed to set ZFS ReadOnly to \"off\"" + echo -e "After the restore, attempt to run the following command manually:" + echo "zfs set readonly=off $pool/ix-applications" + fi + echo "Triggering restore process..." + cli -c 'app kubernetes restore_backup backup_name=''"'"$restore_point"'"' || echo "Restore ${IRed}FAILED${Color_Off}" +elif [[ $yesno == "2" ]]; then + echo "You've chosen NO, killing script. Good luck." +else + echo -e "${IRed}Invalid Selection${Color_Off}" +fi +} +export -f restore diff --git a/includes/chores.sh b/includes/chores.sh new file mode 100644 index 00000000..9f3cbc6a --- /dev/null +++ b/includes/chores.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +helmEnable(){ +echo -e "${BWhite}Enabling Helm${Color_Off}" +export KUBECONFIG=/etc/rancher/k3s/k3s.yaml && echo -e "${IGreen}Helm Enabled${Color_Off}"|| echo -e "${IRed}Helm Enable FAILED${Color_Off}" +} +export -f helmEnable + +aptEnable(){ +echo -e "${BWhite}Enabling Apt-Commands${Color_Off}" +chmod +x /usr/bin/apt* && echo -e "${IGreen}APT enabled${Color_Off}"|| echo -e "${IRed}APT Enable FAILED${Color_Off}" +} +export -f aptEnable + +kubeapiEnable(){ +local -r comment='iX Custom Rule to drop connection requests to k8s cluster from external sources' +echo -e "${BWhite}Enabling Kubernetes API${Color_Off}" +if iptables -t filter -L INPUT 2> /dev/null | grep -q "${comment}" ; then + iptables -D INPUT -p tcp -m tcp --dport 6443 -m comment --comment "${comment}" -j DROP && echo -e "${IGreen}Kubernetes API enabled${Color_Off}"|| echo -e "${IRed}Kubernetes API Enable FAILED${Color_Off}" +else + echo -e "${IGreen}Kubernetes API already enabled${Color_Off}" +fi +} +export -f kubeapiEnable + +# Prune unused docker images to prevent dataset/snapshot bloat related slowdowns on SCALE +prune(){ +echo -e "${BWhite}Docker Prune${Color_Off}" +echo "Pruning Docker Images..." +docker image prune -af | grep "^Total" && echo -e "${IGreen}Docker Prune Successfull${Color_Off}" || echo "Docker Prune ${IRed}FAILED${Color_Off}" + +# TODO Switch to middleware prune on next release +# midclt call container.prune '{"remove_unused_images": true, "remove_stopped_containers": true}' &> /dev/null && echo "Docker Prune completed"|| echo "Docker Prune ${IRed}FAILED${Color_Off}" +} +export -f prune + +# +sync(){ +echo -e "${BWhite}Starting Catalog Sync...${Color_Off}" +cli -c 'app catalog sync_all' &> /dev/null && echo -e "${IGreen}Catalog sync complete${Color_Off}" || echo -e "${IRed}Catalog Sync Failed${Color_Off}" +} +export -f sync diff --git a/includes/colors.sh b/includes/colors.sh new file mode 100644 index 00000000..a1f8cbdd --- /dev/null +++ b/includes/colors.sh @@ -0,0 +1,113 @@ +#!/bin/bash +# shellcheck disable=SC2034 + +# Reset +Color_Off='\033[0m' # Text Reset + +# Regular Colors +Black='\033[0;30m' # Black +Red='\033[0;31m' # Red +Green='\033[0;32m' # Green +Yellow='\033[0;33m' # Yellow +Blue='\033[0;34m' # Blue +Purple='\033[0;35m' # Purple +Cyan='\033[0;36m' # Cyan +White='\033[0;37m' # White + +# Bold +BBlack='\033[1;30m' # Black +BRed='\033[1;31m' # Red +BGreen='\033[1;32m' # Green +BYellow='\033[1;33m' # Yellow +BBlue='\033[1;34m' # Blue +BPurple='\033[1;35m' # Purple +BCyan='\033[1;36m' # Cyan +BWhite='\033[1;37m' # White + +# Underline +UBlack='\033[4;30m' # Black +URed='\033[4;31m' # Red +UGreen='\033[4;32m' # Green +UYellow='\033[4;33m' # Yellow +UBlue='\033[4;34m' # Blue +UPurple='\033[4;35m' # Purple +UCyan='\033[4;36m' # Cyan +UWhite='\033[4;37m' # White + +# High Intensity +IBlack='\033[0;90m' # Black +IRed='\033[0;91m' # Red +IGreen='\033[0;92m' # Green +IYellow='\033[0;93m' # Yellow +IBlue='\033[0;94m' # Blue +IPurple='\033[0;95m' # Purple +ICyan='\033[0;96m' # Cyan +IWhite='\033[0;97m' # White + + +# Bold High Intensity +BIBlack='\033[1;90m' # Black +BIRed='\033[1;91m' # Red +BIGreen='\033[1;92m' # Green +BIYellow='\033[1;93m' # Yellow +BIBlue='\033[1;94m' # Blue +BIPurple='\033[1;95m' # Purple +BICyan='\033[1;96m' # Cyan +BIWhite='\033[1;97m' # White + +noColor(){ +# Reset +Color_Off="" + +# Regular Colors +Black="" +Red="" +Green="" +Yellow="" +Blue="" +Purple="" +Cyan="" +White="" + +# Bold +BBlack="" +BRed="" +BGreen="" +BYellow="" +BBlue="" +BPurple="" +BCyan="" +BWhite="" + +# Underline +UBlack="" +URed="" +UGreen="" +UYellow="" +UBlue="" +UPurple="" +UCyan="" +UWhite="" + +# High Intensity +IBlack="" +IRed="" +IGreen="" +IYellow="" +IBlue="" +IPurple="" +ICyan="" +IWhite="" + + +# Bold High Intensity +BIBlack="" +BIRed="" +BIGreen="" +BIYellow="" +BIBlue="" +BIPurple="" +BICyan="" +BIWhite="" + } + export -f noColor diff --git a/includes/dns.sh b/includes/dns.sh new file mode 100644 index 00000000..0e12e90a --- /dev/null +++ b/includes/dns.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +dns(){ + echo -e "${BWhite}Service DNS Names Tool${Color_Off}" +clear -x +echo "Generating Internal Service DNS Names..." +#ignored dependency pods, may need to add more in the future. +dep_ignore="\-cronjob\-|^kube-system|\ssvclb|NAME|\-memcached\-.[^custom\-app]|\-postgresql\-.[^custom\-app]|\-redis\-.[^custom\-app]|\-mariadb\-.[^custom\-app]|\-promtail\-.[^custom\-app]" + +# Pulling pod names +mapfile -t main < <(k3s kubectl get pods -A | grep -Ev "$dep_ignore" | sort) + +# Pulling all ports +all_ports=$(k3s kubectl get service -A) + +clear -x +count=0 +for i in "${main[@]}" +do + [[ count -le 0 ]] && echo -e "\n" && ((count++)) + appName=$(echo "$i" | awk '{print $2}' | sed 's/-[^-]*-[^-]*$//' | sed 's/-0//') + ixName=$(echo "$i" | awk '{print $1}') + port=$(echo "$all_ports" | grep -E "\s$appName\s" | awk '{print $6}' | grep -Eo "^[[:digit:]]+{1}") + [[ -n "$port" ]] && echo -e "$appName.$ixName.svc.cluster.local $port" +done | uniq | nl -b t | sed 's/\s\s\s$/- -------- ----/' | column -t -R 1 -N "#,DNS_Name,Port" -L +} +export -f dns diff --git a/includes/help.sh b/includes/help.sh new file mode 100644 index 00000000..a31cd4fc --- /dev/null +++ b/includes/help.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +help(){ +[[ $help == "true" ]] && clear -x +echo "" +echo -e "${BWhite}Basic Utilities${Color_Off}" +echo "--mount | Initiates mounting feature, choose between unmounting and mounting PVC data" +echo "--restore | Opens a menu to restore a \"truetool\" backup that was taken on your \"ix-applications\" dataset" +echo "--delete-backup | Opens a menu to delete backups on your system" +echo "--list-backups | Prints a list of backups available" +echo "--helm-enable | Enables Helm command access on SCALE" +echo "--apt-enable | Enables Apt command access on SCALE" +echo "--kubeapi-enable | Enables external access to Kuberntes API port" +echo "--dns | List all of your applications DNS names and their web ports" +echo +echo -e "${BWhite}Update Options${Color_Off}" +echo "-U | Update all applications, ignores versions" +echo "-u | Update all applications, does not update Major releases" +echo "-b | Back-up your ix-applications dataset, specify a number after -b" +echo "-i | Add application to ignore list, one by one, see example below." +echo "-v | verbose output" +echo "-t | Set a custom timeout in seconds when checking if either an App or Mountpoint correctly Started, Stopped or (un)Mounted. Defaults to 500 seconds" +echo "-s | sync catalog" +echo "-p | Prune unused/old docker images" +echo +echo -e "${BWhite}Examples${Color_Off}" +echo "bash truetool.sh -b 14 -i portainer -i arch -i sonarr -i radarr -t 600 -vsUp" +echo "bash /mnt/tank/scripts/truetool.sh -t 150 --mount" +echo "bash /mnt/tank/scripts/truetool.sh --dns" +echo "bash /mnt/tank/scripts/truetool.sh --restore" +echo "bash /mnt/tank/scripts/truetool.sh --delete-backup" +echo +exit +} +export -f help diff --git a/includes/mount.sh b/includes/mount.sh new file mode 100644 index 00000000..7d5a6019 --- /dev/null +++ b/includes/mount.sh @@ -0,0 +1,57 @@ +#!/bin/bash + +mountPVC(){ +echo -e "${BWhite}PVC Mounting Tool${Color_Off}" +clear -x +title +echo -e "1 Mount\n2 Unmount All" && read -rt 600 -p "Please type a number: " selection +[[ -z "$selection" ]] && echo "Your selection cannot be empty" && exit #Check for valid selection. If none, kill script +if [[ $selection == "1" ]]; then + list=$(k3s kubectl get pvc -A | sort -u | awk '{print NR-1, "\t" $1 "\t" $2 "\t" $4}' | column -t | sed "s/^0/ /") + echo "$list" && read -rt 120 -p "Please type a number: " selection + [[ -z "$selection" ]] && echo "Your selection cannot be empty" && exit #Check for valid selection. If none, kill script + app=$(echo -e "$list" | grep ^"$selection " | awk '{print $2}' | cut -c 4- ) + [[ -z "$app" ]] && echo "Invalid Selection: $selection, was not an option" && exit #Check for valid selection. If none, kill script + pvc=$(echo -e "$list" | grep ^"$selection ") + status=$(cli -m csv -c 'app chart_release query name,status' | grep -E "^$app\b" | awk -F ',' '{print $2}'| tr -d " \t\n\r") + if [[ "$status" != "STOPPED" ]]; then + [[ -z $timeout ]] && echo -e "\nDefault Timeout: 500" && timeout=500 || echo -e "\nCustom Timeout: $timeout" + SECONDS=0 && echo -e "\nScaling down $app" && midclt call chart.release.scale "$app" '{"replica_count": 0}' &> /dev/null + else + echo -e "\n$app is already stopped" + fi + while [[ "$SECONDS" -le "$timeout" && "$status" != "STOPPED" ]] + do + status=$(cli -m csv -c 'app chart_release query name,status' | grep -E "^$app\b" | awk -F ',' '{print $2}'| tr -d " \t\n\r") + echo -e "Waiting $((timeout-SECONDS)) more seconds for $app to be STOPPED" && sleep 5 + done + data_name=$(echo "$pvc" | awk '{print $3}') + volume_name=$(echo "$pvc" | awk '{print $4}') + full_path=$(zfs list | grep "$volume_name" | awk '{print $1}') + echo -e "\nMounting\n$full_path\nTo\n/mnt/truetool/$data_name" && zfs set mountpoint="/truetool/$data_name" "$full_path" && echo -e "Mounted, Use the Unmount All option to unmount\n" + exit +elif [[ $selection == "2" ]]; then + mapfile -t unmount_array < <(basename -a /mnt/truetool/* | sed "s/*//") + [[ -z ${unmount_array[*]} ]] && echo "Theres nothing to unmount" && exit + for i in "${unmount_array[@]}" + do + main=$(k3s kubectl get pvc -A | grep -E "\s$i\s" | awk '{print $1, $2, $4}') + app=$(echo "$main" | awk '{print $1}' | cut -c 4-) + pvc=$(echo "$main" | awk '{print $3}') + mapfile -t path < <(find /mnt/*/ix-applications/releases/"$app"/volumes/ -maxdepth 0 | cut -c 6-) + if [[ "${#path[@]}" -gt 1 ]]; then #if there is another app with the same name on another pool, use the current pools application, since the other instance is probably old, or unused. + echo "$i is a name used on more than one pool.. attempting to use your current kubernetes apps pool" + pool=$(cli -c 'app kubernetes config' | grep -E "dataset\s\|" | awk -F '|' '{print $3}' | awk -F '/' '{print $1}' | tr -d " \t\n\r") + full_path=$(find /mnt/"$pool"/ix-applications/releases/"$app"/volumes/ -maxdepth 0 | cut -c 6-) + zfs set mountpoint=legacy "$full_path""$pvc" && echo "$i unmounted" && rmdir /mnt/truetool/"$i" || echo "${IRed}FAILED${Color_Off} to unmount $i" + else + # shellcheck disable=SC2128 + zfs set mountpoint=legacy "$path""$pvc" && echo "$i unmounted" && rmdir /mnt/truetool/"$i" || echo "${IRed}FAILED${Color_Off} to unmount $i" + fi + done + rmdir /mnt/truetool +else + echo -e "${IRed}Invalid selection, \"$selection\" was not an option${Color_Off}" +fi +} +export -f mountPVC diff --git a/includes/no_args.sh b/includes/no_args.sh new file mode 100644 index 00000000..9ff0f3c0 --- /dev/null +++ b/includes/no_args.sh @@ -0,0 +1,72 @@ +#!/bin/bash +# shellcheck disable=SC2034 + +no_args(){ + echo "0 Show Help" + echo "1 List Internal Service DNS Names" + echo "2 Mount and Unmount PVC storage for easy access" + echo "3 List Backups" + echo "4 Create a Backup" + echo "5 Restore a Backup" + echo "6 Delete a Backup" + echo "7 Enable Helm Commands" + echo "8 Enable Apt and Apt-Get Commands" + echo "9 Update All Apps" + echo "10 Enable external access to Kuberntes API port" + read -rt 600 -p "Please select an option by number: " selection + + case $selection in + 0) + help="true" + ;; + 1) + dns="true" + ;; + 2) + mountPVC="true" + ;; + 3) + listBackups="true" + ;; + 4) + read -rt 600 -p "Please type the max number of backups to keep: " backups + re='^[0-9]+$' + number_of_backups=$backups + ! [[ $backups =~ $re ]] && echo -e "Error: -b needs to be assigned an interger\n\"""$number_of_backups""\" is not an interger" >&2 && exit + [[ "$number_of_backups" -le 0 ]] && echo "Error: Number of backups is required to be at least 1" && exit + ;; + 5) + restore="true" + ;; + 6) + deleteBackup="true" + ;; + 7) + helmEnable="true" + ;; + 8) + aptEnable="true" + ;; + 9) + echo "" + echo "1 Update Apps Excluding likely breaking major changes" + echo "2 Update Apps Including likely breaking major changes" + read -rt 600 -p "Please select an option by number: " updateType + if [[ "$updateType" == "1" ]]; then + update_apps="true" + elif [[ "$updateType" == "2" ]]; then + update_all_apps="true" + else + echo "INVALID ENTRY" && exit 1 + fi + ;; + 10) + kubeapiEnable="true" + ;; + *) + echo "Unknown option" && exit 1 + ;; + esac + echo "" +} +export -f no_args diff --git a/includes/patch.sh b/includes/patch.sh new file mode 100644 index 00000000..82393dea --- /dev/null +++ b/includes/patch.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +patchv22120(){ +echo "Applying 22.12 HotPatch 1" +( wget -q -P /tmp https://github.com/truecharts/truetool/raw/main/hotpatch/2212/HP1.patch && echo "download completed" || echo "download failed" ) && ( patch -N -s -p0 -d /usr/lib/python3/dist-packages/middlewared/ < /tmp/HP1.patch && service middlewared restart && echo "waiting 20 seconds for middleware restart..." && sleep 20 && echo "patch completed" || echo "patch failed or skipped, not critical" ) && rm -rf /tmp/HP1.patch +echo "Applying 22.12 HotPatch 2" +( wget -q -P /tmp https://github.com/truecharts/truetool/raw/main/hotpatch/2212/HP2.patch && echo "download completed" || echo "download failed" ) && ( patch -N -s -p0 -d /usr/lib/python3/dist-packages/middlewared/ < /tmp/HP2.patch && service middlewared restart && echo "waiting 20 seconds for middleware restart..." && sleep 20 && echo "patch completed" || echo "patch failed or skipped, not critical" ) && rm -rf /tmp/HP2.patch +} +export -f patchv22120 + + +hotpatch(){ +echo "Starting hotpatcher..." +if [ "$(cli -m csv -c 'system version' | awk -F '-' '{print $3}')" == "22.12.0" ]; then + patchv22120 +fi +} +export -f hotpatch diff --git a/includes/title.sh b/includes/title.sh new file mode 100644 index 00000000..b6c9e740 --- /dev/null +++ b/includes/title.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +# Fancy ascii title. +title(){ +if [[ -z $titleShown ]]; then + echo -e "${IRed} _______ _____ _ _ "; + echo " |__ __| / ____| | | | "; + echo " | |_ __ _ _ ___| | | |__ __ _ _ __| |_ ___ "; + echo -e "${IYellow} | | '__| | | |/ _ \ | | '_ \ / _\` | '__| __/ __|"; + echo " | | | | |_| | __/ |____| | | | (_| | | | |_\__ \\"; + echo -e "${IGreen} __|_|_| \__,_|\___|\_____|_| |_|\__,_|_| \__|___/"; + echo " |__ __| |__ __| | | "; + echo -e "${IBlue} | |_ __ _ _ ___| | ___ ___ | | "; + echo " | | '__| | | |/ _ \ |/ _ \ / _ \| | "; + echo -e "${IPurple} | | | | |_| | __/ | (_) | (_) | | "; + echo " |_|_| \__,_|\___|_|\___/ \___/|_| "; + echo " "; + echo -e "${Color_Off} "; +fi +titleShown='true' +} +export -f title diff --git a/includes/update.sh b/includes/update.sh new file mode 100644 index 00000000..0aaa7506 --- /dev/null +++ b/includes/update.sh @@ -0,0 +1,123 @@ +#!/bin/bash + +update_apps(){ +echo -e "${BWhite}App Updater${Color_Off}" +[[ -z $timeout ]] && echo -e "Default Timeout: 500" && timeout=500 || echo -e "\nCustom Timeout: $timeout" +[[ "$timeout" -le 120 ]] && echo "Warning: Your timeout is set low and may lead to premature rollbacks or skips" + +echo "" +echo "Creating list of Apps to update..." + +# Render a list of ignored applications, so users can verify their ignores got parsed correctly. +if [[ -z ${ignore[*]} ]]; then + echo "No apps added to ignore list, continuing..." +else + echo "ignored applications:" + for ignored in "${ignore[@]}" + do + echo "${ignored}" + done +fi +echo "" + +mapfile -t array < <(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,container_images_update_available,status' | grep -E ",true(,|$)" | sort) +[[ -z ${array[*]} ]] && echo -e "\nThere are no updates available or middleware timed out" && return 0 || echo -e "\n${#array[@]} update(s) available:" +PIDlist=() + +# Draft a list of app names, seperate from actuall execution +# This prevents outputs getting mixed together +for i in "${array[@]}" +do + app_name=$(echo "$i" | awk -F ',' '{print $1}') #print out first catagory, name. + echo "$app_name" +done + +echo "" +echo "Updating Apps..." + +# Create a background task for each update as async solution +for i in "${array[@]}" +do + executeUpdate "${i}" & + PIDlist+=($!) +done +echo "" +echo "Waiting for update results..." + +# Wait for all the async updates to complete +for p in "${PIDlist[@]}" +do + wait "${p}" ||: +done + +} +export -f update_apps + + + +# This is a combination of stopping previously-stopped apps and apps stuck Deploying after update +after_update_actions(){ +SECONDS=0 +count=0 +sleep 15 + +# Keep this running and exit the endless-loop based on a timer, instead of a countered-while-loop +# shellcheck disable=SC2050 +while [[ "0" != "1" ]] +do + (( count++ )) + status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep "^$app_name," | awk -F ',' '{print $2}') + if [[ "$status" == "ACTIVE" && "$startstatus" == "STOPPED" ]]; then + [[ "$verbose" == "true" ]] && echo "Returing to STOPPED state.." + midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null && echo "Stopped"|| echo "FAILED" + break + elif [[ "$SECONDS" -ge "$timeout" && "$status" == "DEPLOYING" && "$failed" != "true" ]]; then + echo -e "Error: Run Time($SECONDS) for $app_name has exceeded Timeout($timeout)\nIf this is a slow starting application, set a higher timeout with -t\nIf this applicaion is always DEPLOYING, you can disable all probes under the Healthcheck Probes Liveness section in the edit configuration\nReverting update.." + midclt call chart.release.rollback "$app_name" "{\"item_version\": \"$rollback_version\"}" &> /dev/null + [[ "$startstatus" == "STOPPED" ]] && failed="true" && after_update_actions && unset failed #run back after_update_actions function if the app was stopped prior to update + break + elif [[ "$SECONDS" -ge "$timeout" && "$status" == "DEPLOYING" && "$failed" == "true" ]]; then + echo -e "Error: Run Time($SECONDS) for $app_name has exceeded Timeout($timeout)\nThe application failed to be ACTIVE even after a rollback,\nManual intervention is required\nAbandoning" + break + elif [[ "$status" == "STOPPED" ]]; then + [[ "$count" -le 1 && "$verbose" == "true" ]] && echo "Verifying Stopped.." && sleep 15 && continue #if reports stopped on FIRST time through loop, double check + [[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports stopped on FIRST time through loop, double check + echo "Stopped" && break #if reports stopped any time after the first loop, assume its extermal services. + elif [[ "$status" == "ACTIVE" ]]; then + [[ "$count" -le 1 && "$verbose" == "true" ]] && echo "Verifying Active.." && sleep 15 && continue #if reports active on FIRST time through loop, double check + [[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports active on FIRST time through loop, double check + echo "Active" && break #if reports active any time after the first loop, assume actually active. + else + [[ "$verbose" == "true" ]] && echo "Waiting $((timeout-SECONDS)) more seconds for $app_name to be ACTIVE" + sleep 15 + continue + fi +done +} +export -f after_update_actions + +# Determine what all the required information for the App to update, check it and execute the update using the SCALE API +executeUpdate(){ + app_name=$(echo "$1" | awk -F ',' '{print $1}') #print out first catagory, name. + old_app_ver=$(echo "$1" | awk -F ',' '{print $4}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #previous/current Application MAJOR Version + new_app_ver=$(echo "$1" | awk -F ',' '{print $5}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #new Application MAJOR Version + old_chart_ver=$(echo "$1" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}' | awk -F '.' '{print $1}') # Old Chart MAJOR version + new_chart_ver=$(echo "$1" | awk -F ',' '{print $5}' | awk -F '_' '{print $2}' | awk -F '.' '{print $1}') # New Chart MAJOR version + status=$(echo "$1" | awk -F ',' '{print $2}') #status of the app: STOPPED / DEPLOYING / ACTIVE + startstatus=$status + diff_app=$(diff <(echo "$old_app_ver") <(echo "$new_app_ver")) #caluclating difference in major app versions + diff_chart=$(diff <(echo "$old_chart_ver") <(echo "$new_chart_ver")) #caluclating difference in Chart versions + old_full_ver=$(echo "$1" | awk -F ',' '{print $4}') #Upgraded From + new_full_ver=$(echo "$1" | awk -F ',' '{print $5}') #Upraded To + rollback_version=$(echo "$1" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}') + printf '%s\0' "${ignore[@]}" | grep -iFxqz "${app_name}" && echo -e "\n$app_name\nIgnored, skipping" && return #If application is on ignore list, skip + if [[ "$diff_app" == "$diff_chart" || "$update_all_apps" == "true" ]]; then #continue to update + [[ "$verbose" == "true" ]] && echo "Updating.." + # shellcheck disable=SC2015 + cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo -e "Updated $app_name\n$old_full_ver\n$new_full_ver" && after_update_actions || { echo -e "$app_name: update ${IRed}FAILED${Color_Off}"; return; } + else + echo -e "\n$app_name\nMajor Release, update manually" + return + fi +} +export -f executeUpdate diff --git a/includes/update_self.sh b/includes/update_self.sh new file mode 100644 index 00000000..7ade24e2 --- /dev/null +++ b/includes/update_self.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +## AutoUpdate TrueTool using Git +updater(){ +echo -e "${BWhite}Checking for updates...${Color_Off}" +git remote set-url origin "${targetRepo}" +BRANCH=$(git rev-parse --abbrev-ref HEAD) +git fetch -q +git update-index -q --refresh +if [[ $(git status --branch --porcelain) == *"behind"* ]]; then + echo -e "${IPurple}TrueTool requires update${Color_Off}" + git reset --hard -q + git checkout -q "${BRANCH}" + git pull -q + echo "script updated" + if [[ "$CHANGED" == "true" ]]; then + echo "LOOP DETECTED, exiting" + exit 1 + else + echo "restarting script after update..." + export CHANGED="true" + . "${SCRIPT_DIR}/truetool.sh" "$@" + exit + fi +else + echo -e "${IGreen}script up-to-date${Color_Off}" + export CHANGED="false" +fi +echo "" +} +export -f updater diff --git a/truetool.sh b/truetool.sh new file mode 100644 index 00000000..6e03990f --- /dev/null +++ b/truetool.sh @@ -0,0 +1,179 @@ +#!/bin/bash + +# Constants +SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]:-$0}"; )" &> /dev/null && pwd 2> /dev/null; )"; +dir=$(basename "$SCRIPT_DIR") + +# Change this if you want to fork the project +enableUpdate="true" +targetRepo="https://github.com/truecharts/truetool.git" + +# CD to the folder containing the script to ensure consistent runs +cd "${SCRIPT_DIR}" || echo -e "ERROR: Something went wrong accessing the script directory" + +# Includes +# shellcheck source=includes/backup.sh +source includes/backup.sh +# shellcheck source=includes/chores.sh +source includes/chores.sh +# shellcheck source=includes/colors.sh +source includes/colors.sh +# shellcheck source=includes/dns.sh +source includes/dns.sh +# shellcheck source=includes/help.sh +source includes/help.sh +# shellcheck source=includes/help.sh +source includes/patch.sh +# shellcheck source=includes/mount.sh +source includes/mount.sh +# shellcheck source=includes/no_args.sh +source includes/no_args.sh +# shellcheck source=includes/title.sh +source includes/title.sh +# shellcheck source=includes/update.sh +source includes/update.sh +# shellcheck source=includes/update_self.sh +source includes/update_self.sh + +#If no argument is passed, set flag to show menu +if [[ -z "$*" || "-" == "$*" || "--" == "$*" ]]; then + no_args="true" +else + + # Parse script options + while getopts ":si:b:t:uUpSv-:" opt + do + case $opt in + -) + case "${OPTARG}" in + help) + help="true" + ;; + dns) + dns="true" + ;; + mount) + mountPVC="true" + ;; + restore) + restore="true" + ;; + delete-backup) + deleteBackup="true" + ;; + list-backups) + listBackups="true" + ;; + helm-enable) + helmEnable="true" + ;; + apt-enable) + aptEnable="true" + ;; + kubeapi-enable) + kubeapiEnable="true" + ;; + no-color) + noColor + ;; + *) + echo -e "Invalid Option \"--$OPTARG\"\n" && help + exit + ;; + esac + ;; + \?) + echo -e "Invalid Option \"-$OPTARG\"\n" && help + exit + ;; + :) + echo -e "Option: \"-$OPTARG\" requires an argument\n" && help + exit + ;; + b) + re='^[0-9]+$' + number_of_backups=$OPTARG + ! [[ $OPTARG =~ $re ]] && echo -e "Error: -b needs to be assigned an interger\n\"""$number_of_backups""\" is not an interger" >&2 && exit + [[ "$number_of_backups" -le 0 ]] && echo "Error: Number of backups is required to be at least 1" && exit + ;; + i) + ignore+=("$OPTARG") + ;; + t) + re='^[0-9]+$' + timeout=$OPTARG + ! [[ $timeout =~ $re ]] && echo -e "Error: -t needs to be assigned an interger\n\"""$timeout""\" is not an interger" >&2 && exit + ;; + s) + sync="true" + ;; + U) + update_all_apps="true" + ;; + u) + update_apps="true" + ;; + p) + prune="true" + ;; + v) + verbose="true" + ;; + *) + echo -e "Invalid Option \"--$OPTARG\"\n" && help + exit + ;; + esac + done +fi + +title + +[[ "$enableUpdate" == "true" ]] && updater "$@" + +## Always check if a hotpatch needs to be applied +hotpatch + +# Show menu if menu flag is set +if [[ "$no_args" == "true" ]]; then + no_args +fi + +## Exit if incompatable functions are called +[[ "$update_all_apps" == "true" && "$update_apps" == "true" ]] && echo -e "-U and -u cannot BOTH be called" && exit + +## Exit if unsafe combinations are used +# Restore and update right after eachother, might cause super weird issues tha are hard to bugtrace +[[ ( "$update_all_apps" == "true" || "$update_apps" == "true" ) && ( "$restore" == "true" ) ]] && echo -e "Update and Restore cannot both be done in the same run..." && exit + +# Backup Deletion is generally considered to be a "once in a while" thing and not great to sync with automated updates for that reason +[[ ( "$update_all_apps" == "true" || "$update_apps" == "true" ) && ( "$deleteBackup" == "true" ) ]] && echo -e "Update Backup-Deletion cannot both be done in the same run..." && exit + +# Backup Deletion is generally considered to be a "once in a while" thing and not great to sync with automated updates for that reason +[[ ( "$update_all_apps" == "true" || "$update_apps" == "true" ) && ( "$deleteBackup" == "true" ) ]] && echo -e "Update and Backup-Deletion cannot both be done in the same run..." && exit + +# Backup listing is a printout, which would either clutter the output or be already outdated when combined with backup +[[ ( "$update_all_apps" == "true" || "$update_apps" == "true" ) && ( "$listBackups" == "true" ) ]] && echo -e "Update and Listing Backups cannot both be done in the same run..." && exit + +# Backup backup would be done after a backup is restored, which would lead to a backup that is... the same as the one restored... +[[ ( "$restore" == "true" && "$number_of_backups" -ge 1 )]] && echo -e "Restoring a backup and making a backup cannot both be done in the same run..." && exit + +# While technically possible, this is asking for user error... where a user by habit mistakes one prompt, for the other. +[[ ( "$restore" == "true" && "$deleteBackup" == "true" )]] && echo -e "restoring a backup and deleting a backup cannot both be done in the same run..." && exit + + +# Continue to call functions in specific order +[[ "$help" == "true" ]] && help +[[ "$helmEnable" == "true" ]] && helmEnable +[[ "$aptEnable" == "true" ]] && aptEnable +[[ "$kubeapiEnable" == "true" ]] && kubeapiEnable +[[ "$aptEnable" == "true" || "$helmEnable" == "true" || "$kubeapiEnable" == "true" ]] && exit +[[ "$listBackups" == "true" ]] && listBackups && exit +[[ "$deleteBackup" == "true" ]] && deleteBackup && exit +[[ "$dns" == "true" ]] && dns && exit +[[ "$restore" == "true" ]] && restore && exit +[[ "$mountPVC" == "true" ]] && mountPVC && exit +[[ "$number_of_backups" -ge 1 ]] && backup +[[ "$sync" == "true" ]] && sync +[[ "$update_all_apps" == "true" || "$update_apps" == "true" ]] && update_apps +[[ "$prune" == "true" ]] && prune From 664fc455db606bd1df0361d010e64b4cac9e3e73 Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Tue, 27 Dec 2022 11:56:40 +0100 Subject: [PATCH 1129/1229] remove unused folder --- patches/backups.patch | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 patches/backups.patch diff --git a/patches/backups.patch b/patches/backups.patch deleted file mode 100644 index 3ce5de06..00000000 --- a/patches/backups.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- /usr/lib/python3/dist-packages/middlewared/plugins/kubernetes_linux/backup.py 2022-12-13 05:32:23.000000000 -0700 -+++ backups.patch 2022-12-26 14:14:25.075037767 -0700 -@@ -61,7 +61,8 @@ - ['metadata.namespace', '=', chart_release['namespace']] - ] - ) -- for secret in sorted(secrets, key=lambda d: d['metadata']['name']): -+ # We ignore this keeping in line with helm behaviour where the secret malformed is ignored by helm -+ for secret in sorted(filter(lambda d: d.get('data'), secrets), key=lambda d: d['metadata']['name']): - with open(os.path.join(secrets_dir, secret['metadata']['name']), 'w') as f: - f.write(self.middleware.call_sync('k8s.secret.export_to_yaml_internal', secret)) \ No newline at end of file From a58d53ac4ee50ed3c28cc1ba77a366f173efa08e Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Tue, 27 Dec 2022 11:57:57 +0100 Subject: [PATCH 1130/1229] add license to Heavyscript functions --- functions/LICENSE | 674 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 674 insertions(+) create mode 100644 functions/LICENSE diff --git a/functions/LICENSE b/functions/LICENSE new file mode 100644 index 00000000..f288702d --- /dev/null +++ b/functions/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. From 407ebddbca345bf311b4159b17002427e6c95541 Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Tue, 27 Dec 2022 12:02:56 +0100 Subject: [PATCH 1131/1229] run pre-commit --- functions/backup.sh | 14 +++++++------- functions/cmd_to_container.sh | 6 +++--- functions/dns.sh | 2 +- functions/menu.sh | 8 ++++---- functions/misc.sh | 11 +++++------ functions/mount.sh | 16 ++++++++-------- functions/script_create.sh | 18 +++++++++--------- functions/self_update.sh | 8 ++++---- functions/update_apps.sh | 28 ++++++++++++++-------------- heavy_script.sh | 8 ++++---- 10 files changed, 59 insertions(+), 60 deletions(-) diff --git a/functions/backup.sh b/functions/backup.sh index 3a2e9b71..f0c2baf6 100644 --- a/functions/backup.sh +++ b/functions/backup.sh @@ -19,7 +19,7 @@ if [[ ${#list_backups[@]} -gt "$number_of_backups" ]]; then done fi -#Dump the echo_array, ensures all output is in a neat order. +#Dump the echo_array, ensures all output is in a neat order. for i in "${echo_backup[@]}" do echo -e "$i" @@ -52,9 +52,9 @@ do read -rt 240 -p "Please type a number: " selection || { echo -e "\nFailed to make a selection in time" ; exit; } restore_point=$(echo "$list_backups" | grep ^"$selection)" | awk '{print $2}') if [[ $selection == 0 ]]; then - echo "Exiting.." + echo "Exiting.." exit - elif [[ -z "$selection" ]]; then + elif [[ -z "$selection" ]]; then echo "Your selection cannot be empty" sleep 3 continue @@ -70,7 +70,7 @@ done while true do clear -x - echo -e "WARNING:\nYou CANNOT go back after deleting your restore point" + echo -e "WARNING:\nYou CANNOT go back after deleting your restore point" echo -e "\n\nYou have chosen:\n$restore_point\n\n" read -rt 120 -p "Would you like to proceed with deletion? (y/N): " yesno || { echo -e "\nFailed to make a selection in time" ; exit; } case $yesno in @@ -104,7 +104,7 @@ do exit ;; *) - echo "$yesno was not an option, try again" + echo "$yesno was not an option, try again" sleep 2 continue ;; @@ -136,9 +136,9 @@ do read -rt 240 -p "Please type a number: " selection || { echo -e "\nFailed to make a selection in time" ; exit; } restore_point=$(echo "$list_backups" | grep ^"$selection)" | awk '{print $2}') if [[ $selection == 0 ]]; then - echo "Exiting.." + echo "Exiting.." exit - elif [[ -z "$selection" ]]; then + elif [[ -z "$selection" ]]; then echo "Your selection cannot be empty" sleep 3 continue diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index e6f36f48..a9a4132e 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -6,7 +6,7 @@ app_name=$(k3s crictl pods -s ready --namespace ix | sed -E 's/[[:space:]]([0-9] while true do clear -x - title + title echo "Command to Container Menu" echo "-------------------------" echo "$app_name" @@ -92,7 +92,7 @@ do exit ;; 1) - clear -x + clear -x title read -rt 500 -p "What command do you want to run?: " command || { echo -e "\nFailed to make a selection in time" ; exit; } # shellcheck disable=SC2086 @@ -116,4 +116,4 @@ do done rm cont_file 2> /dev/null } -export -f cmd_to_container \ No newline at end of file +export -f cmd_to_container diff --git a/functions/dns.sh b/functions/dns.sh index ad6536d3..e628c12a 100644 --- a/functions/dns.sh +++ b/functions/dns.sh @@ -24,4 +24,4 @@ do done | nl -s ") " -b t | sed '0,/\s\s\s/{s/\s\s\s/- ---- -------- ----/}'| column -t -N "#,Name,DNS_Name,Port" rm dns_file } -export -f dns \ No newline at end of file +export -f dns diff --git a/functions/menu.sh b/functions/menu.sh index 82a04e03..8f808c57 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -28,7 +28,7 @@ case $selection in help ;; 2) - dns + dns ;; 3) mount @@ -71,7 +71,7 @@ case $selection in esac done ;; - + 5) self_update ;; @@ -84,7 +84,7 @@ case $selection in 8) patch_2212_backups ;; - 9) + 9) patch_2212_backups2 ;; *) @@ -93,4 +93,4 @@ case $selection in esac echo } -export -f menu \ No newline at end of file +export -f menu diff --git a/functions/misc.sh b/functions/misc.sh index 408fcd58..dd1ae239 100644 --- a/functions/misc.sh +++ b/functions/misc.sh @@ -2,10 +2,10 @@ sync(){ -echo_sync+=("🅂 🅈 🄽 🄲") +echo_sync+=("🅂 🅈 🄽 🄲") cli -c 'app catalog sync_all' &> /dev/null && echo_sync+=("Catalog sync complete") -#Dump the echo_array, ensures all output is in a neat order. +#Dump the echo_array, ensures all output is in a neat order. for i in "${echo_sync[@]}" do echo -e "$i" @@ -17,7 +17,7 @@ export -f sync prune(){ -echo -e "🄿 🅁 🅄 🄽 🄴" +echo -e "🄿 🅁 🅄 🄽 🄴" version="$(cli -c 'system version' | awk -F '-' '{print $3}' | awk -F '.' '{print $1 $2}' | tr -d " \t\r\.")" if (( "$version" >= 2212 )); then if ! cli -c 'app container config prune prune_options={"remove_unused_images": true, "remove_stopped_containers": true}' | head -n -4; then @@ -170,7 +170,7 @@ do continue ;; esac -done +done } @@ -228,6 +228,5 @@ do continue ;; esac -done +done } - diff --git a/functions/mount.sh b/functions/mount.sh index 7badfc58..371c98d7 100644 --- a/functions/mount.sh +++ b/functions/mount.sh @@ -28,15 +28,15 @@ do do clear -x title - echo "$list" - echo + echo "$list" + echo echo "0) Exit" read -rt 120 -p "Please type a number: " selection || { echo -e "\nFailed to make a selection in time" ; exit; } - + #Check for valid selection. If no issues, continue [[ $selection == 0 ]] && echo "Exiting.." && exit app=$(echo -e "$list" | grep ^"$selection)" | awk '{print $2}' | cut -c 4- ) - [[ -z "$app" ]] && echo "Invalid Selection: $selection, was not an option" && sleep 3 && continue + [[ -z "$app" ]] && echo "Invalid Selection: $selection, was not an option" && sleep 3 && continue pvc=$(echo -e "$list" | grep ^"$selection)") #Stop applicaiton if not stopped @@ -64,7 +64,7 @@ do echo -e "\nMounted\n$data_name" fi echo -e "\nUnmount with:\nzfs set mountpoint=legacy $full_path && rmdir /mnt/heavyscript/$data_name\n\nOr use the Unmount All option\n" - + #Ask if user would like to mount something else while true do @@ -80,7 +80,7 @@ do exit ;; *) - echo "Invalid selection \"$yesno\" was not an option" + echo "Invalid selection \"$yesno\" was not an option" sleep 3 continue ;; @@ -97,7 +97,7 @@ do app=$(echo "$main" | awk '{print $1}' | cut -c 4-) pvc=$(echo "$main" | awk '{print $3}') full_path=$(find /mnt/"$pool"/ix-applications/releases/"$app"/volumes/ -maxdepth 0 | cut -c 6-) - zfs set mountpoint=legacy "$full_path""$pvc" + zfs set mountpoint=legacy "$full_path""$pvc" echo "$i unmounted" && rmdir /mnt/heavyscript/"$i" || echo "failed to unmount $i" done rmdir /mnt/heavyscript @@ -111,4 +111,4 @@ do esac done } -export -f mount \ No newline at end of file +export -f mount diff --git a/functions/script_create.sh b/functions/script_create.sh index 63802e63..3f1c26e4 100644 --- a/functions/script_create.sh +++ b/functions/script_create.sh @@ -2,7 +2,7 @@ script_create(){ -while true +while true do clear -x title @@ -19,7 +19,7 @@ do echo "Exiting.." exit ;; - 1 | -U) + 1 | -U) while true do echo -e "\nHow many applications do you want updating at the same time?" @@ -69,7 +69,7 @@ do ;; esac done -while true +while true do clear -x title @@ -91,9 +91,9 @@ do echo echo "99) Remove Update Options, Restart" echo "00) Done making selections, proceed with update" - echo + echo echo "0) Exit" - echo + echo echo "Current Choices" echo "---------------" echo "bash heavy_script.sh ${update_selection[*]}" @@ -153,11 +153,11 @@ do ;; 9 | --ignore-img ) printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "--ignore-img" && echo -e "\"--ignore-img\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it - update_selection+=("--ignore-img") + update_selection+=("--ignore-img") ;; 10 | --self-update ) printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "--self-update" && echo -e "\"--self-update\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it - update_selection+=("--self-update") + update_selection+=("--self-update") ;; 99) count=2 @@ -172,9 +172,9 @@ do continue ;; *) - echo "\"$current_selection\" was not an option, try again" && sleep 3 && continue + echo "\"$current_selection\" was not an option, try again" && sleep 3 && continue ;; esac done } -export -f script_create \ No newline at end of file +export -f script_create diff --git a/functions/self_update.sh b/functions/self_update.sh index e06b2dc9..32795d01 100644 --- a/functions/self_update.sh +++ b/functions/self_update.sh @@ -11,7 +11,7 @@ echo "🅂 🄴 🄻 🄵" echo "🅄 🄿 🄳 🄰 🅃 🄴" if [[ "$hs_version" != "$latest_ver" ]] ; then echo "Found a new version of HeavyScript, updating myself..." - git checkout "$latest_ver" &>/dev/null + git checkout "$latest_ver" &>/dev/null count=0 for i in "${args[@]}" do @@ -22,16 +22,16 @@ if [[ "$hs_version" != "$latest_ver" ]] ; then echo "Updating To: $latest_ver" echo "Changelog:" curl --silent "https://api.github.com/repos/HeavyBullets8/heavy_script/releases/latest" | jq -r .body - echo + echo [[ -z ${args[*]} ]] && echo -e "No more arguments, exiting..\n\n" && exit echo -e "Running the new version...\n\n" sleep 5 exec bash "$script_name" "${args[@]}" # Now exit this old instance exit -else +else echo "HeavyScript is already the latest version:" echo -e "$hs_version\n\n" fi } -export -f self_update \ No newline at end of file +export -f self_update diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 9f54bb33..6ad0d59f 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -38,7 +38,7 @@ do if [[ "$failed_ver" == "$new_full_ver" ]] ; then echo -e "\n$app_name\nSkipping previously failed version:\n$new_full_ver" unset "array[$index]" - else + else sed -i /"$app_name",/d failed fi #Skip Image updates if ignore image updates is set to true @@ -59,7 +59,7 @@ rm finished 2>/dev/null while [[ ${#processes[@]} != 0 || $(wc -l finished 2>/dev/null | awk '{ print $1 }') -lt "${#array[@]}" ]] do if while_status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,container_images_update_available,status' 2>/dev/null) ; then - ((while_count++)) + ((while_count++)) [[ -z $while_status ]] && continue || echo -e "$while_count\n$while_status" > all_app_status mapfile -t deploying_check < <(grep ",DEPLOYING," all_app_status) for i in "${deploying_check[@]}" @@ -78,14 +78,14 @@ do for proc in "${processes[@]}" do kill -0 "$proc" &> /dev/null || unset "processes[$count]" - ((count++)) + ((count++)) done processes=("${processes[@]}") if [[ $index -lt ${#array[@]} && "${#processes[@]}" -lt "$update_limit" ]]; then pre_process "${array[$index]}" & processes+=($!) ((index++)) - else + else sleep 3 fi done @@ -107,7 +107,7 @@ rollback_version=$(echo "${array[$index]}" | awk -F ',' '{print $4}' | awk -F '_ # Check if app is external services, append outcome to external_services file [[ ! -e external_services ]] && touch external_services -if ! grep -qs "^$app_name," external_services ; then +if ! grep -qs "^$app_name," external_services ; then if ! grep -qs "/external-service" /mnt/"$pool"/ix-applications/releases/"$app_name"/charts/"$(find /mnt/"$pool"/ix-applications/releases/"$app_name"/charts/ -maxdepth 1 -type d -printf '%P\n' | sort -r | head -n 1)"/Chart.yaml; then echo "$app_name,false" >> external_services else @@ -178,7 +178,7 @@ count=0 if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then while true do - + # If app reports ACTIVE right away, assume its a false positive and wait for it to change, or trust it after 5 updates to all_app_status status=$(grep "^$app_name," all_app_status | awk -F ',' '{print $2}') if [[ $count -lt 1 && $status == "ACTIVE" && "$(grep "^$app_name," deploying 2>/dev/null | awk -F ',' '{print $2}')" != "DEPLOYING" ]]; then # If status shows up as Active or Stopped on the first check, verify that. Otherwise it may be a false report.. @@ -210,7 +210,7 @@ if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then break else echo_array+=("Active") - break + break fi elif [[ "$SECONDS" -ge "$timeout" ]]; then if [[ $rollback == "true" ]]; then @@ -219,14 +219,14 @@ if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then echo_array+=("Error: Run Time($SECONDS) for $app_name has exceeded Timeout($timeout)") echo_array+=("If this is a slow starting application, set a higher timeout with -t") echo_array+=("If this applicaion is always DEPLOYING, you can disable all probes under the Healthcheck Probes Liveness section in the edit configuration") - echo_array+=("Reverting update..") + echo_array+=("Reverting update..") if rollback_app ; then echo_array+=("Rolled Back") else echo_array+=("Error: Failed to rollback $app_name\nAbandoning") echo_array return 1 - fi + fi failed="true" SECONDS=0 count=0 @@ -286,7 +286,7 @@ do do sleep 1 done - else + else break fi done @@ -316,7 +316,7 @@ do break elif [[ ! $update_avail =~ "true" ]]; then break - else + else sleep 3 fi done @@ -338,7 +338,7 @@ do do sleep 1 done - else + else break fi done @@ -347,7 +347,7 @@ export -f stop_app echo_array(){ -#Dump the echo_array, ensures all output is in a neat order. +#Dump the echo_array, ensures all output is in a neat order. for i in "${echo_array[@]}" do echo -e "$i" @@ -360,4 +360,4 @@ export -f echo_array final_check(){ [[ ! -e finished ]] && touch finished echo "$app_name,finished" >> finished -} \ No newline at end of file +} diff --git a/heavy_script.sh b/heavy_script.sh index 91c0bc36..065a4c76 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -5,7 +5,7 @@ script=$(readlink -f "$0") script_path=$(dirname "$script") script_name="heavy_script.sh" -cd "$script_path" || { echo "Error: Failed to change to script directory" ; exit ; } +cd "$script_path" || { echo "Error: Failed to change to script directory" ; exit ; } #Version hs_version=$(git describe --tags) @@ -98,7 +98,7 @@ do update_limit="$nextopt" else update_limit=1 - fi + fi ;; u) update_apps="true" @@ -129,7 +129,7 @@ do done -#exit if incompatable functions are called +#exit if incompatable functions are called [[ "$update_all_apps" == "true" && "$update_apps" == "true" ]] && echo -e "-U and -u cannot BOTH be called" && exit #Continue to call functions in specific order @@ -157,5 +157,5 @@ elif [[ "$sync" == "true" && -z "$number_of_backups" ]]; then # If only sync is sync fi [[ "$update_all_apps" == "true" || "$update_apps" == "true" ]] && commander -[[ "$prune" == "true" ]] && prune +[[ "$prune" == "true" ]] && prune exit 0 From 61be5c8fdde64d1759a0fe36995684aab103bc75 Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Tue, 27 Dec 2022 12:08:15 +0100 Subject: [PATCH 1132/1229] Fix exec flags --- functions/backup.sh | 0 functions/cmd_to_container.sh | 0 functions/dns.sh | 0 functions/menu.sh | 0 functions/misc.sh | 0 functions/mount.sh | 0 functions/script_create.sh | 0 functions/self_update.sh | 0 functions/update_apps.sh | 0 heavy_script.sh | 0 includes/backup.sh | 0 includes/chores.sh | 0 includes/colors.sh | 0 includes/dns.sh | 0 includes/help.sh | 0 includes/mount.sh | 0 includes/no_args.sh | 0 includes/patch.sh | 0 includes/title.sh | 0 includes/update.sh | 0 includes/update_self.sh | 0 truetool.sh | 0 22 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 functions/backup.sh mode change 100644 => 100755 functions/cmd_to_container.sh mode change 100644 => 100755 functions/dns.sh mode change 100644 => 100755 functions/menu.sh mode change 100644 => 100755 functions/misc.sh mode change 100644 => 100755 functions/mount.sh mode change 100644 => 100755 functions/script_create.sh mode change 100644 => 100755 functions/self_update.sh mode change 100644 => 100755 functions/update_apps.sh mode change 100644 => 100755 heavy_script.sh mode change 100644 => 100755 includes/backup.sh mode change 100644 => 100755 includes/chores.sh mode change 100644 => 100755 includes/colors.sh mode change 100644 => 100755 includes/dns.sh mode change 100644 => 100755 includes/help.sh mode change 100644 => 100755 includes/mount.sh mode change 100644 => 100755 includes/no_args.sh mode change 100644 => 100755 includes/patch.sh mode change 100644 => 100755 includes/title.sh mode change 100644 => 100755 includes/update.sh mode change 100644 => 100755 includes/update_self.sh mode change 100644 => 100755 truetool.sh diff --git a/functions/backup.sh b/functions/backup.sh old mode 100644 new mode 100755 diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh old mode 100644 new mode 100755 diff --git a/functions/dns.sh b/functions/dns.sh old mode 100644 new mode 100755 diff --git a/functions/menu.sh b/functions/menu.sh old mode 100644 new mode 100755 diff --git a/functions/misc.sh b/functions/misc.sh old mode 100644 new mode 100755 diff --git a/functions/mount.sh b/functions/mount.sh old mode 100644 new mode 100755 diff --git a/functions/script_create.sh b/functions/script_create.sh old mode 100644 new mode 100755 diff --git a/functions/self_update.sh b/functions/self_update.sh old mode 100644 new mode 100755 diff --git a/functions/update_apps.sh b/functions/update_apps.sh old mode 100644 new mode 100755 diff --git a/heavy_script.sh b/heavy_script.sh old mode 100644 new mode 100755 diff --git a/includes/backup.sh b/includes/backup.sh old mode 100644 new mode 100755 diff --git a/includes/chores.sh b/includes/chores.sh old mode 100644 new mode 100755 diff --git a/includes/colors.sh b/includes/colors.sh old mode 100644 new mode 100755 diff --git a/includes/dns.sh b/includes/dns.sh old mode 100644 new mode 100755 diff --git a/includes/help.sh b/includes/help.sh old mode 100644 new mode 100755 diff --git a/includes/mount.sh b/includes/mount.sh old mode 100644 new mode 100755 diff --git a/includes/no_args.sh b/includes/no_args.sh old mode 100644 new mode 100755 diff --git a/includes/patch.sh b/includes/patch.sh old mode 100644 new mode 100755 diff --git a/includes/title.sh b/includes/title.sh old mode 100644 new mode 100755 diff --git a/includes/update.sh b/includes/update.sh old mode 100644 new mode 100755 diff --git a/includes/update_self.sh b/includes/update_self.sh old mode 100644 new mode 100755 diff --git a/truetool.sh b/truetool.sh old mode 100644 new mode 100755 From ce164b23597b7946e29203c8a0400ba53b2a03c2 Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Tue, 27 Dec 2022 12:37:53 +0100 Subject: [PATCH 1133/1229] remove unused functions --- functions/menu.sh | 96 -------------------- functions/script_create.sh | 180 ------------------------------------- functions/self_update.sh | 37 -------- 3 files changed, 313 deletions(-) delete mode 100755 functions/menu.sh delete mode 100755 functions/script_create.sh delete mode 100755 functions/self_update.sh diff --git a/functions/menu.sh b/functions/menu.sh deleted file mode 100755 index 8f808c57..00000000 --- a/functions/menu.sh +++ /dev/null @@ -1,96 +0,0 @@ -#!/bin/bash - - -menu(){ -clear -x -title -echo "Available Utilities" -echo "-------------------" -echo "1) Help" -echo "2) List DNS Names" -echo "3) Mount and Unmount PVC storage" -echo "4) Backup Options" -echo "5) Update HeavyScript" -echo "6) Update Applications" -echo "7) Command to Container" -echo "8) Patch 22.12.0" -echo "9) Patch 22.12.0 (2)" -echo -echo "0) Exit" -read -rt 120 -p "Please select an option by number: " selection || { echo -e "\nFailed to make a selection in time" ; exit; } - -case $selection in - 0) - echo "Exiting.." - exit - ;; - 1) - help - ;; - 2) - dns - ;; - 3) - mount - ;; - 4) - while [[ $backup_selection != true ]] - do - clear -x - title - echo "Backup Menu" - echo "-----------" - echo "1) Create Backup" - echo "2) Delete Backup" - echo "3) Restore Backup" - echo - echo "0) Exit" - read -rt 120 -p "Please select an option by number: " backup_selection || { echo -e "\nFailed to make a selection in time" ; exit; } - case $backup_selection in - 0) - echo "Exiting.." - exit - ;; - 1) - read -rt 120 -p "What is the maximun number of backups you would like?: " number_of_backups || { echo -e "\nFailed to make a selection in time" ; exit; } - ! [[ $number_of_backups =~ ^[0-9]+$ ]] && echo -e "Error: The input must be an interger\n\"""$number_of_backups""\" is not an interger" >&2 && exit - [[ "$number_of_backups" -le 0 ]] && echo "Error: Number of backups is required to be at least 1" && exit - backup_selection=true - ;; - 2) - backup_selection=true - deleteBackup - ;; - 3) - backup_selection=true - restore - ;; - *) - echo "\"$selection\" was not an option, please try agian" && sleep 3 && continue - ;; - esac - done - ;; - - 5) - self_update - ;; - 6) - script_create - ;; - 7) - cmd_to_container - ;; - 8) - patch_2212_backups - ;; - 9) - patch_2212_backups2 - ;; - *) - echo "\"$selection\" was not an option, please try agian" && sleep 3 && menu - ;; -esac -echo -} -export -f menu diff --git a/functions/script_create.sh b/functions/script_create.sh deleted file mode 100755 index 3f1c26e4..00000000 --- a/functions/script_create.sh +++ /dev/null @@ -1,180 +0,0 @@ -#!/bin/bash - - -script_create(){ -while true -do - clear -x - title - echo "Choose Your Update Type" - echo "-----------------------" - echo "1) -U | Update all applications, ignores versions" - echo "2) -u | Update all applications, does not update Major releases" - echo - echo "0) Exit" - echo - read -rt 120 -p "Type the Number or Flag: " current_selection || { echo -e "\nFailed to make a selection in time" ; exit; } - case $current_selection in - 0 | [Ee][Xx][Ii][Tt]) - echo "Exiting.." - exit - ;; - 1 | -U) - while true - do - echo -e "\nHow many applications do you want updating at the same time?" - read -rt 120 -p "Please type an integer greater than 0: " up_async || { echo -e "\nFailed to make a selection in time" ; exit; } - if [[ $up_async == 0 ]]; then - echo "Error: \"$up_async\" is less than 1" - echo "NOT adding it to the list" - sleep 3 - continue - elif ! [[ $up_async =~ ^[0-9]+$ ]]; then - echo "Error: \"$up_async\" is invalid, it needs to be an integer" - echo "NOT adding it to the list" - sleep 3 - continue - else - update_selection+=("-U" "$up_async") - break - fi - done - break - ;; - 2 | -u) - while true - do - echo -e "\nHow many applications do you want updating at the same time?" - read -rt 120 -p "Please type an integer greater than 0: " up_async || { echo -e "\nFailed to make a selection in time" ; exit; } - if [[ $up_async == 0 ]]; then - echo "Error: \"$up_async\" is less than 1" - echo "NOT adding it to the list" - sleep 3 - continue - elif ! [[ $up_async =~ ^[0-9]+$ ]]; then - echo "Error: \"$up_async\" is invalid, it needs to be an integer" - echo "NOT adding it to the list" - sleep 3 - continue - else - update_selection+=("-u" "$up_async") - break - fi - done - break - ;; - *) - echo "$current_selection was not an option, try again" && sleep 3 - continue - ;; - esac -done -while true -do - clear -x - title - echo "Update Options" - echo "--------------" - echo "1) -r | Roll-back applications if they fail to update" - echo "2) -i | Add application to ignore list" - echo "3) -S | Shutdown applications prior to updating" - echo "4) -v | verbose output" - echo "5) -t | Set a custom timeout in seconds when checking if either an App or Mountpoint correctly Started, Stopped or (un)Mounted. Defaults to 500 seconds" - echo - echo "Additional Options" - echo "------------------" - echo "6) -b | Back-up your ix-applications dataset" - echo "7) -s | sync catalog" - echo "8) -p | Prune unused/old docker images" - echo "9) --ignore-img | Ignore container image updates" - echo "10) --self-update | Updates HeavyScript prior to running any other commands" - echo - echo "99) Remove Update Options, Restart" - echo "00) Done making selections, proceed with update" - echo - echo "0) Exit" - echo - echo "Current Choices" - echo "---------------" - echo "bash heavy_script.sh ${update_selection[*]}" - echo - read -rt 600 -p "Type the Number or Flag: " current_selection || { echo -e "\nFailed to make a selection in time" ; exit; } - case $current_selection in - 0 | [Ee][Xx][Ii][Tt]) - echo "Exiting.." - exit - ;; - 00) - clear -x - echo "Running \"bash heavy_script.sh ${update_selection[*]}\"" - echo - exec bash "$script_name" "${update_selection[@]}" - exit - ;; - 1 | -r) - printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-r" && echo -e "\"-r\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it - update_selection+=("-r") - ;; - 2 | -i) - read -rt 120 -p "What is the name of the application we should ignore?: " up_ignore || { echo -e "\nFailed to make a selection in time" ; exit; } - ! [[ $up_ignore =~ ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ ]] && echo -e "Error: \"$up_ignore\" is not a possible option for an application name" && sleep 3 && continue - update_selection+=("-i" "$up_ignore") - ;; - 3 | -S) - printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-S" && echo -e "\"-S\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it - update_selection+=("-S") - ;; - 4 | -v) - printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-v" && echo -e "\"-v\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it - update_selection+=("-v") - ;; - 5 | -t) - printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-t" && echo -e "\"-t\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it - echo "What do you want your timeout to be?" - read -rt 120 -p "Please type an integer: " up_timeout || { echo -e "\nFailed to make a selection in time" ; exit; } - ! [[ $up_timeout =~ ^[0-9]+$ ]] && echo -e "Error: \"$up_timeout\" is invalid, it needs to be an integer\nNOT adding it to the list" && sleep 3 && continue - update_selection+=("-t" "$up_timeout") - ;; - 6 | -b) - printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-b" && echo -e "\"-b\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it - echo "Up to how many backups should we keep?" - read -rt 120 -p "Please type an integer: " up_backups || { echo -e "\nFailed to make a selection in time" ; exit; } - ! [[ $up_backups =~ ^[0-9]+$ ]] && echo -e "Error: \"$up_backups\" is invalid, it needs to be an integer\nNOT adding it to the list" && sleep 3 && continue - [[ $up_backups == 0 ]] && echo -e "Error: Number of backups cannot be 0\nNOT adding it to the list" && sleep 3 && continue - update_selection+=("-b" "$up_backups") - ;; - 7 | -s) - printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-s" && echo -e "\"-s\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it - update_selection+=("-s") - ;; - 8 | -p) - printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-p" && echo -e "\"-p\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it - update_selection+=("-p") - ;; - 9 | --ignore-img ) - printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "--ignore-img" && echo -e "\"--ignore-img\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it - update_selection+=("--ignore-img") - ;; - 10 | --self-update ) - printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "--self-update" && echo -e "\"--self-update\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it - update_selection+=("--self-update") - ;; - 99) - count=2 - echo "restarting" - for i in "${update_selection[@]:2}" - do - unset "update_selection[$count]" - echo "$i removed" - ((count++)) - done - sleep 3 - continue - ;; - *) - echo "\"$current_selection\" was not an option, try again" && sleep 3 && continue - ;; - esac -done -} -export -f script_create diff --git a/functions/self_update.sh b/functions/self_update.sh deleted file mode 100755 index 32795d01..00000000 --- a/functions/self_update.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash - - -args=("$@") -self_update() { - -git fetch --tags &>/dev/null -git reset --hard &>/dev/null -latest_ver=$(git describe --tags "$(git rev-list --tags --max-count=1)") -echo "🅂 🄴 🄻 🄵" -echo "🅄 🄿 🄳 🄰 🅃 🄴" -if [[ "$hs_version" != "$latest_ver" ]] ; then - echo "Found a new version of HeavyScript, updating myself..." - git checkout "$latest_ver" &>/dev/null - count=0 - for i in "${args[@]}" - do - [[ "$i" == "--self-update" ]] && unset "args[$count]" && break - ((count++)) - done - echo "Updating from: $hs_version" - echo "Updating To: $latest_ver" - echo "Changelog:" - curl --silent "https://api.github.com/repos/HeavyBullets8/heavy_script/releases/latest" | jq -r .body - echo - [[ -z ${args[*]} ]] && echo -e "No more arguments, exiting..\n\n" && exit - echo -e "Running the new version...\n\n" - sleep 5 - exec bash "$script_name" "${args[@]}" - # Now exit this old instance - exit -else - echo "HeavyScript is already the latest version:" - echo -e "$hs_version\n\n" -fi -} -export -f self_update From 85cbb5eb5b00055ce7137f8a48e2cd725308dc27 Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Tue, 27 Dec 2022 12:43:26 +0100 Subject: [PATCH 1134/1229] Port DNS to HeavyScript functions --- includes/dns.sh | 27 --------------------------- truetool.sh | 2 +- 2 files changed, 1 insertion(+), 28 deletions(-) delete mode 100755 includes/dns.sh diff --git a/includes/dns.sh b/includes/dns.sh deleted file mode 100755 index 0e12e90a..00000000 --- a/includes/dns.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash - -dns(){ - echo -e "${BWhite}Service DNS Names Tool${Color_Off}" -clear -x -echo "Generating Internal Service DNS Names..." -#ignored dependency pods, may need to add more in the future. -dep_ignore="\-cronjob\-|^kube-system|\ssvclb|NAME|\-memcached\-.[^custom\-app]|\-postgresql\-.[^custom\-app]|\-redis\-.[^custom\-app]|\-mariadb\-.[^custom\-app]|\-promtail\-.[^custom\-app]" - -# Pulling pod names -mapfile -t main < <(k3s kubectl get pods -A | grep -Ev "$dep_ignore" | sort) - -# Pulling all ports -all_ports=$(k3s kubectl get service -A) - -clear -x -count=0 -for i in "${main[@]}" -do - [[ count -le 0 ]] && echo -e "\n" && ((count++)) - appName=$(echo "$i" | awk '{print $2}' | sed 's/-[^-]*-[^-]*$//' | sed 's/-0//') - ixName=$(echo "$i" | awk '{print $1}') - port=$(echo "$all_ports" | grep -E "\s$appName\s" | awk '{print $6}' | grep -Eo "^[[:digit:]]+{1}") - [[ -n "$port" ]] && echo -e "$appName.$ixName.svc.cluster.local $port" -done | uniq | nl -b t | sed 's/\s\s\s$/- -------- ----/' | column -t -R 1 -N "#,DNS_Name,Port" -L -} -export -f dns diff --git a/truetool.sh b/truetool.sh index 6e03990f..e7801881 100755 --- a/truetool.sh +++ b/truetool.sh @@ -19,7 +19,7 @@ source includes/chores.sh # shellcheck source=includes/colors.sh source includes/colors.sh # shellcheck source=includes/dns.sh -source includes/dns.sh +source functions/dns.sh # shellcheck source=includes/help.sh source includes/help.sh # shellcheck source=includes/help.sh From 6fef708edcb061d8cc207961bfe85f830d21c322 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Tue, 27 Dec 2022 06:01:30 +0000 Subject: [PATCH 1135/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.74.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 0816077f..1f418ea3 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@d4496c2d9b06c4e43b227fc3f331a434e99eaef5 # v34.73.3 + uses: renovatebot/github-action@173425112e1e66409fb696205d24a3f2e4122db4 # v34.74.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 2b7e8131be8873a8c4de3befcffb36f6f12a29e2 Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Tue, 27 Dec 2022 13:03:34 +0100 Subject: [PATCH 1136/1229] remove heavyscript functions we're not going to use --- functions/misc.sh | 214 ---------------------------------------------- 1 file changed, 214 deletions(-) diff --git a/functions/misc.sh b/functions/misc.sh index dd1ae239..211c01fd 100755 --- a/functions/misc.sh +++ b/functions/misc.sh @@ -15,218 +15,4 @@ echo } export -f sync - -prune(){ -echo -e "🄿 🅁 🅄 🄽 🄴" -version="$(cli -c 'system version' | awk -F '-' '{print $3}' | awk -F '.' '{print $1 $2}' | tr -d " \t\r\.")" -if (( "$version" >= 2212 )); then - if ! cli -c 'app container config prune prune_options={"remove_unused_images": true, "remove_stopped_containers": true}' | head -n -4; then - echo "Failed to Prune Docker Images" - fi -else - if ! docker image prune -af | grep "^Total"; then - echo "Failed to Prune Docker Images" - fi -fi -} -export -f prune - - -title(){ -echo ' _ _ _____ _ _ ' -echo '| | | | / ___| (_) | | ' -echo '| |_| | ___ __ ___ ___ _\ `--. ___ _ __ _ _ __ | |_' -echo "| _ |/ _ \/ _\` \ \ / / | | |\`--. \/ __| '__| | '_ \| __|" -echo '| | | | __/ (_| |\ V /| |_| /\__/ / (__| | | | |_) | |_ ' -echo '\_| |_/\___|\__,_| \_/ \__, \____/ \___|_| |_| .__/ \__|' -echo ' __/ | | | ' -echo ' |___/ |_| ' -echo "$hs_version" -echo -} -export -f title - - -help(){ -[[ $help == "true" ]] && clear -x - -echo "Access the HeavyScript Menu" -echo "---------------------------" -echo "bash heavy_script.sh" -echo -echo "Utilities" -echo "---------" -echo "--mount | Initiates mounting feature, choose between unmounting and mounting PVC data" -echo "--restore | Opens a menu to restore a \"heavy_script\" backup that was taken on your \"ix-applications\" dataset" -echo "--delete-backup | Opens a menu to delete backups on your system" -echo "--dns | list all of your applications DNS names and their web ports" -echo "--cmd | Open a shell for one of your applications" -echo -echo "Update Types" -echo "------------" -echo "-U | Update all applications, ignores versions" -echo "-U 5 | Same as above, but updates 5 applications at one time" -echo "-u | Update all applications, does not update Major releases" -echo "-u 5 | Same as above, but updates 5 applications at one time" -echo -echo "Update Options" -echo "--------------" -echo "-r | Roll-back applications if they fail to update" -echo "-i | Add application to ignore list, one by one, see example below." -echo "-S | Shutdown applications prior to updating" -echo "-v | verbose output" -echo "-t 500| The amount of time HS will wait for an application to be ACTIVE. Defaults to 500 seconds" -echo -echo "Additional Options" -echo "------------------" -echo "-b 14 | Back-up your ix-applications dataset, specify a number after -b" -echo "-s | sync catalog" -echo "-p | Prune unused/old docker images" -echo "--ignore-img | Ignore container image updates" -echo "--self-update | Updates HeavyScript prior to running any other commands" -echo -echo "Examples" -echo "--------" -echo "bash heavy_script.sh" -echo "bash heavy_script.sh -b 14 -i portainer -i arch -i sonarr -t 600 -vrsUp --self-update" -echo "bash heavy_script.sh -b 14 -i portainer -i arch -i sonarr -t 600 -vrsp -U 10 --self-update" -echo "bash /mnt/tank/scripts/heavy_script.sh -t 150 --mount" -echo "bash /mnt/tank/scripts/heavy_script.sh --dns" -echo "bash heavy_script.sh --restore" -echo "bash /mnt/tank/scripts/heavy_script.sh --delete-backup" -echo -exit -} -export -f help - - - -patch_2212_backups(){ -clear -x -#Check TrueNAS version, skip if not 22.12.0 -if ! [ "$(cli -m csv -c 'system version' | awk -F '-' '{print $3}')" == "22.12.0" ]; then - echo "This patch does not apply to your version of TrueNAS" - return -fi - - -#Description -echo "This patch will fix the issue with backups not restoring properly" -echo "Due to Ix-Systems not saving PVC in backups, this patch will fix that" -echo "Otherwise backups will not restore properly" -echo "You only need to run this patch once, it will not run again" -echo - - -#Download patch -echo "Downloading Backup Patch" -if ! wget -q https://github.com/truecharts/truetool/raw/main/hotpatch/2212/HP1.patch; then - echo "Failed to download Backup Patch" - exit -else - echo "Downloaded Backup Patch" -fi - -echo - -# Apply patch -echo "Applying Backup Patch" -if patch -N --reject-file=/dev/null -s -p0 -d /usr/lib/python3/dist-packages/middlewared/ < HP1.patch &>/dev/null; then - echo "Backup Patch applied" - rm -rf HP1.patch -else - echo "Backup Patch already applied" - rm -rf HP1.patch - exit -fi - -echo - -#Restart middlewared -while true -do - echo "We need to restart middlewared to finish the patch" - echo "This will cause a short downtime for some minor services approximately 10-30 seconds" - echo "Applications should not be affected" - read -rt 120 -p "Would you like to proceed? (y/N): " yesno || { echo -e "\nFailed to make a selection in time" ; exit; } - case $yesno in - [Yy] | [Yy][Ee][Ss]) - echo "Restarting middlewared" - service middlewared restart & - wait $! - echo "Restarted middlewared" - echo "You are set, there is no need to run this patch again" - break - ;; - [Nn] | [Nn][Oo]) - echo "Exiting" - echo "Please restart middlewared manually" - echo "You can do: service middlewared restart" - exit - ;; - *) - echo "That was not an option, try again" - sleep 3 - continue - ;; - esac -done -} - - -patch_2212_backups2(){ -clear -x -#Check TrueNAS version, skip if not 22.12.0 -if ! [ "$(cli -m csv -c 'system version' | awk -F '-' '{print $3}')" == "22.12.0" ]; then - echo "This patch does not apply to your version of TrueNAS" - return -fi - - -#Description -echo "This patch will fix the issue certain applicattions breaking backups" -echo "You only need to run this patch once, it will not run again" -echo - - -# Apply patch -echo "Applying Backup Patch" -if patch -N --reject-file=/dev/null -s -p0 /usr/lib/python3/dist-packages/middlewared/plugins/kubernetes_linux/backup.py < patches/backups.patch &>/dev/null; then - echo "Backup Patch applied" -else - echo "Backup Patch already applied" - exit -fi - -echo - -#Restart middlewared -while true -do - echo "We need to restart middlewared to finish the patch" - echo "This will cause a short downtime for some minor services approximately 10-30 seconds" - echo "Applications should not be affected" - read -rt 120 -p "Would you like to proceed? (y/N): " yesno || { echo -e "\nFailed to make a selection in time" ; exit; } - case $yesno in - [Yy] | [Yy][Ee][Ss]) - echo "Restarting middlewared" - service middlewared restart & - wait $! - echo "Restarted middlewared" - echo "You are set, there is no need to run this patch again" - break - ;; - [Nn] | [Nn][Oo]) - echo "Exiting" - echo "Please restart middlewared manually" - echo "You can do: service middlewared restart" - exit - ;; - *) - echo "That was not an option, try again" - sleep 3 - continue - ;; - esac -done } From 89fa678cd9d3d12089846bb960d7a499164535b9 Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Tue, 27 Dec 2022 13:04:26 +0100 Subject: [PATCH 1137/1229] improve update, middleware restart and version checking behavior --- includes/chores.sh | 25 ++++++++++++++----------- includes/patch.sh | 18 +++++++++++++++--- truetool.sh | 2 ++ 3 files changed, 31 insertions(+), 14 deletions(-) diff --git a/includes/chores.sh b/includes/chores.sh index 9f3cbc6a..95de557d 100755 --- a/includes/chores.sh +++ b/includes/chores.sh @@ -25,18 +25,21 @@ export -f kubeapiEnable # Prune unused docker images to prevent dataset/snapshot bloat related slowdowns on SCALE prune(){ -echo -e "${BWhite}Docker Prune${Color_Off}" -echo "Pruning Docker Images..." -docker image prune -af | grep "^Total" && echo -e "${IGreen}Docker Prune Successfull${Color_Off}" || echo "Docker Prune ${IRed}FAILED${Color_Off}" - -# TODO Switch to middleware prune on next release -# midclt call container.prune '{"remove_unused_images": true, "remove_stopped_containers": true}' &> /dev/null && echo "Docker Prune completed"|| echo "Docker Prune ${IRed}FAILED${Color_Off}" +echo -e "🄿 🅁 🅄 🄽 🄴" +if (( "$scaleVersion" >= 22120 )); then + cli -c 'app container config prune prune_options={"remove_unused_images": true, "remove_stopped_containers": true}' | head -n -4 || echo "Failed to Prune Docker Images" +else + docker image prune -af | grep "^Total" || echo "Failed to Prune Docker Images" +fi } export -f prune -# -sync(){ -echo -e "${BWhite}Starting Catalog Sync...${Color_Off}" -cli -c 'app catalog sync_all' &> /dev/null && echo -e "${IGreen}Catalog sync complete${Color_Off}" || echo -e "${IRed}Catalog Sync Failed${Color_Off}" +middlewareRestart() { + echo "We need to restart middlewared." + echo "This will cause a short downtime for the webui approximately 10-30 seconds" + echo "Restarting middlewared" + service middlewared restart & + wait $! + echo "Restarted middlewared" } -export -f sync +export -f middlewareRestart diff --git a/includes/patch.sh b/includes/patch.sh index 82393dea..cecbf90d 100755 --- a/includes/patch.sh +++ b/includes/patch.sh @@ -2,17 +2,29 @@ patchv22120(){ echo "Applying 22.12 HotPatch 1" -( wget -q -P /tmp https://github.com/truecharts/truetool/raw/main/hotpatch/2212/HP1.patch && echo "download completed" || echo "download failed" ) && ( patch -N -s -p0 -d /usr/lib/python3/dist-packages/middlewared/ < /tmp/HP1.patch && service middlewared restart && echo "waiting 20 seconds for middleware restart..." && sleep 20 && echo "patch completed" || echo "patch failed or skipped, not critical" ) && rm -rf /tmp/HP1.patch + +( wget -q -P /tmp https://github.com/truecharts/truetool/raw/main/hotpatch/2212/HP1.patch && echo "download completed" || echo "download failed" ) && ( patch -N -s -p0 -d /usr/lib/python3/dist-packages/middlewared/ &>/dev/null < /tmp/HP1.patch && echo "patch completed" || echo "Patch Already Applied" ) && rm -rf /tmp/HP1.patch + echo "Applying 22.12 HotPatch 2" -( wget -q -P /tmp https://github.com/truecharts/truetool/raw/main/hotpatch/2212/HP2.patch && echo "download completed" || echo "download failed" ) && ( patch -N -s -p0 -d /usr/lib/python3/dist-packages/middlewared/ < /tmp/HP2.patch && service middlewared restart && echo "waiting 20 seconds for middleware restart..." && sleep 20 && echo "patch completed" || echo "patch failed or skipped, not critical" ) && rm -rf /tmp/HP2.patch +( wget -q -P /tmp https://github.com/truecharts/truetool/raw/main/hotpatch/2212/HP2.patch && echo "download completed" || echo "download failed" ) && ( patch -N -s -p0 -d /usr/lib/python3/dist-packages/middlewared/ &>/dev/null < /tmp/HP2.patch && echo "patch completed" || echo "Patch Already Applied" ) && rm -rf /tmp/HP2.patch } export -f patchv22120 + + hotpatch(){ echo "Starting hotpatcher..." -if [ "$(cli -m csv -c 'system version' | awk -F '-' '{print $3}')" == "22.12.0" ]; then +restartmiddleware=no +if (( "$scaleVersion" == 22120 )); then patchv22120 + restartmiddleware=yes +else + echo "No hotpatch available for your version, congratulations!" +fi + +if (( "$restartmiddleware" == "yes" )); then + middlewareRestart fi } export -f hotpatch diff --git a/truetool.sh b/truetool.sh index e7801881..f71429ec 100755 --- a/truetool.sh +++ b/truetool.sh @@ -131,6 +131,8 @@ title [[ "$enableUpdate" == "true" ]] && updater "$@" +scaleVersion=$(version="$(cli -c 'system version' | awk -F '-' '{print $3}' | awk -F '.' '{print $1 $2 $3}' | tr -d " \t\r\.")") + ## Always check if a hotpatch needs to be applied hotpatch From 520caadacfc4819ea2ed068ec3d66bd2e1a34544 Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Tue, 27 Dec 2022 13:07:15 +0100 Subject: [PATCH 1138/1229] load the misc library and improve comments --- truetool.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/truetool.sh b/truetool.sh index f71429ec..956f675b 100755 --- a/truetool.sh +++ b/truetool.sh @@ -18,8 +18,6 @@ source includes/backup.sh source includes/chores.sh # shellcheck source=includes/colors.sh source includes/colors.sh -# shellcheck source=includes/dns.sh -source functions/dns.sh # shellcheck source=includes/help.sh source includes/help.sh # shellcheck source=includes/help.sh @@ -35,6 +33,12 @@ source includes/update.sh # shellcheck source=includes/update_self.sh source includes/update_self.sh +# Libraries loaded from Heavyscript +# shellcheck source=functions/dns.sh +source functions/dns.sh +# shellcheck source=functions/misc.sh +source functions/misc.sh + #If no argument is passed, set flag to show menu if [[ -z "$*" || "-" == "$*" || "--" == "$*" ]]; then no_args="true" From 3a1d22eebc6db2b3de595193caf35e66b256321d Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Tue, 27 Dec 2022 13:09:00 +0100 Subject: [PATCH 1139/1229] move mount over to use heavyscript library --- functions/mount.sh | 8 ++++---- truetool.sh | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/functions/mount.sh b/functions/mount.sh index 371c98d7..1e7137e3 100755 --- a/functions/mount.sh +++ b/functions/mount.sh @@ -63,7 +63,7 @@ do else echo -e "\nMounted\n$data_name" fi - echo -e "\nUnmount with:\nzfs set mountpoint=legacy $full_path && rmdir /mnt/heavyscript/$data_name\n\nOr use the Unmount All option\n" + echo -e "\nUnmount with:\nzfs set mountpoint=legacy $full_path && rmdir /mnt/truetool/$data_name\n\nOr use the Unmount All option\n" #Ask if user would like to mount something else while true @@ -89,7 +89,7 @@ do done ;; 2) - mapfile -t unmount_array < <(basename -a /mnt/heavyscript/* | sed "s/*//") + mapfile -t unmount_array < <(basename -a /mnt/truetool/* | sed "s/*//") [[ -z ${unmount_array[*]} ]] && echo "Theres nothing to unmount" && sleep 3 && continue for i in "${unmount_array[@]}" do @@ -98,9 +98,9 @@ do pvc=$(echo "$main" | awk '{print $3}') full_path=$(find /mnt/"$pool"/ix-applications/releases/"$app"/volumes/ -maxdepth 0 | cut -c 6-) zfs set mountpoint=legacy "$full_path""$pvc" - echo "$i unmounted" && rmdir /mnt/heavyscript/"$i" || echo "failed to unmount $i" + echo "$i unmounted" && rmdir /mnt/truetool/"$i" || echo "failed to unmount $i" done - rmdir /mnt/heavyscript + rmdir /mnt/truetool sleep 3 ;; *) diff --git a/truetool.sh b/truetool.sh index 956f675b..e76566cc 100755 --- a/truetool.sh +++ b/truetool.sh @@ -38,6 +38,8 @@ source includes/update_self.sh source functions/dns.sh # shellcheck source=functions/misc.sh source functions/misc.sh +# shellcheck source=functions/mount.sh +source functions/mount.sh #If no argument is passed, set flag to show menu if [[ -z "$*" || "-" == "$*" || "--" == "$*" ]]; then From 32e611c9b68b56b25abd1a88835d71396a88aa40 Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Tue, 27 Dec 2022 13:12:57 +0100 Subject: [PATCH 1140/1229] Patch backup branding --- functions/backup.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/functions/backup.sh b/functions/backup.sh index f0c2baf6..c94b0afb 100755 --- a/functions/backup.sh +++ b/functions/backup.sh @@ -5,8 +5,8 @@ backup(){ echo_backup+=("🄱 🄰 🄲 🄺 🅄 🄿 🅂") echo_backup+=("Number of backups was set to $number_of_backups") date=$(date '+%Y_%m_%d_%H_%M_%S') -[[ "$verbose" == "true" ]] && cli -c 'app kubernetes backup_chart_releases backup_name=''"'HeavyScript_"$date"'"' &> /dev/null && echo_backup+=(HeavyScript_"$date") -[[ -z "$verbose" ]] && echo_backup+=("\nNew Backup Name:") && cli -c 'app kubernetes backup_chart_releases backup_name=''"'HeavyScript_"$date"'"' | tail -n 1 &> /dev/null && echo_backup+=(HeavyScript_"$date") +[[ "$verbose" == "true" ]] && cli -c 'app kubernetes backup_chart_releases backup_name=''"'TrueTool_"$date"'"' &> /dev/null && echo_backup+=(TrueTool_"$date") +[[ -z "$verbose" ]] && echo_backup+=("\nNew Backup Name:") && cli -c 'app kubernetes backup_chart_releases backup_name=''"'TrueTool_"$date"'"' | tail -n 1 &> /dev/null && echo_backup+=(TrueTool_"$date") mapfile -t list_backups < <(cli -c 'app kubernetes list_backups' | grep -E "HeavyScript_|TrueTool_" | sort -t '_' -Vr -k2,7 | awk -F '|' '{print $2}'| tr -d " \t\r") if [[ ${#list_backups[@]} -gt "$number_of_backups" ]]; then echo_backup+=("\nDeleted the oldest backup(s) for exceeding limit:") @@ -45,7 +45,7 @@ while true do clear -x title - echo -e "Choose a Restore Point to Delete\nThese may be out of order if they are not HeavyScript backups" + echo -e "Choose a Restore Point to Delete\nThese may be out of order if they are not TrueTool backups" echo "$list_backups" echo echo "0) Exit" @@ -120,7 +120,7 @@ restore(){ clear -x && echo "pulling restore points.." list_backups=$(cli -c 'app kubernetes list_backups' | grep -E "HeavyScript_|TrueTool_" | sort -t '_' -Vr -k2,7 | tr -d " \t\r" | awk -F '|' '{print $2}' | nl -s ") " | column -t) if [[ -z "$list_backups" ]]; then - echo "No HeavyScript restore points available" + echo "No TrueTool restore points available" exit fi @@ -198,7 +198,7 @@ if [[ $borked == True ]]; then echo "If you were to restore, you would lose all of your application data" echo "If you are on Bluefin version: 22.12.0, and have not yet ran the patch, you will need to run it" echo "Afterwards you will be able to create backups and restore them" - echo "This is a known ix-systems bug, and has nothing to do with HeavyScript" + echo "This is a known ix-systems bug and has nothing to do with TrueTool" exit fi From 442e75d678af7785715aec9a2c6397a48ad16fca Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Tue, 27 Dec 2022 13:27:38 +0100 Subject: [PATCH 1141/1229] removing old backup version and moving to HeavyScript library backup --- includes/backup.sh | 96 ---------------------------------------------- truetool.sh | 9 +++-- 2 files changed, 5 insertions(+), 100 deletions(-) delete mode 100755 includes/backup.sh diff --git a/includes/backup.sh b/includes/backup.sh deleted file mode 100755 index e09449f9..00000000 --- a/includes/backup.sh +++ /dev/null @@ -1,96 +0,0 @@ -#!/bin/bash - -## Simple shortcut to just list the backups without promts and such -listBackups(){ -echo -e "${BWhite}Backup Listing Tool${Color_Off}" -clear -x && echo "pulling all restore points.." -list_backups=$(cli -c 'app kubernetes list_backups' | grep -v system-update | sort -t '_' -Vr -k2,7 | tr -d " \t\r" | awk -F '|' '{print $2}' | nl | column -t) -[[ -z "$list_backups" ]] && echo -e "${IRed}No restore points available${Color_Off}" && exit || echo "Detected Backups:" && echo "$list_backups" -} -export -f listBackups - -## Lists backups, except system-created backups, and promts which one to delete -deleteBackup(){ -echo -e "${BWhite}Backup Deletion Tool${Color_Off}" -clear -x && echo "pulling all restore points.." -list_delete_backups=$(cli -c 'app kubernetes list_backups' | grep -v system-update | sort -t '_' -Vr -k2,7 | tr -d " \t\r" | awk -F '|' '{print $2}' | nl | column -t) -clear -x -# shellcheck disable=SC2015 -[[ -z "$list_delete_backups" ]] && echo -e "${IRed}No restore points available${Color_Off}" && exit || { title; echo -e "Choose a restore point to delete\nThese may be out of order if they are not TrueTool backups" ; } -# shellcheck disable=SC2015 -echo "$list_delete_backups" && read -rt 600 -p "Please type a number: " selection && restore_point=$(echo "$list_delete_backups" | grep ^"$selection " | awk '{print $2}') -[[ -z "$selection" ]] && echo "${IRed}Your selection cannot be empty${Color_Off}" && exit #Check for valid selection. If none, kill script -[[ -z "$restore_point" ]] && echo "Invalid Selection: $selection, was not an option" && exit #Check for valid selection. If none, kill script -echo -e "\nWARNING:\nYou CANNOT go back after deleting your restore point" || { echo "${IRed}FAILED${Color_Off}"; exit; } -# shellcheck disable=SC2015 -echo -e "\n\nYou have chosen:\n$restore_point\n\nWould you like to continue?" && echo -e "1 Yes\n2 No" && read -rt 120 -p "Please type a number: " yesno || { echo "${IRed}FAILED${Color_Off}"; exit; } -if [[ $yesno == "1" ]]; then - echo -e "\nDeleting $restore_point" && cli -c 'app kubernetes delete_backup backup_name=''"'"$restore_point"'"' &>/dev/null && echo -e "${IGreen}Sucessfully deleted${Color_Off}" || echo -e "${IRed}Deletion FAILED${Color_Off}" -elif [[ $yesno == "2" ]]; then - echo "You've chosen NO, killing script." -else - echo -e "${IRed}Invalid Selection${Color_Off}" -fi -} -export -f deleteBackup - -## Creates backups and deletes backups if a "backups to keep"-count is exceeded. -# backups-to-keep takes only heavyscript and truetool created backups into account, as other backups aren't guaranteed to be sorted correctly -backup(){ -echo -e "${BWhite}Backup Tool${Color_Off}" -echo -e "\nNumber of backups was set to $number_of_backups" -date=$(date '+%Y_%m_%d_%H_%M_%S') -[[ "$verbose" == "true" ]] && cli -c 'app kubernetes backup_chart_releases backup_name=''"'TrueTool_"$date"'"' -[[ -z "$verbose" ]] && echo -e "\nNew Backup Name:" && cli -c 'app kubernetes backup_chart_releases backup_name=''"'TrueTool_"$date"'"' | tail -n 1 -mapfile -t list_create_backups < <(cli -c 'app kubernetes list_backups' | grep 'HeavyScript\|TrueTool_' | sort -t '_' -Vr -k2,7 | awk -F '|' '{print $2}'| tr -d " \t\r") -# shellcheck disable=SC2309 -if [[ ${#list_create_backups[@]} -gt "number_of_backups" ]]; then - echo -e "\nDeleting the oldest backup(s) for exceeding limit:" - overflow=$(( ${#list_create_backups[@]} - "$number_of_backups" )) - mapfile -t list_overflow < <(cli -c 'app kubernetes list_backups' | grep "TrueTool_" | sort -t '_' -V -k2,7 | awk -F '|' '{print $2}'| tr -d " \t\r" | head -n "$overflow") - for i in "${list_overflow[@]}" - do - cli -c 'app kubernetes delete_backup backup_name=''"'"$i"'"' &> /dev/null || echo "${IRed}FAILED${Color_Off} to delete $i" - echo "$i" - done -fi -} -export -f backup - -## Lists available backup and prompts the users to select a backup to restore -restore(){ -echo -e "${BWhite}Backup Restoration Tool${Color_Off}" -clear -x && echo "pulling restore points.." -list_restore_backups=$(cli -c 'app kubernetes list_backups' | grep "TrueTool_" | sort -t '_' -Vr -k2,7 | tr -d " \t\r" | awk -F '|' '{print $2}' | nl | column -t) -clear -x -# shellcheck disable=SC2015 -[[ -z "$list_restore_backups" ]] && echo "No TrueTool restore points available" && exit || { title; echo "Choose a restore point" ; } -echo "$list_restore_backups" && read -rt 600 -p "Please type a number: " selection && restore_point=$(echo "$list_restore_backups" | grep ^"$selection " | awk '{print $2}') -[[ -z "$selection" ]] && echo "Your selection cannot be empty" && exit #Check for valid selection. If none, kill script -[[ -z "$restore_point" ]] && echo "Invalid Selection: $selection, was not an option" && exit #Check for valid selection. If none, kill script -echo -e "\nWARNING:\nThis is NOT guranteed to work\nThis is ONLY supposed to be used as a LAST RESORT\nConsider rolling back your applications instead if possible" || { echo "${IRed}FAILED${Color_Off}"; exit; } -# shellcheck disable=SC2015 -echo -e "\n\nYou have chosen:\n$restore_point\n\nWould you like to continue?" && echo -e "1 Yes\n2 No" && read -rt 120 -p "Please type a number: " yesno || { echo "${IRed}FAILED${Color_Off}"; exit; } -if [[ $yesno == "1" ]]; then - echo -e "\nStarting Restore, this will take a ${BWhite}LONG${Color_Off} time." - pool=$(cli -c 'app kubernetes config' | grep -E "pool\s\|" | awk -F '|' '{print $3}' | tr -d " \t\n\r") - echo "Correcting PVC mountpoints..." - for pvc in $(zfs list -t filesystem -r "$pool"/ix-applications -o name -H | grep "/ix-applications/" | grep "volumes/pvc") - do - zfs set mountpoint=legacy "${pvc}" || echo "Fixing PVC mountpoints Failed for ${pvc}... Continuing..." - done - # Ensure readonly is turned off - if ! zfs set readonly=off "$pool"/ix-applications;then - echo -e "Error: Failed to set ZFS ReadOnly to \"off\"" - echo -e "After the restore, attempt to run the following command manually:" - echo "zfs set readonly=off $pool/ix-applications" - fi - echo "Triggering restore process..." - cli -c 'app kubernetes restore_backup backup_name=''"'"$restore_point"'"' || echo "Restore ${IRed}FAILED${Color_Off}" -elif [[ $yesno == "2" ]]; then - echo "You've chosen NO, killing script. Good luck." -else - echo -e "${IRed}Invalid Selection${Color_Off}" -fi -} -export -f restore diff --git a/truetool.sh b/truetool.sh index e76566cc..cf7809ea 100755 --- a/truetool.sh +++ b/truetool.sh @@ -12,8 +12,6 @@ targetRepo="https://github.com/truecharts/truetool.git" cd "${SCRIPT_DIR}" || echo -e "ERROR: Something went wrong accessing the script directory" # Includes -# shellcheck source=includes/backup.sh -source includes/backup.sh # shellcheck source=includes/chores.sh source includes/chores.sh # shellcheck source=includes/colors.sh @@ -22,8 +20,6 @@ source includes/colors.sh source includes/help.sh # shellcheck source=includes/help.sh source includes/patch.sh -# shellcheck source=includes/mount.sh -source includes/mount.sh # shellcheck source=includes/no_args.sh source includes/no_args.sh # shellcheck source=includes/title.sh @@ -40,6 +36,9 @@ source functions/dns.sh source functions/misc.sh # shellcheck source=functions/mount.sh source functions/mount.sh +# shellcheck source=functions/backup.sh +source functions/backup.sh + #If no argument is passed, set flag to show menu if [[ -z "$*" || "-" == "$*" || "--" == "$*" ]]; then @@ -138,6 +137,8 @@ title [[ "$enableUpdate" == "true" ]] && updater "$@" scaleVersion=$(version="$(cli -c 'system version' | awk -F '-' '{print $3}' | awk -F '.' '{print $1 $2 $3}' | tr -d " \t\r\.")") +update_limit=$(nproc --all) +rollback="true" ## Always check if a hotpatch needs to be applied hotpatch From bcd5fac0d6cc6f3c0ee3a0b01233fc4cb8e8af95 Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Tue, 27 Dec 2022 13:29:07 +0100 Subject: [PATCH 1142/1229] Run more function async --- truetool.sh | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/truetool.sh b/truetool.sh index cf7809ea..2f7b3dfc 100755 --- a/truetool.sh +++ b/truetool.sh @@ -182,7 +182,21 @@ fi [[ "$dns" == "true" ]] && dns && exit [[ "$restore" == "true" ]] && restore && exit [[ "$mountPVC" == "true" ]] && mountPVC && exit -[[ "$number_of_backups" -ge 1 ]] && backup -[[ "$sync" == "true" ]] && sync +if [[ "$number_of_backups" -gt 1 && "$sync" == "true" ]]; then # Run backup and sync at the same time + echo "Running Apps Backup & Syncing Catalog" + if [[ "$prune" == "true" ]]; then + prune & + fi + backup & + sync & + wait +elif [[ "$number_of_backups" -gt 1 && -z "$sync" ]]; then # If only backup is true, run it + echo "Running Apps Backup" + backup +elif [[ "$sync" == "true" && -z "$number_of_backups" ]]; then # If only sync is true, run it + echo "Syncing Catalog" + echo -e "Syncing Catalog(s)\n\n" + sync +fi [[ "$update_all_apps" == "true" || "$update_apps" == "true" ]] && update_apps [[ "$prune" == "true" ]] && prune From c845c9541cf6f4c1135858be5007e75a770944e6 Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Tue, 27 Dec 2022 13:29:38 +0100 Subject: [PATCH 1143/1229] move update over to heavyscript library --- includes/update.sh | 123 --------------------------------------------- truetool.sh | 4 +- 2 files changed, 2 insertions(+), 125 deletions(-) delete mode 100755 includes/update.sh diff --git a/includes/update.sh b/includes/update.sh deleted file mode 100755 index 0aaa7506..00000000 --- a/includes/update.sh +++ /dev/null @@ -1,123 +0,0 @@ -#!/bin/bash - -update_apps(){ -echo -e "${BWhite}App Updater${Color_Off}" -[[ -z $timeout ]] && echo -e "Default Timeout: 500" && timeout=500 || echo -e "\nCustom Timeout: $timeout" -[[ "$timeout" -le 120 ]] && echo "Warning: Your timeout is set low and may lead to premature rollbacks or skips" - -echo "" -echo "Creating list of Apps to update..." - -# Render a list of ignored applications, so users can verify their ignores got parsed correctly. -if [[ -z ${ignore[*]} ]]; then - echo "No apps added to ignore list, continuing..." -else - echo "ignored applications:" - for ignored in "${ignore[@]}" - do - echo "${ignored}" - done -fi -echo "" - -mapfile -t array < <(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,container_images_update_available,status' | grep -E ",true(,|$)" | sort) -[[ -z ${array[*]} ]] && echo -e "\nThere are no updates available or middleware timed out" && return 0 || echo -e "\n${#array[@]} update(s) available:" -PIDlist=() - -# Draft a list of app names, seperate from actuall execution -# This prevents outputs getting mixed together -for i in "${array[@]}" -do - app_name=$(echo "$i" | awk -F ',' '{print $1}') #print out first catagory, name. - echo "$app_name" -done - -echo "" -echo "Updating Apps..." - -# Create a background task for each update as async solution -for i in "${array[@]}" -do - executeUpdate "${i}" & - PIDlist+=($!) -done -echo "" -echo "Waiting for update results..." - -# Wait for all the async updates to complete -for p in "${PIDlist[@]}" -do - wait "${p}" ||: -done - -} -export -f update_apps - - - -# This is a combination of stopping previously-stopped apps and apps stuck Deploying after update -after_update_actions(){ -SECONDS=0 -count=0 -sleep 15 - -# Keep this running and exit the endless-loop based on a timer, instead of a countered-while-loop -# shellcheck disable=SC2050 -while [[ "0" != "1" ]] -do - (( count++ )) - status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep "^$app_name," | awk -F ',' '{print $2}') - if [[ "$status" == "ACTIVE" && "$startstatus" == "STOPPED" ]]; then - [[ "$verbose" == "true" ]] && echo "Returing to STOPPED state.." - midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null && echo "Stopped"|| echo "FAILED" - break - elif [[ "$SECONDS" -ge "$timeout" && "$status" == "DEPLOYING" && "$failed" != "true" ]]; then - echo -e "Error: Run Time($SECONDS) for $app_name has exceeded Timeout($timeout)\nIf this is a slow starting application, set a higher timeout with -t\nIf this applicaion is always DEPLOYING, you can disable all probes under the Healthcheck Probes Liveness section in the edit configuration\nReverting update.." - midclt call chart.release.rollback "$app_name" "{\"item_version\": \"$rollback_version\"}" &> /dev/null - [[ "$startstatus" == "STOPPED" ]] && failed="true" && after_update_actions && unset failed #run back after_update_actions function if the app was stopped prior to update - break - elif [[ "$SECONDS" -ge "$timeout" && "$status" == "DEPLOYING" && "$failed" == "true" ]]; then - echo -e "Error: Run Time($SECONDS) for $app_name has exceeded Timeout($timeout)\nThe application failed to be ACTIVE even after a rollback,\nManual intervention is required\nAbandoning" - break - elif [[ "$status" == "STOPPED" ]]; then - [[ "$count" -le 1 && "$verbose" == "true" ]] && echo "Verifying Stopped.." && sleep 15 && continue #if reports stopped on FIRST time through loop, double check - [[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports stopped on FIRST time through loop, double check - echo "Stopped" && break #if reports stopped any time after the first loop, assume its extermal services. - elif [[ "$status" == "ACTIVE" ]]; then - [[ "$count" -le 1 && "$verbose" == "true" ]] && echo "Verifying Active.." && sleep 15 && continue #if reports active on FIRST time through loop, double check - [[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports active on FIRST time through loop, double check - echo "Active" && break #if reports active any time after the first loop, assume actually active. - else - [[ "$verbose" == "true" ]] && echo "Waiting $((timeout-SECONDS)) more seconds for $app_name to be ACTIVE" - sleep 15 - continue - fi -done -} -export -f after_update_actions - -# Determine what all the required information for the App to update, check it and execute the update using the SCALE API -executeUpdate(){ - app_name=$(echo "$1" | awk -F ',' '{print $1}') #print out first catagory, name. - old_app_ver=$(echo "$1" | awk -F ',' '{print $4}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #previous/current Application MAJOR Version - new_app_ver=$(echo "$1" | awk -F ',' '{print $5}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #new Application MAJOR Version - old_chart_ver=$(echo "$1" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}' | awk -F '.' '{print $1}') # Old Chart MAJOR version - new_chart_ver=$(echo "$1" | awk -F ',' '{print $5}' | awk -F '_' '{print $2}' | awk -F '.' '{print $1}') # New Chart MAJOR version - status=$(echo "$1" | awk -F ',' '{print $2}') #status of the app: STOPPED / DEPLOYING / ACTIVE - startstatus=$status - diff_app=$(diff <(echo "$old_app_ver") <(echo "$new_app_ver")) #caluclating difference in major app versions - diff_chart=$(diff <(echo "$old_chart_ver") <(echo "$new_chart_ver")) #caluclating difference in Chart versions - old_full_ver=$(echo "$1" | awk -F ',' '{print $4}') #Upgraded From - new_full_ver=$(echo "$1" | awk -F ',' '{print $5}') #Upraded To - rollback_version=$(echo "$1" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}') - printf '%s\0' "${ignore[@]}" | grep -iFxqz "${app_name}" && echo -e "\n$app_name\nIgnored, skipping" && return #If application is on ignore list, skip - if [[ "$diff_app" == "$diff_chart" || "$update_all_apps" == "true" ]]; then #continue to update - [[ "$verbose" == "true" ]] && echo "Updating.." - # shellcheck disable=SC2015 - cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo -e "Updated $app_name\n$old_full_ver\n$new_full_ver" && after_update_actions || { echo -e "$app_name: update ${IRed}FAILED${Color_Off}"; return; } - else - echo -e "\n$app_name\nMajor Release, update manually" - return - fi -} -export -f executeUpdate diff --git a/truetool.sh b/truetool.sh index 2f7b3dfc..a8f15157 100755 --- a/truetool.sh +++ b/truetool.sh @@ -24,8 +24,6 @@ source includes/patch.sh source includes/no_args.sh # shellcheck source=includes/title.sh source includes/title.sh -# shellcheck source=includes/update.sh -source includes/update.sh # shellcheck source=includes/update_self.sh source includes/update_self.sh @@ -38,6 +36,8 @@ source functions/misc.sh source functions/mount.sh # shellcheck source=functions/backup.sh source functions/backup.sh +# shellcheck source=functions/update_apps.sh +source functions/update_apps.sh #If no argument is passed, set flag to show menu From 50e1fee670a6bb17e04bd26d10eeedbe16fe6ef2 Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Tue, 27 Dec 2022 13:30:31 +0100 Subject: [PATCH 1144/1229] remove heavsyscript itself as it's not in the right license folder --- heavy_script.sh | 161 ------------------------------------------------ 1 file changed, 161 deletions(-) delete mode 100755 heavy_script.sh diff --git a/heavy_script.sh b/heavy_script.sh deleted file mode 100755 index 065a4c76..00000000 --- a/heavy_script.sh +++ /dev/null @@ -1,161 +0,0 @@ -#!/bin/bash - - -# cd to script, this ensures the script can find the source scripts below, even when ran from a seperate directory -script=$(readlink -f "$0") -script_path=$(dirname "$script") -script_name="heavy_script.sh" -cd "$script_path" || { echo "Error: Failed to change to script directory" ; exit ; } - -#Version -hs_version=$(git describe --tags) - -source functions/backup.sh -source functions/dns.sh -source functions/menu.sh -source functions/misc.sh -source functions/mount.sh -source functions/self_update.sh -source functions/update_apps.sh -source functions/cmd_to_container.sh -source functions/script_create.sh - - -#If no argument is passed, kill the script. -[[ -z "$*" || "-" == "$*" || "--" == "$*" ]] && menu - - -# Parse script options -while getopts ":si:rb:t:uUpSRv-:" opt -do - case $opt in - -) - case "${OPTARG}" in - help) - help="true" - ;; - self-update) - self_update="true" - ;; - dns) - dns="true" - ;; - cmd) - cmd="true" - ;; - restore) - restore="true" - ;; - mount) - mount="true" - ;; - delete-backup) - deleteBackup="true" - ;; - ignore-img) - ignore_image_update="true" - ;; - *) - echo -e "Invalid Option \"--$OPTARG\"\n" - help - ;; - esac - ;; - :) - echo -e "Option: \"-$OPTARG\" requires an argument\n" - help - ;; - b) - number_of_backups=$OPTARG - ! [[ $OPTARG =~ ^[0-9]+$ ]] && echo -e "Error: -b needs to be assigned an interger\n\"""$number_of_backups""\" is not an interger" >&2 && exit - [[ "$number_of_backups" -le 0 ]] && echo "Error: Number of backups is required to be at least 1" && exit - ;; - r) - rollback="true" - ;; - i) - if ! [[ $OPTARG =~ ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ ]]; then # Using case insensitive version of the regex used by Truenas Scale - echo -e "Error: \"$OPTARG\" is not a possible option for an application name" - exit - else - ignore+=("$OPTARG") - fi - ;; - t) - timeout=$OPTARG - ! [[ $timeout =~ ^[0-9]+$ ]] && echo -e "Error: -t needs to be assigned an interger\n\"""$timeout""\" is not an interger" >&2 && exit - ;; - s) - sync="true" - ;; - U) - update_all_apps="true" - # Check next positional parameter - eval nextopt=${!OPTIND} - # existing or starting with dash? - if [[ -n $nextopt && $nextopt != -* ]] ; then - OPTIND=$((OPTIND + 1)) - update_limit="$nextopt" - else - update_limit=1 - fi - ;; - u) - update_apps="true" - # Check next positional parameter - eval nextopt=${!OPTIND} - # existing or starting with dash? - if [[ -n $nextopt && $nextopt != -* ]] ; then - OPTIND=$((OPTIND + 1)) - update_limit="$nextopt" - else - update_limit=1 - fi - ;; - S) - stop_before_update="true" - ;; - p) - prune="true" - ;; - v) - verbose="true" - ;; - *) - echo -e "Invalid Option \"-$OPTARG\"\n" - help - ;; - esac -done - - -#exit if incompatable functions are called -[[ "$update_all_apps" == "true" && "$update_apps" == "true" ]] && echo -e "-U and -u cannot BOTH be called" && exit - -#Continue to call functions in specific order -[[ "$self_update" == "true" ]] && self_update -[[ "$help" == "true" ]] && help -[[ "$cmd" == "true" ]] && cmd_to_container && exit -[[ "$deleteBackup" == "true" ]] && deleteBackup && exit -[[ "$dns" == "true" ]] && dns && exit -[[ "$restore" == "true" ]] && restore && exit -[[ "$mount" == "true" ]] && mount && exit -if [[ "$number_of_backups" -gt 1 && "$sync" == "true" ]]; then # Run backup and sync at the same time - echo "🅃 🄰 🅂 🄺 🅂 :" - echo -e "-Backing up ix-applications Dataset\n-Syncing catalog(s)" - echo -e "This can take a LONG time, Please Wait For Both Output..\n\n" - backup & - sync & - wait -elif [[ "$number_of_backups" -gt 1 && -z "$sync" ]]; then # If only backup is true, run it - echo "🅃 🄰 🅂 🄺 :" - echo -e "-Backing up \"ix-applications\" Dataset\nPlease Wait..\n\n" - backup -elif [[ "$sync" == "true" && -z "$number_of_backups" ]]; then # If only sync is true, run it - echo "🅃 🄰 🅂 🄺 :" - echo -e "Syncing Catalog(s)\nThis Takes a LONG Time, Please Wait..\n\n" - sync -fi -[[ "$update_all_apps" == "true" || "$update_apps" == "true" ]] && commander -[[ "$prune" == "true" ]] && prune -exit 0 From 09fb93140f6a4118ac53de1e2eb72b25a2643ad1 Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Tue, 27 Dec 2022 13:31:55 +0100 Subject: [PATCH 1145/1229] remove colors as it doesn't play nice with cron --- includes/colors.sh | 113 --------------------------------------------- truetool.sh | 5 -- 2 files changed, 118 deletions(-) delete mode 100755 includes/colors.sh diff --git a/includes/colors.sh b/includes/colors.sh deleted file mode 100755 index a1f8cbdd..00000000 --- a/includes/colors.sh +++ /dev/null @@ -1,113 +0,0 @@ -#!/bin/bash -# shellcheck disable=SC2034 - -# Reset -Color_Off='\033[0m' # Text Reset - -# Regular Colors -Black='\033[0;30m' # Black -Red='\033[0;31m' # Red -Green='\033[0;32m' # Green -Yellow='\033[0;33m' # Yellow -Blue='\033[0;34m' # Blue -Purple='\033[0;35m' # Purple -Cyan='\033[0;36m' # Cyan -White='\033[0;37m' # White - -# Bold -BBlack='\033[1;30m' # Black -BRed='\033[1;31m' # Red -BGreen='\033[1;32m' # Green -BYellow='\033[1;33m' # Yellow -BBlue='\033[1;34m' # Blue -BPurple='\033[1;35m' # Purple -BCyan='\033[1;36m' # Cyan -BWhite='\033[1;37m' # White - -# Underline -UBlack='\033[4;30m' # Black -URed='\033[4;31m' # Red -UGreen='\033[4;32m' # Green -UYellow='\033[4;33m' # Yellow -UBlue='\033[4;34m' # Blue -UPurple='\033[4;35m' # Purple -UCyan='\033[4;36m' # Cyan -UWhite='\033[4;37m' # White - -# High Intensity -IBlack='\033[0;90m' # Black -IRed='\033[0;91m' # Red -IGreen='\033[0;92m' # Green -IYellow='\033[0;93m' # Yellow -IBlue='\033[0;94m' # Blue -IPurple='\033[0;95m' # Purple -ICyan='\033[0;96m' # Cyan -IWhite='\033[0;97m' # White - - -# Bold High Intensity -BIBlack='\033[1;90m' # Black -BIRed='\033[1;91m' # Red -BIGreen='\033[1;92m' # Green -BIYellow='\033[1;93m' # Yellow -BIBlue='\033[1;94m' # Blue -BIPurple='\033[1;95m' # Purple -BICyan='\033[1;96m' # Cyan -BIWhite='\033[1;97m' # White - -noColor(){ -# Reset -Color_Off="" - -# Regular Colors -Black="" -Red="" -Green="" -Yellow="" -Blue="" -Purple="" -Cyan="" -White="" - -# Bold -BBlack="" -BRed="" -BGreen="" -BYellow="" -BBlue="" -BPurple="" -BCyan="" -BWhite="" - -# Underline -UBlack="" -URed="" -UGreen="" -UYellow="" -UBlue="" -UPurple="" -UCyan="" -UWhite="" - -# High Intensity -IBlack="" -IRed="" -IGreen="" -IYellow="" -IBlue="" -IPurple="" -ICyan="" -IWhite="" - - -# Bold High Intensity -BIBlack="" -BIRed="" -BIGreen="" -BIYellow="" -BIBlue="" -BIPurple="" -BICyan="" -BIWhite="" - } - export -f noColor diff --git a/truetool.sh b/truetool.sh index a8f15157..4095961c 100755 --- a/truetool.sh +++ b/truetool.sh @@ -14,8 +14,6 @@ cd "${SCRIPT_DIR}" || echo -e "ERROR: Something went wrong accessing the script # Includes # shellcheck source=includes/chores.sh source includes/chores.sh -# shellcheck source=includes/colors.sh -source includes/colors.sh # shellcheck source=includes/help.sh source includes/help.sh # shellcheck source=includes/help.sh @@ -78,9 +76,6 @@ else kubeapi-enable) kubeapiEnable="true" ;; - no-color) - noColor - ;; *) echo -e "Invalid Option \"--$OPTARG\"\n" && help exit From 4731b93a1476244284329fc45acd0f36a21037ee Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Tue, 27 Dec 2022 13:34:42 +0100 Subject: [PATCH 1146/1229] Fixed mistakes --- functions/misc.sh | 2 -- truetool.sh | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/functions/misc.sh b/functions/misc.sh index 211c01fd..4cd09905 100755 --- a/functions/misc.sh +++ b/functions/misc.sh @@ -14,5 +14,3 @@ echo echo } export -f sync - -} diff --git a/truetool.sh b/truetool.sh index 4095961c..3fd25056 100755 --- a/truetool.sh +++ b/truetool.sh @@ -131,7 +131,7 @@ title [[ "$enableUpdate" == "true" ]] && updater "$@" -scaleVersion=$(version="$(cli -c 'system version' | awk -F '-' '{print $3}' | awk -F '.' '{print $1 $2 $3}' | tr -d " \t\r\.")") +scaleVersion=$(cli -c 'system version' | awk -F '-' '{print $3}' | awk -F '.' '{print $1 $2 $3}' | tr -d " \t\r\.") update_limit=$(nproc --all) rollback="true" From 34e8ae4474ee4359debf6a5335839e0a29939249 Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Tue, 27 Dec 2022 13:38:41 +0100 Subject: [PATCH 1147/1229] ensure middlewared isn't restarted when not needed --- includes/patch.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/includes/patch.sh b/includes/patch.sh index cecbf90d..4e7b1b28 100755 --- a/includes/patch.sh +++ b/includes/patch.sh @@ -3,10 +3,10 @@ patchv22120(){ echo "Applying 22.12 HotPatch 1" -( wget -q -P /tmp https://github.com/truecharts/truetool/raw/main/hotpatch/2212/HP1.patch && echo "download completed" || echo "download failed" ) && ( patch -N -s -p0 -d /usr/lib/python3/dist-packages/middlewared/ &>/dev/null < /tmp/HP1.patch && echo "patch completed" || echo "Patch Already Applied" ) && rm -rf /tmp/HP1.patch +( wget -q -P /tmp https://github.com/truecharts/truetool/raw/main/hotpatch/2212/HP1.patch && echo "download completed" || echo "download failed" ) && ( patch -N -s -p0 -d /usr/lib/python3/dist-packages/middlewared/ &>/dev/null < /tmp/HP1.patch && restartmiddleware=yes && echo "patch completed" || echo "Patch Already Applied" ) && rm -rf /tmp/HP1.patch echo "Applying 22.12 HotPatch 2" -( wget -q -P /tmp https://github.com/truecharts/truetool/raw/main/hotpatch/2212/HP2.patch && echo "download completed" || echo "download failed" ) && ( patch -N -s -p0 -d /usr/lib/python3/dist-packages/middlewared/ &>/dev/null < /tmp/HP2.patch && echo "patch completed" || echo "Patch Already Applied" ) && rm -rf /tmp/HP2.patch +( wget -q -P /tmp https://github.com/truecharts/truetool/raw/main/hotpatch/2212/HP2.patch && echo "download completed" || echo "download failed" ) && ( patch -N -s -p0 -d /usr/lib/python3/dist-packages/middlewared/ &>/dev/null < /tmp/HP2.patch && restartmiddleware=yes && echo "patch completed" || echo "Patch Already Applied" ) && rm -rf /tmp/HP2.patch } export -f patchv22120 @@ -18,7 +18,6 @@ echo "Starting hotpatcher..." restartmiddleware=no if (( "$scaleVersion" == 22120 )); then patchv22120 - restartmiddleware=yes else echo "No hotpatch available for your version, congratulations!" fi From d94524f1e56109885b301e28aff38924afcc118e Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Tue, 27 Dec 2022 13:41:44 +0100 Subject: [PATCH 1148/1229] try2 --- includes/patch.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/includes/patch.sh b/includes/patch.sh index 4e7b1b28..00946740 100755 --- a/includes/patch.sh +++ b/includes/patch.sh @@ -3,10 +3,10 @@ patchv22120(){ echo "Applying 22.12 HotPatch 1" -( wget -q -P /tmp https://github.com/truecharts/truetool/raw/main/hotpatch/2212/HP1.patch && echo "download completed" || echo "download failed" ) && ( patch -N -s -p0 -d /usr/lib/python3/dist-packages/middlewared/ &>/dev/null < /tmp/HP1.patch && restartmiddleware=yes && echo "patch completed" || echo "Patch Already Applied" ) && rm -rf /tmp/HP1.patch +( wget -q -P /tmp https://github.com/truecharts/truetool/raw/main/hotpatch/2212/HP1.patch && echo "download completed" || echo "download failed" ) && ( patch -N -s -p0 -d /usr/lib/python3/dist-packages/middlewared/ &>/dev/null < /tmp/HP1.patch && echo "patch completed" && restartmiddleware=yes || echo "Patch Already Applied" ) && rm -rf /tmp/HP1.patch echo "Applying 22.12 HotPatch 2" -( wget -q -P /tmp https://github.com/truecharts/truetool/raw/main/hotpatch/2212/HP2.patch && echo "download completed" || echo "download failed" ) && ( patch -N -s -p0 -d /usr/lib/python3/dist-packages/middlewared/ &>/dev/null < /tmp/HP2.patch && restartmiddleware=yes && echo "patch completed" || echo "Patch Already Applied" ) && rm -rf /tmp/HP2.patch +( wget -q -P /tmp https://github.com/truecharts/truetool/raw/main/hotpatch/2212/HP2.patch && echo "download completed" || echo "download failed" ) && ( patch -N -s -p0 -d /usr/lib/python3/dist-packages/middlewared/ &>/dev/null < /tmp/HP2.patch && echo "patch completed" && restartmiddleware=yes || echo "Patch Already Applied" ) && rm -rf /tmp/HP2.patch } export -f patchv22120 @@ -25,5 +25,6 @@ fi if (( "$restartmiddleware" == "yes" )); then middlewareRestart fi +restartmiddleware=no } export -f hotpatch From 3e4ec91b3fa03b5de0c127d123fcfb4f2410ccaa Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Tue, 27 Dec 2022 13:45:09 +0100 Subject: [PATCH 1149/1229] attempt 3 --- includes/patch.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/patch.sh b/includes/patch.sh index 00946740..e4639e59 100755 --- a/includes/patch.sh +++ b/includes/patch.sh @@ -3,7 +3,7 @@ patchv22120(){ echo "Applying 22.12 HotPatch 1" -( wget -q -P /tmp https://github.com/truecharts/truetool/raw/main/hotpatch/2212/HP1.patch && echo "download completed" || echo "download failed" ) && ( patch -N -s -p0 -d /usr/lib/python3/dist-packages/middlewared/ &>/dev/null < /tmp/HP1.patch && echo "patch completed" && restartmiddleware=yes || echo "Patch Already Applied" ) && rm -rf /tmp/HP1.patch +( wget -q -P /tmp https://github.com/truecharts/truetool/raw/main/hotpatch/2212/HP1.patch && echo "download completed" || echo "download failed" ) && ( patch -N -s -p0 -d /usr/lib/python3/dist-packages/middlewared/ &>/dev/null < /tmp/HP1.patch && echo "patch completed" || echo "Patch Already Applied" ) && rm -rf /tmp/HP1.patch echo "Applying 22.12 HotPatch 2" ( wget -q -P /tmp https://github.com/truecharts/truetool/raw/main/hotpatch/2212/HP2.patch && echo "download completed" || echo "download failed" ) && ( patch -N -s -p0 -d /usr/lib/python3/dist-packages/middlewared/ &>/dev/null < /tmp/HP2.patch && echo "patch completed" && restartmiddleware=yes || echo "Patch Already Applied" ) && rm -rf /tmp/HP2.patch @@ -22,7 +22,7 @@ else echo "No hotpatch available for your version, congratulations!" fi -if (( "$restartmiddleware" == "yes" )); then +if [[ "$restartmiddleware" == "yes" ]]; then middlewareRestart fi restartmiddleware=no From 8e23d96bec8c38e532eefa803f75401c5c7214d3 Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Tue, 27 Dec 2022 13:47:14 +0100 Subject: [PATCH 1150/1229] ensure having no-collors set doesn't break execution --- truetool.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/truetool.sh b/truetool.sh index 3fd25056..07f7b97b 100755 --- a/truetool.sh +++ b/truetool.sh @@ -76,6 +76,9 @@ else kubeapi-enable) kubeapiEnable="true" ;; + no-color) + noColor + ;; *) echo -e "Invalid Option \"--$OPTARG\"\n" && help exit From 0da11f985748721436cc211552a3a98d0187b12d Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Tue, 27 Dec 2022 13:53:29 +0100 Subject: [PATCH 1151/1229] misc fixes --- truetool.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/truetool.sh b/truetool.sh index 07f7b97b..1859410f 100755 --- a/truetool.sh +++ b/truetool.sh @@ -77,7 +77,7 @@ else kubeapiEnable="true" ;; no-color) - noColor + noColor="true" ;; *) echo -e "Invalid Option \"--$OPTARG\"\n" && help @@ -196,5 +196,5 @@ elif [[ "$sync" == "true" && -z "$number_of_backups" ]]; then # If only sync is echo -e "Syncing Catalog(s)\n\n" sync fi -[[ "$update_all_apps" == "true" || "$update_apps" == "true" ]] && update_apps +[[ "$update_all_apps" == "true" || "$update_apps" == "true" ]] && commander [[ "$prune" == "true" ]] && prune From 582d21d039471d4714259ff8a6d49d6a113059f2 Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Tue, 27 Dec 2022 14:42:16 +0100 Subject: [PATCH 1152/1229] fix shellcheck issues --- truetool.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/truetool.sh b/truetool.sh index 1859410f..7420bbf3 100755 --- a/truetool.sh +++ b/truetool.sh @@ -77,7 +77,7 @@ else kubeapiEnable="true" ;; no-color) - noColor="true" + echo "Colors are removed, so the no-color option is depricated. Please stop using this" ;; *) echo -e "Invalid Option \"--$OPTARG\"\n" && help From c68322c9a5dad3b405267486ac713fcdd0e5e846 Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Tue, 27 Dec 2022 14:50:49 +0100 Subject: [PATCH 1153/1229] fix mount command --- truetool.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/truetool.sh b/truetool.sh index 7420bbf3..add90b39 100755 --- a/truetool.sh +++ b/truetool.sh @@ -179,7 +179,7 @@ fi [[ "$deleteBackup" == "true" ]] && deleteBackup && exit [[ "$dns" == "true" ]] && dns && exit [[ "$restore" == "true" ]] && restore && exit -[[ "$mountPVC" == "true" ]] && mountPVC && exit +[[ "$mountPVC" == "true" ]] && mount && exit if [[ "$number_of_backups" -gt 1 && "$sync" == "true" ]]; then # Run backup and sync at the same time echo "Running Apps Backup & Syncing Catalog" if [[ "$prune" == "true" ]]; then From 5e675ab7ae08611a5aea4748aa5a640e99840c19 Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Tue, 27 Dec 2022 16:27:44 +0100 Subject: [PATCH 1154/1229] Fix heavybugs --- functions/backup.sh | 1 + includes/backup.sh | 10 ++++++++++ truetool.sh | 2 ++ 3 files changed, 13 insertions(+) create mode 100644 includes/backup.sh diff --git a/functions/backup.sh b/functions/backup.sh index c94b0afb..46ffa330 100755 --- a/functions/backup.sh +++ b/functions/backup.sh @@ -98,6 +98,7 @@ do read -rt 120 -p "Delete more backups? (y/N): " yesno || { echo -e "\nFailed to make a selection in time" ; exit; } case $yesno in [Yy] | [Yy][Ee][Ss]) + deleteBackup break ;; [Nn] | [Nn][Oo]) diff --git a/includes/backup.sh b/includes/backup.sh new file mode 100644 index 00000000..9308664d --- /dev/null +++ b/includes/backup.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +## Simple shortcut to just list the backups without promts and such +listBackups(){ +echo -e "${BWhite}Backup Listing Tool${Color_Off}" +clear -x && echo "pulling all restore points.." +list_backups=$(cli -c 'app kubernetes list_backups' | grep -v system-update | sort -t '_' -Vr -k2,7 | tr -d " \t\r" | awk -F '|' '{print $2}' | nl | column -t) +[[ -z "$list_backups" ]] && echo -e "${IRed}No restore points available${Color_Off}" && exit || echo "Detected Backups:" && echo "$list_backups" +} +export -f listBackups diff --git a/truetool.sh b/truetool.sh index add90b39..ee61aa82 100755 --- a/truetool.sh +++ b/truetool.sh @@ -24,6 +24,8 @@ source includes/no_args.sh source includes/title.sh # shellcheck source=includes/update_self.sh source includes/update_self.sh +# shellcheck source=includes/backup.sh +source includes/backup.sh # Libraries loaded from Heavyscript # shellcheck source=functions/dns.sh From b7e055258df625934576157030fbb0a9578e0ade Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Tue, 27 Dec 2022 16:38:24 +0100 Subject: [PATCH 1155/1229] fix editor mistake --- functions/mount.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/mount.sh b/functions/mount.sh index 1e7137e3..e2a1de4d 100755 --- a/functions/mount.sh +++ b/functions/mount.sh @@ -57,7 +57,7 @@ do data_name=$(echo "$pvc" | awk '{print $3}') volume_name=$(echo "$pvc" | awk '{print $4}') full_path=$(zfs list -t filesystem -r "$pool"/ix-applications/releases/"$app"/volumes -o name -H | grep "$volume_name") - if ! zfs set mountpoint=/heavyscript/"$data_name" "$full_path" ; then + if ! zfs set mountpoint=/truetool/"$data_name" "$full_path" ; then echo "Error: Failed to mount $app" exit 1 else From 00475ffecf4713ca83742a04d3e5c16adcfecfdb Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Wed, 28 Dec 2022 00:02:49 +0000 Subject: [PATCH 1156/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.74.2 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 1f418ea3..3a1733c0 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@173425112e1e66409fb696205d24a3f2e4122db4 # v34.74.0 + uses: renovatebot/github-action@6a0663311f9df691bdb00b4bee52f2a270b68373 # v34.74.2 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 7e003b667cc8e527e19042899fb3ab01b3a645a3 Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Wed, 28 Dec 2022 19:46:45 +0100 Subject: [PATCH 1157/1229] Update README.md --- README.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 2e7d9251..7215759e 100644 --- a/README.md +++ b/README.md @@ -133,9 +133,12 @@ Then Support-Manager for TrueCharts, HeavyBullets8, ported this to Bash and star After a month or so, the TrueCharts Team officially started refactoring this expanded bash-port. Due to personal reasons, HeavyBullets by then decided to separate from TrueCharts after merging the TrueCharts refactor into his own work. The beauty of OpenSource. -From this point onwards the HeavyScript and TrueTool diverged a bit. +From this point onwards the HeavyScript and TrueTool diverged a bit. Development of TrueTool slowed down a bit during Q3 of 2022 and HeavyScript significantly improved on the reliability of primary features while also adding some of it's own. + +While previously HeavyScript and TrueTool shared a lot of code back-and-forth without much care to attribution, we've decided to more officially attribute and start using functions with all the HeavyScript improvements in-place for some of the primary features like: Backup, Restore and App-Updates. Cleanly seperating those from TrueCharts features that have neglitable involvement of HeavyScript. + +Users from HeavyScript should be able to safely start using TrueTool, as we've made precautions to ensure the backups take over smoothly. +We, however, do _not_ advise using HeavyScript with TrueCharts Apps. Not because it's a bad App, but because we offer an alternative that is validated by our Staff. + We internally review changes within our staff team, to verify we somewhat stick to best-practices. This means, in some cases, we decided not to port certain features from HeavyScript and did decide to add features we think are useful and safe. But this also means we can give guarantees TrueTool works optimally with our Catalog of TrueNAS SCALE Apps, as well as official Apps. - -Users from HeavyScript can safely start using TrueTool, as we've made precautions to ensure the backups take over smoothly. -We, however, do _not_ advise using HeavyScript with TrueCharts Apps. Not because it's a bad App, but because we offer an alternative that is validated by our Staff. From 48505b7e1467f682943db1cf2f6a57f423e60105 Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Wed, 28 Dec 2022 20:55:49 +0100 Subject: [PATCH 1158/1229] some restructure and cleanup --- functions/cmd_to_container.sh | 119 ----------------------------- functions/misc.sh | 16 ---- functions/readme.md | 3 + includes/chores.sh | 15 ++++ includes/patch.sh | 4 +- {hotpatch => patch}/2212/HP1.patch | 0 {hotpatch => patch}/2212/HP2.patch | 0 truetool.sh | 2 - 8 files changed, 20 insertions(+), 139 deletions(-) delete mode 100755 functions/cmd_to_container.sh delete mode 100755 functions/misc.sh create mode 100644 functions/readme.md rename {hotpatch => patch}/2212/HP1.patch (100%) rename {hotpatch => patch}/2212/HP2.patch (100%) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh deleted file mode 100755 index a9a4132e..00000000 --- a/functions/cmd_to_container.sh +++ /dev/null @@ -1,119 +0,0 @@ -#!/bin/bash - - -cmd_to_container(){ -app_name=$(k3s crictl pods -s ready --namespace ix | sed -E 's/[[:space:]]([0-9]*|About)[a-z0-9 ]{5,12}ago[[:space:]]//' | sed '1d' | awk '{print $4}' | cut -c4- | sort -u | nl -s ") " | column -t) -while true -do - clear -x - title - echo "Command to Container Menu" - echo "-------------------------" - echo "$app_name" - echo - echo "0) Exit" - read -rt 120 -p "Please type a number: " selection || { echo -e "\nFailed to make a selection in time" ; exit; } - if [[ $selection == 0 ]]; then - echo "Exiting.." - exit - elif ! echo -e "$app_name" | grep -qs ^"$selection)" ; then - echo "Error: \"$selection\" was not an option.. Try again" - sleep 3 - continue - else - break - fi -done -rm cont_file 2> /dev/null -app_name=$(echo -e "$app_name" | grep ^"$selection)" | awk '{print $2}') -mapfile -t pod_id < <(k3s crictl pods -s ready --namespace ix | grep -v "[[:space:]]svclb-" | grep -E "[[:space:]]ix-${app_name}[[:space:]]" | awk '{print $1}') -search=$(k3s crictl ps -a -s running | sed -E 's/[[:space:]]([0-9]*|About)[a-z0-9 ]{5,12}ago[[:space:]]//') -for pod in "${pod_id[@]}" -do - echo "$search" | grep "$pod" >> cont_file -done -mapfile -t containers < <(sort -u cont_file 2> /dev/null) -case "${#containers[@]}" in - 0) - echo -e "No containers available\nAre you sure the application in running?" - exit - ;; - 1) - container=$(grep "${pod_id[0]}" cont_file | awk '{print $4}') - container_id=$(grep -E "[[:space:]]${container}[[:space:]]" cont_file | awk '{print $1}') - ;; - *) - while true - do - clear -x - title - echo "Available Containers" - echo "--------------------" - cont_search=$( - for i in "${containers[@]}" - do - echo "$i" | awk '{print $4}' - done | nl -s ") " | column -t - ) - echo "$cont_search" - echo - echo "0) Exit" - read -rt 120 -p "Choose a container by number: " selection || { echo -e "\nFailed to make a selection in time" ; exit; } - if [[ $selection == 0 ]]; then - echo "Exiting.." - exit - elif ! echo -e "$cont_search" | grep -qs ^"$selection)" ; then - echo "Error: \"$selection\" was not an option.. Try again" - sleep 3 - continue - else - break - fi - done - container=$(echo "$cont_search" | grep ^"$selection)" | awk '{print $2}') - container_id=$(grep -E "[[:space:]]${container}[[:space:]]" cont_file | awk '{print $1}') - ;; -esac -while true -do - clear -x - title - echo "App Name: $app_name" - echo "Container: $container" - echo - echo "1) Run a single command" - echo "2) Open Shell" - echo - echo "0) Exit" - read -rt 120 -p "Please choose an option: " selection || { echo -e "\nFailed to make a selection in time" ; exit; } - case $selection in - 0) - echo "Exiting.." - exit - ;; - 1) - clear -x - title - read -rt 500 -p "What command do you want to run?: " command || { echo -e "\nFailed to make a selection in time" ; exit; } - # shellcheck disable=SC2086 - # Quoting $command as suggested, causes the k3s command to fail - k3s crictl exec -it "$container_id" $command - break - ;; - 2) - clear -x - title - if ! k3s crictl exec -it "$container_id" /bin/bash 2>/dev/null; then - k3s crictl exec -it "$container_id" /bin/sh 2>/dev/null || echo "This container does not accept shell access, try a different one." - fi - break - ;; - *) - echo "That was not an option.. Try again" - sleep 3 - ;; - esac -done -rm cont_file 2> /dev/null -} -export -f cmd_to_container diff --git a/functions/misc.sh b/functions/misc.sh deleted file mode 100755 index 4cd09905..00000000 --- a/functions/misc.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - - -sync(){ -echo_sync+=("🅂 🅈 🄽 🄲") -cli -c 'app catalog sync_all' &> /dev/null && echo_sync+=("Catalog sync complete") - -#Dump the echo_array, ensures all output is in a neat order. -for i in "${echo_sync[@]}" -do - echo -e "$i" -done -echo -echo -} -export -f sync diff --git a/functions/readme.md b/functions/readme.md new file mode 100644 index 00000000..360abd32 --- /dev/null +++ b/functions/readme.md @@ -0,0 +1,3 @@ +# HeavyScript Functions + +This folder contains modified variants of functions ported from HeavyScript. diff --git a/includes/chores.sh b/includes/chores.sh index 95de557d..c7b02f5a 100755 --- a/includes/chores.sh +++ b/includes/chores.sh @@ -43,3 +43,18 @@ middlewareRestart() { echo "Restarted middlewared" } export -f middlewareRestart + + +sync(){ +echo_sync+=("🅂 🅈 🄽 🄲") +cli -c 'app catalog sync_all' &> /dev/null && echo_sync+=("Catalog sync complete") + +#Dump the echo_array, ensures all output is in a neat order. +for i in "${echo_sync[@]}" +do + echo -e "$i" +done +echo +echo +} +export -f sync diff --git a/includes/patch.sh b/includes/patch.sh index e4639e59..600a2aa3 100755 --- a/includes/patch.sh +++ b/includes/patch.sh @@ -3,10 +3,10 @@ patchv22120(){ echo "Applying 22.12 HotPatch 1" -( wget -q -P /tmp https://github.com/truecharts/truetool/raw/main/hotpatch/2212/HP1.patch && echo "download completed" || echo "download failed" ) && ( patch -N -s -p0 -d /usr/lib/python3/dist-packages/middlewared/ &>/dev/null < /tmp/HP1.patch && echo "patch completed" || echo "Patch Already Applied" ) && rm -rf /tmp/HP1.patch +( wget -q -P /tmp https://github.com/truecharts/truetool/raw/main/patch/2212/HP1.patch && echo "download completed" || echo "download failed" ) && ( patch -N -s -p0 -d /usr/lib/python3/dist-packages/middlewared/ &>/dev/null < /tmp/HP1.patch && echo "patch completed" || echo "Patch Already Applied" ) && rm -rf /tmp/HP1.patch echo "Applying 22.12 HotPatch 2" -( wget -q -P /tmp https://github.com/truecharts/truetool/raw/main/hotpatch/2212/HP2.patch && echo "download completed" || echo "download failed" ) && ( patch -N -s -p0 -d /usr/lib/python3/dist-packages/middlewared/ &>/dev/null < /tmp/HP2.patch && echo "patch completed" && restartmiddleware=yes || echo "Patch Already Applied" ) && rm -rf /tmp/HP2.patch +( wget -q -P /tmp https://github.com/truecharts/truetool/raw/main/patch/2212/HP2.patch && echo "download completed" || echo "download failed" ) && ( patch -N -s -p0 -d /usr/lib/python3/dist-packages/middlewared/ &>/dev/null < /tmp/HP2.patch && echo "patch completed" && restartmiddleware=yes || echo "Patch Already Applied" ) && rm -rf /tmp/HP2.patch } export -f patchv22120 diff --git a/hotpatch/2212/HP1.patch b/patch/2212/HP1.patch similarity index 100% rename from hotpatch/2212/HP1.patch rename to patch/2212/HP1.patch diff --git a/hotpatch/2212/HP2.patch b/patch/2212/HP2.patch similarity index 100% rename from hotpatch/2212/HP2.patch rename to patch/2212/HP2.patch diff --git a/truetool.sh b/truetool.sh index ee61aa82..1c79416c 100755 --- a/truetool.sh +++ b/truetool.sh @@ -30,8 +30,6 @@ source includes/backup.sh # Libraries loaded from Heavyscript # shellcheck source=functions/dns.sh source functions/dns.sh -# shellcheck source=functions/misc.sh -source functions/misc.sh # shellcheck source=functions/mount.sh source functions/mount.sh # shellcheck source=functions/backup.sh From e77027af715ad429cc8d0f5f07b7dd3d556f159c Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Thu, 29 Dec 2022 12:35:31 +0100 Subject: [PATCH 1159/1229] try to deal with globbing better... --- functions/mount.sh | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/functions/mount.sh b/functions/mount.sh index e2a1de4d..a062bf27 100755 --- a/functions/mount.sh +++ b/functions/mount.sh @@ -36,34 +36,34 @@ do #Check for valid selection. If no issues, continue [[ $selection == 0 ]] && echo "Exiting.." && exit app=$(echo -e "$list" | grep ^"$selection)" | awk '{print $2}' | cut -c 4- ) - [[ -z "$app" ]] && echo "Invalid Selection: $selection, was not an option" && sleep 3 && continue + [[ -z "${app}" ]] && echo "Invalid Selection: $selection, was not an option" && sleep 3 && continue pvc=$(echo -e "$list" | grep ^"$selection)") #Stop applicaiton if not stopped - status=$(cli -m csv -c 'app chart_release query name,status' | grep "^$app," | awk -F ',' '{print $2}'| tr -d " \t\n\r") + status=$(cli -m csv -c 'app chart_release query name,status' | grep "^${app}," | awk -F ',' '{print $2}'| tr -d " \t\n\r") if [[ "$status" != "STOPPED" ]]; then - echo -e "\nStopping $app prior to mount" - if ! cli -c 'app chart_release scale release_name='\""$app"\"\ 'scale_options={"replica_count": 0}' &> /dev/null; then - echo "Failed to stop $app" + echo -e "\nStopping ${app} prior to mount" + if ! cli -c 'app chart_release scale release_name='\""${app}"\"\ 'scale_options={"replica_count": 0}' &> /dev/null; then + echo "Failed to stop ${app}" exit 1 else echo "Stopped" fi else - echo -e "\n$app is already stopped" + echo -e "\n${app} is already stopped" fi #Grab data then output and mount - data_name=$(echo "$pvc" | awk '{print $3}') - volume_name=$(echo "$pvc" | awk '{print $4}') - full_path=$(zfs list -t filesystem -r "$pool"/ix-applications/releases/"$app"/volumes -o name -H | grep "$volume_name") - if ! zfs set mountpoint=/truetool/"$data_name" "$full_path" ; then - echo "Error: Failed to mount $app" + data_name=$(echo "${pvc}" | awk '{print $3}') + volume_name=$(echo "${pvc}" | awk '{print $4}') + full_path=$(zfs list -t filesystem -r "${pool}"/ix-applications/releases/"${app}"/volumes -o name -H | grep "$volume_name") + if ! zfs set mountpoint=/truetool/"$data_name" "${full_path}" ; then + echo "Error: Failed to mount ${app}" exit 1 else echo -e "\nMounted\n$data_name" fi - echo -e "\nUnmount with:\nzfs set mountpoint=legacy $full_path && rmdir /mnt/truetool/$data_name\n\nOr use the Unmount All option\n" + echo -e "\nUnmount with:\nzfs set mountpoint=legacy ${full_path} && rmdir /mnt/truetool/$data_name\n\nOr use the Unmount All option\n" #Ask if user would like to mount something else while true @@ -96,8 +96,8 @@ do main=$(k3s kubectl get pvc -A | grep -E "\s$i\s" | awk '{print $1, $2, $4}') app=$(echo "$main" | awk '{print $1}' | cut -c 4-) pvc=$(echo "$main" | awk '{print $3}') - full_path=$(find /mnt/"$pool"/ix-applications/releases/"$app"/volumes/ -maxdepth 0 | cut -c 6-) - zfs set mountpoint=legacy "$full_path""$pvc" + full_path=$(find /mnt/"${pool}"/ix-applications/releases/"${app}"/volumes/ -maxdepth 0 | cut -c 6-) + zfs set mountpoint=legacy "${full_path}""${pvc}" echo "$i unmounted" && rmdir /mnt/truetool/"$i" || echo "failed to unmount $i" done rmdir /mnt/truetool From 49923ef82f50a25e36fa67add3efb0cee28eb992 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Fri, 30 Dec 2022 06:01:40 +0000 Subject: [PATCH 1160/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.76.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 3a1733c0..3ef856aa 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@6a0663311f9df691bdb00b4bee52f2a270b68373 # v34.74.2 + uses: renovatebot/github-action@7eccde7bfcc3162f7914ea64d7682e3b2ac06b04 # v34.76.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 8adfecd3167ebe1ea822d3722d9d8caf79d1cf5d Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Sat, 31 Dec 2022 00:02:44 +0000 Subject: [PATCH 1161/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.76.2 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 3ef856aa..ee3787d9 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@7eccde7bfcc3162f7914ea64d7682e3b2ac06b04 # v34.76.0 + uses: renovatebot/github-action@e44f62357269a997beca7bf8ea1561d9422ed8cd # v34.76.2 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 22aa06a872c306be01c763dd54b27554238533a2 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Sat, 31 Dec 2022 18:01:28 +0000 Subject: [PATCH 1162/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.77.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index ee3787d9..3512f374 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@e44f62357269a997beca7bf8ea1561d9422ed8cd # v34.76.2 + uses: renovatebot/github-action@82b1933ef436b79b3ca36ab612b9d0bc6ca5c166 # v34.77.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 26aa3c1400af04ba994d464f1c82d8608a3f22d9 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Sun, 1 Jan 2023 18:01:19 +0000 Subject: [PATCH 1163/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.77.1 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 3512f374..9c4d9adf 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@82b1933ef436b79b3ca36ab612b9d0bc6ca5c166 # v34.77.0 + uses: renovatebot/github-action@33fce9286b85fbc0be2a9a18f03db7e0acf3bfa1 # v34.77.1 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From c91b365426f5da0223477deaabce5aef48443ca2 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Tue, 3 Jan 2023 00:02:49 +0000 Subject: [PATCH 1164/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.78.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 9c4d9adf..4738e484 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@33fce9286b85fbc0be2a9a18f03db7e0acf3bfa1 # v34.77.1 + uses: renovatebot/github-action@b0b629aa1d1bffb348fbe0e67ac2fad818d0f384 # v34.78.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 1dd62247cdfe8ecf4ba15d7116125d2ab9de0e76 Mon Sep 17 00:00:00 2001 From: Konrni <39877017+Konrni@users.noreply.github.com> Date: Tue, 3 Jan 2023 20:27:18 +0100 Subject: [PATCH 1165/1229] no-color option, removed, marked as deprecated, fixed typo --- README.md | 2 +- truetool.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7215759e..42cfacd3 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ It also offers a few handy shortcuts for commonly required chores, like: Enablin | --helm-enable | --helm-enable | None | Enables Helm command access on SCALE | | --kubeapi-enable | --kubeapi-enable | None | Enables external access to Kuberntes API port | | --apt-enable | --apt-enable | None | Enables Apt command access on SCALE | -| --no-color | --no-color | None | Disables showing colors in terminal output, usefull for SCALE Email output | +| --no-color | --no-color | None | (deprecated) Disables showing colors in terminal output, usefull for SCALE Email output | | -U | -U | None | Update applications, ignoring major version changes | | -u | -u | None | Update applications, do NOT update if there was a major version change | | -b | -b 14 | Integer | Backup `ix-applications` dataset
_Creates backups up to the number you've chosen_ | diff --git a/truetool.sh b/truetool.sh index 1c79416c..977f3d48 100755 --- a/truetool.sh +++ b/truetool.sh @@ -77,7 +77,7 @@ else kubeapiEnable="true" ;; no-color) - echo "Colors are removed, so the no-color option is depricated. Please stop using this" + echo "Colors are removed, so the no-color option is deprecated. Please stop using this" ;; *) echo -e "Invalid Option \"--$OPTARG\"\n" && help From 084d824aa9021347230c9deac1e99a5ff3f85325 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Wed, 4 Jan 2023 06:01:31 +0000 Subject: [PATCH 1166/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.82.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 4738e484..1d5eb82d 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@b0b629aa1d1bffb348fbe0e67ac2fad818d0f384 # v34.78.0 + uses: renovatebot/github-action@8343fa1c8d38f3d030aa8332773b737f7e2fa591 # v34.82.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From eee3967b116252e41ab7b87ff16c51e23433784b Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Thu, 5 Jan 2023 06:01:27 +0000 Subject: [PATCH 1167/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.83.1 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 1d5eb82d..de875dbb 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@8343fa1c8d38f3d030aa8332773b737f7e2fa591 # v34.82.0 + uses: renovatebot/github-action@3ba16d130f7873b7ae4308225e723562e79e6aaa # v34.83.1 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 1f4548a2ca1583aa8b2b881754234819c398aed9 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Thu, 5 Jan 2023 18:01:51 +0000 Subject: [PATCH 1168/1229] chore(deps): update github-action actions/checkout [skip ci] to ac59398 --- .github/workflows/shellcheck.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml index 43b3800b..1896ce22 100644 --- a/.github/workflows/shellcheck.yml +++ b/.github/workflows/shellcheck.yml @@ -10,7 +10,7 @@ jobs: name: Shellcheck runs-on: ubuntu-latest steps: - - uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3 + - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3 - name: Run ShellCheck uses: ludeeus/action-shellcheck@master with: @@ -21,6 +21,6 @@ jobs: pre-commit: runs-on: ubuntu-latest steps: - - uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3 + - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3 - uses: actions/setup-python@5ccb29d8773c3f3f653e1705f474dfaa8a06a912 # v4 - uses: pre-commit/action@646c83fcd040023954eafda54b4db0192ce70507 # tag=v3.0.0 From 38c81287d7a94e8f491f6ea153cd74763869d134 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Thu, 5 Jan 2023 18:01:53 +0000 Subject: [PATCH 1169/1229] chore(deps): update github-action actions/checkout [skip ci] to v3.3.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index de875dbb..c720ceb4 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3.2.0 + uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate From ed8853c1d557a7223b656c9356d3970abbb0a59c Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Fri, 6 Jan 2023 18:01:35 +0000 Subject: [PATCH 1170/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.87.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index c720ceb4..be3ea784 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@3ba16d130f7873b7ae4308225e723562e79e6aaa # v34.83.1 + uses: renovatebot/github-action@b8658673a0d2aca747883660ff867cc949026154 # v34.87.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From f0dc890ccdb8aba8ccddd7a28ead821c7e0a481c Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Sat, 7 Jan 2023 06:07:34 +0000 Subject: [PATCH 1171/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.90.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index be3ea784..e5757700 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@b8658673a0d2aca747883660ff867cc949026154 # v34.87.0 + uses: renovatebot/github-action@d94ad8a4f7257a3b920ebc494e325508558406a0 # v34.90.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From edad9f9a1b770a8cb225b15d25d8ed732844ff28 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Sun, 8 Jan 2023 06:07:53 +0000 Subject: [PATCH 1172/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.93.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index e5757700..c32c811f 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@d94ad8a4f7257a3b920ebc494e325508558406a0 # v34.90.0 + uses: renovatebot/github-action@470e3afc63e6918e343692f5f7f1ecb84ca3fac7 # v34.93.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 32a696ce32991282e1a6f18170fa6f0384022728 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Mon, 9 Jan 2023 00:32:15 +0000 Subject: [PATCH 1173/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.94.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index c32c811f..5228ba11 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@470e3afc63e6918e343692f5f7f1ecb84ca3fac7 # v34.93.0 + uses: renovatebot/github-action@113b06e5b242a79bdb97ea0aaff69b00899bf740 # v34.94.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 81cf4d8e344f90ff7039e80d0c975d0218df3aea Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Wed, 11 Jan 2023 06:09:04 +0000 Subject: [PATCH 1174/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.97.5 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 5228ba11..532e9fd0 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@113b06e5b242a79bdb97ea0aaff69b00899bf740 # v34.94.0 + uses: renovatebot/github-action@cf443181a287e16154f0261dc9a756a19f16b035 # v34.97.5 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 2d3562020b9821b55a837af8fe1b8f51b5b0d3e3 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Thu, 12 Jan 2023 00:33:56 +0000 Subject: [PATCH 1175/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.99.2 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 532e9fd0..dc40ebb8 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@cf443181a287e16154f0261dc9a756a19f16b035 # v34.97.5 + uses: renovatebot/github-action@fb392f59cb0ed397b0efe67a66966c13b428e159 # v34.99.2 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 2aa380023a83c378678f76e8bdcd8dec0a808f60 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Thu, 12 Jan 2023 18:09:07 +0000 Subject: [PATCH 1176/1229] chore(deps): update github-action actions/setup-python [skip ci] to d27e3f3 --- .github/workflows/shellcheck.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml index 1896ce22..b0c3d633 100644 --- a/.github/workflows/shellcheck.yml +++ b/.github/workflows/shellcheck.yml @@ -22,5 +22,5 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3 - - uses: actions/setup-python@5ccb29d8773c3f3f653e1705f474dfaa8a06a912 # v4 + - uses: actions/setup-python@d27e3f3d7c64b4bbf8e4abfb9b63b83e846e0435 # v4 - uses: pre-commit/action@646c83fcd040023954eafda54b4db0192ce70507 # tag=v3.0.0 From db40dd53e836425e581c88133b9d47375d965824 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Fri, 13 Jan 2023 00:34:35 +0000 Subject: [PATCH 1177/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.100.1 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index dc40ebb8..3cce66e0 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@fb392f59cb0ed397b0efe67a66966c13b428e159 # v34.99.2 + uses: renovatebot/github-action@bfe5dbccb1efa3b4a9280284b1e2a3f03a9eed15 # v34.100.1 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 6b12bb407e8ba709882ed737ee510c82cbf3d97b Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Fri, 13 Jan 2023 18:07:53 +0000 Subject: [PATCH 1178/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.100.2 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 3cce66e0..eb81346b 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@bfe5dbccb1efa3b4a9280284b1e2a3f03a9eed15 # v34.100.1 + uses: renovatebot/github-action@f1162ed49dd9e54f8083e260a0654964bedd972f # v34.100.2 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From a084496072083f0826b2078d26399aa33eb4f920 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Sat, 14 Jan 2023 06:01:33 +0000 Subject: [PATCH 1179/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.102.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index eb81346b..71320f9a 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@f1162ed49dd9e54f8083e260a0654964bedd972f # v34.100.2 + uses: renovatebot/github-action@c6e430eb027fc91a23845ee68eca41d66c3b8a32 # v34.102.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 81cb6d6b6375677bba183438304a0e31a697fccd Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Sun, 15 Jan 2023 00:02:53 +0000 Subject: [PATCH 1180/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.102.2 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 71320f9a..b94c86e6 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@c6e430eb027fc91a23845ee68eca41d66c3b8a32 # v34.102.0 + uses: renovatebot/github-action@0e4d0194f4d6956aa80f43d4973055aeebe2d681 # v34.102.2 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 2bb49a03685990ab7aa2928332d3d56f0a98160a Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Sun, 15 Jan 2023 18:01:37 +0000 Subject: [PATCH 1181/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.102.7 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index b94c86e6..4e262cca 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@0e4d0194f4d6956aa80f43d4973055aeebe2d681 # v34.102.2 + uses: renovatebot/github-action@2e905f096a53611d8389341afdecf46ddc12e570 # v34.102.7 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From e26e387231d2c99bd318208e20983100a1a78656 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Mon, 16 Jan 2023 12:01:44 +0000 Subject: [PATCH 1182/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.102.8 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 4e262cca..580a4625 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@2e905f096a53611d8389341afdecf46ddc12e570 # v34.102.7 + uses: renovatebot/github-action@6e0a8659644e144db359d9871d2789b6b37d54c0 # v34.102.8 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 8f224cad15c0d3fc39e2f0452ca1e36c844059a7 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Tue, 17 Jan 2023 06:01:31 +0000 Subject: [PATCH 1183/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.104.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 580a4625..407d2a3d 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@6e0a8659644e144db359d9871d2789b6b37d54c0 # v34.102.8 + uses: renovatebot/github-action@da92719eacd06b98b2b4eb75e47b7d19eef77b70 # v34.104.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From c3029749985595d92249742a27ab54d7f8f3d366 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Wed, 18 Jan 2023 12:01:39 +0000 Subject: [PATCH 1184/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.105.3 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 407d2a3d..6bbd46e2 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@da92719eacd06b98b2b4eb75e47b7d19eef77b70 # v34.104.0 + uses: renovatebot/github-action@2044b1f9df1cfa13642bc34c8a6e55274af6b7ca # v34.105.3 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From f0b85f5252ef685a2adc1119cba843c5ac2984c0 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Thu, 19 Jan 2023 06:01:57 +0000 Subject: [PATCH 1185/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.105.5 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 6bbd46e2..5597203f 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@2044b1f9df1cfa13642bc34c8a6e55274af6b7ca # v34.105.3 + uses: renovatebot/github-action@6a1657a5ec715bd16b32f80873f13a141d80cafe # v34.105.5 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From dac47d16c025d4701f2fbd65ac1971c19afa542d Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Thu, 19 Jan 2023 18:02:12 +0000 Subject: [PATCH 1186/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.105.6 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 5597203f..5af6a26e 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@6a1657a5ec715bd16b32f80873f13a141d80cafe # v34.105.5 + uses: renovatebot/github-action@0fe0c23abd2d9a9929d94bde6314171e67375e6b # v34.105.6 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 7b7c732a9d6cf1f4a8b8cc0bbdc038d90beb381d Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Fri, 20 Jan 2023 06:01:50 +0000 Subject: [PATCH 1187/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.106.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 5af6a26e..758a6a18 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@0fe0c23abd2d9a9929d94bde6314171e67375e6b # v34.105.6 + uses: renovatebot/github-action@973b554245cce4eeac6fee9edd995356a980f0eb # v34.106.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 4b05039a0768b8cdc8c1bdb4d2b7d7ab2709cc1a Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Sat, 21 Jan 2023 18:02:08 +0000 Subject: [PATCH 1188/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.108.3 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 758a6a18..d7420b39 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@973b554245cce4eeac6fee9edd995356a980f0eb # v34.106.0 + uses: renovatebot/github-action@2f0dca806d9244848e07c637b8f36f5e4732a713 # v34.108.3 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 634b1bf6d4c0a00ac6abe19e35328936d3dffd4c Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Sun, 22 Jan 2023 06:01:56 +0000 Subject: [PATCH 1189/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.108.4 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index d7420b39..b2d4e87d 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@2f0dca806d9244848e07c637b8f36f5e4732a713 # v34.108.3 + uses: renovatebot/github-action@2535077be4f3a55ecff924d99c5deee087865a76 # v34.108.4 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 0c7a1713492e5256665a480b20c31f28a986088f Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Sun, 22 Jan 2023 18:01:45 +0000 Subject: [PATCH 1190/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.108.5 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index b2d4e87d..520a9ad3 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@2535077be4f3a55ecff924d99c5deee087865a76 # v34.108.4 + uses: renovatebot/github-action@50132854284b060dea4842b0b0634105ee514b01 # v34.108.5 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 667edd8fc2e61044c165948e5c92b5e6da7b1d6b Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Mon, 23 Jan 2023 18:01:30 +0000 Subject: [PATCH 1191/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.109.1 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 520a9ad3..385eacec 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@50132854284b060dea4842b0b0634105ee514b01 # v34.108.5 + uses: renovatebot/github-action@c4ea9ea73ec458a71cdb70b08acfb91492946072 # v34.109.1 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 246e48f6a0401b44c45c4276ecf7280ddac239b4 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Sat, 4 Feb 2023 06:02:01 +0000 Subject: [PATCH 1192/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.122.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 385eacec..bc27bb60 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@c4ea9ea73ec458a71cdb70b08acfb91492946072 # v34.109.1 + uses: renovatebot/github-action@0455824f3ee1aa6f42563639d43264ee14e9db58 # v34.122.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 4265370f4650ec93a6604e01032266945d5bcd6c Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Sun, 5 Feb 2023 00:03:00 +0000 Subject: [PATCH 1193/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.124.1 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index bc27bb60..fc60dd81 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@0455824f3ee1aa6f42563639d43264ee14e9db58 # v34.122.0 + uses: renovatebot/github-action@753250471bd642ce8a8b9d9f83299b316d2586ab # v34.124.1 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 20e7983d3e7b4e7b334409ed4b6e308451f33842 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Sun, 5 Feb 2023 18:01:44 +0000 Subject: [PATCH 1194/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.124.3 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index fc60dd81..8cf323db 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@753250471bd642ce8a8b9d9f83299b316d2586ab # v34.124.1 + uses: renovatebot/github-action@0fce79bdbacb2bf5e92fc93944dc94e351868eb3 # v34.124.3 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 303f78937d68c5ebd9d1473b861f375bb725cc61 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Mon, 6 Feb 2023 12:01:53 +0000 Subject: [PATCH 1195/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.124.5 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 8cf323db..b07a8984 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@0fce79bdbacb2bf5e92fc93944dc94e351868eb3 # v34.124.3 + uses: renovatebot/github-action@2e41b1ddc902fddc4c963101990b835f940e6246 # v34.124.5 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 398b496f9eca61d0ed641d0e745ca11868680e0e Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Tue, 7 Feb 2023 12:01:50 +0000 Subject: [PATCH 1196/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.125.1 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index b07a8984..a7b85604 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@2e41b1ddc902fddc4c963101990b835f940e6246 # v34.124.5 + uses: renovatebot/github-action@4609183eaf7c2416f62c0030b07d5bd6d272eb58 # v34.125.1 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 30bd0a825c5f224895cf1c74641fa026bc36e91b Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Wed, 8 Feb 2023 12:01:48 +0000 Subject: [PATCH 1197/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.128.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index a7b85604..efc273bf 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@4609183eaf7c2416f62c0030b07d5bd6d272eb58 # v34.125.1 + uses: renovatebot/github-action@ca612a08d86755be29c8c5ae1080d2265af008dd # v34.128.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 8d38e29d840be05cf37c801cac69e76039c961d4 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Thu, 9 Feb 2023 06:01:44 +0000 Subject: [PATCH 1198/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.128.1 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index efc273bf..34051107 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@ca612a08d86755be29c8c5ae1080d2265af008dd # v34.128.0 + uses: renovatebot/github-action@16fb647d39d5ccaec3cbb4805b7d258d301798ab # v34.128.1 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From c3346b825b6d7444def34c8d335741a8fae31de9 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Thu, 9 Feb 2023 18:02:01 +0000 Subject: [PATCH 1199/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.128.2 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 34051107..1f6282dc 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@16fb647d39d5ccaec3cbb4805b7d258d301798ab # v34.128.1 + uses: renovatebot/github-action@2e8211b5883108deb947945f0cb5ba6df11b68f7 # v34.128.2 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From c71edbd21c578cb7558787ea65cd9ac4b5fa137d Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Fri, 10 Feb 2023 06:01:44 +0000 Subject: [PATCH 1200/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.128.3 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 1f6282dc..97ba37fc 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@2e8211b5883108deb947945f0cb5ba6df11b68f7 # v34.128.2 + uses: renovatebot/github-action@275d5cc9435a842e7e2beb128b18dd77f58f1f47 # v34.128.3 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From bf7aeaffa4980ce82dcf89e28b402ad275dee655 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Sat, 11 Feb 2023 06:01:45 +0000 Subject: [PATCH 1201/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.130.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 97ba37fc..4549fd83 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@275d5cc9435a842e7e2beb128b18dd77f58f1f47 # v34.128.3 + uses: renovatebot/github-action@ddc7c2d18a8be56d49db4bf068f2a9e4323d723a # v34.130.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 568bf0f70b45f0c56f9947dfa0b81f3e9ac9f25d Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Sun, 12 Feb 2023 00:03:01 +0000 Subject: [PATCH 1202/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.132.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 4549fd83..6b470934 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@ddc7c2d18a8be56d49db4bf068f2a9e4323d723a # v34.130.0 + uses: renovatebot/github-action@decd41430b4e97500ddd041a6f529ccbb364d4b5 # v34.132.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 43373619173ba53f6587d4f97eeda043eb67726f Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Sun, 12 Feb 2023 18:01:22 +0000 Subject: [PATCH 1203/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.132.1 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 6b470934..e71b8a0f 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@decd41430b4e97500ddd041a6f529ccbb364d4b5 # v34.132.0 + uses: renovatebot/github-action@763e632d06fb55a58680de8a975a78217332d7ac # v34.132.1 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 57d9cd5868ca3d87f287c5f1e5ec21afed477516 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Tue, 14 Feb 2023 12:02:15 +0000 Subject: [PATCH 1204/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.136.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index e71b8a0f..956ae5df 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@763e632d06fb55a58680de8a975a78217332d7ac # v34.132.1 + uses: renovatebot/github-action@0c3fbdc6346afb523f8f993c0d6888c5db277ac8 # v34.136.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 9c105b6cd355f2a9cdc056ea4334d2370270030b Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Wed, 15 Feb 2023 06:01:58 +0000 Subject: [PATCH 1205/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.138.3 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 956ae5df..cd0e4dd9 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@0c3fbdc6346afb523f8f993c0d6888c5db277ac8 # v34.136.0 + uses: renovatebot/github-action@299cbf941792d474b268c2c486505a04f632e89e # v34.138.3 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From e7d72d82084c99a3226b21a9389889ad2f3e4ae8 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Thu, 16 Feb 2023 12:01:59 +0000 Subject: [PATCH 1206/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.141.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index cd0e4dd9..ee8df92c 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@299cbf941792d474b268c2c486505a04f632e89e # v34.138.3 + uses: renovatebot/github-action@19fcb7282281b0f02488bb772042f53ba654a99e # v34.141.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From b01af1e7a69d1379f3f7b736b575f1ed93e98316 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Fri, 17 Feb 2023 06:02:11 +0000 Subject: [PATCH 1207/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.143.1 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index ee8df92c..0622e9a0 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@19fcb7282281b0f02488bb772042f53ba654a99e # v34.141.0 + uses: renovatebot/github-action@d219f8fea2d2665a25fd4d0f39b6a18e31ac8fa2 # v34.143.1 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 0eeed904a7b3c6d41fdc57e31c843c90cd50a128 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Sat, 18 Feb 2023 06:01:45 +0000 Subject: [PATCH 1208/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.145.1 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 0622e9a0..bce947b8 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@d219f8fea2d2665a25fd4d0f39b6a18e31ac8fa2 # v34.143.1 + uses: renovatebot/github-action@78179592fbdafad8276d547ce30a1e7b63cf395e # v34.145.1 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From bd35192df1fc91c7ec49c2fb659a645948585dcd Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Sun, 19 Feb 2023 06:01:58 +0000 Subject: [PATCH 1209/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.146.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index bce947b8..2e8211ff 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@78179592fbdafad8276d547ce30a1e7b63cf395e # v34.145.1 + uses: renovatebot/github-action@b57001b1b7a54305bc29e0dd9e9b58528765e68d # v34.146.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From faeb90e033cabc15143aaa3bcbd0f6faa2e469fc Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Mon, 20 Feb 2023 06:02:17 +0000 Subject: [PATCH 1210/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.146.1 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 2e8211ff..ed370b55 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@b57001b1b7a54305bc29e0dd9e9b58528765e68d # v34.146.0 + uses: renovatebot/github-action@57ea3203719eee5f6de53b57eb613562b34e72ae # v34.146.1 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 78775efabc94524bdee8ce782dfc5e065d541f7e Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Tue, 21 Feb 2023 12:01:53 +0000 Subject: [PATCH 1211/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.147.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index ed370b55..fa86daa0 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@57ea3203719eee5f6de53b57eb613562b34e72ae # v34.146.1 + uses: renovatebot/github-action@3769535a024b2af8b3d75036125c6a6310bfaecb # v34.147.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 501e7bb36e95e76ad9c455a8e08254fe5a25bd10 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Wed, 22 Feb 2023 12:01:55 +0000 Subject: [PATCH 1212/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.149.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index fa86daa0..81ca04e4 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@3769535a024b2af8b3d75036125c6a6310bfaecb # v34.147.0 + uses: renovatebot/github-action@2118dab1b054c719e86062765ef531540cef617e # v34.149.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From bda6669115f3d3b9a61e28683d2665e18fb958b8 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Thu, 23 Feb 2023 06:01:59 +0000 Subject: [PATCH 1213/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.152.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 81ca04e4..48bcfd1e 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@2118dab1b054c719e86062765ef531540cef617e # v34.149.0 + uses: renovatebot/github-action@1c6288ccd6c960b99957a5e1bdb0ea9fc992d35f # v34.152.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 1c06f724c488bcd9a47d57b5bcbb4d6531122dc5 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Fri, 24 Feb 2023 06:01:53 +0000 Subject: [PATCH 1214/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.152.3 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 48bcfd1e..c7631542 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@1c6288ccd6c960b99957a5e1bdb0ea9fc992d35f # v34.152.0 + uses: renovatebot/github-action@860873109c4e50ae40ae67ddfaa470ff27dfedfc # v34.152.3 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From b4189ff3d0c2f29fa546740a514e04a3fcee7b6e Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Fri, 24 Feb 2023 18:01:56 +0000 Subject: [PATCH 1215/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.152.4 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index c7631542..ae183102 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@860873109c4e50ae40ae67ddfaa470ff27dfedfc # v34.152.3 + uses: renovatebot/github-action@3cae5833b4ae40ae8e4b9921c5c1a32adeda490b # v34.152.4 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 28613bb6427388ec70413c8f7ebb7da24dab92eb Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Mon, 27 Feb 2023 00:03:29 +0000 Subject: [PATCH 1216/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.152.5 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index ae183102..986d374a 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@3cae5833b4ae40ae8e4b9921c5c1a32adeda490b # v34.152.4 + uses: renovatebot/github-action@eecdb5036a45e69b95c4efe9df8c3070c5f18d2f # v34.152.5 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 59f637f4a98199a1ab056e1455a0296b6caeae65 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Tue, 28 Feb 2023 06:01:51 +0000 Subject: [PATCH 1217/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.153.2 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 986d374a..5d8c874e 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@eecdb5036a45e69b95c4efe9df8c3070c5f18d2f # v34.152.5 + uses: renovatebot/github-action@f1483ca0114f708761dd3f70ac6fbe90a8c53b2a # v34.153.2 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 6329bafde7f2f4b0dfb84228efc6b35c70cb22dc Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Wed, 1 Mar 2023 06:02:07 +0000 Subject: [PATCH 1218/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.154.1 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 5d8c874e..1602f78d 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@f1483ca0114f708761dd3f70ac6fbe90a8c53b2a # v34.153.2 + uses: renovatebot/github-action@51912b2f2014c635a0cbd42e1c09f808f705df0c # v34.154.1 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 4f7b3b476ad4f52c6787b71509e7c39b2f949a83 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Thu, 2 Mar 2023 00:03:10 +0000 Subject: [PATCH 1219/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.154.2 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 1602f78d..e6992d9e 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@51912b2f2014c635a0cbd42e1c09f808f705df0c # v34.154.1 + uses: renovatebot/github-action@10adb9e8e0ec7a22afc911836833330eba0f81aa # v34.154.2 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 7a38723ce233a0bb1c35c68cbd7370210d463b03 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Fri, 3 Mar 2023 06:01:55 +0000 Subject: [PATCH 1220/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.154.4 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index e6992d9e..22ecc2fd 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@10adb9e8e0ec7a22afc911836833330eba0f81aa # v34.154.2 + uses: renovatebot/github-action@62d4ea4890488e04a064062124f66ca001cbfec3 # v34.154.4 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 3c5ea7b7104072ae9ec59fa179b6a454238ffeae Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Sun, 5 Mar 2023 00:03:17 +0000 Subject: [PATCH 1221/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.157.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 22ecc2fd..5fdd7976 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@62d4ea4890488e04a064062124f66ca001cbfec3 # v34.154.4 + uses: renovatebot/github-action@a659fe27f0a9503a1603320305d635b47301ae28 # v34.157.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 07f6648e93d362a9b58fa688a5f8fe9b7b747842 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Mon, 6 Mar 2023 06:01:46 +0000 Subject: [PATCH 1222/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.157.1 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 5fdd7976..af000128 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@a659fe27f0a9503a1603320305d635b47301ae28 # v34.157.0 + uses: renovatebot/github-action@53bd6fe922a2555afc79e4f82d626e49b0a0f6b1 # v34.157.1 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 5d7e0b7b63c5ee367d4850f5fba0ee52d9ba5cc8 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Wed, 8 Mar 2023 00:03:32 +0000 Subject: [PATCH 1223/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.158.2 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index af000128..bd14c1da 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@53bd6fe922a2555afc79e4f82d626e49b0a0f6b1 # v34.157.1 + uses: renovatebot/github-action@be5f2172cb562ed27e7cde06f3543e3eb92cffc0 # v34.158.2 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From f3b4009b8d8688051f9219f9408a0d75f90bb132 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Thu, 9 Mar 2023 00:03:22 +0000 Subject: [PATCH 1224/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.159.1 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index bd14c1da..093ba903 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@be5f2172cb562ed27e7cde06f3543e3eb92cffc0 # v34.158.2 + uses: renovatebot/github-action@5e8129624e65d182d7dc0fa673708ff4badab949 # v34.159.1 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 76c0863f8b99fb8e46a4a21d922e3a9434e21a00 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Fri, 10 Mar 2023 00:03:13 +0000 Subject: [PATCH 1225/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v34.159.2 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 093ba903..c535b39b 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@5e8129624e65d182d7dc0fa673708ff4badab949 # v34.159.1 + uses: renovatebot/github-action@c56dbeca772b331ddf18eefad8b93f0f3c69d34a # v34.159.2 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 64a9bc726ab364395dda502425187ac22f99ecc6 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Fri, 10 Mar 2023 18:01:46 +0000 Subject: [PATCH 1226/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v35.0.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index c535b39b..8d6ffd85 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@c56dbeca772b331ddf18eefad8b93f0f3c69d34a # v34.159.2 + uses: renovatebot/github-action@ad0da5aa3d10144426ac0c672f04a7b5d98a1306 # v35.0.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 27712ae833af17d7acb014edcbe4856c31d33975 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Sun, 12 Mar 2023 06:01:46 +0000 Subject: [PATCH 1227/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v35.1.2 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 8d6ffd85..7db9909d 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@ad0da5aa3d10144426ac0c672f04a7b5d98a1306 # v35.0.0 + uses: renovatebot/github-action@24c7a5d0372c64ae42b6b02f155a4223f5ea6a8d # v35.1.2 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 9d41ae3875013dd690188c6c76f1cae55be7b900 Mon Sep 17 00:00:00 2001 From: TrueCharts-Admin Date: Mon, 13 Mar 2023 00:03:23 +0000 Subject: [PATCH 1228/1229] chore(deps): update github-action renovatebot/github-action [skip ci] to v35.2.0 --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 7db9909d..1ef06756 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} - name: Self-hosted Renovate - uses: renovatebot/github-action@24c7a5d0372c64ae42b6b02f155a4223f5ea6a8d # v35.1.2 + uses: renovatebot/github-action@927d318430b8127887559d9721fdfcaaa4646fb9 # v35.2.0 with: configurationFile: .github/renovate-config.js token: ${{ secrets.BOT_TOKEN }} From 8ac7f0fb9cb06b4dff446df731bb5a744001666e Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Thu, 16 Mar 2023 09:47:07 +0100 Subject: [PATCH 1229/1229] move to truetool folder --- .../.github}/renovate-config.js | 0 {.github => truetool/.github}/renovate.json5 | 0 .../.github}/workflows/renovate.yml | 0 .../.github}/workflows/shellcheck.yml | 0 truetool/.pre-commit-config.yaml | 21 +++++++++++++++++++ LICENSE => truetool/LICENSE | 0 README.md => truetool/README.md | 0 {bin => truetool/bin}/truetool | 0 bootstrap => truetool/bootstrap | 0 {functions => truetool/functions}/LICENSE | 0 {functions => truetool/functions}/backup.sh | 0 {functions => truetool/functions}/dns.sh | 0 {functions => truetool/functions}/mount.sh | 0 {functions => truetool/functions}/readme.md | 0 .../functions}/update_apps.sh | 0 {includes => truetool/includes}/backup.sh | 0 {includes => truetool/includes}/chores.sh | 0 {includes => truetool/includes}/help.sh | 0 {includes => truetool/includes}/mount.sh | 0 {includes => truetool/includes}/no_args.sh | 0 {includes => truetool/includes}/patch.sh | 0 {includes => truetool/includes}/title.sh | 0 .../includes}/update_self.sh | 0 {patch => truetool/patch}/2212/HP1.patch | 0 {patch => truetool/patch}/2212/HP2.patch | 0 truetool.sh => truetool/truetool.sh | 0 26 files changed, 21 insertions(+) rename {.github => truetool/.github}/renovate-config.js (100%) rename {.github => truetool/.github}/renovate.json5 (100%) rename {.github => truetool/.github}/workflows/renovate.yml (100%) rename {.github => truetool/.github}/workflows/shellcheck.yml (100%) create mode 100644 truetool/.pre-commit-config.yaml rename LICENSE => truetool/LICENSE (100%) rename README.md => truetool/README.md (100%) rename {bin => truetool/bin}/truetool (100%) mode change 100755 => 100644 rename bootstrap => truetool/bootstrap (100%) mode change 100755 => 100644 rename {functions => truetool/functions}/LICENSE (100%) rename {functions => truetool/functions}/backup.sh (100%) mode change 100755 => 100644 rename {functions => truetool/functions}/dns.sh (100%) mode change 100755 => 100644 rename {functions => truetool/functions}/mount.sh (100%) mode change 100755 => 100644 rename {functions => truetool/functions}/readme.md (100%) rename {functions => truetool/functions}/update_apps.sh (100%) mode change 100755 => 100644 rename {includes => truetool/includes}/backup.sh (100%) rename {includes => truetool/includes}/chores.sh (100%) mode change 100755 => 100644 rename {includes => truetool/includes}/help.sh (100%) mode change 100755 => 100644 rename {includes => truetool/includes}/mount.sh (100%) mode change 100755 => 100644 rename {includes => truetool/includes}/no_args.sh (100%) mode change 100755 => 100644 rename {includes => truetool/includes}/patch.sh (100%) mode change 100755 => 100644 rename {includes => truetool/includes}/title.sh (100%) mode change 100755 => 100644 rename {includes => truetool/includes}/update_self.sh (100%) mode change 100755 => 100644 rename {patch => truetool/patch}/2212/HP1.patch (100%) rename {patch => truetool/patch}/2212/HP2.patch (100%) rename truetool.sh => truetool/truetool.sh (100%) mode change 100755 => 100644 diff --git a/.github/renovate-config.js b/truetool/.github/renovate-config.js similarity index 100% rename from .github/renovate-config.js rename to truetool/.github/renovate-config.js diff --git a/.github/renovate.json5 b/truetool/.github/renovate.json5 similarity index 100% rename from .github/renovate.json5 rename to truetool/.github/renovate.json5 diff --git a/.github/workflows/renovate.yml b/truetool/.github/workflows/renovate.yml similarity index 100% rename from .github/workflows/renovate.yml rename to truetool/.github/workflows/renovate.yml diff --git a/.github/workflows/shellcheck.yml b/truetool/.github/workflows/shellcheck.yml similarity index 100% rename from .github/workflows/shellcheck.yml rename to truetool/.github/workflows/shellcheck.yml diff --git a/truetool/.pre-commit-config.yaml b/truetool/.pre-commit-config.yaml new file mode 100644 index 00000000..cce767d4 --- /dev/null +++ b/truetool/.pre-commit-config.yaml @@ -0,0 +1,21 @@ +# See https://pre-commit.com for more information +repos: +- repo: https://github.com/Lucas-C/pre-commit-hooks + rev: v1.1.10 + hooks: + - id: remove-tabs + +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.0.1 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: fix-byte-order-marker + - id: mixed-line-ending + - id: check-merge-conflict + - id: check-case-conflict + - id: check-executables-have-shebangs + - id: check-docstring-first + - id: check-symlinks + - id: destroyed-symlinks + - id: fix-byte-order-marker diff --git a/LICENSE b/truetool/LICENSE similarity index 100% rename from LICENSE rename to truetool/LICENSE diff --git a/README.md b/truetool/README.md similarity index 100% rename from README.md rename to truetool/README.md diff --git a/bin/truetool b/truetool/bin/truetool old mode 100755 new mode 100644 similarity index 100% rename from bin/truetool rename to truetool/bin/truetool diff --git a/bootstrap b/truetool/bootstrap old mode 100755 new mode 100644 similarity index 100% rename from bootstrap rename to truetool/bootstrap diff --git a/functions/LICENSE b/truetool/functions/LICENSE similarity index 100% rename from functions/LICENSE rename to truetool/functions/LICENSE diff --git a/functions/backup.sh b/truetool/functions/backup.sh old mode 100755 new mode 100644 similarity index 100% rename from functions/backup.sh rename to truetool/functions/backup.sh diff --git a/functions/dns.sh b/truetool/functions/dns.sh old mode 100755 new mode 100644 similarity index 100% rename from functions/dns.sh rename to truetool/functions/dns.sh diff --git a/functions/mount.sh b/truetool/functions/mount.sh old mode 100755 new mode 100644 similarity index 100% rename from functions/mount.sh rename to truetool/functions/mount.sh diff --git a/functions/readme.md b/truetool/functions/readme.md similarity index 100% rename from functions/readme.md rename to truetool/functions/readme.md diff --git a/functions/update_apps.sh b/truetool/functions/update_apps.sh old mode 100755 new mode 100644 similarity index 100% rename from functions/update_apps.sh rename to truetool/functions/update_apps.sh diff --git a/includes/backup.sh b/truetool/includes/backup.sh similarity index 100% rename from includes/backup.sh rename to truetool/includes/backup.sh diff --git a/includes/chores.sh b/truetool/includes/chores.sh old mode 100755 new mode 100644 similarity index 100% rename from includes/chores.sh rename to truetool/includes/chores.sh diff --git a/includes/help.sh b/truetool/includes/help.sh old mode 100755 new mode 100644 similarity index 100% rename from includes/help.sh rename to truetool/includes/help.sh diff --git a/includes/mount.sh b/truetool/includes/mount.sh old mode 100755 new mode 100644 similarity index 100% rename from includes/mount.sh rename to truetool/includes/mount.sh diff --git a/includes/no_args.sh b/truetool/includes/no_args.sh old mode 100755 new mode 100644 similarity index 100% rename from includes/no_args.sh rename to truetool/includes/no_args.sh diff --git a/includes/patch.sh b/truetool/includes/patch.sh old mode 100755 new mode 100644 similarity index 100% rename from includes/patch.sh rename to truetool/includes/patch.sh diff --git a/includes/title.sh b/truetool/includes/title.sh old mode 100755 new mode 100644 similarity index 100% rename from includes/title.sh rename to truetool/includes/title.sh diff --git a/includes/update_self.sh b/truetool/includes/update_self.sh old mode 100755 new mode 100644 similarity index 100% rename from includes/update_self.sh rename to truetool/includes/update_self.sh diff --git a/patch/2212/HP1.patch b/truetool/patch/2212/HP1.patch similarity index 100% rename from patch/2212/HP1.patch rename to truetool/patch/2212/HP1.patch diff --git a/patch/2212/HP2.patch b/truetool/patch/2212/HP2.patch similarity index 100% rename from patch/2212/HP2.patch rename to truetool/patch/2212/HP2.patch diff --git a/truetool.sh b/truetool/truetool.sh old mode 100755 new mode 100644 similarity index 100% rename from truetool.sh rename to truetool/truetool.sh