Dockerfile removed, README fixes

This commit is contained in:
Anthony Axenov 2022-09-30 15:46:34 +08:00
parent 40d214e99b
commit 8b809bafca
Signed by: anthony
GPG Key ID: EA9EC32FF7CCD4EC
4 changed files with 5 additions and 148 deletions

View File

@ -1,4 +0,0 @@
.git
.gitignore
.dockerignore
README.md

View File

@ -1,27 +0,0 @@
FROM ubuntu:22.04
RUN apt update && \
apt -y install \
apt-transport-https \
apt-utils \
bsdmainutils \
curl \
dialog \
grep \
make \
man \
sudo \
wget
RUN adduser ivan \
--quiet \
--home=/home/ivan \
--ingroup=sudo \
--disabled-password \
--disabled-login
COPY ./ /home/ivan/my-env
RUN echo "ivan ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
USER ivan
WORKDIR /home/ivan/my-env

View File

@ -36,10 +36,10 @@ make
### Selective straightforward installation
```shell
# from remote file
# from remote file (you can meet interaction bugs this way!)
wget -qO - https://git.axenov.dev/anthony/my-env/raw/branch/master/install/apt | bash
# from locally cloned repo
# from locally cloned repo (except scripts from ./packs)
./install/apt
```
@ -58,11 +58,12 @@ wget -qO - https://git.axenov.dev/anthony/my-env/raw/branch/master/install/apt |
3. Test your script
4. Run `make self` to generate new `./Makefile`
## How to create packs?
## How to create a pack?
You can create new file inside `./packs` dir.
Syntax is same as classic makefile with one important and necessary addition -- a comment started with `##`:
Syntax is same as classic makefile.
It is important to add a comment with short description:
```makefile
# Pack description
@ -80,27 +81,6 @@ where:
* `mypack*` is the pack name
* `goal*` are script names in `./install`
## Testing in docker (not recommended)
> Note that this is almost useless way to test since you'll meet errors in many cases because dockerized OS is not fully-functional and will never be.
>
> You can use docker to test something **really simple**, e.g. to check general script steps or install cli tools.
>
> In other cases you need virtualized Ubuntu instead of dockerized one, so I strongly recommend you to use [VirtualBox](https://www.virtualbox.org/wiki/Downloads) or your host machine.
```shell
# switch to repo dir
cd my-env
# build and run container
docker build -t myenv . && docker run -it myenv
# or oneliner
docker run -it $(docker build -q .)
```
Now you can play around with scripts.
## TODO
* build: [flameshot](https://github.com/flameshot-org/flameshot#compilation)

View File

@ -1,92 +0,0 @@
#!/bin/bash
mv Makefile Makefile.bak
CHR_UPGRADE='^'
CHR_UNINSTALL='/'
cat << EOF >> Makefile
# Autogenerated at $(date +'%d.%m.%Y %H:%M') using ${BASH_SOURCE[0]}
.DEFAULT_GOAL := help
#===============================================
# Scripts listed in ./packs
#===============================================
EOF
for file in ./packs/*; do
cat "$file" >> Makefile
echo >> Makefile
done;
cat << EOF >> Makefile
#===============================================
# Scripts listed in ./install
#===============================================
EOF
for file in ./install/*; do
name=${file##*/}
name=${name%.sh}
desc=$(grep -m 1 -oP "(?<=^##makedesc:\s).*$" ${file})
[ -z "$desc" ] && desc='<no description>'
echo -e "# ${desc}\n${name}:\n\t@${file}\n" >> Makefile
done;
cat << EOF >> Makefile
#===============================================
# Scripts listed in ./upgrade
#===============================================
EOF
for file in ./upgrade/*; do
name=${file##*/}
name=${name%.sh}
desc=$(grep -m 1 -oP "(?<=^##makedesc:\s).*$" ${file})
[ -z "$desc" ] && desc='<no description>'
echo -e "# ${desc}\n${CHR_UPGRADE}${name}:\n\t@${file}\n" >> Makefile
done;
cat << EOF >> Makefile
#===============================================
# Scripts listed in ./uninstall
#===============================================
EOF
for file in ./uninstall/*; do
name=${file##*/}
name=${name%.sh}
desc=$(grep -m 1 -oP "(?<=^##makedesc:\s).*$" ${file})
[ -z "$desc" ] && desc='<no description>'
echo -e "# ${desc}\n${CHR_UNINSTALL}${name}:\n\t@${file}\n" >> Makefile
done;
cat << EOF >> Makefile
#===============================================
# Service goals
#===============================================
self:
@./gen-makefile
help: Makefile
@echo "Ubuntu software installator"
@echo
@echo "Usage:\n \
make help|- show this help\n \
make self|- regenerate Makefile (alias of ./gen-makefile)\n \
make GOAL|- install software\n \
make ${CHR_UPGRADE}GOAL|- upgrade software\n \
make ${CHR_UNINSTALL}GOAL|- uninstall software" | column -ts '|'
@echo "\nYou can combine GOALs, here are some examples:"
@echo "\tmake @docker docker"
@echo "\tmake php @docker ^omz"
@echo "\nAvailable GOALs:"
@sed -n '/^#/{N;s/# *\(.*\)\n\([^# .].*:\)/\t\2\1/p}' $< | column -ts ':'
EOF
echo "New ./Makefile has been generated!"
echo "Old one has been saved as ./Makefile.bak"
echo "Now run 'make' to get help"