From 8831ee59a4735e64d19376215d7cf649f820ff0d Mon Sep 17 00:00:00 2001 From: "T. Joseph Carter" Date: Mon, 23 Apr 2018 11:03:17 -0700 Subject: [PATCH] Make install_archive_tools behave Now install_archive_tools creates its own temp directories for installation. Nulib2 doesn't build for me on sid/buster though, we're going to need a patch I think. We may as well patch it at that point for building libnufx as a shared lib while we're at it. I really don't want another project right now. :( This is why we don't get releases out. --- scripts/install_archive_tools | 37 +++++++++++++++++----------------- setup/ivan.sh | 38 +++++++++++++++++------------------ 2 files changed, 37 insertions(+), 38 deletions(-) diff --git a/scripts/install_archive_tools b/scripts/install_archive_tools index ebeef44..42c78e4 100755 --- a/scripts/install_archive_tools +++ b/scripts/install_archive_tools @@ -34,10 +34,14 @@ install_nulib2() { echo "A2CLOUD: Installing nulib2..." - cd /tmp/a2cloud-install + local nulibWork="$(mktemp -d /tmp/nulib.XXXXXXXXXXXX)" + pushd "$nulibWork" >/dev/null if [[ $downloadBinaries ]]; then ### ArchiveTools: Install nulib2 binaries - wget -qO- "${a2cBinaryURL}/picopkg/nulib2-${ras2_os}_${ras2_arch}.tgz" | sudo tar Pzx + wget -q "${a2cBinaryURL}/picopkg/nulib2-${ras2_os}_${ras2_arch}.tgz" + if [[ -f "nulib2-${ras2_os}_${ras2_arch}.tgz" ]]; then + sudo tar Pzxf "nulib2-${ras2_os}_${ras2_arch}.tgz" + fi fi if ! hash nulib2 2> /dev/null; then @@ -47,10 +51,7 @@ install_nulib2() { sudo apt-get -y clean # install nulib2 - rm -rf nulib &> /dev/null - mkdir -p nulib - cd nulib - wget -qO nulib.tgz http://web.archive.org/web/20131031160750/http://www.nulib.com/downloads/nulibdist.tar.gz + wget -O nulib.tgz http://web.archive.org/web/20131031160750/http://www.nulib.com/downloads/nulibdist.tar.gz tar zxf nulib.tgz cd nufxlib* ./configure @@ -60,9 +61,9 @@ install_nulib2() { ./configure make sudo make install - cd /tmp/a2cloud-install - rm -rf nulib + popd >/dev/null fi + rm -rf "$nulibWork" else echo "A2CLOUD: nulib2 is already installed." fi @@ -75,15 +76,14 @@ install_sciibin() { sudo apt-get -y install build-essential unzip sudo apt-get -y clean - rm -rf undoit &> /dev/null - mkdir -p undoit - cd undoit + local undoitWork="$(mktemp -d /tmp/undoit.XXXXXXXXXXXX)" + pushd "$undoitWork" >/dev/null wget -q http://web.archive.org/web/20110619163030/http://fadden.com/dl-apple2/undoit.zip unzip undoit.zip make sudo mv sciibin unbit unblu unexec usq /usr/local/bin - cd /tmp/a2cloud-install - rm -rf undoit + popd >/dev/null + rm -rf "$undoitWork" else echo "A2CLOUD: sciibin, unblu, unbit, unexec, usq are already installed." fi @@ -92,7 +92,7 @@ install_sciibin() { install_shk2image() { echo "A2CLOUD: Setting up shk2image command..." ### ArchiveTools: Install shk2image command - sudo install -u root -g root -m 755 "$a2cSource/setup/shk2image" /usr/local/bin/shk2image + sudo install -o root -g root -m 755 "$a2cSource/setup/shk2image" /usr/local/bin/shk2image } install_unar() { @@ -112,9 +112,8 @@ install_unar() { sudo apt-get -y install build-essential libgnustep-base-dev libz-dev libbz2-dev libssl-dev libicu-dev unzip sudo apt-get clean - rm -rf /tmp/unar &> /dev/null - mkdir /tmp/unar - cd /tmp/unar + local unarWork="$(mktemp -d /tmp/undoit.XXXXXXXXXXXX)" + pushd "$unarWork" >/dev/null if [[ $useExternalURL ]]; then wget -O unar-1.8.1.zip https://github.com/incbee/Unarchiver/archive/unar-1.8.1.zip unzip -o unar-1.8.1.zip &> /dev/null @@ -129,8 +128,8 @@ install_unar() { cd ../Extra sudo mkdir -p /usr/local/man/man1 sudo mv lsar.1 unar.1 /usr/local/man/man1 - cd - rm -rf /tmp/unar + popd >/dev/null + rm -rf "$unarWork" sudo mandb &> /dev/null fi else diff --git a/setup/ivan.sh b/setup/ivan.sh index cb23e86..b2fdf1d 100755 --- a/setup/ivan.sh +++ b/setup/ivan.sh @@ -304,11 +304,11 @@ source /usr/local/etc/a2cloudrc # this up at some point. echo "A2CLOUD: Setting up motd..." if [[ $(grep Raspple /etc/motd) ]]; then - sudo install -u root -g root -m 644 "$a2cSource/setup/motd-rasppleii.txt" /etc/motd + sudo install -o root -g root -m 644 "$a2cSource/setup/motd-rasppleii.txt" /etc/motd elif [[ $(grep A2SERVER /etc/motd) ]]; then - sudo install -u root -g root -m 644 "$a2cSource/setup/motd-vm.txt" /etc/motd + sudo install -o root -g root -m 644 "$a2cSource/setup/motd-vm.txt" /etc/motd else - sudo install -u root -g root -m 644 "$a2cSource/setup/motd.txt" /etc/motd + sudo install -o root -g root -m 644 "$a2cSource/setup/motd.txt" /etc/motd fi if lspci 2> /dev/null | grep -q VirtualBox; then @@ -490,7 +490,7 @@ if [[ $installADTPro ]]; then ### ADTPro: Install our modified adtpro.sh echo "A2CLOUD: Setting up customized adtpro.sh..." - sudo install -u root -g root -m 755 ${a2cSource}/setup/adtpro.sh /usr/local/bin/adtpro.sh + sudo install -o root -g root -m 755 ${a2cSource}/setup/adtpro.sh /usr/local/bin/adtpro.sh ### ADTPro: Replace A2CLOUD's disks with the ones ... ### FIXME: where are these created/downloaded to move? @@ -568,19 +568,19 @@ if [[ $installADTPro ]]; then ### A2CLOUD: Install various shell scripts echo "A2CLOUD: Setting up adtpro-start command..." - sudo install -u root -g root -m 755 "$a2cSource/setup/adtpro-start" /usr/local/bin/adtpro-start + sudo install -o root -g root -m 755 "$a2cSource/setup/adtpro-start" /usr/local/bin/adtpro-start echo "A2CLOUD: Setting up vsd1/vsd2 commands..." - sudo install -u root -g root -m 755 "$a2cSource/setup/vsd" /usr/local/bin/vsd + sudo install -o root -g root -m 755 "$a2cSource/setup/vsd" /usr/local/bin/vsd echo "A2CLOUD: Setting up acmd command..." - sudo install -u root -g root -m 755 "$a2cSource/setup/acmd" /usr/local/bin/acmd + sudo install -o root -g root -m 755 "$a2cSource/setup/acmd" /usr/local/bin/acmd echo "A2CLOUD: Setting up mkpo command..." - sudo install -u root -g root -m 755 "$a2cSource/setup/mkpo" /usr/local/bin/mkpo + sudo install -o root -g root -m 755 "$a2cSource/setup/mkpo" /usr/local/bin/mkpo echo "A2CLOUD: Setting up dos2pro command..." - sudo install -u root -g root -m 755 "$a2cSource/setup/dos2pro" /usr/local/bin/dos2pro + sudo install -o root -g root -m 755 "$a2cSource/setup/dos2pro" /usr/local/bin/dos2pro fi @@ -599,7 +599,7 @@ fi ### A2CLOUD: Install serial port rules/scripts echo "A2CLOUD: Setting up USB port serial adapter handler..." -sudo install -u root -g root -m 755 "$a2cSource/setup/ttyusbhandler" /usr/local/sbin/ttyusbhandler +sudo install -o root -g root -m 755 "$a2cSource/setup/ttyusbhandler" /usr/local/sbin/ttyusbhandler if [[ ! -f /etc/udev/rules.d/50-usb.rules ]]; then echo "A2CLOUD: Creating device rules for USB ports..." @@ -688,14 +688,14 @@ if [[ $setupSerialPortLogin ]]; then ### SerialCon: Install serial login command scripts echo "A2CLOUD: Setting up baud command..." - sudo install -u root -g root -m 755 "$a2cSource/setup/baud" /usr/local/bin/baud + sudo install -o root -g root -m 755 "$a2cSource/setup/baud" /usr/local/bin/baud echo "A2CLOUD: Setting up term command..." - sudo install -u root -g root -m 755 "$a2cSource/setup/term" /usr/local/bin/term + sudo install -o root -g root -m 755 "$a2cSource/setup/term" /usr/local/bin/term ### SerialCon: Install USB serial port login echo "A2CLOUD: Setting up USB shell login..." - sudo install -u root -g root -m 755 "$a2cSource/setup/usbgetty" /usr/local/sbin/usbgetty + sudo install -o root -g root -m 755 "$a2cSource/setup/usbgetty" /usr/local/sbin/usbgetty if [[ -n "$isSystemd" ]]; then # FIXME: Okay, the way we need to fix this is that we need to do the # -scanttyUSB behavior and create a symlink in udev here. If we have @@ -708,7 +708,7 @@ if [[ $setupSerialPortLogin ]]; then # (called by udev, as before) now restarts the service upon adapter insertion. # This might not be the best way to do it, but it works for now, # apart from a 30 second delay before the getty becomes available. - sudo install -u root -g root -m 644 "$a2cSource/setup/usbgetty-systemd.service" /etc/systemd/system/getty.target.wants/usbgetty@.service + sudo install -o root -g root -m 644 "$a2cSource/setup/usbgetty-systemd.service" /etc/systemd/system/getty.target.wants/usbgetty@.service pwd=$PWD cd /etc/systemd/system/getty.target.wants grep -o 'SYMLINK+="ttyUSB.*,' /etc/udev/rules.d/50-usb.rules | cut -d '"' -f 2 | \ @@ -812,7 +812,7 @@ if [[ $installCommTools ]]; then fi ### CommTools: Install tin + a2news script - sudo install -u root -g root -m 755 "$a2cSource/setup/a2news" /usr/local/bin/a2news + sudo install -o root -g root -m 755 "$a2cSource/setup/a2news" /usr/local/bin/a2news if ! hash tin 2> /dev/null; then echo "A2CLOUD: Installing a2news/tin..." sudo apt-get -y install tin @@ -838,7 +838,7 @@ if [[ $installCommTools ]]; then fi ### CommTools: Install irssi + a2chat script - sudo install -u root -g root -m 755 "$a2cSource/setup/a2chat" /usr/local/bin/a2chat + sudo install -o root -g root -m 755 "$a2cSource/setup/a2chat" /usr/local/bin/a2chat if ! hash irssi 2> /dev/null; then echo "A2CLOUD: Installing a2chat/irssi..." sudo apt-get -y install irssi @@ -1018,8 +1018,8 @@ if [[ $installEmulators ]]; then sudo chgrp gsport /usr/local/bin/gsportx sudo chmod u+s /usr/local/bin/gsportx - sudo install -u root -g root -m 755 "$a2cSource/setup/gsport" /usr/local/bin/gsport - sudo install -u root -g root -m 755 "$a2cSource/setup/gsport-setup" /usr/local/bin/gsport-setup + sudo install -o root -g root -m 755 "$a2cSource/setup/gsport" /usr/local/bin/gsport + sudo install -o root -g root -m 755 "$a2cSource/setup/gsport-setup" /usr/local/bin/gsport-setup else echo "A2CLOUD: GSport is already installed." @@ -1054,7 +1054,7 @@ if [[ $installEmulators ]]; then echo "A2CLOUD: LinApple is already installed." fi echo "A2CLOUD: Updating LinApple launch file..." - sudo install -u root -g root -m 755 "$a2cSource/setup/linapple" /usr/local/bin/linapple + sudo install -o root -g root -m 755 "$a2cSource/setup/linapple" /usr/local/bin/linapple ### Emulators: Set Groups sudo addgroup gsport &> /dev/null