You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
131 lines
3.6 KiB
131 lines
3.6 KiB
#!/bin/bash |
|
|
|
## Copyright (c) 2023. Open Mobile Platform LLC. |
|
## License: Proprietary. |
|
## |
|
## SPDX-FileCopyrightText: 2023 Open Mobile Platform LLC <community@omp.ru> |
|
# SPDX-License-Identifier: BSD-3-Clause |
|
## Contact: https://community.omprussia.ru/open-source |
|
## |
|
## This file is part of the Aurora OS Application Template project. |
|
## |
|
## Redistribution and use in source and binary forms, |
|
## with or without modification, are permitted provided |
|
## that the following conditions are met: |
|
## |
|
## * Redistributions of source code must retain the above copyright notice, |
|
## this list of conditions and the following disclaimer. |
|
## * 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. |
|
## * 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. |
|
|
|
## Build example, sign rpm, upload/install/run rpm to device |
|
|
|
## Usage |
|
## |
|
## chmod +x ./run.sh |
|
## |
|
## ./run.sh \ |
|
## -d <ip>:<password> \ |
|
## -s /home/user/sign/folder |
|
|
|
sudo echo 'Start...'; |
|
|
|
## Flutter path |
|
FLUTTER="$HOME/.local/opt/flutter/bin/flutter" |
|
|
|
## https://developer.auroraos.ru/doc/software_development/psdk/setup |
|
## Install Platform SDK path |
|
## You may not have set the PSDK_DIR environment variable. |
|
## export PSDK_DIR=$HOME/AuroraPlatformSDK/sdks/aurora_psdk |
|
|
|
while getopts d:s: flag; do |
|
case "${flag}" in |
|
d) device=${OPTARG} ;; |
|
s) sign=${OPTARG} ;; |
|
*) |
|
echo "usage: $0 [-d] [-s]" >&2 |
|
exit 1 |
|
;; |
|
esac |
|
done |
|
|
|
## Update dependency |
|
$FLUTTER pub get |
|
|
|
## Generate internationalizing |
|
$FLUTTER pub run build_runner build |
|
|
|
## Run ffigen |
|
# $FLUTTER pub run ffigen |
|
|
|
## Build aurora example app |
|
{ |
|
$FLUTTER build aurora --release |
|
} || { |
|
exit 1; |
|
} |
|
|
|
if [ -n "$sign" ]; then |
|
|
|
key=$(ls "$sign"/*key.pem) |
|
|
|
if [ -z "$key" ]; then |
|
echo "Key *key.pem not found." |
|
exit |
|
fi |
|
|
|
cert=$(ls "$sign"/*cert.pem) |
|
|
|
if [ -z "$cert" ]; then |
|
echo "Key *cert.pem not found." |
|
exit |
|
fi |
|
|
|
## Sign rpm system key |
|
"$PSDK_DIR"/sdk-chroot rpmsign-external sign \ |
|
--key "$key" \ |
|
--cert "$cert" \ |
|
build/aurora/arm/release/RPMS/*.rpm |
|
fi |
|
|
|
if [ -n "$device" ]; then |
|
|
|
PACKAGE="ru.auroraos.flutter_example_packages" |
|
|
|
IFS=':' read -ra ADDR <<< "$device" |
|
|
|
D_IP="${ADDR[0]}" |
|
D_PASS="${ADDR[1]}" |
|
|
|
# shellcheck disable=SC2012 |
|
rpm=$(ls "$PWD"/build/aurora/arm/release/RPMS/*.rpm | sort -r | head -n 1) |
|
|
|
# upload rpm |
|
scp "$rpm" defaultuser@"$D_IP:/home/defaultuser/Downloads" |
|
|
|
# install rpm |
|
ssh -t defaultuser@"$D_IP" "echo $D_PASS | devel-su pkcon -y install-local /home/defaultuser/Downloads/$PACKAGE*.rpm" |
|
|
|
# run application |
|
ssh -t defaultuser@"$D_IP" "/usr/bin/$PACKAGE" |
|
fi
|
|
|