Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update misc.sh #312

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ We thank all the contributors to the project. Here is the full list of the peopl
* [Anton Maksimovich](https://github.com/ABSLord)
* [Dmitriy Ivanko](https://github.com/Themanwhosmellslikesugar)
* [Vladislav Iarovoy](https://github.com/IrovoyVlad)
* [Daria Budarina](https://github.com/db-yaya)
97 changes: 97 additions & 0 deletions helpers/misc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,80 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

# Adds the specified package name to the BASE_PACKAGES environment variable
# which is a comma-separated list.
# Globals:
# BASE_PACKAGES
# Arguments:
# Package name
# Returns:
# None
add_package_to_base_packages() {
if is_alpine; then
add_item_to_list "${1}" BASE_PACKAGES " "
else
add_item_to_list "${1}" BASE_PACKAGES ","
fi
}

# Adds the specified package name to the INCLUDES environment variable which is
# a comma-separated list.
# Globals:
# INCLUDES
# Arguments:
# Package name
# Returns:
# None
add_package_to_includes() {
add_item_to_list "${1}" INCLUDES ","
}

# Adds the specified options to the PM_OPTIONS environment variable which is
# a space-separated list.
# Globals:
# PM_OPTIONS
# Arguments:
# option
# Returns:
# None
add_option_to_pm_options() {
add_item_to_list "${1}" PM_OPTIONS " "
}

# Checks if Pieman is run in the docker container based on its official Docker
# image cusdeb/pieman.
# Globals:
# None
# Arguments:
# None
# Returns:
# Boolean
check_if_run_in_docker() {
if [ -f /.dockerenv ]; then
true
else
false
fi
}


# Creates a keyring from the public keys related to the operating system which
# is going to be used as a base for the target image. Then, the keyring is
# passed to debootstrap. The keyring name is stored in the KEYRING environment
# variable.
# Globals:
# PIECES
# KEYRING
# Arguments:
# None
# Returns:
# None
create_keyring() {
for key in keys/"${PIECES[0]}"/*; do
gpg --no-default-keyring --keyring="${KEYRING}" --import "${key}"
done
}

# Encrypts the specified password using the SHA-512 method.
# Globals:
# PYTHON
Expand All @@ -37,3 +111,26 @@ do_wget() {
wget.py "$@"
}

# Adds the public keys, related to the operating system which is used as a base
# for the target image, to the list of trusted keys.
# Globals:
# PIECES
# R
# Arguments:
# None
# Returns:
# None
mark_keys_as_trusted() {
for key in keys/"${PIECES[0]}"/*; do
local key_name=""

key_name=$(basename "${key}")

cp "${key}" "${R}"

info "adding ${key} to the list of trusted keys"
chroot_exec apt-key add "${key_name}"

chroot_exec rm "${key_name}"
done
}
111 changes: 0 additions & 111 deletions helpers/others.sh

This file was deleted.