aboutsummaryrefslogtreecommitdiff
path: root/i18n/fr_FR/projects/cros-scripts
diff options
context:
space:
mode:
authorLibreboot Contributor <contributor@libreboot.org>2020-03-18 17:20:14 +0100
committerLibreboot Contributor <contributor@libreboot.org>2020-03-18 17:20:27 +0100
commit0f6ea1c9e0a25a9b7546f96f27cef8841f0d09b5 (patch)
treea28b9403123dd6204eb2dd8cb44eada12c169f4b /i18n/fr_FR/projects/cros-scripts
parent6e5bdd1271059a9c61c80b21001fd3d14ff25045 (diff)
downloadlibrebootfr-0f6ea1c9e0a25a9b7546f96f27cef8841f0d09b5.tar.gz
librebootfr-0f6ea1c9e0a25a9b7546f96f27cef8841f0d09b5.zip
Creation of i18n folder containing translations of the libreboot project. Added french one, not finished.
Diffstat (limited to 'i18n/fr_FR/projects/cros-scripts')
-rwxr-xr-xi18n/fr_FR/projects/cros-scripts/cros-scripts40
-rwxr-xr-xi18n/fr_FR/projects/cros-scripts/install/cros-boot-keys210
-rwxr-xr-xi18n/fr_FR/projects/cros-scripts/install/cros-firmware-prepare320
-rwxr-xr-xi18n/fr_FR/projects/cros-scripts/install/cros-kernel-install286
-rwxr-xr-xi18n/fr_FR/projects/cros-scripts/install/cros-kernel-prepare159
-rwxr-xr-xi18n/fr_FR/projects/cros-scripts/install/cros-medium-setup316
-rw-r--r--i18n/fr_FR/projects/cros-scripts/install/install5
7 files changed, 1336 insertions, 0 deletions
diff --git a/i18n/fr_FR/projects/cros-scripts/cros-scripts b/i18n/fr_FR/projects/cros-scripts/cros-scripts
new file mode 100755
index 00000000..1171e459
--- /dev/null
+++ b/i18n/fr_FR/projects/cros-scripts/cros-scripts
@@ -0,0 +1,40 @@
+#!/usr/bin/env bash
+
+# Copyright (C) 2016 Paul Kocialkowski <contact@paulk.fr>
+#
+# 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 <http://www.gnu.org/licenses/>.
+
+usage() {
+ project_usage_actions "$project"
+}
+
+install() {
+ project_install "$project"
+}
+
+install_check() {
+ project_install_check "$project"
+}
+
+release() {
+ project_release_install_archive "$project" "$TOOLS"
+}
+
+release_check() {
+ project_release_install_archive_check "$project" "$TOOLS"
+}
+
+clean() {
+ project_clean "$project"
+}
diff --git a/i18n/fr_FR/projects/cros-scripts/install/cros-boot-keys b/i18n/fr_FR/projects/cros-scripts/install/cros-boot-keys
new file mode 100755
index 00000000..53db579f
--- /dev/null
+++ b/i18n/fr_FR/projects/cros-scripts/install/cros-boot-keys
@@ -0,0 +1,210 @@
+#!/usr/bin/env bash
+
+# Copyright (C) 2016 Paul Kocialkowski <contact@paulk.fr>
+#
+# 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 <http://www.gnu.org/licenses/>.
+
+REGEXP="\([^[:space:]]*\)[[:space:]]\(.*\)"
+
+KEYBLOCK="keyblock"
+VBPRIVK="vbprivk"
+VBPUBK="vbpubk"
+KEYB="keyb"
+PEM="pem"
+CRT="crt"
+
+KEYS="ec_root_key ec_data_key root_key firmware_data_key kernel_subkey kernel_data_key recovery_key recovery_kernel_data_key installer_kernel_data_key"
+KEYBLOCKS="firmware ec recovery_kernel kernel installer_kernel"
+SUBKEYS="firmware_data_key root_key ec_data_key ec_root_key recovery_kernel_data_key recovery_key kernel_data_key kernel_subkey installer_kernel_data_key recovery_key"
+ALGORITHMS="7 7 11 7 7 4 11 11 11"
+MODES="7 7 11 7 10"
+
+usage() {
+ printf 1>&2 '%s\n' "$executable [action]"
+
+ printf 1>&2 '\n%s\n' 'Actions:'
+ printf 1>&2 '%s\n' ' generate - Generate a set of keys'
+ printf 1>&2 '%s\n' ' verify - Verify keyblocks'
+
+ printf 1>&2 '\n%s\n' 'Environment variables:'
+ printf 1>&2 '%s\n' ' KEYS_VERSION - Version to give the keys'
+ printf 1>&2 '%s\n' ' VBOOT_KEYS_PATH - Path to the vboot keys'
+ printf 1>&2 '%s\n' ' VBOOT_TOOLS_PATH - Path to vboot tools'
+}
+
+keys_override_confirm() {
+ local override=0
+ local confirm
+
+ for key in $KEYS
+ do
+ if [ -f "$VBOOT_KEYS_PATH/$key.$VBPUBK" ] || [ -f "$VBOOT_KEYS_PATH/$key.$VBPRIVK" ]
+ then
+ override=1
+ fi
+ done
+
+ for keyblock in $KEYBLOCKS
+ do
+ if [ -f "$VBOOT_KEYS_PATH/$keyblock.$KEYBLOCK" ]
+ then
+ override=1
+ fi
+ done
+
+ if [ $override -ne 1 ]
+ then
+ return 0
+ fi
+
+ printf '%s\n' 'This is going to override keys stored in the following directory:'
+ printf '%s\n' " $VBOOT_KEYS_PATH"
+ printf '%s' 'Press enter to confirm: '
+
+ read confirm
+}
+
+generate() {
+ local algorithms=$ALGORITHMS
+ local subkeys=$SUBKEYS
+ local modes=$MODES
+ local keyblock
+ local algorithm
+ local pubkey
+ local privkey
+ local mode
+
+ keys_override_confirm
+
+ for key in $KEYS
+ do
+ algorithm=$( printf '%s\n' "$algorithms" | sed "s/$REGEXP/\1/g" )
+ algorithms=$( printf '%s\n' "$algorithms" | sed "s/$REGEXP/\2/g" )
+
+ key_length=$(( 1 << (10 + ($algorithm / 3)) ))
+
+ openssl genrsa -F4 -out "$VBOOT_KEYS_PATH/$key.$PEM" "$key_length"
+ openssl req -batch -new -x509 -key "$VBOOT_KEYS_PATH/$key.$PEM"
+ openssl req -batch -new -x509 -key "$VBOOT_KEYS_PATH/$key.$PEM" -out "$VBOOT_KEYS_PATH/$key.$CRT"
+ dumpRSAPublicKey -cert "$VBOOT_KEYS_PATH/$key.$CRT" > "$VBOOT_KEYS_PATH/$key.$KEYB"
+ futility vbutil_key --pack "$VBOOT_KEYS_PATH/$key.$VBPUBK" --key "$VBOOT_KEYS_PATH/$key.$KEYB" --version "$KEYS_VERSION" --algorithm "$algorithm"
+ futility vbutil_key --pack "$VBOOT_KEYS_PATH/$key.$VBPRIVK" --key "$VBOOT_KEYS_PATH/$key.$PEM" --algorithm "$algorithm"
+
+ rm -f "$VBOOT_KEYS_PATH/$key.$PEM" "$VBOOT_KEYS_PATH/$key.$CRT" "$VBOOT_KEYS_PATH/$key.$KEYB"
+ done
+
+ printf '\n%s\n' "Generated keys $KEYS"
+
+ for keyblock in $KEYBLOCKS
+ do
+ pubkey=$( printf '%s\n' "$subkeys" | sed "s/$REGEXP/\1/g" )
+ subkeys=$( printf '%s\n' "$subkeys" | sed "s/$REGEXP/\2/g" )
+ privkey=$( printf '%s\n' "$subkeys" | sed "s/$REGEXP/\1/g" )
+ subkeys=$( printf '%s\n' "$subkeys" | sed "s/$REGEXP/\2/g" )
+
+ mode=$( printf '%s\n' "$modes" | sed "s/$REGEXP/\1/g" )
+ modes=$( printf '%s\n' "$modes" | sed "s/$REGEXP/\2/g" )
+
+ futility vbutil_keyblock --pack "$VBOOT_KEYS_PATH/$keyblock.$KEYBLOCK" --flags "$mode" --datapubkey "$VBOOT_KEYS_PATH/$pubkey.$VBPUBK" --signprivate "$VBOOT_KEYS_PATH/$privkey.$VBPRIVK"
+ futility vbutil_keyblock --unpack "$VBOOT_KEYS_PATH/$keyblock.$KEYBLOCK" --signpubkey "$VBOOT_KEYS_PATH/$privkey.$VBPUBK"
+ done
+
+ printf '\n%s\n' "Generated keyblocks $KEYBLOCKS"
+}
+
+verify() {
+ local subkeys=$SUBKEYS
+ local pubkey
+ local privkey
+
+ for keyblock in $KEYBLOCKS
+ do
+ pubkey=$( printf '%s\n' "$subkeys" | sed "s/$REGEXP/\1/g" )
+ subkeys=$( printf '%s\n' "$subkeys" | sed "s/$REGEXP/\2/g" )
+ privkey=$( printf '%s\n' "$subkeys" | sed "s/$REGEXP/\1/g" )
+ subkeys=$( printf '%s\n' "$subkeys" | sed "s/$REGEXP/\2/g" )
+
+ futility vbutil_keyblock --unpack "$VBOOT_KEYS_PATH/$keyblock.$KEYBLOCK" --signpubkey "$VBOOT_KEYS_PATH/$privkey.$VBPUBK"
+ done
+
+ printf '\n%s\n' "Verified keyblocks $KEYBLOCKS"
+}
+
+requirements() {
+ local requirement
+ local requirement_path
+
+ for requirement in "$@"
+ do
+ requirement_path=$( which "$requirement" || true )
+
+ if [ -z "$requirement_path" ]
+ then
+ printf 1>&2 '%s\n' "Missing requirement: $requirement"
+ exit 1
+ fi
+ done
+}
+
+setup() {
+ root=$(readlink -f "$( dirname "$0" )" )
+ executable=$( basename "$0" )
+
+ if [ -z "$KEYS_VERSION" ]
+ then
+ KEYS_VERSION=1
+ fi
+
+ if ! [ -z "$VBOOT_TOOLS_PATH" ]
+ then
+ PATH="$PATH:$VBOOT_TOOLS_PATH"
+ fi
+
+ if [ -z "$VBOOT_KEYS_PATH" ]
+ then
+ VBOOT_KEYS_PATH="$root/keys"
+ mkdir -p "$VBOOT_KEYS_PATH"
+ fi
+}
+
+cros_boot_keys() {
+ local action=$1
+
+ set -e
+
+ setup "$@"
+
+ if [ -z "$action" ]
+ then
+ usage
+ exit 1
+ fi
+
+ case $action in
+ "generate")
+ requirements "openssl" "dumpRSAPublicKey" "futility"
+ generate
+ ;;
+ "verify")
+ requirements "futility"
+ verify
+ ;;
+ *)
+ usage
+ exit 1
+ ;;
+ esac
+}
+
+cros_boot_keys "$@"
diff --git a/i18n/fr_FR/projects/cros-scripts/install/cros-firmware-prepare b/i18n/fr_FR/projects/cros-scripts/install/cros-firmware-prepare
new file mode 100755
index 00000000..8fceffb4
--- /dev/null
+++ b/i18n/fr_FR/projects/cros-scripts/install/cros-firmware-prepare
@@ -0,0 +1,320 @@
+#!/usr/bin/env bash
+
+# Copyright (C) 2016 Paul Kocialkowski <contact@paulk.fr>
+#
+# 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 <http://www.gnu.org/licenses/>.
+
+KEYBLOCK="keyblock"
+VBPRIVK="vbprivk"
+VBPUBK="vbpubk"
+
+GBB_FLAGS="dev_screen_short_delay load_option_roms enable_alternate_os force_dev_switch_on force_dev_boot_usb disable_fw_rollback_check enter_triggers_tonorm force_dev_boot_legacy faft_key_overide disable_ec_software_sync default_dev_boot_lefacy disable_pd_software_sync disable_lid_shutdown dev_boot_fastboot_full_cap enable_serial"
+
+usage() {
+ printf 1>&2 '%s\n' "$executable [action] [firmware image] [gbb action|vpd action] [gbb file|gbb flag|vpd file]"
+
+ printf 1>&2 '\n%s\n' 'Actions:'
+ printf 1>&2 '%s\n' ' sign - Sign firmware image'
+ printf 1>&2 '%s\n' ' verify - Verify firmware image'
+ printf 1>&2 '%s\n' ' gbb - Google Binary Block'
+
+ printf 1>&2 '\n%s\n' 'GBB actions:'
+ printf 1>&2 '%s\n' ' extract - Extract GBB from firmware image to path'
+ printf 1>&2 '%s\n' ' replace - Replace GBB from path to firmware image'
+ printf 1>&2 '%s\n' ' list - List enabled GBB flags'
+ printf 1>&2 '%s\n' ' enable - Enable GBB flag'
+ printf 1>&2 '%s\n' ' disable - Disable GBB flag'
+
+ printf 1>&2 '\n%s\n' 'GBB flags:'
+
+ for flag in $GBB_FLAGS
+ do
+ printf 1>&2 '%s\n' " $flag"
+ done
+
+ printf 1>&2 '\n%s\n' 'VPD actions:'
+ printf 1>&2 '%s\n' ' extract - Extract VPD from firmware image to path'
+ printf 1>&2 '%s\n' ' replace - Replace VPD from path to firmware image'
+
+ printf 1>&2 '\n%s\n' 'Environment variables:'
+ printf 1>&2 '%s\n' ' VBOOT_KEYS_PATH - Path to the vboot keys'
+ printf 1>&2 '%s\n' ' VBOOT_TOOLS_PATH - Path to vboot tools'
+}
+
+sign() {
+ local firmware_image_path=$1
+
+ futility sign --signprivate="$VBOOT_KEYS_PATH/firmware_data_key.$VBPRIVK" --keyblock "$VBOOT_KEYS_PATH/firmware.$KEYBLOCK" --kernelkey "$VBOOT_KEYS_PATH/kernel_subkey.$VBPUBK" --infile "$firmware_image_path"
+ futility gbb_utility -s --recoverykey="$VBOOT_KEYS_PATH/recovery_key.$VBPUBK" --rootkey="$VBOOT_KEYS_PATH/root_key.$VBPUBK" "$firmware_image_path" "$firmware_image_path"
+
+ printf '\n%s\n' "Signed firmwares image $firmware_image_path"
+}
+
+verify() {
+ local firmware_image_path=$1
+
+ futility verify -k "$VBOOT_KEYS_PATH/root_key.$VBPUBK" "$firmware_image_path" || ( printf '\n%s\n' "Bad firmware image signature!" >&2 && return 1 )
+
+ printf '\n%s\n' "Verified firmware image $firmware_image_path"
+}
+
+gbb() {
+ local firmware_image_path=$1
+ local gbb_action=$2
+ local gbb_file_path=$3
+ local gbb_flag=$3
+
+ local i=0
+ local flags
+ local flag
+ local flag_value
+
+ case $gbb_action in
+ "extract")
+ if [ -z "$gbb_file_path" ]
+ then
+ usage
+ exit 1
+ fi
+
+
+ futility dump_fmap -x "$firmware_image_path" "GBB:$gbb_file_path"
+
+ printf '\n%s\n' "Extracted GBB from $firmware_image_path to $gbb_file_path"
+ ;;
+ "replace")
+ if [ -z "$gbb_file_path" ]
+ then
+ usage
+ exit 1
+ fi
+
+ futility load_fmap "$firmware_image_path" "GBB:$gbb_file_path"
+
+ printf '\n%s\n' "Replaced GBB from $gbb_file_path to $firmware_image_path"
+ ;;
+ "list")
+ printf '%s\n' "GBB flags in $firmware_image_path:"
+
+ flags=$( gbb_flags_get "$firmware_image_path" )
+
+ for flag in $GBB_FLAGS
+ do
+ flag_value=$(( 1 << $i ))
+
+ if (( $flags & $flag_value ))
+ then
+ printf '%s\n' " $flag"
+ fi
+
+ i=$(( $i + 1 ))
+ done
+
+ ;;
+ "enable")
+ if [ -z "$gbb_flag" ]
+ then
+ usage
+ exit 1
+ fi
+
+ flags=$( gbb_flags_get "$firmware_image_path" )
+ flag_value=$( gbb_flag_value "$gbb_flag" )
+
+ if [ -z "$flag_value" ]
+ then
+ printf 1>&2 '%s\n' "Invalid GBB flag: $gbb_flag"
+ exit 1
+ fi
+
+ flags=$( printf "0x%x\n" $(( $flags | $flag_value )) )
+
+ gbb_flags_set "$firmware_image_path" "$flags"
+
+ printf '\n%s\n' "Enabled GBB flag $gbb_flag in $firmware_image_path"
+ ;;
+ "disable")
+ if [ -z "$gbb_flag" ]
+ then
+ usage
+ exit 1
+ fi
+
+ flags=$( gbb_flags_get "$firmware_image_path" )
+ flag_value=$( gbb_flag_value "$gbb_flag" )
+
+ if [ -z "$flag_value" ]
+ then
+ printf 1>&2 '%s\n' "Invalid GBB flag: $gbb_flag"
+ exit 1
+ fi
+
+ flags=$( printf "0x%x\n" $(( $flags & ~$flag_value )) )
+
+ gbb_flags_set "$firmware_image_path" "$flags"
+
+ printf '\n%s\n' "Disabled GBB flag $gbb_flag in $firmware_image_path"
+ ;;
+ *)
+ usage
+ exit 1
+ ;;
+ esac
+
+}
+
+gbb_flags_get() {
+ local firmware_image_path=$1
+
+ futility gbb_utility -g --flags "$firmware_image_path" | sed "s/^[^:]*: //g"
+}
+
+gbb_flags_set() {
+ local firmware_image_path=$1
+ local gbb_flags=$2
+
+ futility gbb_utility -s --flags="$gbb_flags" "$firmware_image_path"
+}
+
+gbb_flag_value() {
+ local gbb_flag=$1
+
+ local i=0
+
+ for flag in $GBB_FLAGS
+ do
+ if [ "$gbb_flag" = "$flag" ]
+ then
+ printf '%d\n' $(( 1 << $i ))
+ return
+ fi
+
+ i=$(( $i + 1 ))
+ done
+}
+
+vpd() {
+ local firmware_image_path=$1
+ local vpd_action=$2
+ local vpd_file_path=$3
+
+ case $vpd_action in
+ "extract")
+ futility dump_fmap -x "$firmware_image_path" "RO_VPD:$vpd_file_path"
+
+ printf '\n%s\n' "Extracted VPD from $firmware_image_path to $vpd_file_path"
+ ;;
+ "replace")
+ futility load_fmap "$firmware_image_path" "RO_VPD:$vpd_file_path"
+
+ printf '\n%s\n' "Replaced VPD from $vpd_file_path to $firmware_image_path"
+ ;;
+ *)
+ usage
+ exit 1
+ ;;
+ esac
+}
+
+requirements() {
+ local requirement
+ local requirement_path
+
+ for requirement in "$@"
+ do
+ requirement_path=$( which "$requirement" || true )
+
+ if [ -z "$requirement_path" ]
+ then
+ printf 1>&2 '%s\n' "Missing requirement: $requirement"
+ exit 1
+ fi
+ done
+}
+
+setup() {
+ root=$(readlink -f "$( dirname "$0" )" )
+ executable=$( basename "$0" )
+
+ if ! [ -z "$VBOOT_TOOLS_PATH" ]
+ then
+ PATH="$PATH:$VBOOT_TOOLS_PATH"
+ fi
+
+ if [ -z "$VBOOT_KEYS_PATH" ]
+ then
+ if ! [ -z "$VBOOT_TOOLS_PATH" ] && [ -d "$VBOOT_TOOLS_PATH/devkeys" ]
+ then
+ VBOOT_KEYS_PATH="$VBOOT_TOOLS_PATH/devkeys"
+ else
+ VBOOT_KEYS_PATH="/usr/share/vboot/devkeys"
+ fi
+ fi
+}
+
+cros_firmware_prepare() {
+ local action=$1
+ local firmware_image_path=$2
+ local gbb_action=$3
+ local vpd_action=$3
+ local gbb_file_path_flag=$4
+ local vpd_file_path=$4
+
+ set -e
+
+ setup "$@"
+
+ if [ -z "$action" ] || [ -z "$firmware_image_path" ]
+ then
+ usage
+ exit 1
+ fi
+
+ case $action in
+ "sign")
+ if ! [ -f "$firmware_image_path" ]
+ then
+ usage
+ exit 1
+ fi
+
+ requirements "futility"
+ sign "$firmware_image_path"
+ ;;
+ "verify")
+ requirements "futility"
+ verify "$firmware_image_path"
+ ;;
+ "gbb")
+ requirements "futility"
+ gbb "$firmware_image_path" "$gbb_action" "$gbb_file_path_flag"
+ ;;
+ "vpd")
+ if [ -z "$vpd_file_path" ]
+ then
+ usage
+ exit 1
+ fi
+
+ requirements "futility"
+ vpd "$firmware_image_path" "$vpd_action" "$vpd_file_path"
+ ;;
+ *)
+ usage
+ exit 1
+ ;;
+ esac
+}
+
+cros_firmware_prepare "$@"
diff --git a/i18n/fr_FR/projects/cros-scripts/install/cros-kernel-install b/i18n/fr_FR/projects/cros-scripts/install/cros-kernel-install
new file mode 100755
index 00000000..8f6c69e9
--- /dev/null
+++ b/i18n/fr_FR/projects/cros-scripts/install/cros-kernel-install
@@ -0,0 +1,286 @@
+#!/usr/bin/env bash
+
+# Copyright (C) 2016 Paul Kocialkowski <contact@paulk.fr>
+#
+# 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 <http://www.gnu.org/licenses/>.
+
+SYS_BLOCK_PATH="/sys/class/block"
+DEV_PATH="/dev"
+DEVICE="device"
+VENDOR="vendor"
+MODEL="model"
+NAME="name"
+
+usage() {
+ printf 1>&2 '%s\n' "$executable [action] [storage] [kernel image|kernel modules]"
+
+ printf 1>&2 '\n%s\n' 'Actions:'
+ printf 1>&2 '%s\n' ' backup - Backup kernel image'
+ printf 1>&2 '%s\n' ' image - Install kernel image'
+ printf 1>&2 '%s\n' ' modules - Install kernel modules'
+
+ usage_storage
+
+ printf 1>&2 '\n%s\n' 'Environment variables:'
+ printf 1>&2 '%s\n' ' VBOOT_KEYS_PATH - Path to the vboot keys'
+ printf 1>&2 '%s\n' ' VBOOT_TOOLS_PATH - Path to vboot tools'
+}
+
+usage_storage() {
+ printf 1>&2 '\n%s\n' 'Storage:'
+
+ local nodes=$( ls "$SYS_BLOCK_PATH" )
+ local node_path
+ local name
+
+ for node in $nodes
+ do
+ node_path="$DEV_PATH/$node"
+ if ! [ -b "$node_path" ]
+ then
+ continue
+ fi
+
+ name=$( storage_name "$node_path" )
+ if [ -z "$name" ]
+ then
+ continue
+ fi
+
+ printf 1>&2 '%s\n' " $node_path - $name"
+ done
+}
+
+storage_affect_confirm() {
+ local storage_path=$1
+
+ local name=$( storage_name "$storage_path" )
+ local confirm
+
+ printf '%s\n' 'This is going to affect the following storage:'
+ printf '%s\n' " $storage_path - $name"
+ printf '%s' 'Press enter to confirm: '
+
+ read confirm
+}
+
+storage_name() {
+ local storage_path=$1
+
+ local node=$( basename "$storage_path" )
+ local vendor_path="$SYS_BLOCK_PATH/$node/$DEVICE/$VENDOR"
+ local model_path="$SYS_BLOCK_PATH/$node/$DEVICE/$MODEL"
+ local name_path="$SYS_BLOCK_PATH/$node/$DEVICE/$NAME"
+ local vendor
+ local name
+
+ if [ -f "$model_path" ]
+ then
+ name=$( cat "$model_path" )
+ elif [ -f "$name_path" ]
+ then
+ name=$( cat "$name_path" )
+ else
+ return 0
+ fi
+
+ name=$( printf '%s\n' "$name" | sed -e "s/^[[:space:]]*//;s/[[:space:]]*$//" )
+
+ if [ -f "$vendor_path" ]
+ then
+ vendor=$( cat "$vendor_path" )
+ vendor=$( printf '%s\n' "$vendor" | sed -e "s/^[[:space:]]*//;s/[[:space:]]*$//" )
+
+ name="$vendor $name"
+ fi
+
+ printf '%s\n' "$name"
+}
+
+storage_partition_path() {
+ local storage_path=$1
+ local index=$2
+
+ storage_partition_path="$storage_path$index"
+
+ if ! [ -b "$storage_partition_path" ]
+ then
+ storage_partition_path="$storage_path""p$index"
+ fi
+
+ if ! [ -b "$storage_partition_path" ]
+ then
+ return 1
+ fi
+
+ printf '%s\n' "$storage_partition_path"
+}
+
+storage_partition_mount_path() {
+ local storage_partition_path=$1
+
+ local storage_partition_mount_path=$( udisksctl info -b "$storage_partition_path" | grep "MountPoints" | sed "s/.*MountPoints:[[:space:]]*\(.*\)/\1/g" )
+
+ printf '%s\n' "$storage_partition_mount_path"
+}
+
+storage_kernel_path() {
+ local storage_path=$1
+
+ cgpt find -t kernel "$storage_path" | head -n 1
+}
+
+storage_rootfs_path() {
+ local storage_path=$1
+
+ cgpt find -t rootfs "$storage_path" | head -n 1
+}
+
+backup() {
+ local storage_path=$1
+ local kernel_image_path=$2
+
+ local storage_kernel_path=$( storage_kernel_path "$storage_path" )
+
+ if [ -z "$storage_kernel_path" ]
+ then
+ printf 1>&2 '%s\n' "No kernel partition found on storage $storage_path"
+ return 1
+ fi
+
+ cat "$storage_kernel_path" > "$kernel_image_path"
+
+ printf '\n%s\n' "Backed up kernel image to $kernel_image_path"
+}
+
+image() {
+ local storage_path=$1
+ local kernel_image_path=$2
+
+ local storage_kernel_path=$( storage_kernel_path "$storage_path" )
+
+ if [ -z "$storage_kernel_path" ]
+ then
+ printf 1>&2 '%s\n' "No kernel partition found on storage $storage_path"
+ return 1
+ fi
+
+ storage_affect_confirm "$storage_path"
+
+ cat "$kernel_image_path" > "$storage_kernel_path"
+ sync
+
+ printf '\n%s\n' "Installed kernel image on storage $storage_path"
+}
+
+modules() {
+ local storage_path=$1
+ local kernel_modules_path=$2
+
+ local storage_rootfs_path=$( storage_rootfs_path "$storage_path" )
+
+ if [ -z "$storage_rootfs_path" ]
+ then
+ printf 1>&2 '%s\n' "No rootfs partition found on storage $storage_path"
+ return 1
+ fi
+
+ storage_affect_confirm "$storage_path"
+
+ # Partition may already be mounted.
+ udisksctl mount -b "$storage_rootfs_path" || true
+
+ storage_rootfs_mount_path=$( storage_partition_mount_path "$storage_rootfs_path" )
+
+ rsync -a --keep-dirlinks "$kernel_modules_path" "$storage_rootfs_mount_path/"
+ sync
+
+ udisksctl unmount -b "$storage_rootfs_path"
+
+ printf '\n%s\n' "Installed kernel modules on storage $storage_path"
+}
+
+requirements() {
+ local requirement
+ local requirement_path
+
+ for requirement in "$@"
+ do
+ requirement_path=$( which "$requirement" || true )
+
+ if [ -z "$requirement_path" ]
+ then
+ printf 1>&2 '%s\n' "Missing requirement: $requirement"
+ exit 1
+ fi
+ done
+}
+
+setup() {
+ root=$(readlink -f "$( dirname "$0" )" )
+ executable=$( basename "$0" )
+
+ if ! [ -z "$VBOOT_TOOLS_PATH" ]
+ then
+ PATH="$PATH:$VBOOT_TOOLS_PATH"
+ fi
+
+ if [ -z "$VBOOT_KEYS_PATH" ]
+ then
+ if ! [ -z "$VBOOT_TOOLS_PATH" ] && [ -d "$VBOOT_TOOLS_PATH/devkeys" ]
+ then
+ VBOOT_KEYS_PATH="$VBOOT_TOOLS_PATH/devkeys"
+ else
+ VBOOT_KEYS_PATH="/usr/share/vboot/devkeys"
+ fi
+ fi
+}
+
+cros_kernel_install() {
+ local action=$1
+ local storage_path=$2
+ local kernel_image_path=$3
+ local kernel_modules_path=$3
+
+ set -e
+
+ setup "$@"
+
+ if [ -z "$action" ] || [ -z "$storage_path" ] || [ -z "$kernel_image_path" ] || [ -z "$kernel_modules_path" ]
+ then
+ usage
+ exit 1
+ fi
+
+ case $action in
+ "backup")
+ requirements "cgpt"
+ backup "$storage_path" "$kernel_image_path"
+ ;;
+ "image")
+ requirements "cgpt"
+ image "$storage_path" "$kernel_image_path"
+ ;;
+ "modules")
+ requirements "cgpt"
+ modules "$storage_path" "$kernel_modules_path"
+ ;;
+ *)
+ usage
+ exit 1
+ ;;
+ esac
+}
+
+cros_kernel_install "$@"
diff --git a/i18n/fr_FR/projects/cros-scripts/install/cros-kernel-prepare b/i18n/fr_FR/projects/cros-scripts/install/cros-kernel-prepare
new file mode 100755
index 00000000..8dd5c797
--- /dev/null
+++ b/i18n/fr_FR/projects/cros-scripts/install/cros-kernel-prepare
@@ -0,0 +1,159 @@
+#!/usr/bin/env bash
+
+# Copyright (C) 2016 Paul Kocialkowski <contact@paulk.fr>
+#
+# 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 <http://www.gnu.org/licenses/>.
+
+KEYBLOCK="keyblock"
+VBPRIVK="vbprivk"
+VBPUBK="vbpubk"
+ARCH="arch"
+CMDLINE="cmdline"
+BOOTLOADER="bootloader"
+KERNEL="kernel"
+ITS="its"
+FIT="fit"
+IMG="img"
+
+usage() {
+ printf 1>&2 '%s\n' "$executable [action] [kernel files|kernel image] [medium]"
+
+ printf 1>&2 '\n%s\n' 'Actions:'
+ printf 1>&2 '%s\n' ' pack - Pack kernel files to a medium-specific image'
+ printf 1>&2 '%s\n' ' sign - Sign kernel image'
+ printf 1>&2 '%s\n' ' verify - Very kernel image signatures'
+
+ printf 1>&2 '\n%s\n' 'Medium:'
+ printf 1>&2 '%s\n' ' usb - External USB storage'
+ printf 1>&2 '%s\n' ' mmc - External SD card storage'
+ printf 1>&2 '%s\n' ' emmc - Internal storage'
+
+ printf 1>&2 '\n%s\n' 'Environment variables:'
+ printf 1>&2 '%s\n' ' VBOOT_KEYS_PATH - Path to the vboot keys'
+ printf 1>&2 '%s\n' ' VBOOT_TOOLS_PATH - Path to vboot tools'
+}
+
+pack() {
+ local kernel_files_path=$1
+ local medium=$2
+
+ local arch_path="$kernel_files_path/$ARCH"
+ local arch=$( cat "$arch_path" )
+ local cmdline_path="$kernel_files_path/$CMDLINE-$medium"
+ local bootloader_path="$kernel_files_path/$BOOTLOADER"
+ local kernel_its_path="$kernel_files_path/$KERNEL.$ITS"
+ local kernel_fit_path="$kernel_files_path/$KERNEL.$FIT"
+ local kernel_image_path="$kernel_files_path/$KERNEL-$medium.$IMG"
+
+ mkimage -f "$kernel_its_path" "$kernel_fit_path"
+ futility vbutil_kernel --pack "$kernel_image_path" --version 1 --arch "$arch" --keyblock "$VBOOT_KEYS_PATH/kernel.$KEYBLOCK" --signprivate "$VBOOT_KEYS_PATH/kernel_data_key.$VBPRIVK" --config "$cmdline_path" --vmlinuz "$kernel_fit_path" --bootloader "$bootloader_path"
+
+ printf '\n%s\n' "Packed kernel image $kernel_image_path"
+}
+
+sign() {
+ local kernel_image_path=$1
+
+ futility vbutil_kernel --repack "$kernel_image_path" --version 1 --keyblock "$VBOOT_KEYS_PATH/kernel.$KEYBLOCK" --signprivate "$VBOOT_KEYS_PATH/kernel_data_key.$VBPRIVK" --oldblob "$kernel_image_path"
+
+ printf '\n%s\n' "Signed kernel image $kernel_image_path"
+}
+
+verify() {
+ local kernel_image_path=$1
+
+ futility vbutil_kernel --verify "$kernel_image_path" --signpubkey "$VBOOT_KEYS_PATH/kernel_subkey.$VBPUBK"
+
+ printf '\n%s\n' "Verified kernel image $kernel_image_path"
+}
+
+requirements() {
+ local requirement
+ local requirement_path
+
+ for requirement in "$@"
+ do
+ requirement_path=$( which "$requirement" || true )
+
+ if [ -z "$requirement_path" ]
+ then
+ printf 1>&2 '%s\n' "Missing requirement: $requirement"
+ exit 1
+ fi
+ done
+}
+
+setup() {
+ root=$(readlink -f "$( dirname "$0" )" )
+ executable=$( basename "$0" )
+
+ if ! [ -z "$VBOOT_TOOLS_PATH" ]
+ then
+ PATH="$PATH:$VBOOT_TOOLS_PATH"
+ fi
+
+ if [ -z "$VBOOT_KEYS_PATH" ]
+ then
+ if ! [ -z "$VBOOT_TOOLS_PATH" ] && [ -d "$VBOOT_TOOLS_PATH/devkeys" ]
+ then
+ VBOOT_KEYS_PATH="$VBOOT_TOOLS_PATH/devkeys"
+ else
+ VBOOT_KEYS_PATH="/usr/share/vboot/devkeys"
+ fi
+ fi
+}
+
+cros_kernel_prepare() {
+ local action=$1
+ local kernel_files_path=$2
+ local kernel_image_path=$2
+ local medium=$3
+
+ set -e
+
+ setup "$@"
+
+ if [ -z "$action" ] || [ -z "$kernel_files_path" ] || [ -z "$kernel_image_path" ]
+ then
+ usage
+ exit 1
+ fi
+
+ case $action in
+ "pack")
+ if [ -z "$medium" ]
+ then
+ usage
+ exit 1
+ fi
+
+ requirements "mkimage" "futility"
+ pack "$kernel_files_path" "$medium"
+ ;;
+ "sign")
+ requirements "futility"
+ sign "$kernel_image_path"
+ ;;
+ "verify")
+ requirements "futility"
+ verify "$kernel_image_path"
+ ;;
+ *)
+ usage
+ exit 1
+ ;;
+ esac
+}
+
+cros_kernel_prepare "$@"
diff --git a/i18n/fr_FR/projects/cros-scripts/install/cros-medium-setup b/i18n/fr_FR/projects/cros-scripts/install/cros-medium-setup
new file mode 100755
index 00000000..6295e0ec
--- /dev/null
+++ b/i18n/fr_FR/projects/cros-scripts/install/cros-medium-setup
@@ -0,0 +1,316 @@
+#!/usr/bin/env bash
+
+# Copyright (C) 2016 Paul Kocialkowski <contact@paulk.fr>
+#
+# 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 <http://www.gnu.org/licenses/>.
+
+SYS_BLOCK_PATH="/sys/class/block"
+DEV_PATH="/dev"
+DEVICE="device"
+VENDOR="vendor"
+MODEL="model"
+NAME="name"
+KERNEL="kernel"
+IMG="img"
+KERNEL_MODULES="modules/lib"
+KERNEL_PARTITION_INDEX=1
+ROOTFS_PARTITION_INDEX=2
+
+# Size in blocks (512 kiB)
+GPT_SIZE=34
+KERNEL_SIZE=16384
+
+usage() {
+ printf 1>&2 '%s\n' "$executable [action] [storage] [rootfs tarball|kernel files] [medium]"
+
+ printf 1>&2 '\n%s\n' 'Actions:'
+ printf 1>&2 '%s\n' ' partitions - Setup partitions on storage'
+ printf 1>&2 '%s\n' ' rootfs - Install rootfs tarball to storage'
+ printf 1>&2 '%s\n' ' kernel - Install kernel files to storage'
+
+ usage_storage
+
+ printf 1>&2 '\n%s\n' 'Environment variables:'
+ printf 1>&2 '%s\n' ' KERNEL_PATH - Path to the kernel image'
+ printf 1>&2 '%s\n' ' VBOOT_TOOLS_PATH - Path to vboot tools'
+}
+
+usage_storage() {
+ printf 1>&2 '\n%s\n' 'Storage:'
+
+ local nodes=$( ls "$SYS_BLOCK_PATH" )
+ local node_path
+ local name
+
+ for node in $nodes
+ do
+ node_path="$DEV_PATH/$node"
+ if ! [ -b "$node_path" ]
+ then
+ continue
+ fi
+
+ name=$( storage_name "$node_path" )
+ if [ -z "$name" ]
+ then
+ continue
+ fi
+
+ printf 1>&2 '%s\n' " $node_path - $name"
+ done
+}
+
+storage_affect_confirm() {
+ local storage_path=$1
+
+ local name=$( storage_name "$storage_path" )
+ local confirm
+
+ printf '%s\n' 'This is going to affect the following storage:'
+ printf '%s\n' " $storage_path - $name"
+ printf '%s' 'Press enter to confirm: '
+
+ read confirm
+}
+
+storage_name() {
+ local storage_path=$1
+
+ local node=$( basename "$storage_path" )
+ local vendor_path="$SYS_BLOCK_PATH/$node/$DEVICE/$VENDOR"
+ local model_path="$SYS_BLOCK_PATH/$node/$DEVICE/$MODEL"
+ local name_path="$SYS_BLOCK_PATH/$node/$DEVICE/$NAME"
+ local vendor
+ local name
+
+ if [ -f "$model_path" ]
+ then
+ name=$( cat "$model_path" )
+ elif [ -f "$name_path" ]
+ then
+ name=$( cat "$name_path" )
+ else
+ return 0
+ fi
+
+ name=$( printf '%s\n' "$name" | sed -e "s/^[[:space:]]*//;s/[[:space:]]*$//" )
+
+ if [ -f "$vendor_path" ]
+ then
+ vendor=$( cat "$vendor_path" )
+ vendor=$( printf '%s\n' "$vendor" | sed -e "s/^[[:space:]]*//;s/[[:space:]]*$//" )
+
+ name="$vendor $name"
+ fi
+
+ printf '%s\n' "$name"
+}
+
+storage_partition_path() {
+ local storage_path=$1
+ local index=$2
+
+ storage_partition_path="$storage_path$index"
+
+ if ! [ -b "$storage_partition_path" ]
+ then
+ storage_partition_path="$storage_path""p$index"
+ fi
+
+ if ! [ -b "$storage_partition_path" ]
+ then
+ return 1
+ fi
+
+ printf '%s\n' "$storage_partition_path"
+}
+
+storage_partition_mount_path() {
+ local storage_partition_path=$1
+
+ local storage_partition_mount_path=$( udisksctl info -b "$storage_partition_path" | grep "MountPoints" | sed "s/.*MountPoints:[[:space:]]*\(.*\)/\1/g" )
+
+ printf '%s\n' "$storage_partition_mount_path"
+}
+
+partitions() {
+ local storage_path=$1
+
+ local storage_rootfs_path
+ local partitions
+ local start
+
+ storage_affect_confirm "$storage_path"
+
+ partitions=$( mount | grep -P "^$storage_path" | sed "s/^\([^[:space:]]*\).*/\1/g" )
+
+ for partition in $partitions
+ do
+ # Partition may already be unmounted.
+ udisksctl unmount -b "$partition" || true
+ done
+
+ ( printf '%s\n' "g" ; printf '%s\n' "w" ) | fdisk "$storage_path"
+
+ cgpt create "$storage_path"
+
+ start=$GPT_SIZE
+ size=$KERNEL_SIZE
+ cgpt add -b "$start" -s "$size" -P 1 -S 1 -t kernel -l kernel "$storage_path"
+
+ start=$(( $start + $size ))
+ size=$( cgpt show "$storage_path" | grep "Sec GPT table" | sed "s/[[:space:]]*\([0-9]*\).*/\1/g" )
+ size=$(( $size - $start ))
+ cgpt add -b "$start" -s "$size" -t rootfs -l rootfs "$storage_path"
+
+ blockdev --rereadpt "$storage_path" || partprobe "$storage_path"
+
+ storage_rootfs_path=$( storage_partition_path "$storage_path" "$ROOTFS_PARTITION_INDEX" )
+
+ mkfs.ext4 -F "$storage_rootfs_path"
+
+ printf '\n%s\n' "Setup partitions on storage $storage_path"
+}
+
+rootfs() {
+ local storage_path=$1
+ local rootfs_tarball_path=$2
+
+ local storage_rootfs_path=$( storage_partition_path "$storage_path" "$ROOTFS_PARTITION_INDEX" )
+ local storage_rootfs_mount_path
+
+ storage_affect_confirm "$storage_path"
+
+ # Partition may already be mounted.
+ udisksctl mount -b "$storage_rootfs_path" || true
+
+ storage_rootfs_mount_path=$( storage_partition_mount_path "$storage_rootfs_path" )
+
+ tar -xf "$rootfs_tarball_path" -ps -C "$storage_rootfs_mount_path"
+
+ udisksctl unmount -b "$storage_rootfs_path"
+
+ printf '\n%s\n' "Installed rootfs on storage $storage_path"
+}
+
+kernel() {
+ local storage_path=$1
+ local kernel_files_path=$2
+ local medium=$3
+
+ local storage_kernel_path=$( storage_partition_path "$storage_path" "$KERNEL_PARTITION_INDEX" )
+ local storage_rootfs_path=$( storage_partition_path "$storage_path" "$ROOTFS_PARTITION_INDEX" )
+ local kernel_image_path="$kernel_files_path/$KERNEL-$medium.$IMG"
+ local kernel_modules_path="$kernel_files_path/$KERNEL_MODULES"
+ local storage_rootfs_mount_path
+
+ storage_affect_confirm "$storage_path"
+
+ cat "$kernel_image_path" > "$storage_kernel_path"
+ sync
+
+ # Partition may already be mounted.
+ udisksctl mount -b "$storage_rootfs_path" || true
+
+ storage_rootfs_mount_path=$( storage_partition_mount_path "$storage_rootfs_path" )
+
+ rsync -a --keep-dirlinks "$kernel_modules_path" "$storage_rootfs_mount_path/"
+ sync
+
+ udisksctl unmount -b "$storage_rootfs_path"
+
+ printf '\n%s\n' "Installed kernel on storage $storage_path"
+}
+
+requirements() {
+ local requirement
+ local requirement_path
+
+ for requirement in "$@"
+ do
+ requirement_path=$( which "$requirement" || true )
+
+ if [ -z "$requirement_path" ]
+ then
+ printf 1>&2 '%s\n' "Missing requirement: $requirement"
+ exit 1
+ fi
+ done
+}
+
+setup() {
+ root=$(readlink -f "$( dirname "$0" )" )
+ executable=$( basename "$0" )
+
+ if [ -z "$KERNEL_PATH" ]
+ then
+ KERNEL_PATH=$root
+ fi
+
+ if ! [ -z "$VBOOT_TOOLS_PATH" ]
+ then
+ PATH="$PATH:$VBOOT_TOOLS_PATH"
+ fi
+}
+
+cros_medium_setup() {
+ local action=$1
+ local storage_path=$2
+ local rootfs_tarball_path=$3
+ local kernel_files_path=$3
+ local medium=$4
+
+ set -e
+
+ setup "$@"
+
+ if [ -z "$action" ] || [ -z "$storage_path" ]
+ then
+ usage
+ exit 1
+ fi
+
+ case $action in
+ "partitions")
+ requirements "udisksctl" "fdisk" "cgpt" "mkfs.ext4"
+ partitions "$storage_path"
+ ;;
+ "rootfs")
+ if [ -z "$rootfs_tarball_path" ]
+ then
+ usage
+ exit 1
+ fi
+
+ requirements "udisksctl" "tar"
+ rootfs "$storage_path" "$rootfs_tarball_path"
+ ;;
+ "kernel")
+ if [ -z "$kernel_files_path" ] || [ -z "$medium" ]
+ then
+ usage
+ exit 1
+ fi
+
+ requirements "udisksctl" "rsync"
+ kernel "$storage_path" "$kernel_files_path" "$medium"
+ ;;
+ *)
+ usage
+ exit 1
+ ;;
+ esac
+}
+
+cros_medium_setup "$@"
diff --git a/i18n/fr_FR/projects/cros-scripts/install/install b/i18n/fr_FR/projects/cros-scripts/install/install
new file mode 100644
index 00000000..e29374d4
--- /dev/null
+++ b/i18n/fr_FR/projects/cros-scripts/install/install
@@ -0,0 +1,5 @@
+cros-boot-keys:cros-boot-keys
+cros-firmware-prepare:cros-firmware-prepare
+cros-kernel-install:cros-kernel-install
+cros-kernel-prepare:cros-kernel-prepare
+cros-medium-setup:cros-medium-setup