Skip to content

Commit 2230a61

Browse files
authored
Merge pull request #86 from quaxalber/development
Make user owner of all files in repo
2 parents a5a07a1 + 50b5fb8 commit 2230a61

File tree

2 files changed

+18
-11
lines changed

2 files changed

+18
-11
lines changed

scripts/install.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ main() {
6464
base_directory=$(dirname "${scripts_directory}")
6565
cd "${base_directory}"
6666

67+
# Capture the current user and group ownership
68+
current_user=$(stat -c '%U' .) || abort_update "Failed retrieving current user ownership."
69+
current_group=$(stat -c '%G' .) || abort_update "Failed retrieving current group ownership."
70+
6771
colored_output "${GREEN}" "Creating Python virtual environment \"${base_directory}/.venv\"..."
6872
python3.11 -m venv .venv || abort_install "Failed creating Python virtual environment."
6973

@@ -85,6 +89,8 @@ main() {
8589
systemctl enable bluetooth_2_usb.service || abort_install "Failed enabling service."
8690
systemctl start bluetooth_2_usb.service || abort_install "Failed starting service."
8791

92+
chown -R ${current_user}:${current_group} "${base_directory}"
93+
8894
version=$(/usr/bin/bluetooth_2_usb -v)
8995
if [[ $version == *"Bluetooth 2 USB"* ]]; then
9096
colored_output "${GREEN}" "Installation successful. Now running ${version}"

scripts/update.sh

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,26 +40,27 @@ fi
4040
# Trap EXIT signal and call cleanup function
4141
trap cleanup EXIT
4242

43-
colored_output "${GREEN}" "Updating Bluetooth 2 USB..."
44-
4543
# Determine the current script's directory and the parent directory
4644
scripts_directory=$(dirname $(readlink -f "$0"))
4745
base_directory=$(dirname "${scripts_directory}")
4846
cd "${base_directory}"
4947

48+
current_version=$(/usr/bin/bluetooth_2_usb -v)
49+
latest_vesion=$(git tag -l | sort -V | tail -n1)
50+
colored_output "${GREEN}" "Updating ${current_version} -> ${latest_vesion}..."
51+
5052
# Capture the current user and group ownership and branch
5153
current_user=$(stat -c '%U' .) || abort_update "Failed retrieving current user ownership."
5254
current_group=$(stat -c '%G' .) || abort_update "Failed retrieving current group ownership."
5355
current_branch=$(git symbolic-ref --short HEAD) || abort_update "Failed retrieving currently checked out branch."
5456

55-
{
57+
{
5658
scripts/uninstall.sh &&
57-
cd .. &&
58-
rm -rf bluetooth_2_usb &&
59-
git clone https://github.com/quaxalber/bluetooth_2_usb.git &&
60-
chown -R ${current_user}:${current_group} bluetooth_2_usb &&
61-
cd bluetooth_2_usb &&
62-
git checkout "${current_branch}"
63-
scripts/install.sh &&
64-
cd .. ;
59+
cd .. &&
60+
rm -rf "${base_directory}" &&
61+
git clone https://github.com/quaxalber/bluetooth_2_usb.git &&
62+
cd "${base_directory}" &&
63+
git checkout "${current_branch}" &&
64+
chown -R ${current_user}:${current_group} "${base_directory}" &&
65+
scripts/install.sh ;
6566
} || abort_update "Failed updating Bluetooth 2 USB"

0 commit comments

Comments
 (0)