Skip to content

Commit 7325b6d

Browse files
authored
- enhance the script, to install leapp-repositoriy from Git, with the GPG keys preserving, and exits if some important commands fail
1 parent 6d4f9ea commit 7325b6d

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

ci/scripts/install_elevate_dev.sh

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ WORK_DIR="$HOME"
4040
NEW_LEAPP_NAME="leapp-repository-$BRANCH"
4141
NEW_LEAPP_DIR="$WORK_DIR/$NEW_LEAPP_NAME/"
4242
LEAPP_PATH='/usr/share/leapp-repository/repositories/'
43+
LEAPP_GPG_PATH='/etc/leapp/repos.d/system_upgrade/common/files/rpm-gpg'
4344
EXCLUDE_PATH='
4445
/usr/share/leapp-repository/repositories/system_upgrade/el7toel8/files/bundled-rpms
4546
/usr/share/leapp-repository/repositories/system_upgrade/el7toel8/files
@@ -56,6 +57,11 @@ echo "RHEL_MAJOR_VERSION=$RHEL_MAJOR_VERSION"
5657
echo "WORK_DIR=$WORK_DIR"
5758
echo "EXCLUDED_PATHS=$EXCLUDE_PATH"
5859

60+
echo "Preserve GPG keys if any"
61+
for major in 8 9; do
62+
test -e ${LEAPP_GPG_PATH}/${major} && mv ${LEAPP_GPG_PATH}/${major} ${WORK_DIR}/
63+
done
64+
5965

6066
echo 'Remove old files'
6167
for dir in $(find $LEAPP_PATH -type d);
@@ -73,8 +79,8 @@ do
7379
fi
7480
done
7581

76-
echo "Download new tarball from https://github.com/$USER/leapp-repository/archive/$BRANCH/leapp-repository-$BRANCH.tar.gz"
77-
curl -s -L https://github.com/$USER/leapp-repository/archive/$BRANCH/leapp-repository-$BRANCH.tar.gz | tar -xz -C $WORK_DIR/
82+
echo "Download new tarball from https://github.com/$USER/leapp-repository/archive/$BRANCH/leapp-repository-$BRANCH.tar.gz"
83+
curl -s -L https://github.com/$USER/leapp-repository/archive/$BRANCH/leapp-repository-$BRANCH.tar.gz | tar -xmz -C $WORK_DIR/ || exit 1
7884

7985
echo 'Deleting files as in spec file'
8086
rm -rf $NEW_LEAPP_DIR/repos/common/actors/testactor
@@ -89,15 +95,23 @@ else
8995
fi
9096

9197
echo 'Copy new data to system'
92-
cp -r $NEW_LEAPP_DIR/repos/* $LEAPP_PATH
98+
cp -r $NEW_LEAPP_DIR/repos/* $LEAPP_PATH || exit 1
9399

94100
for DIRECTORY in $(find $LEAPP_PATH -mindepth 1 -maxdepth 1 -type d);
95101
do
96102
REPOSITORY=$(basename $DIRECTORY)
97103
if ! [ -e /etc/leapp/repos.d/$REPOSITORY ];then
98104
echo "Enabling repository $REPOSITORY"
99-
ln -s $LEAPP_PATH/$REPOSITORY /etc/leapp/repos.d/$REPOSITORY
105+
ln -s $LEAPP_PATH/$REPOSITORY /etc/leapp/repos.d/$REPOSITORY || exit 1
100106
fi
101107
done
102108

109+
echo "Restore GPG keys if any"
110+
for major in 8 9; do
111+
rm -rf ${LEAPP_GPG_PATH}/${major}
112+
test -e ${WORK_DIR}/${major} && mv ${WORK_DIR}/${major} ${LEAPP_GPG_PATH}/
113+
done
114+
103115
rm -rf $NEW_LEAPP_DIR
116+
117+
exit 0

0 commit comments

Comments
 (0)