Skip to content

Commit

Permalink
wslu 1.8
Browse files Browse the repository at this point in the history
  • Loading branch information
patrick330602 committed Sep 22, 2018
2 parents 1df93ec + c655e10 commit 6371c82
Show file tree
Hide file tree
Showing 26 changed files with 248 additions and 309 deletions.
53 changes: 14 additions & 39 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,64 +15,39 @@ jobs:
command: |
cd scripts/
bash -x ./install.sh
builddevsource:
docker:
- image: patrick330602/fake_wsl_env
steps:
- checkout
- run:
name: Install Pre-requisites
command: |
apt-get update -qq
apt-get install -qq apt-utils mime-support sudo
- run:
name: Install via Source Code
command: |
cd scripts/
bash -x ./install-dev.sh
builddeb:
genpkg:
machine: true
steps:
- checkout
- run:
name: Install Pre-requisites
command: |
sudo apt-get update -qq
sudo apt-get install -qq build-essential rpm sudo
sudo apt-get install -qq build-essential rpm sudo dh-make devscripts
- run:
name: Build Package
command: |
make
cd scripts
sudo bash -x ./builder-deb.sh
mkdir -p /tmp/pkgs
sudo mv ../target/* /tmp/pkgs
- store_artifacts:
path: /tmp/pkgs
buildrpm:
machine: true
steps:
- checkout
- run:
name: Install Pre-requisites
command: |
sudo apt-get update -qq
sudo apt-get install -qq build-essential rpm sudo
- run:
name: Build Package
command: |
make
cd scripts
sudo bash -x ./builder-rpm.sh
mkdir -p /tmp/pkgs
sudo mv ../target/* /tmp/pkgs
- store_artifacts:
path: /tmp/pkgs
workflows:
version: 2
build-and-generate:
build:
jobs:
- buildsource
- builddevsource
- builddeb
- buildrpm
- genpkg
nightlybuild:
triggers:
- schedule:
cron: "0 0 * * *"
filters:
branches:
only:
- develop
jobs:
- genpkg
11 changes: 8 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,25 @@
running the following to get started:

```bash
curl -o- https://github.com/raw/wslutilities/wslu/develop/scripts/install-dev.sh | bash
curl -o- https://github.com/raw/wslutilities/wslu/develop/scripts/install.sh | bash
```

## Build Structure

```
wslu
|-src
| |-mime/wslview: mime file for wslview
| |-etc
| | |-wsl.ico: default icon for wslusc
| | \-runHidden.vbs: script for wslusc
| |-wslu-header: Header file of all script
| \-<components>.sh: Components of script
|-scripts: scripts used for building, installing and uninstalling
|-tests: location for script tests
\-extras
\-bats: testing utility
|-bats: testing utility
\-debian: stuff for
```

## Build
Expand All @@ -45,4 +50,4 @@ cd script
sudo ./builder-rpm.sh
```

It is suggested to do such action in Ubuntu 14.04 LTS or its corresponding environment.
It is suggested to do such action in Ubuntu 14.04 LTS or its corresponding environment.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ clean:

test:
PATH="$$CURRENT_PATH/src:$$CURRENT_PATH/out:$$PATH"
extras/bats/libexec/bats tests/header.bats tests/wslsys.bats tests/wslusc.bats tests/wslupath.bats tests/wslfetch.bats
extras/bats/libexec/bats tests/header.bats tests/wslsys.bats tests/wslusc.bats tests/wslupath.bats tests/wslfetch.bats tests/wslview.bats
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fpatrick330602%2Fwslu.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fpatrick330602%2Fwslu?ref=badge_shield)
[![Donate](https://badgen.net/badge/Donate/Paypal/purple)](https://www.paypal.me/callmepk/)

This is a collection of utilities for Windows 10 Linux Subsystem, such as enabling sound in WSL or creating your favorite linux GUI application shortcuts on Windows 10 Desktop. Requires Windows 10 Creators Update.
This is a collection of utilities for Windows 10 Linux Subsystem, such as converting WSL path to Windows path or creating your favorite linux GUI application shortcuts on Windows 10 Desktop. Requires Windows 10 Creators Update.

**Currently supported Distro:**
- Ubuntu
Expand All @@ -20,6 +20,7 @@ This is a collection of utilities for Windows 10 Linux Subsystem, such as enabli
- SUSE Linux Enterprise Server (SLES)
- Debian GNU/Linux
- Kali Linux
- **WLinux**

Legacy Ubuntu is no longer supported.

Expand All @@ -42,7 +43,9 @@ This is a fake WSL browser that can help you open link in default Windows browse

## Installation

Detailed installation is in Wiki/Installation.
### For WLinux

Preinstalled in WLinux.

### For Ubuntu/Debian/Kali Linux

Expand All @@ -67,11 +70,6 @@ sudo zypper in wslu

Or you can download the .rpm package from release and install it using `sudo rpm -ivh "wslu*"`.

### Source Code

To install, just run the following command in the bash prompt:
`curl -o- https://github.com/raw/patrick330602/wslu/master/extras/scripts/install.sh | bash`

## Contributing

Check [CONTRIBUTING.md](CONTRIBUTING.md).
Expand Down
16 changes: 16 additions & 0 deletions extras/debian/changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
wslu (1.8-0) stable; urgency=low

* less dependent on lsb-release/hostname/uptime/uname.
* add support for WLinux.
* install and build scripts update.

-- Patrick Wu <wotingwu@live.com> Sun, 23 Sep 2018 12:00:00 +0800

wslu (1.7-0) stable; urgency=low

* wslview out of experimental stage.
* Fix issues when running on top of Powershell Core 6.
* install scripts further update.

-- Patrick Wu <wotingwu@live.com> Sun, 02 Sep 2018 12:00:00 +0800

1 change: 1 addition & 0 deletions extras/debian/compat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
10
12 changes: 12 additions & 0 deletions extras/debian/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Source: wslu
Section: utils
Maintainer: Patrick Wu <wotingwu@live.com>
Standards-Version: VERSIONPLACEHOLDER-0~DATEPLACEHOLDER
Priority: optional

Package: wslu
Architecture: arm64 amd64
Depends: bc, wget
Recommends: git
Description: A collection of utilities for Windows 10 Linux Subsystem
This is a collection of utilities for Windows 10 Linux Subsystem, such as enabling sound in WSL or creating your favorite linux app shortcuts on Windows 10 Desktop. Requires Windows 10 Creators Update and higher.
22 changes: 22 additions & 0 deletions extras/debian/copyright
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: wslu
Upstream-Contact: Patrick Wu <wotingwu@live.com>
Source: https://github.com/wslutilities/wslu

Files: *
Copyright: 2017-2018 Patrick Wu <wotingwu@live.com>
License: GPL-3+

License: GPL-3+
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
3 changes: 3 additions & 0 deletions extras/debian/install
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
src/wsl* /usr/bin
src/etc/* usr/share/wslu
src/mime/* usr/lib/mime/packages
3 changes: 3 additions & 0 deletions extras/debian/postinst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash
update-alternatives --install /usr/bin/x-www-browser x-www-browser /usr/bin/wslview 1
update-alternatives --install /usr/bin/www-browser www-browser /usr/bin/wslview 1
3 changes: 3 additions & 0 deletions extras/debian/prerm
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash
update-alternatives --remove x-www-browser /usr/bin/wslview
update-alternatives --remove www-browser /usr/bin/wslview
16 changes: 16 additions & 0 deletions extras/debian/rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/make -f
# See debhelper(7) (uncomment to enable)
# output every command that modifies files on the build system.
#DH_VERBOSE = 1

# see FEATURE AREAS in dpkg-buildflags(1)
#export DEB_BUILD_MAINT_OPTIONS = hardening=+all

# see ENVIRONMENT in dpkg-buildflags(1)
# package maintainers to append CFLAGS
#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic
# package maintainers to append LDFLAGS
#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed

%:
dh $@
81 changes: 33 additions & 48 deletions scripts/builder-deb.sh
Original file line number Diff line number Diff line change
@@ -1,55 +1,40 @@
#!/usr/bin/env bash
BUILD_DIR=`mktemp --tmpdir --directory wslu-build-debian.XXXX`
BUILD_DIR_WSLVIEW=`mktemp --tmpdir --directory wslview-build-debian.XXXX`
BUILD_VER=`grep 'version=' ../src/wslu-header | cut -d'=' -f 2 | xargs`
DATE=`date +%Y%m%d%H%M%S`
CURRENT_DIR=`pwd`

mkdir $BUILD_DIR/{DEBIAN/,usr/,usr/bin/,usr/share/,usr/share/wslu/,usr/lib,usr/lib/mime,/usr/lib/mime/packages/}

touch $BUILD_DIR/DEBIAN/{postinst,prerm,control}

chmod 755 $BUILD_DIR/DEBIAN/{postinst,prerm}

cat <<EOF >>$BUILD_DIR/DEBIAN/postinst
#!/usr/bin/env bash
update-alternatives --install /usr/bin/x-www-browser x-www-browser /usr/bin/wslview 1
update-alternatives --install /usr/bin/www-browser www-browser /usr/bin/wslview 1
EOF

cat <<EOF >>$BUILD_DIR/DEBIAN/prerm
#!/usr/bin/env bash
update-alternatives --remove x-www-browser /usr/bin/wslview
update-alternatives --remove www-browser /usr/bin/wslview
EOF

cat <<EOF >>$BUILD_DIR/DEBIAN/control
Package: wslu
Architecture: all
Maintainer: Patrick Wu <wotingwu@live.com>
Depends: bc, wget, unzip, lsb-release
Recommends: git
Suggests: build-essential
Priority: optional
Version: $BUILD_VER-1
Description: A collection of utilities for Windows 10 Linux Subsystem
This is a collection of utilities for Windows 10 Linux Subsystem, such as enabling sound in WSL or creating your favorite linux app shortcuts on Windows 10 Desktop. Requires Windows 10 Creators Update and higher.
EOF

cp ../out/wsl* $BUILD_DIR/usr/bin/
cp ../src/etc/* $BUILD_DIR/usr/share/wslu/
cp ../src/mime/* $BUILD_DIR/usr/lib/mime/packages/

cd $BUILD_DIR
find . -type f ! -regex '.*.hg.*' ! -regex '.*?debian-binary.*' ! -regex '.*?DEBIAN.*' -printf '%P ' | xargs md5sum > DEBIAN/md5sums

find $BUILD_DIR -type d -exec chmod 0755 {} \;
find $BUILD_DIR/usr/ -type f -exec chmod 0555 {} \;
find $BUILD_DIR/usr/lib/mime/packages/ -type f -exec chmod 644 {} \;

[ -d $CURRENT_DIR/../target ] || mkdir $CURRENT_DIR/../target
cd $CURRENT_DIR/../target/

sudo dpkg -b $BUILD_DIR/ wslu-${BUILD_VER}.deb

# Creating folders
mkdir -p $BUILD_DIR/wslu-$BUILD_VER/{debian,debian/source,src,src/etc,src/mime}

# Build wslu
cd $CURRENT_DIR/../
make

# copy files to build folder
cp out/* $BUILD_DIR/wslu-$BUILD_VER/src/
cp src/etc/* $BUILD_DIR/wslu-$BUILD_VER/src/etc/
cp src/mime/* $BUILD_DIR/wslu-$BUILD_VER/src/mime/
cp extras/debian/* $BUILD_DIR/wslu-$BUILD_VER/debian

# modifying the files
sed -i s/VERSIONPLACEHOLDER/$BUILD_VER/g $BUILD_DIR/wslu-$BUILD_VER/debian/control
sed -i s/DATEPLACEHOLDER/$DATE/g $BUILD_DIR/wslu-$BUILD_VER/debian/control
chmod 755 $BUILD_DIR/wslu-$BUILD_VER/debian/{postinst,prerm,rules}

# Build packages
cd $BUILD_DIR/wslu-$BUILD_VER/
dpkg-buildpackage -rsudo -us -uc

# Move built packages
[ -d $CURRENT_DIR/../target/debian ] || mkdir -p $CURRENT_DIR/../target/debian
cd $CURRENT_DIR/../target/debian
cp -r $BUILD_DIR/*.dsc .
cp -r $BUILD_DIR/*.deb .
cp -r $BUILD_DIR/*.tar.gz .
cp -r $BUILD_DIR/*.buildinfo .
cp -r $BUILD_DIR/*.changes .

# CLeanup everything
rm -rf $BUILD_DIR
cd $CURRENT_DIR
2 changes: 1 addition & 1 deletion scripts/builder-rpm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Name: wslu
Version: $BUILD_VER
Release: 2
Source: wslu-$BUILD_VER.tar.gz
Requires: bc lsb-release wget unzip
Requires: bc wget unzip
Requires(post): %{_sbindir}/update-alternatives
Requires(postun): %{_sbindir}/update-alternatives
URL: https://github.com/patrick330602/wslu/
Expand Down
Loading

1 comment on commit 6371c82

@sirredbeard
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All very nice improvements. Thank you.

Please sign in to comment.