Skip to content

Commit

Permalink
sgugshell: make standalone package, have existing script redirect for…
Browse files Browse the repository at this point in the history
… peoples muscle memory, update readme to reflect this, add contribution link.
  • Loading branch information
danielhams committed Dec 12, 2020
1 parent fc5962f commit f90c4ef
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 71 deletions.
34 changes: 17 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,17 @@ Unless otherwise stated, those `.spec` files remain under their original license

The modifications from the original fedora `.spec` files fall under the license of the sgug-rse project, namely GPL3.

## Contributing

Want to help? Please see our [contribution guide](contributing.md).

## How to get this working

NOTE: While we are not yet out of beta, it is recommended to remove any previous sgug-rse installation before extracting this new one. We don't yet support in-place upgrades using RPMs.

(1) Add your user account to the irix `sys` group - this will allow you to use the sgug `sudo` out of the box with your user password - then you can follow the steps below without additional hoop jumping.

(2) Ensure your system can cope with long command line buffers (this value or higher):
(2) Ensure your system can cope with long command line buffers:

```
# As root
Expand All @@ -44,19 +48,19 @@ rm -rf /usr/sgug/*
You'll find three main archives - and there might be "update" archives too that need to be extracted:

```
sgug-rse-selfhoster-0.0.6beta.tar.gz
sgug-rse-srpms-0.0.6beta.tar.gz
sgug-rse-rpms-0.0.6beta.tar.gz
sgug-rse-selfhoster-0.0.7beta.tar.gz
sgug-rse-srpms-0.0.7beta.tar.gz
sgug-rse-rpms-0.0.7beta.tar.gz
sgug-rse-rpms-0.0.6betaupdateNUM.tar.gz
sgug-rse-rpms-0.0.7betaupdateNUM.tar.gz
```

(5) Extract the selfhoster archive under /usr as root (important, sgug-rse _installation_ files are root owned and managed):

```
su - (enter root password)
cd /usr
gunzip -dc /path/to/sgug-rse-selfhoster-0.0.6beta.tar.gz |tar xf -
gunzip -dc /path/to/sgug-rse-selfhoster-0.0.7beta.tar.gz |tar xf -
(log out of root)
```

Expand All @@ -73,12 +77,12 @@ mkdir -p ~/rpmbuild/RPMS

```
cd ~/rpmbuild
gunzip -dc /path/to/sgug-rse-srpms-0.0.6beta.tar.gz | tar xf -
gunzip -dc /path/to/sgug-rse-rpms-0.0.6beta.tar.gz | tar xf -
gunzip -dc /path/to/sgug-rse-srpms-0.0.7beta.tar.gz | tar xf -
gunzip -dc /path/to/sgug-rse-rpms-0.0.7beta.tar.gz | tar xf -
# Optional
mkdir ~/rpmupdates
cd ~/rpmupdates
gunzip -dc /path/to/sgug-rse-rpms-0.0.6betaupdateNUM.tar.gz | tar xf -
gunzip -dc /path/to/sgug-rse-rpms-0.0.7betaupdateNUM.tar.gz | tar xf -
```

(8) You'll need to clone this repo (sgug-rse) -
Expand All @@ -94,8 +98,7 @@ Adjust that path as appropriate for where you wish the repo to live.
(9) Now you can install all packages (you can pick and choose if that's your thing):

```
cd ~/sgug-rse.git
./sgugshell.sh
/usr/sgug/bin/sgugshell
cd ~/rpmbuild/RPMS
sudo rpm --reinstall -ivh noarch/*.rpm mips/*.rpm
```
Expand All @@ -105,17 +108,15 @@ and for any upgrades/updates:
* CARE: You must use the "upgrade" flag for any upgraded packages to avoid double-installs

```
cd ~/sgug-rse.git
./sgugshell.sh
/usr/sgug/bin/sgugshell
cd ~/rpmupdates/RPMS
sudo rpm -Uvh noarch/*.rpm mips/*.rpm
```

(10) Now you can rebuild one of the out-of-the-box packages with:

```
cd ~/sgug-rse.git
./sgugshell.sh
/usr/sgug/bin/sgugshell
cd ~/rpmbuild/SPECS
rpm -ivh ../SRPMS/m4-1.4.18-11.sgugbeta.src.rpm
cp -r ~/sgug-rse.git/packages/m4/* ~/rpmbuild/
Expand All @@ -125,8 +126,7 @@ rpmbuild -ba m4.spec --nocheck
(11) Installing RPMs must be done as root (add `--reinstall` to refresh an already installed package):

```
cd ~user/sgug-rse.git
./sgugshell.sh
/usr/sgug/bin/sgugshell
sudo rpm -ivh ~/rpmbuild/RPMS/mips/m4*.rpm
```

Expand Down
56 changes: 56 additions & 0 deletions packages/sgugshell/SOURCES/sgugshell
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/usr/sgug/bin/bash

unset PKG_CONFIG_PATH
unset LDFLAGS
unset CFLAGS
unset CPPFLAGS
unset PERL
unset M4
unset SED
unset GREP
unset BISON
unset YACC
unset SHELL
unset SHELL_PATH
unset CONFIG_SHELL
unset LD_LIBRARY_PATH
unset LD_LIBRARYN32_PATH
unset LD_LIBRARYN64_PATH
unset GCC_ROOT
unset CC
unset CXX
unset LD
unset AR
unset RANLIB
unset PYTHONPATH
unset PYTHONHOME

SGUG_ROOT=/usr/sgug
SGUG_BIN=$SGUG_ROOT/bin
SGUG_SBIN=$SGUG_ROOT/sbin
SGUG_LIB=$SGUG_ROOT/lib32

export PATH=$SGUG_BIN:$SGUG_SBIN:/usr/bin/X11:/usr/bin:/bin:/usr/sbin:/usr/bsd

# Explicit library paths
export LD_LIBRARYN32_PATH=$SGUG_LIB:/usr/lib32:/lib32:/usr/lib:/lib
# Without /usr/lib or /lib
#export LD_LIBRARYN32_PATH=$SGUG_LIB:/usr/lib32:/lib32

# Use this when sgug stuff has validated RPATH to reference the libs
#export LD_LIBRARYN32_PATH=/usr/lib32:/lib32:/usr/lib:/lib

# NOTE: Setting pkgconfig path like below is unnecessary - the two
# listed paths are the default - and are searched last resort
# even when PKG_CONFIG_PATH is set to something.
#export PKG_CONFIG_PATH=$SGUG_LIB/pkgconfig:$SGUG_ROOT/share/pkgconfig

export MANPATH=$SGUG_ROOT/share/man:/usr/share/catman/a_man:/usr/share/catman/g_man:/usr/share/catman/p_man:/usr/share/catman/u_man

# Work around localisation issue with libiconv
export LC_ALL=C

export PS1='[sgugshell \u@\h \W]\$ '
# If ~/.sgug_bashrc exists, use that as our init file.
[ -e $HOME/.sgug_bashrc ] && exec bash --rcfile $HOME/.sgug_bashrc -i
exec bash --norc -i
28 changes: 28 additions & 0 deletions packages/sgugshell/SPECS/sgugshell.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
Summary: SGUG Environment Shell
Name: sgugshell
Version: 0.1.0
Release: 1%{?dist}
License: GPLv3+
URL: https://github.com/sgidevnet/sgug-rse
Source: sgugshell

BuildRequires: bash, coreutils

%description
A utility shell that sets a correct started environment for developing with
the SGUG RPM software environment.

%prep
%setup -c -T
cp -p %{sources} .

%install
mkdir -p $RPM_BUILD_ROOT%{_bindir}
install -p -m 755 -t %{buildroot}%{_bindir} sgugshell

%files
%{_bindir}/sgugshell

%changelog
* Sat Dec 12 2020 Daniel Hams <[email protected]> - 0.1.0
- First Package
55 changes: 1 addition & 54 deletions sgugshell.sh
Original file line number Diff line number Diff line change
@@ -1,56 +1,3 @@
#!/usr/sgug/bin/bash

unset PKG_CONFIG_PATH
unset LDFLAGS
unset CFLAGS
unset CPPFLAGS
unset PERL
unset M4
unset SED
unset GREP
unset BISON
unset YACC
unset SHELL
unset SHELL_PATH
unset CONFIG_SHELL
unset LD_LIBRARY_PATH
unset LD_LIBRARYN32_PATH
unset LD_LIBRARYN64_PATH
unset GCC_ROOT
unset CC
unset CXX
unset LD
unset AR
unset RANLIB
unset PYTHONPATH
unset PYTHONHOME

SGUG_ROOT=/usr/sgug
SGUG_BIN=$SGUG_ROOT/bin
SGUG_SBIN=$SGUG_ROOT/sbin
SGUG_LIB=$SGUG_ROOT/lib32

export PATH=$SGUG_BIN:$SGUG_SBIN:/usr/bin/X11:/usr/bin:/bin:/usr/sbin:/usr/bsd

# Explicit library paths
export LD_LIBRARYN32_PATH=$SGUG_LIB:/usr/lib32:/lib32:/usr/lib:/lib
# Without /usr/lib or /lib
#export LD_LIBRARYN32_PATH=$SGUG_LIB:/usr/lib32:/lib32

# Use this when sgug stuff has validated RPATH to reference the libs
#export LD_LIBRARYN32_PATH=/usr/lib32:/lib32:/usr/lib:/lib

# NOTE: Setting pkgconfig path like below is unnecessary - the two
# listed paths are the default - and are searched last resort
# even when PKG_CONFIG_PATH is set to something.
#export PKG_CONFIG_PATH=$SGUG_LIB/pkgconfig:$SGUG_ROOT/share/pkgconfig

export MANPATH=$SGUG_ROOT/share/man:/usr/share/catman/a_man:/usr/share/catman/g_man:/usr/share/catman/p_man:/usr/share/catman/u_man

# Work around localisation issue with libiconv
export LC_ALL=C

export PS1='[sgugshell \u@\h \W]\$ '
# If ~/.sgug_bashrc exists, use that as our init file.
[ -e $HOME/.sgug_bashrc ] && exec bash --rcfile $HOME/.sgug_bashrc -i
exec bash --norc -i
exec sgugshell

0 comments on commit f90c4ef

Please sign in to comment.