Use system_ident, fix picopkg names

Cherry-picked the system_ident script from the refactor branch.  This
sets ras2_os and ras2_arch in a way that would be more useful for
selecting a filename from among arch-specific alternatives.  It's less
good for identifying a Pi vs. desktop Debian or anything else, so I've
kept around the isRpi variable for now.

May revisit the variables in system_ident later on if it really would be
useful to have ras2_os not include the release codename.  For now
though, this is fine.  If nothing else this will encourage me to do more
to get rid of the specific checks for the Pi.  The major places the
check seems to be used at the moment are:

1. Text output
2. Determining which version of java to install
3. Whether to spew out the USB lower/upper udev rules
4. How to compile GSport

The question of which java to install is easily answered: The one you
have available.  Currently we're calling for java8 on RPi and ORACLE
java7 on Debian.  That doesn't actually make sense.  On Debian we'd
probably want to use openjdk, and the only reason to use Oracle's JDK on
Raspbian is because you might already have it installed.  I'm inclined
to suggest that we should check if you have RPF's Oracle java installed,
and if you don't install openjdk—unless someone can give me a good
reason to use the JDK from those evil bastards at Oracle who believe
that implementing a standard library compatible with theirs from
published specs is somehow a Copyright infringement…  Needless to say I
have a bias against evil/stupid companies.

GSport should literally use $ras2_arch if that once we have it replaced
with GSplus.  That just leaves the udev rules and flavor text.  I think
the problem will solve itself in time.
This commit is contained in:
T. Joseph Carter 2018-04-22 18:56:28 -07:00
parent 2d65ec0ee0
commit 30ccb87cd8

View File

@ -18,39 +18,19 @@ fi
useExternalURL=1
[[ $A2CLOUD_NO_EXTERNAL ]] && useExternalURL=
debianVersion=$(cat /etc/debian_version 2> /dev/null)
# Make sure ras2_{os,arch} get set
. "$a2cSource/scripts/system_ident" -q
isRpi=
isDebian=
arch=
if [[ -f /usr/bin/raspi-config ]]; then
if [[ $ras2_os == rpi-* ]]; then
isRpi=1
arch='rpi'
me="Pi"
fullme="Raspberry Pi"
elif lsb_release -a 2> /dev/null | grep -q 'Distributor ID:.Debian' && [[ $(cut -d . -f 1 <<< $debianVersion) -ge "7" ]]; then
isDebian=1
uname_m="$(uname -m)"
if [[ $uname_m == "i686" ]]; then
arch='debian_x86'
elif [[ $uname_m == "x86_64" ]]; then
arch='debian_x64'
fi
else
me="computer"
fullme="computer"
fi
debianName=
if [[ $debianVersion ]]; then
debianMajor=$(cut -d . -f 1 <<< $debianVersion)
if [[ $debianMajor == "8" ]]; then
debianName="jessie"
elif [[ $debianMajor == "7" ]]; then
debianName="wheezy"
else
debianName="unknown"
fi
fi
isSystemd=
isSysVInit=
# If you really want something else, *you* maintain it!
@ -113,9 +93,6 @@ while [[ $1 ]]; do
echo "-6: put blank 140K disk images in GSport slot 6"
echo "-b: build A2CLOUD disks, rather than downloading premade images"
echo "-c: compile non-package items, rather than downloading binaries"
if [[ $isRpi ]]; then
echo "-os: update Raspbian OS, A2CLOUD, and A2SERVER"
fi
[[ $0 == "-bash" ]] && return 1 || exit 1
fi
done
@ -794,7 +771,7 @@ if [[ $installCommTools ]]; then
echo "A2CLOUD: Installing cftp..."
cd /tmp/a2cloud-install
if [[ $downloadBinaries ]]; then
wget -qO- "${a2cBinaryURL}/picopkg/cftp-${arch}_${debianName}.tgz" | sudo tar Pzx
wget -qO- "${a2cBinaryURL}/picopkg/cftp-${ras2_os}_${ras2_arch}.tgz" | sudo tar Pzx
fi
if ! hash cftp 2> /dev/null; then
sudo apt-get -y install build-essential
@ -944,7 +921,7 @@ if [[ $installEmulators ]]; then
### Emulators: GSport: Install pre-built binaries
sudo apt-get -y install libpcap0.8 &> /dev/null
sudo apt-get -y clean
wget -qO- "${a2cBinaryURL}/picopkg/gsport-${arch}_${debianName}.tgz" | sudo tar Pzx 2> /dev/null
wget -qO- "${a2cBinaryURL}/picopkg/gsport-${ras2_os}_${ras2_arch}.tgz" | sudo tar Pzx 2> /dev/null
fi
if ! hash gsport 2> /dev/null || ! hash gsportx 2> /dev/null || ! hash gsportfb 2> /dev/null; then
### Emulators: GSport: Install from source
@ -966,15 +943,19 @@ if [[ $installEmulators ]]; then
cp vars_pi vars_x
else
cp vars_x86linux vars_x
if [[ $arch == "debian_x86" ]]; then
sed -i 's/-march=armv6/-march=i686/' vars_fb
elif [[ $arch == "debian_x64" ]]; then
sed -i 's/-march=i686/-march=x86-64/' vars_x
sed -i 's/-march=armv6/-march=x86-64/' vars_fb
else
buildGSport=
echo "A2CLOUD: cannot build GSport; unknown machine architecture."
fi
case "$ras2_arch" in
x86_64)
sed -i 's/-march=i686/-march=x86-64/' vars_x
sed -i 's/-march=armv6/-march=x86-64/' vars_fb
;;
i686)
sed -i 's/-march=armv6/-march=i686/' vars_fb
;;
*)
buildGSport=
echo "A2CLOUD: cannot build GSport; unknown machine architecture."
;;
esac
fi
sed -i 's/^LDFLAGS =.*$/LDFLAGS = -ldl/' vars_x
sed -i 's/^LDFLAGS =.*$/LDFLAGS = -ldl/' vars_fb
@ -1050,7 +1031,7 @@ if [[ $installEmulators ]]; then
cd /tmp/a2cloud-install
if [[ $downloadBinaries ]]; then
### Emulators: LinApple: Install pre-built binaries
wget -qO- "${a2cBinaryURL}/picopkg/linapple-${arch}_${debianName}.tgz" | sudo tar Pzx
wget -qO- "${a2cBinaryURL}/picopkg/linapple-${ras2_os}_${ras2_arch}.tgz" | sudo tar Pzx
fi
if ! hash linapple 2> /dev/null; then
### Emulators: LinApple: Install from source
@ -1090,7 +1071,7 @@ if [[ $installArchiveTools ]]; then
cd /tmp/a2cloud-install
if [[ $downloadBinaries ]]; then
### ArchiveTools: Install nulib2 binaries
wget -qO- "${a2cBinaryURL}/picopkg/nulib2-${arch}_${debianName}.tgz" | sudo tar Pzx
wget -qO- "${a2cBinaryURL}/picopkg/nulib2-${ras2_os}_${ras2_arch}.tgz" | sudo tar Pzx
fi
if ! hash nulib2 2> /dev/null; then
@ -1160,7 +1141,7 @@ if [[ $installArchiveTools ]]; then
# Dependencies: for unar
sudo apt-get -y install libgnustep-base1.22
sudo apt-get clean
wget -qO- "${a2cBinaryURL}/picopkg/unar-${arch}_${debianName}.tgz" | sudo tar Pzx &> /dev/null
wget -qO- "${a2cBinaryURL}/picopkg/unar-${ras2_os}_${ras2_arch}.tgz" | sudo tar Pzx &> /dev/null
fi
# If all else fails, compile from source.